@jcoreio/toolchain 3.6.2 → 3.7.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/package.json
CHANGED
|
@@ -2,6 +2,7 @@ const { name } = require('../package.json')
|
|
|
2
2
|
const dedent = require('dedent-js')
|
|
3
3
|
const fs = require('../util/projectFs.cjs')
|
|
4
4
|
const JSON5 = require('json5')
|
|
5
|
+
const getPluginsArraySync = require('../util/getPluginsArraySync.cjs')
|
|
5
6
|
|
|
6
7
|
async function getRootEslintConfig() {
|
|
7
8
|
if (await fs.pathExists('.eslintrc.json')) {
|
|
@@ -30,6 +31,21 @@ module.exports = [
|
|
|
30
31
|
}
|
|
31
32
|
}
|
|
32
33
|
`,
|
|
34
|
+
'toolchain.config.cjs': async (existing) => {
|
|
35
|
+
if (existing) return existing
|
|
36
|
+
return dedent`
|
|
37
|
+
/* eslint-env node, es2018 */
|
|
38
|
+
module.exports = {
|
|
39
|
+
// scripts: {
|
|
40
|
+
// pretest: 'docker compose up -d',
|
|
41
|
+
// jsExample: {
|
|
42
|
+
// description: 'example of running a JS script',
|
|
43
|
+
// run: async (args = []) => console.log('TEST', ...args),
|
|
44
|
+
// },
|
|
45
|
+
// }
|
|
46
|
+
}
|
|
47
|
+
`
|
|
48
|
+
},
|
|
33
49
|
}
|
|
34
50
|
for (const file of [
|
|
35
51
|
'githooks.cjs',
|
|
@@ -45,6 +61,30 @@ module.exports = [
|
|
|
45
61
|
|
|
46
62
|
`
|
|
47
63
|
}
|
|
64
|
+
const tasks = await getPluginsArraySync('vscodeTasks')
|
|
65
|
+
const launch = await getPluginsArraySync('vscodeLaunch')
|
|
66
|
+
|
|
67
|
+
if (tasks) {
|
|
68
|
+
files['.vscode/tasks.json'] = JSON.stringify(
|
|
69
|
+
{
|
|
70
|
+
version: '2.0.0',
|
|
71
|
+
tasks,
|
|
72
|
+
},
|
|
73
|
+
null,
|
|
74
|
+
2
|
|
75
|
+
)
|
|
76
|
+
}
|
|
77
|
+
if (launch) {
|
|
78
|
+
files['.vscode/launch.json'] = JSON.stringify(
|
|
79
|
+
{
|
|
80
|
+
version: '0.2.0',
|
|
81
|
+
configurations: launch,
|
|
82
|
+
},
|
|
83
|
+
null,
|
|
84
|
+
2
|
|
85
|
+
)
|
|
86
|
+
}
|
|
87
|
+
|
|
48
88
|
return files
|
|
49
89
|
},
|
|
50
90
|
]
|
package/scripts/check.cjs
CHANGED
|
@@ -8,7 +8,7 @@ const fs = require('../util/projectFs.cjs')
|
|
|
8
8
|
exports.run = async function check(args = []) {
|
|
9
9
|
await require('../scripts/runPrettier.cjs').prettierCheck(args)
|
|
10
10
|
await require('../scripts/runEslint.cjs').eslintCheck(args)
|
|
11
|
-
const isTest = Boolean(process.env.
|
|
11
|
+
const isTest = Boolean(process.env.JCOREIO_TOOLCHAIN_SELF_TEST)
|
|
12
12
|
if (devDependencies['flow-bin'] && (await fs.pathExists('.flowconfig'))) {
|
|
13
13
|
await execa('flow', isTest ? ['check'] : [])
|
|
14
14
|
}
|
package/scripts/init.cjs
CHANGED
|
@@ -54,8 +54,16 @@ async function init(args = []) {
|
|
|
54
54
|
})),
|
|
55
55
|
}))
|
|
56
56
|
}
|
|
57
|
+
if (
|
|
58
|
+
['flow', 'typescript', 'react'].some((value) =>
|
|
59
|
+
selectedToolchains.includes(`${name}-${value}`)
|
|
60
|
+
) &&
|
|
61
|
+
!selectedToolchains.includes(`${name}-esnext`)
|
|
62
|
+
) {
|
|
63
|
+
selectedToolchains.push(`${name}-esnext`)
|
|
64
|
+
}
|
|
57
65
|
|
|
58
|
-
const isTest = Boolean(process.env.
|
|
66
|
+
const isTest = Boolean(process.env.JCOREIO_TOOLCHAIN_SELF_TEST)
|
|
59
67
|
|
|
60
68
|
await execa('tc', ['preinstall'])
|
|
61
69
|
await execa('pnpm', [
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
const { toolchainManaged } = require('../../util/findUps.cjs')
|
|
2
|
+
const { name } = require('../../package.json')
|
|
2
3
|
const getPluginsAsyncFunction = require('../../util/getPluginsAsyncFunction.cjs')
|
|
3
4
|
const fs = require('../../util/projectFs.cjs')
|
|
4
5
|
const sortDeps = require('../../util/sortDeps.cjs')
|
|
@@ -6,7 +7,6 @@ const semver = require('semver')
|
|
|
6
7
|
const isEmpty = require('lodash/isEmpty')
|
|
7
8
|
const pick = require('lodash/pick')
|
|
8
9
|
const Path = require('path')
|
|
9
|
-
const { toolchainConfig } = require('../../util/findUps.cjs')
|
|
10
10
|
const confirmOutputEsm = require('./confirmOutputEsm.cjs')
|
|
11
11
|
const confirm = require('../../util/confirm.cjs')
|
|
12
12
|
|
|
@@ -107,9 +107,7 @@ async function migrateProjectPackageJson() {
|
|
|
107
107
|
? {
|
|
108
108
|
'./*': {
|
|
109
109
|
types: './*.d.ts',
|
|
110
|
-
...(
|
|
111
|
-
? { import: './*.mjs' }
|
|
112
|
-
: {}),
|
|
110
|
+
...(outputEsm !== false ? { import: './*.mjs' } : {}),
|
|
113
111
|
default: './*.js',
|
|
114
112
|
},
|
|
115
113
|
}
|
|
@@ -135,6 +133,8 @@ async function migrateProjectPackageJson() {
|
|
|
135
133
|
)
|
|
136
134
|
if (isEmpty(packageJson.config)) delete packageJson.config
|
|
137
135
|
|
|
136
|
+
const isTest = Boolean(process.env.JCOREIO_TOOLCHAIN_SELF_TEST)
|
|
137
|
+
|
|
138
138
|
for (const section in toolchainManaged) {
|
|
139
139
|
if (!section.endsWith('ependencies')) continue
|
|
140
140
|
const managedSection = toolchainManaged[section]
|
|
@@ -147,7 +147,9 @@ async function migrateProjectPackageJson() {
|
|
|
147
147
|
for (const dep in managedSection) {
|
|
148
148
|
if (/^optional/.test(section) && !pkgSection[dep]) continue
|
|
149
149
|
const versionRange = managedSection[dep]
|
|
150
|
-
if (
|
|
150
|
+
if (isTest && dep.startsWith(`${name}-`)) {
|
|
151
|
+
pkgSection[dep] = `link:${dep.replace(`${name}-`, '../packages/')}`
|
|
152
|
+
} else if (
|
|
151
153
|
!pkgSection[dep] ||
|
|
152
154
|
!semver.satisfies(semver.minVersion(pkgSection[dep]), versionRange)
|
|
153
155
|
) {
|
package/scripts/prepublish.cjs
CHANGED
|
@@ -4,6 +4,7 @@ exports.run = async function (args = []) {
|
|
|
4
4
|
const { scripts } = require('./toolchain.cjs')
|
|
5
5
|
await execa('tc', ['check'])
|
|
6
6
|
if (scripts.coverage) await execa('tc', ['coverage'])
|
|
7
|
+
if (scripts['test:esm']) await execa('tc', ['test:esm'])
|
|
7
8
|
await execa('tc', ['build'])
|
|
8
9
|
}
|
|
9
10
|
|
package/scripts/upgrade.cjs
CHANGED
|
@@ -9,7 +9,7 @@ async function upgrade([version] = []) {
|
|
|
9
9
|
const toolchains = Object.keys(devDependencies).filter((pkg) =>
|
|
10
10
|
pkg.startsWith(`${name}-`)
|
|
11
11
|
)
|
|
12
|
-
const isTest = Boolean(process.env.
|
|
12
|
+
const isTest = Boolean(process.env.JCOREIO_TOOLCHAIN_SELF_TEST)
|
|
13
13
|
|
|
14
14
|
if (!isTest && !version) {
|
|
15
15
|
version = (
|
package/util/isInteractive.cjs
CHANGED