Skip to content

Commit 8bbe2a6

Browse files
committed
✨ Adds auxiliary flags for jscodeshift
1 parent 5864962 commit 8bbe2a6

File tree

4 files changed

+19
-2
lines changed

4 files changed

+19
-2
lines changed

.changeset/kind-houses-applaud.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@codeshift/cli': minor
3+
---
4+
5+
Adds auxiliary flags for jscodeshift

packages/cli/src/index.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,12 @@ program
4343
'--ignore-pattern <value>',
4444
'Ignore files that match a provided glob expression',
4545
)
46+
.option(
47+
'-c, --cpus <value>',
48+
'start at most N child processes to process source files',
49+
)
50+
.option('-d, --dry', 'dry run (no changes are made to files)')
51+
.option('--run-in-band', 'run serially in the current process')
4652
.addHelpText(
4753
'after',
4854
`

packages/cli/src/main.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,13 +130,14 @@ export default async function main(paths: string[], flags: Flags) {
130130

131131
await jscodeshift.run(transform, paths, {
132132
verbose: 0,
133-
dry: false,
133+
dry: flags.dry,
134134
print: true,
135135
babel: true,
136136
extensions: flags.extensions,
137137
ignorePattern: flags.ignorePattern,
138+
cpus: flags.cpus,
138139
ignoreConfig: [],
139-
runInBand: false,
140+
runInBand: flags.runInBand,
140141
silent: false,
141142
parser: flags.parser,
142143
stdin: false,

packages/cli/src/types.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,9 @@ export interface Flags {
3131
* Ignore files that match a provided glob expression
3232
*/
3333
ignorePattern?: string;
34+
35+
/** Auxiliary jscodeshift params */
36+
cpus?: number;
37+
dry?: boolean;
38+
runInBand?: boolean;
3439
}

0 commit comments

Comments
 (0)