@vanillaes/esmtk 0.24.1 → 0.24.3
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/README.md +13 -13
- package/bin/commands/init.js +2 -2
- package/bin/commands/preview.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -32,7 +32,7 @@ Create a package.json file for ECMAScript module development
|
|
|
32
32
|
|
|
33
33
|
### Arguments
|
|
34
34
|
|
|
35
|
-
`esmtk init`
|
|
35
|
+
`esmtk init [...options]`
|
|
36
36
|
|
|
37
37
|
- `--scripts` - Include ESMTK scripts
|
|
38
38
|
|
|
@@ -43,7 +43,7 @@ Create a package.json file for ECMAScript module development
|
|
|
43
43
|
npx @vanillaes/esmtk init
|
|
44
44
|
|
|
45
45
|
# init package.json (including ESMTK scripts)
|
|
46
|
-
npx @vanillaes/esmtk init
|
|
46
|
+
npx @vanillaes/esmtk init --scripts
|
|
47
47
|
```
|
|
48
48
|
|
|
49
49
|
|
|
@@ -53,7 +53,7 @@ Run tests (using Tape-ES)
|
|
|
53
53
|
|
|
54
54
|
### Arguments
|
|
55
55
|
|
|
56
|
-
`esmtk test [glob]`
|
|
56
|
+
`esmtk test [...options] [glob]`
|
|
57
57
|
|
|
58
58
|
- `[glob]` - the glob used to locate test files (default: `**/*.spec.js`)
|
|
59
59
|
- `-i` | `--ignore` - the ignore matcher pattern (default `**/node_modules/**`)
|
|
@@ -86,7 +86,7 @@ Lint the source code (using StandardJS)
|
|
|
86
86
|
|
|
87
87
|
### Arguments
|
|
88
88
|
|
|
89
|
-
`esmtk lint [
|
|
89
|
+
`esmtk lint [...options]`
|
|
90
90
|
|
|
91
91
|
- `--fix` - automatically fix problems
|
|
92
92
|
|
|
@@ -107,7 +107,7 @@ Type check the JSDoc typings (using Typescript)
|
|
|
107
107
|
|
|
108
108
|
### Arguments
|
|
109
109
|
|
|
110
|
-
`esmtk types [entry]`
|
|
110
|
+
`esmtk types [...options] [entry]`
|
|
111
111
|
|
|
112
112
|
- `[entry]` - the entry-point for the source
|
|
113
113
|
- `--strict` - enable 'strict mode' type checks
|
|
@@ -131,7 +131,7 @@ Bundle the source code to an ECMAScript module (using ESBuild)
|
|
|
131
131
|
|
|
132
132
|
### Arguments
|
|
133
133
|
|
|
134
|
-
`esmtk bundle [input] [output]`
|
|
134
|
+
`esmtk bundle [...options] [input] [output]`
|
|
135
135
|
|
|
136
136
|
- `[input]` - the input source file path
|
|
137
137
|
- `[output]` - the output bundle file path
|
|
@@ -154,7 +154,7 @@ Bundle and Minify the source code to an ECMAScript module (using ESBuild)
|
|
|
154
154
|
|
|
155
155
|
### Arguments
|
|
156
156
|
|
|
157
|
-
`esmtk minify [input] [output]`
|
|
157
|
+
`esmtk minify [...options] [input] [output]`
|
|
158
158
|
|
|
159
159
|
- `[input]` - the input source file path
|
|
160
160
|
- `[output]` - the output bundle file path
|
|
@@ -181,7 +181,7 @@ Bundle the source code to a CommonJS module (using ESBuild)
|
|
|
181
181
|
|
|
182
182
|
### Arguments
|
|
183
183
|
|
|
184
|
-
`esmtk commonjs [input] [output]`
|
|
184
|
+
`esmtk commonjs [...options] [input] [output]`
|
|
185
185
|
|
|
186
186
|
- `[input]` - the input source file path
|
|
187
187
|
- `[output]` - the output bundle file path
|
|
@@ -222,7 +222,7 @@ Clean up build artifacts
|
|
|
222
222
|
|
|
223
223
|
### Arguments
|
|
224
224
|
|
|
225
|
-
`esmtk clean [root]`
|
|
225
|
+
`esmtk clean [...options] [root]`
|
|
226
226
|
|
|
227
227
|
- `[root]` - the root directory to perform the cleanup (default: `process.cwd()`)
|
|
228
228
|
- `--bundle` - Clean bundled build artifacts (default: `**/*.esm.js`)
|
|
@@ -252,9 +252,9 @@ Preview the package contents included during `npm publish`
|
|
|
252
252
|
|
|
253
253
|
### Arguments
|
|
254
254
|
|
|
255
|
-
`esmtk preview`
|
|
255
|
+
`esmtk preview [...options]`
|
|
256
256
|
|
|
257
|
-
- `-r` | `--root` -
|
|
257
|
+
- `-r` | `--root` - the root path to preview
|
|
258
258
|
|
|
259
259
|
### Usage
|
|
260
260
|
|
|
@@ -273,7 +273,7 @@ A cross-platform clone of the `cp` command in Linux
|
|
|
273
273
|
|
|
274
274
|
### Arguments
|
|
275
275
|
|
|
276
|
-
`esmtk cp [
|
|
276
|
+
`esmtk cp [...options] [source...] [destination]`
|
|
277
277
|
|
|
278
278
|
- `[source(s)...]` - the source file(s)/glob(s)
|
|
279
279
|
- `[destination]` - the destination file/directory
|
|
@@ -305,7 +305,7 @@ A cross-platform clone of the `rm` command in Linux
|
|
|
305
305
|
|
|
306
306
|
### Arguments
|
|
307
307
|
|
|
308
|
-
`esmtk rm [
|
|
308
|
+
`esmtk rm [...options] [path(s)...]`
|
|
309
309
|
|
|
310
310
|
- `[path(s)...]` - the source file(s)/glob(s)
|
|
311
311
|
- `-r, --recursive` - remove directory recursively
|
package/bin/commands/init.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { fileExists, which } from '../../src/index.js'
|
|
2
2
|
import { exec } from 'node:child_process'
|
|
3
3
|
import { readFile, writeFile } from 'node:fs/promises'
|
|
4
|
-
import { basename, join
|
|
4
|
+
import { basename, join } from 'node:path'
|
|
5
5
|
import { stdin, stdout } from 'node:process'
|
|
6
6
|
import { createInterface } from 'node:readline/promises'
|
|
7
7
|
import { promisify } from 'node:util'
|
|
@@ -69,7 +69,7 @@ export async function init (options) {
|
|
|
69
69
|
const entry = await ask(program, 'entry point', 'index.js')
|
|
70
70
|
if (entry) {
|
|
71
71
|
pkg.exports = {}
|
|
72
|
-
pkg.exports['.'] =
|
|
72
|
+
pkg.exports['.'] = entry
|
|
73
73
|
}
|
|
74
74
|
if (options?.scripts) {
|
|
75
75
|
pkg.scripts = {}
|
package/bin/commands/preview.js
CHANGED
|
@@ -74,7 +74,7 @@ function fileCompare (a, b) {
|
|
|
74
74
|
function formatFile (path) {
|
|
75
75
|
const size = statSync(path).size
|
|
76
76
|
if (size > (1024 * 1024)) {
|
|
77
|
-
|
|
77
|
+
const megabytes = (size / (1024 * 1024)).toLocaleString('en-US', {
|
|
78
78
|
minimumFractionDigits: 1,
|
|
79
79
|
maximumFractionDigits: 1,
|
|
80
80
|
roundingMode: 'trunc'
|