Skip to content

Commit e523c41

Browse files
authored
fix: double dash arguments in cli.mdx (swc-project#287)
Wrap double dash (--) arguments with code block prevents replacing it with joined character on website + improves consitency with existing '--only' argument Spent good 5 min figuring out why copy-pasted argument from official docs doesn't work, until noticed that double dash magically transformed into the single long dash character (possibly markdown lib bug) ![Screenshot 2025-05-06 at 12 31 10](https://github.com/user-attachments/assets/a39c3632-625a-4001-bc01-1566ec20c502)
1 parent e2c1cc9 commit e523c41

1 file changed

Lines changed: 21 additions & 21 deletions

File tree

  • apps/website/content/docs/usage

apps/website/content/docs/usage/cli.mdx

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -39,39 +39,39 @@ npx swc ./my-dir -d output
3939

4040
## Options
4141

42-
### --filename (-f)
42+
### `--filename` (-f)
4343

4444
Filename to use when reading from stdin. This will be used in source maps and errors.
4545

4646
```sh
4747
npx swc -f input.js
4848
```
4949

50-
### --config-file
50+
### `--config-file`
5151

5252
Path to a `.swcrc` file to use.
5353

5454
```sh
5555
npx swc input.js --config-file .swcrc
5656
```
5757

58-
### --env-name
58+
### `--env-name`
5959

6060
The name of the 'env' to use when loading configs and plugins. Defaults to the value of `SWC_ENV`, or else `NODE_ENV`, or else `development`.
6161

6262
```sh
6363
npx swc input.js --env-name='test'
6464
```
6565

66-
### --no-swcrc
66+
### `--no-swcrc`
6767

6868
Whether or not to look up `.swcrc` files.
6969

7070
```sh
7171
npx swc input.js --no-swcrc
7272
```
7373

74-
### --ignore
74+
### `--ignore`
7575

7676
List of glob paths to **not** compile.
7777

@@ -89,7 +89,7 @@ Example:
8989
npx swc src --only **/*.js
9090
```
9191

92-
### --watch (-w)
92+
### `--watch` (-w)
9393

9494
To automatically recompile files on changes, install `chokidar`:
9595

@@ -103,99 +103,99 @@ Then, add the `-w` flag:
103103
npx swc input.js -w
104104
```
105105

106-
### --quiet (-q)
106+
### `--quiet` (-q)
107107

108108
Suppress compilation output.
109109

110110
```sh
111111
npx swc input.js -q
112112
```
113113

114-
### --source-maps (-s)
114+
### `--source-maps` (-s)
115115

116116
Values: `true|false|inline|both`
117117

118118
```sh
119119
npx swc input.js -s
120120
```
121121

122-
### --source-map-target
122+
### `--source-map-target`
123123

124124
Define the `file` for the source map.
125125

126126
```sh
127127
npx swc input.js -s --source-map-target input.map.js
128128
```
129129

130-
### --source-file-name
130+
### `--source-file-name`
131131

132132
Set `sources[0]` on returned source map
133133

134-
### --source-root
134+
### `--source-root`
135135

136136
The root from which all sources are relative.
137137

138-
### --out-file (-o)
138+
### `--out-file` (-o)
139139

140140
Compile all input files into a single file.
141141

142142
```sh
143143
npx swc input.js -o output.js
144144
```
145145

146-
### --out-dir (-d)
146+
### `--out-dir` (-d)
147147

148148
Compile an input directory of modules into an output directory.
149149

150150
```sh
151151
npx swc src -d dist
152152
```
153153

154-
### --copy-files (-D)
154+
### `--copy-files` (-D)
155155

156156
When compiling a directory, copy over non-compilable files.
157157

158158
```sh
159159
npx swc src --copy-files
160160
```
161161

162-
### --include-dotfiles
162+
### `--include-dotfiles`
163163

164164
Include dotfiles when compiling and copying non-compilable files.
165165

166166
```sh
167167
npx swc src --include-dotfiles
168168
```
169169

170-
### --config (-C)
170+
### `--config` (-C)
171171

172172
Override a config from `.swcrc` file.
173173

174174
```sh
175175
npx swc src -C module.type=amd -C module.moduleId=hello
176176
```
177177

178-
### --sync
178+
### `--sync`
179179

180180
Invoke swc synchronously. Useful for debugging.
181181

182182
```sh
183183
npx swc src --sync
184184
```
185185

186-
### --log-watch-compilation
186+
### `--log-watch-compilation`
187187

188188
Log a message when a watched file is successfully compiled.
189189

190190
```sh
191191
npx swc input.js --log-watch-compilation
192192
```
193193

194-
### --extensions
194+
### `--extensions`
195195

196196
Use specific extensions.
197197

198-
### --strip-leading-paths
198+
### `--strip-leading-paths`
199199

200200
Remove the leading directory (including all parent relative paths) when building the final output path. As an example it compiles all modules under `src` folder to `dist` folder, without create the `src` folder inside of `dist`.
201201

@@ -242,7 +242,7 @@ swcDir({
242242

243243
Please note that when using `callbacks`, the `--quiet (-q)` will always be true.
244244

245-
### --out-file-extension
245+
### `--out-file-extension`
246246

247247
Use a specific extension for the output files.
248248

0 commit comments

Comments
 (0)