Skip to content

Commit 157f755

Browse files
author
Daniel Del Core
committed
cli fixes
1 parent 934ec9e commit 157f755

File tree

5 files changed

+26
-24
lines changed

5 files changed

+26
-24
lines changed

.changeset/brown-owls-confess.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@codeshift/core': patch
3+
---
4+
5+
Only use a single path when importing the Worker regardless of process.env

.changeset/moody-fishes-march.md

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+
Removes typescript/js interop layer from the CLI in favour of just pointing to the built dist files.

package.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,11 @@
1010
"predocs:start": "ts-node scripts/docs",
1111
"docs:start": "cd website && yarn start",
1212
"postinstall": "yarn monorepo:check",
13-
"build": "parcel build packages/* community/*",
13+
"build": "yarn build:pkgs && yarn build:community",
14+
"build:pkgs": "parcel build packages/*",
15+
"build:pkgs:watch": "parcel watch packages/*",
16+
"build:community": "parcel build community/*",
17+
"build:community:watch": "parcel watch community/*",
1418
"clean": "rm -rf node_modules/.cache && rimraf packages/**/{tsconfig.tsbuildinfo,lib,dist} community/**/{tsconfig.tsbuildinfo,lib,dist}",
1519
"test": "jest",
1620
"test:watch": "jest --watch",

packages/cli/bin/codeshift-cli.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env node
2-
/* eslint-disable */
2+
const path = require('path');
33

44
const packageJson = require('../package.json');
55

6-
require('../' + packageJson.main);
6+
require(path.join('..', packageJson.main));

packages/core/src/runner.ts

Lines changed: 9 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -225,27 +225,15 @@ export function run(entrypointPath: string, paths: string[], options: Flags) {
225225
const workers = [];
226226

227227
for (let i = 0; i < processes; i++) {
228-
if (process.env.NODE_ENV !== 'production') {
229-
workers.push(
230-
options.runInBand
231-
? // eslint-disable-next-line @typescript-eslint/no-var-requires
232-
require('./lib/Worker')(args)
233-
: child_process.fork(
234-
path.join(__dirname, 'lib', 'Worker.js'),
235-
args,
236-
),
237-
);
238-
} else {
239-
workers.push(
240-
options.runInBand
241-
? // eslint-disable-next-line @typescript-eslint/no-var-requires
242-
require('../lib/Worker')(args)
243-
: child_process.fork(
244-
path.join(__dirname, '..', 'lib', 'Worker.js'),
245-
args,
246-
),
247-
);
248-
}
228+
workers.push(
229+
options.runInBand
230+
? // eslint-disable-next-line @typescript-eslint/no-var-requires
231+
require('../lib/Worker')(args)
232+
: child_process.fork(
233+
path.join(__dirname, '..', 'lib', 'Worker.js'),
234+
args,
235+
),
236+
);
249237
}
250238

251239
return workers.map(child => {

0 commit comments

Comments
 (0)