@vanillaes/esmtk 0.17.1 → 0.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.vscode/launch.json +13 -1
- package/README.md +7 -3
- package/bin/commands/clean.js +4 -0
- package/bin/esmtk.js +5 -3
- package/package.json +1 -1
package/.vscode/launch.json
CHANGED
|
@@ -408,6 +408,18 @@
|
|
|
408
408
|
"cwd": "${workspaceFolder}",
|
|
409
409
|
"args": ["clean", "--bundle", "--minify", "--typings"],
|
|
410
410
|
"console": "integratedTerminal",
|
|
411
|
-
}
|
|
411
|
+
},
|
|
412
|
+
{
|
|
413
|
+
"name": "Clean --custom",
|
|
414
|
+
"type": "node",
|
|
415
|
+
"request": "launch",
|
|
416
|
+
"skipFiles": [
|
|
417
|
+
"<node_internals>/**"
|
|
418
|
+
],
|
|
419
|
+
"program": "${workspaceFolder}/bin/esmtk.js",
|
|
420
|
+
"cwd": "${workspaceFolder}",
|
|
421
|
+
"args": ["clean", "--custom", "**/*.min.js"],
|
|
422
|
+
"console": "integratedTerminal",
|
|
423
|
+
},
|
|
412
424
|
]
|
|
413
425
|
}
|
package/README.md
CHANGED
|
@@ -148,9 +148,10 @@ Clean up build artifacts
|
|
|
148
148
|
`esmtk clean [root]`
|
|
149
149
|
|
|
150
150
|
- `[root]` - the root directory to perform the cleanup (default: `process.cwd()`)
|
|
151
|
-
- `--bundle` - Clean bundled build artifacts (default:
|
|
152
|
-
- `--minify` - Clean minified build artifacts (default:
|
|
153
|
-
- `--typings` - Clean typing artifacts (default:
|
|
151
|
+
- `--bundle` - Clean bundled build artifacts (default: `**/*.esm.js`)
|
|
152
|
+
- `--minify` - Clean minified build artifacts (default: `**/*.min.js`)
|
|
153
|
+
- `--typings` - Clean typing artifacts (default: `**/*.d.ts`)
|
|
154
|
+
- `--custom` - Clean based on a user-defined pattern
|
|
154
155
|
|
|
155
156
|
### Usage
|
|
156
157
|
|
|
@@ -160,6 +161,9 @@ esmtk clean --bundle --minify --typings
|
|
|
160
161
|
|
|
161
162
|
# override default extension
|
|
162
163
|
esmtk clean --bundle *.mjs
|
|
164
|
+
|
|
165
|
+
# define your own pattern
|
|
166
|
+
esmtk clean --custom *.scss.css
|
|
163
167
|
```
|
|
164
168
|
|
|
165
169
|
**Node: The `clean` command automatically ignores the contents of `node_modules/`**
|
package/bin/commands/clean.js
CHANGED
|
@@ -24,6 +24,10 @@ export async function clean (root, options) {
|
|
|
24
24
|
if (options?.typings) {
|
|
25
25
|
await cleanOne(root, options.typings, options)
|
|
26
26
|
}
|
|
27
|
+
|
|
28
|
+
if (options?.custom) {
|
|
29
|
+
await cleanOne(root, options.custom, options)
|
|
30
|
+
}
|
|
27
31
|
}
|
|
28
32
|
|
|
29
33
|
async function cleanOne (root, glob, options) {
|
package/bin/esmtk.js
CHANGED
|
@@ -54,9 +54,10 @@ program.command('minify <input> <output>')
|
|
|
54
54
|
program.command('clean')
|
|
55
55
|
.description('Clean build artificts')
|
|
56
56
|
.argument('[root]', 'The root directory to perform operations from (default cwd)', process.cwd())
|
|
57
|
-
.option('--bundle [bundle]', 'Clean bundled build artifacts (default:
|
|
58
|
-
.option('--minify [minify]', 'Clean minified build artifacts (default:
|
|
59
|
-
.option('--typings [typings]', 'Clean typing artifacts (default:
|
|
57
|
+
.option('--bundle [bundle]', 'Clean bundled build artifacts (default: **/*.esm.js)')
|
|
58
|
+
.option('--minify [minify]', 'Clean minified build artifacts (default: **/*.min.js)')
|
|
59
|
+
.option('--typings [typings]', 'Clean typing artifacts (default: **/*.d.ts)')
|
|
60
|
+
.option('--custom <custom>', 'Clean based on a user-defined pattern')
|
|
60
61
|
// .option('-f, --force', 'Do not prompt before overwriting', false)
|
|
61
62
|
.action((root, options) => {
|
|
62
63
|
// set --bundle default
|
|
@@ -71,6 +72,7 @@ program.command('clean')
|
|
|
71
72
|
if (options?.typings && typeof (options.typings) === 'boolean') {
|
|
72
73
|
options.typings = '**/*.d.ts'
|
|
73
74
|
}
|
|
75
|
+
|
|
74
76
|
clean(root, options)
|
|
75
77
|
})
|
|
76
78
|
|