Skip to content

Commit 0379577

Browse files
committed
Provide better CLI flag defaults
1 parent 06c835d commit 0379577

File tree

3 files changed

+28
-8
lines changed

3 files changed

+28
-8
lines changed

.changeset/clean-hounds-begin.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 sensible defaults as CLI options. Affecting flags --ignore-path, --extensions and --parser

packages/cli/src/index.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,16 +35,17 @@ program
3535
'Parser to use for parsing the source files',
3636
)
3737
.choices(['babel', 'babylon', 'flow', 'ts', 'tsx'])
38-
.default('babel'),
38+
.default('tsx'),
3939
)
4040
.option(
4141
'-e, --extensions <value>',
4242
'Transform files with these file extensions (comma separated list)',
43-
'js',
43+
'js, jsx, ts, tsx',
4444
)
4545
.option(
4646
'--ignore-pattern <value>',
4747
'Ignore files that match a provided glob expression',
48+
'**/node_modules/**',
4849
)
4950
.option(
5051
'-c, --cpus <value>',

website/docs/api/codeshift-cli.mdx

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,17 @@ Parser to use for parsing the source files you are code modding.
6161

6262
**options:**
6363

64-
- babel (default)
65-
- babylon
66-
- flow
67-
- ts
68-
- tsx
64+
- `babel`
65+
- `babylon`
66+
- `flow`
67+
- `ts`
68+
- `tsx` (default)
69+
70+
**default:**
71+
72+
`tsx`
73+
74+
tsx is a superset of JavaScript + JSX and should be the most sensible default for modern codebases.
6975

7076
**example:**
7177

@@ -74,7 +80,11 @@ Parser to use for parsing the source files you are code modding.
7480

7581
### --extensions, -e
7682

77-
Transform files with these file extensions (comma separated list) (default: js)
83+
Transform files with these file extensions (comma separated list)
84+
85+
**default:**
86+
87+
`js, jsx, ts, tsx`
7888

7989
**example:**
8090

@@ -85,6 +95,10 @@ Transform files with these file extensions (comma separated list) (default: js)
8595

8696
Ignore files that match a provided glob expression
8797

98+
**default:**
99+
100+
- `**/node_modules/**`
101+
88102
**example:**
89103

90104
- `$ codeshift --ignore-pattern node_modules /project/src/file.js`

0 commit comments

Comments
 (0)