@jcoreio/toolchain 1.0.0-beta.4 → 1.0.0-beta.6
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 +6 -3
- package/scripts/bootstrap/bootstrapConfigFiles.cjs +7 -1
- package/scripts/bootstrap/bootstrapProjectPackageJson.cjs +40 -12
- package/scripts/bootstrap/bootstrapRemoveDevDeps.cjs +1 -5
- package/scripts/bootstrap/bootstrapRemoveFiles.cjs +14 -19
- package/scripts/preinstall/preinstallRemoveFiles.cjs +0 -5
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jcoreio/toolchain",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.6",
|
|
4
4
|
"description": "base JS build toolchain",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -36,11 +36,14 @@
|
|
|
36
36
|
"prettier": "^2.5.1",
|
|
37
37
|
"resolve-bin": "^1.0.0",
|
|
38
38
|
"semantic-release": "^21.0.5",
|
|
39
|
+
"semver": "^7.5.3",
|
|
39
40
|
"toposort": "^2.0.2",
|
|
40
41
|
"zod": "^3.21.4"
|
|
41
42
|
},
|
|
42
|
-
"
|
|
43
|
-
"
|
|
43
|
+
"toolchainManaged": {
|
|
44
|
+
"devDependencies": {
|
|
45
|
+
"eslint": "*"
|
|
46
|
+
}
|
|
44
47
|
},
|
|
45
48
|
"bin": {
|
|
46
49
|
"commitizen": "./bin/commitizen",
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
const fs = require('../../util/projectFs.cjs')
|
|
2
2
|
const getPluginsObject = require('../../util/getPluginsObject.cjs')
|
|
3
|
+
const { name } = require('../../package.json')
|
|
3
4
|
|
|
4
5
|
async function bootstrapConfigFiles() {
|
|
5
6
|
const files = await getPluginsObject('getConfigFiles')
|
|
@@ -7,7 +8,12 @@ async function bootstrapConfigFiles() {
|
|
|
7
8
|
const value = files[file]
|
|
8
9
|
const content = typeof value === 'string' ? value : value.content
|
|
9
10
|
const overwrite = typeof value === 'string' ? false : value.overwrite
|
|
10
|
-
if (
|
|
11
|
+
if (
|
|
12
|
+
overwrite === true ||
|
|
13
|
+
!(await fs.pathExists(file)) ||
|
|
14
|
+
(content.includes(name) &&
|
|
15
|
+
!(await fs.readFile(file, 'utf8')).includes(name))
|
|
16
|
+
) {
|
|
11
17
|
await fs.writeFile(file, content, 'utf8')
|
|
12
18
|
// eslint-disable-next-line no-console
|
|
13
19
|
console.error(`wrote ${file}`)
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
const { name
|
|
1
|
+
const { name } = require('../../package.json')
|
|
2
2
|
const { projectDir, toolchainPackages } = require('../../util/findUps.cjs')
|
|
3
3
|
const getPluginsAsyncFunction = require('../../util/getPluginsAsyncFunction.cjs')
|
|
4
4
|
const fs = require('../../util/projectFs.cjs')
|
|
5
5
|
const sortDeps = require('../../util/sortDeps.cjs')
|
|
6
|
+
const semver = require('semver')
|
|
6
7
|
|
|
7
8
|
async function bootstrapProjectPackageJson() {
|
|
8
9
|
const { merge, unset } = require('lodash')
|
|
@@ -11,13 +12,25 @@ async function bootstrapProjectPackageJson() {
|
|
|
11
12
|
const devDependencies =
|
|
12
13
|
packageJson.devDependencies || (packageJson.devDependencies = {})
|
|
13
14
|
|
|
14
|
-
const
|
|
15
|
+
const toolchainManaged = {}
|
|
15
16
|
for (const pkg of toolchainPackages) {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
17
|
+
const toolchainPkgJson = require(require.resolve(`${pkg}/package.json`, {
|
|
18
|
+
paths: [projectDir],
|
|
19
|
+
}))
|
|
20
|
+
const toolchainPkgDeps = toolchainPkgJson.dependencies || {}
|
|
21
|
+
const toolchainPkgDevDeps = toolchainPkgJson.devDependencies || {}
|
|
22
|
+
if (toolchainPkgJson.toolchainManaged) {
|
|
23
|
+
for (const section in toolchainPkgJson.toolchainManaged) {
|
|
24
|
+
const sectionDeps = toolchainPkgJson.toolchainManaged[section]
|
|
25
|
+
if (!toolchainManaged[section]) toolchainManaged[section] = {}
|
|
26
|
+
for (const dep in sectionDeps) {
|
|
27
|
+
let version = sectionDeps[dep]
|
|
28
|
+
if (version === '*')
|
|
29
|
+
version = toolchainPkgDevDeps[dep] || toolchainPkgDeps[dep]
|
|
30
|
+
if (version !== '*') toolchainManaged[section][dep] = version
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
21
34
|
}
|
|
22
35
|
|
|
23
36
|
for (const path of [
|
|
@@ -56,11 +69,26 @@ async function bootstrapProjectPackageJson() {
|
|
|
56
69
|
},
|
|
57
70
|
})
|
|
58
71
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
72
|
+
for (const section in toolchainManaged) {
|
|
73
|
+
const managedSection = toolchainManaged[section]
|
|
74
|
+
const pkgSectionName = section.replace(/^optionalD/, 'd')
|
|
75
|
+
let pkgSection = packageJson[pkgSectionName]
|
|
76
|
+
if (!pkgSection) {
|
|
77
|
+
if (/^optional/.test(section)) continue
|
|
78
|
+
pkgSection = packageJson[pkgSectionName] = {}
|
|
79
|
+
}
|
|
80
|
+
for (const dep in managedSection) {
|
|
81
|
+
if (/^optional/.test(section) && !pkgSection[dep]) continue
|
|
82
|
+
const versionRange = managedSection[dep]
|
|
83
|
+
if (
|
|
84
|
+
!pkgSection[dep] ||
|
|
85
|
+
semver.gt(
|
|
86
|
+
versionRange.replace(/^\D+/, ''),
|
|
87
|
+
pkgSection[dep].replace(/^\D+/, '')
|
|
88
|
+
)
|
|
89
|
+
) {
|
|
90
|
+
pkgSection[dep] = versionRange
|
|
91
|
+
}
|
|
64
92
|
}
|
|
65
93
|
}
|
|
66
94
|
|
|
@@ -90,18 +90,14 @@ module.exports = [
|
|
|
90
90
|
'babylon',
|
|
91
91
|
'codecov',
|
|
92
92
|
'coveralls',
|
|
93
|
-
'eslint-plugin-flowtype',
|
|
94
|
-
'eslint-plugin-prettier',
|
|
95
|
-
'eslint-plugin-react',
|
|
96
93
|
'eslint-watch',
|
|
97
|
-
'eslint',
|
|
98
94
|
'flow-copy-source',
|
|
99
95
|
'flow-watch',
|
|
100
96
|
'husky',
|
|
101
97
|
'isparta',
|
|
102
98
|
'istanbul',
|
|
99
|
+
'jsdom-global',
|
|
103
100
|
'lint-staged',
|
|
104
|
-
'mocha',
|
|
105
101
|
'nyc',
|
|
106
102
|
'prettier-eslint',
|
|
107
103
|
'prettier',
|
|
@@ -1,24 +1,26 @@
|
|
|
1
1
|
module.exports = [
|
|
2
|
-
'.babelrc.cjs',
|
|
3
2
|
'.babelrc.js',
|
|
4
3
|
'.babelrc.json',
|
|
5
4
|
'.babelrc.mjs',
|
|
6
5
|
'.babelrc',
|
|
6
|
+
'babel.config.cjs',
|
|
7
|
+
'babel.config.js',
|
|
8
|
+
'babel.config.json',
|
|
9
|
+
'babel.config.mjs',
|
|
7
10
|
'.commitlintrc.js',
|
|
8
11
|
'.commitlintrc.json',
|
|
9
12
|
'.commitlintrc.yml',
|
|
13
|
+
'commitlint.config.js',
|
|
10
14
|
'.eslintignore',
|
|
11
|
-
'.github/renovate.json',
|
|
12
|
-
'.github/renovate.json5',
|
|
13
15
|
'.gitignore',
|
|
14
|
-
'.gitlab/renovate.json',
|
|
15
|
-
'.gitlab/renovate.json5',
|
|
16
16
|
'.lintstagedrc',
|
|
17
|
+
'lint-staged.config.js',
|
|
17
18
|
'.npmignore',
|
|
18
19
|
'.nycrc.json',
|
|
19
20
|
'.nycrc.yaml',
|
|
20
21
|
'.nycrc.yml',
|
|
21
22
|
'.nycrc',
|
|
23
|
+
'nyc.config.js',
|
|
22
24
|
'.prettierrc.cjs',
|
|
23
25
|
'.prettierrc.js',
|
|
24
26
|
'.prettierrc.json',
|
|
@@ -27,24 +29,17 @@ module.exports = [
|
|
|
27
29
|
'.prettierrc.yaml',
|
|
28
30
|
'.prettierrc.yml',
|
|
29
31
|
'.prettierrc',
|
|
32
|
+
'prettier.config.js',
|
|
33
|
+
'package-lock.json',
|
|
34
|
+
'.github/renovate.json',
|
|
35
|
+
'.github/renovate.json5',
|
|
36
|
+
'.gitlab/renovate.json',
|
|
37
|
+
'.gitlab/renovate.json5',
|
|
30
38
|
'.renovaterc.json',
|
|
31
39
|
'.renovaterc',
|
|
32
|
-
'.travis.yml',
|
|
33
|
-
'babel.config.cjs',
|
|
34
|
-
'babel.config.js',
|
|
35
|
-
'babel.config.json',
|
|
36
|
-
'babel.config.mjs',
|
|
37
|
-
'commitlint.config.cjs',
|
|
38
|
-
'commitlint.config.js',
|
|
39
|
-
'lint-staged.config.cjs',
|
|
40
|
-
'lint-staged.config.js',
|
|
41
|
-
'nyc.config.cjs',
|
|
42
|
-
'nyc.config.js',
|
|
43
|
-
'package-lock.json',
|
|
44
|
-
'prettier.config.cjs',
|
|
45
|
-
'prettier.config.js',
|
|
46
40
|
'renovate.json',
|
|
47
41
|
'renovate.json5',
|
|
48
42
|
'solano.yml',
|
|
43
|
+
'.travis.yml',
|
|
49
44
|
'yarn.lock',
|
|
50
45
|
]
|
|
@@ -2,7 +2,6 @@ module.exports = [
|
|
|
2
2
|
'.babelrc',
|
|
3
3
|
'.babelrc.json',
|
|
4
4
|
'.babelrc.js',
|
|
5
|
-
'.babelrc.cjs',
|
|
6
5
|
'.babelrc.mjs',
|
|
7
6
|
'babel.config.json',
|
|
8
7
|
'babel.config.js',
|
|
@@ -17,25 +16,21 @@ module.exports = [
|
|
|
17
16
|
'.prettierrc.js',
|
|
18
17
|
'.prettierrc.cjs',
|
|
19
18
|
'prettier.config.js',
|
|
20
|
-
'prettier.config.cjs',
|
|
21
19
|
'package-lock.json',
|
|
22
20
|
'.npmignore',
|
|
23
21
|
'.gitignore',
|
|
24
22
|
'.eslintignore',
|
|
25
23
|
'commitlint.config.js',
|
|
26
|
-
'commitlint.config.cjs',
|
|
27
24
|
'.commitlintrc.js',
|
|
28
25
|
'.commitlintrc.json',
|
|
29
26
|
'.commitlintrc.yml',
|
|
30
27
|
'.lintstagedrc',
|
|
31
28
|
'lint-staged.config.js',
|
|
32
|
-
'lint-staged.config.cjs',
|
|
33
29
|
'.nycrc',
|
|
34
30
|
'.nycrc.json',
|
|
35
31
|
'.nycrc.yaml',
|
|
36
32
|
'.nycrc.yml',
|
|
37
33
|
'nyc.config.js',
|
|
38
|
-
'nyc.config.cjs',
|
|
39
34
|
'.github/renovate.json',
|
|
40
35
|
'.github/renovate.json5',
|
|
41
36
|
'.gitlab/renovate.json',
|