@jcoreio/toolchain 2.0.0 → 2.0.1
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/package.json +1 -1
- package/scripts/init.cjs +22 -13
package/package.json
CHANGED
package/scripts/init.cjs
CHANGED
|
@@ -1,13 +1,18 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
const { packageJson } = require('../util/findUps.cjs')
|
|
4
|
+
const fs = require('../util/projectFs.cjs')
|
|
4
5
|
const preinstall = require('./preinstall.cjs')
|
|
5
6
|
const execa = require('../util/execa.cjs')
|
|
6
7
|
const hasTSFiles = require('../util/hasTSFiles.cjs')
|
|
7
8
|
|
|
8
9
|
async function init(args = []) {
|
|
9
|
-
const { dependencies = {}, devDependencies = {} } = packageJson
|
|
10
|
-
const toolchains =
|
|
10
|
+
const { version, dependencies = {}, devDependencies = {} } = packageJson
|
|
11
|
+
const toolchains = new Set(
|
|
12
|
+
Object.keys(devDependencies).filter((dep) =>
|
|
13
|
+
dep.startsWith('@jcoreio/toolchain-')
|
|
14
|
+
)
|
|
15
|
+
)
|
|
11
16
|
const isBabel =
|
|
12
17
|
devDependencies['@babel/core'] != null ||
|
|
13
18
|
devDependencies['babel-core'] != null ||
|
|
@@ -17,15 +22,17 @@ async function init(args = []) {
|
|
|
17
22
|
const isReact = dependencies.react != null || devDependencies.react != null
|
|
18
23
|
const isMocha = devDependencies['mocha'] != null
|
|
19
24
|
const isCircle = true // might be false someday
|
|
20
|
-
const isSemanticRelease =
|
|
25
|
+
const isSemanticRelease =
|
|
26
|
+
devDependencies['semantic-release'] != null ||
|
|
27
|
+
(await fs.pathExists('release.config.cjs'))
|
|
21
28
|
|
|
22
|
-
if (isMocha) toolchains.
|
|
23
|
-
if (isBabel) toolchains.
|
|
24
|
-
if (isFlow) toolchains.
|
|
25
|
-
if (isTS) toolchains.
|
|
26
|
-
if (isReact) toolchains.
|
|
27
|
-
if (isCircle) toolchains.
|
|
28
|
-
if (isSemanticRelease) toolchains.
|
|
29
|
+
if (isMocha) toolchains.add('@jcoreio/toolchain-mocha')
|
|
30
|
+
if (isBabel) toolchains.add('@jcoreio/toolchain-esnext')
|
|
31
|
+
if (isFlow) toolchains.add('@jcoreio/toolchain-flow')
|
|
32
|
+
if (isTS) toolchains.add('@jcoreio/toolchain-typescript')
|
|
33
|
+
if (isReact) toolchains.add('@jcoreio/toolchain-react')
|
|
34
|
+
if (isCircle) toolchains.add('@jcoreio/toolchain-circle')
|
|
35
|
+
if (isSemanticRelease) toolchains.add('@jcoreio/toolchain-semantic-release')
|
|
29
36
|
|
|
30
37
|
const isTest = Boolean(process.env.JCOREIO_TOOLCHAIN_TEST)
|
|
31
38
|
|
|
@@ -33,10 +40,12 @@ async function init(args = []) {
|
|
|
33
40
|
await execa('pnpm', [
|
|
34
41
|
'add',
|
|
35
42
|
'-D',
|
|
36
|
-
isTest ? '../packages/base' :
|
|
43
|
+
isTest ? '../packages/base' : `@jcoreio/toolchain@^${version}`,
|
|
37
44
|
...(isTest
|
|
38
|
-
? toolchains.map((t) =>
|
|
39
|
-
|
|
45
|
+
? [...toolchains].map((t) =>
|
|
46
|
+
t.replace(/@jcoreio\/toolchain-/, '../packages/')
|
|
47
|
+
)
|
|
48
|
+
: [...toolchains].map((t) => `${t}@^${version}`)),
|
|
40
49
|
])
|
|
41
50
|
await execa('tc', ['migrate'])
|
|
42
51
|
}
|