Skip to content

Commit e3f5a15

Browse files
author
Daniel Del Core
committed
fix cli
1 parent 486282e commit e3f5a15

File tree

3 files changed

+7
-21
lines changed

3 files changed

+7
-21
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@codeshift/cli': patch
3+
---
4+
5+
Fixes bin entrypoint for CLI

packages/cli/bin/codeshift-cli.js

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,6 @@
11
#!/usr/bin/env node
22
/* eslint-disable */
33

4-
const fs = require('fs');
5-
const path = require('path');
4+
const packageJson = require('../package.json');
65

7-
const project = path.join(__dirname, '../tsconfig.json');
8-
const dev = fs.existsSync(project);
9-
10-
if (!require.extensions['.ts']) {
11-
// ts-node can only handle being registered once, see https://github.com/TypeStrong/ts-node/issues/409
12-
require('ts-node').register(dev ? { project } : {});
13-
}
14-
15-
try {
16-
require(path.join('..', dev ? 'src/index' : 'dist/codeshift-cli.cjs.js'));
17-
} catch (error) {
18-
if (typeof error === 'number') {
19-
process.exit(error);
20-
}
21-
console.error(error);
22-
process.exit(1);
23-
}
6+
require('../' + packageJson.main);

packages/cli/src/index.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,8 +143,6 @@ Examples:
143143
$ codeshift validate ./codemods/my-codemods`,
144144
);
145145

146-
program.exitOverride();
147-
148146
(async function () {
149147
try {
150148
await program.parseAsync(process.argv);

0 commit comments

Comments
 (0)