File tree Expand file tree Collapse file tree 3 files changed +7
-21
lines changed Expand file tree Collapse file tree 3 files changed +7
-21
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ ' @codeshift/cli ' : patch
3+ ---
4+
5+ Fixes bin entrypoint for CLI
Original file line number Diff line number Diff line change 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 ) ;
Original file line number Diff line number Diff 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 ) ;
You can’t perform that action at this time.
0 commit comments