@vanillaes/esmtk 0.23.1 → 0.24.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/README.md CHANGED
@@ -34,11 +34,16 @@ Create a package.json file for ECMAScript module development
34
34
 
35
35
  `esmtk init`
36
36
 
37
+ - `--scripts` - Include ESMTK scripts
38
+
37
39
  ### Usage
38
40
 
39
41
  ```sh
40
42
  # init package.json
41
43
  npx @vanillaes/esmtk init
44
+
45
+ # init package.json (including ESMTK scripts)
46
+ npx @vanillaes/esmtk init
42
47
  ```
43
48
 
44
49
 
@@ -10,8 +10,9 @@ const execAsync = promisify(exec)
10
10
 
11
11
  /**
12
12
  * Create a package.json file for ECMAScript Development
13
+ * @param {any} options init options
13
14
  */
14
- export async function init () {
15
+ export async function init (options) {
15
16
  const npmExists = await which('npm')
16
17
  if (!npmExists) {
17
18
  console.error('npm not found')
@@ -63,25 +64,28 @@ export async function init () {
63
64
  pkg.author += ` (${website})`
64
65
  }
65
66
  }
66
- pkg.license = await ask(program, 'license', 'ISC')
67
+ pkg.license = await ask(program, 'license', 'MIT')
67
68
  pkg.type = 'module'
68
69
  const entry = await ask(program, 'entry point', 'index.js')
69
70
  if (entry) {
70
71
  pkg.exports = {}
71
72
  pkg.exports['.'] = 'entry'
72
73
  }
73
- const scripts = await ask(program, 'include ESMTK scripts?', 'yes')
74
- if (scripts.toLowerCase() === 'yes') {
74
+ if (options?.scripts) {
75
75
  pkg.scripts = {}
76
76
  pkg.scripts.test = 'esmtk test'
77
77
  pkg.scripts.lint = 'esmtk lint'
78
78
  pkg.scripts.types = `esmtk types ${entry}`
79
+ pkg.scripts.typings = `esmtk typings ${entry}`
80
+ pkg.scripts.clean = 'esmtk clean --typings'
81
+ pkg.scripts.preview = 'esmtk preview'
79
82
  } else {
80
83
  pkg.scripts = {}
81
84
  pkg.scripts.test = await ask(program, 'test command')
82
85
  }
83
- const pkgString = JSON.stringify(pkg, null, 2)
84
- console.log(`About to write to ${DIR}${sep}package.json:`)
86
+ const pkgString = JSON.stringify(pkg, null, 2) + '\n'
87
+ console.log()
88
+ console.log(`About to write to ${join(DIR, 'package.json')}:`)
85
89
  console.log(pkgString)
86
90
 
87
91
  const ok = await ask(program, 'is this OK', 'yes')
package/bin/esmtk.js CHANGED
@@ -10,8 +10,9 @@ program.version(pkg.version, '-v, --version')
10
10
 
11
11
  program.command('init')
12
12
  .description('Create a package.json file for ECMAScript module development')
13
- .action(() => {
14
- init()
13
+ .option('--scripts', 'Include ESMTK scripts')
14
+ .action((options) => {
15
+ init(options)
15
16
  })
16
17
 
17
18
  program.command('test')
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vanillaes/esmtk",
3
- "version": "0.23.1",
3
+ "version": "0.24.0",
4
4
  "description": "ES Module Toolkit",
5
5
  "keywords": [
6
6
  "ecmascript",