@jcoreio/toolchain 3.0.0 → 3.1.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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/scripts/init.cjs +27 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jcoreio/toolchain",
3
- "version": "3.0.0",
3
+ "version": "3.1.0",
4
4
  "description": "base JS build toolchain",
5
5
  "repository": {
6
6
  "type": "git",
package/scripts/init.cjs CHANGED
@@ -6,6 +6,7 @@ const preinstall = require('./preinstall.cjs')
6
6
  const execa = require('../util/execa.cjs')
7
7
  const hasTSFiles = require('../util/hasTSFiles.cjs')
8
8
  const { name, version } = require('../package.json')
9
+ const isInteractive = require('../util/isInteractive.cjs')
9
10
 
10
11
  async function init(args = []) {
11
12
  const { dependencies = {}, devDependencies = {} } = packageJson
@@ -33,6 +34,28 @@ async function init(args = []) {
33
34
  if (isCircle) toolchains.add(`${name}-circle`)
34
35
  if (isSemanticRelease) toolchains.add(`${name}-semantic-release`)
35
36
 
37
+ let selectedToolchains = [...toolchains]
38
+ if (isInteractive) {
39
+ ;({ selectedToolchains } = await require('prompts')({
40
+ name: 'selectedToolchains',
41
+ type: 'multiselect',
42
+ message: 'Select toolchains to install',
43
+ choices: [
44
+ 'mocha',
45
+ 'esnext',
46
+ 'flow',
47
+ 'typescript',
48
+ 'react',
49
+ 'circle',
50
+ 'semantic-release',
51
+ ].map((value) => ({
52
+ title: `${name}-${value}`,
53
+ value: `${name}-${value}`,
54
+ selected: toolchains.has(`${name}-${value}`),
55
+ })),
56
+ }))
57
+ }
58
+
36
59
  const isTest = Boolean(process.env.JCOREIO_TOOLCHAIN_TEST)
37
60
 
38
61
  await preinstall.run()
@@ -41,8 +64,10 @@ async function init(args = []) {
41
64
  '-D',
42
65
  isTest ? '../packages/base' : `${name}@^${version}`,
43
66
  ...(isTest
44
- ? [...toolchains].map((t) => t.replace(`${name}-`, '../packages/'))
45
- : [...toolchains].map((t) => `${t}@^${version}`)),
67
+ ? [...selectedToolchains].map((t) =>
68
+ t.replace(`${name}-`, '../packages/')
69
+ )
70
+ : [...selectedToolchains].map((t) => `${t}@^${version}`)),
46
71
  ])
47
72
  await execa('tc', ['migrate'])
48
73
  }