Skip to content

Commit

Permalink
Fix TS resolution mode node10
Browse files Browse the repository at this point in the history
  • Loading branch information
SBoudrias committed Nov 17, 2024
1 parent 15fcfbe commit bf287be
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 9 deletions.
4 changes: 4 additions & 0 deletions packages/core/ansi.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/* eslint-disable n/no-missing-require */
// Shim for Node10 path exports

module.exports = require('./dist/commonjs/lib/ansi.js');
2 changes: 1 addition & 1 deletion packages/core/core.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import {
makeTheme,
type Status,
} from './src/index.js';
import { cursorHide, cursorShow, eraseLines } from './src/ansi.js';
import { cursorHide, cursorShow, eraseLines } from './src/lib/ansi.js';

describe('createPrompt()', () => {
it('onKeypress: allow to implement custom behavior on keypress', async () => {
Expand Down
13 changes: 7 additions & 6 deletions packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,20 +64,21 @@
},
"./ansi": {
"import": {
"types": "./dist/esm/ansi.d.ts",
"default": "./dist/esm/ansi.js"
"types": "./dist/esm/lib/ansi.d.ts",
"default": "./dist/esm/lib/ansi.js"
},
"require": {
"types": "./dist/commonjs/ansi.d.ts",
"default": "./dist/commonjs/ansi.js"
"types": "./dist/commonjs/lib/ansi.d.ts",
"default": "./dist/commonjs/lib/ansi.js"
}
}
},
"main": "./dist/commonjs/index.js",
"module": "./dist/esm/index.js",
"types": "./dist/commonjs/index.d.ts",
"files": [
"dist"
"dist",
"ansi.js"
],
"scripts": {
"attw": "attw --pack",
Expand Down Expand Up @@ -115,7 +116,7 @@
"exports": {
"./package.json": "./package.json",
".": "./src/index.ts",
"./ansi": "./src/ansi.ts"
"./ansi": "./src/lib/ansi.ts"
}
}
}
File renamed without changes.
2 changes: 1 addition & 1 deletion packages/core/src/lib/screen-manager.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import stripAnsi from 'strip-ansi';
import { breakLines, readlineWidth } from './utils.js';
import { cursorDown, cursorUp, cursorTo, cursorShow, eraseLines } from '../ansi.js';
import { cursorDown, cursorUp, cursorTo, cursorShow, eraseLines } from './ansi.js';
import type { InquirerReadline } from '@inquirer/type';

const height = (content: string): number => content.split('\n').length;
Expand Down
4 changes: 3 additions & 1 deletion tools/setup-packages.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,9 @@ Promise.all(
}

if (isTS) {
pkg.files = ['dist'];
const files = new Set(pkg.files ?? []);
files.add('dist');
pkg.files = [...files];

pkg.devDependencies = pkg.devDependencies ?? {};
pkg.devDependencies['tshy'] = versions['tshy'];
Expand Down

0 comments on commit bf287be

Please sign in to comment.