@jcoreio/toolchain 1.0.0-beta.3 → 1.0.0-beta.5
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/bootstrap/bootstrapConfigFiles.cjs +7 -1
- package/scripts/bootstrap/bootstrapRemoveFiles.cjs +14 -19
- package/scripts/bootstrap.cjs +4 -0
- package/scripts/preinstall/preinstallRemoveFiles.cjs +0 -5
- package/scripts/preinstall.cjs +5 -0
- package/util/hasYarnOrNpmLockfile.cjs +13 -0
package/package.json
CHANGED
|
@@ -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,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
|
]
|
package/scripts/bootstrap.cjs
CHANGED
|
@@ -12,10 +12,14 @@ async function bootstrap(args = []) {
|
|
|
12
12
|
const bootstrapMoveTypeDefs = require('./bootstrap/bootstrapMoveTypeDefs.cjs')
|
|
13
13
|
const bootstrapGitignore = require('./bootstrap/bootstrapGitignore.cjs')
|
|
14
14
|
const bootstrapRemoveFiles = require('./bootstrap/bootstrapRemoveFiles.cjs')
|
|
15
|
+
const hasYarnOrNpmLockfile = require('../util/hasYarnOrNpmLockfile.cjs')
|
|
15
16
|
|
|
16
17
|
await execa('git', ['init'])
|
|
17
18
|
await installGitHooks()
|
|
18
19
|
await bootstrapProjectPackageJson()
|
|
20
|
+
if (await hasYarnOrNpmLockfile()) {
|
|
21
|
+
await execa('pnpm', ['import'])
|
|
22
|
+
}
|
|
19
23
|
await Promise.all(
|
|
20
24
|
bootstrapRemoveFiles.map(async (file) => {
|
|
21
25
|
const exists = await fs.pathExists(file)
|
|
@@ -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',
|
package/scripts/preinstall.cjs
CHANGED
|
@@ -4,7 +4,12 @@ const fs = require('../util/projectFs.cjs')
|
|
|
4
4
|
|
|
5
5
|
async function preinstall(args = []) {
|
|
6
6
|
const preinstallUpdateProjectPackageJson = require('./preinstall/preinstallUpdateProjectPackageJson.cjs')
|
|
7
|
+
const execa = require('../util/execa.cjs')
|
|
8
|
+
const hasYarnOrNpmLockfile = require('../util/hasYarnOrNpmLockfile.cjs')
|
|
7
9
|
|
|
10
|
+
if (await hasYarnOrNpmLockfile()) {
|
|
11
|
+
await execa('pnpm', ['import'])
|
|
12
|
+
}
|
|
8
13
|
await Promise.all(
|
|
9
14
|
require('./preinstall/preinstallRemoveFiles.cjs').map(async (file) => {
|
|
10
15
|
const exists = await fs.pathExists(file)
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
const fs = require('./projectFs.cjs')
|
|
2
|
+
|
|
3
|
+
async function hasYarnOrNpmLockfile() {
|
|
4
|
+
return (
|
|
5
|
+
await Promise.all(
|
|
6
|
+
['yarn.lock', 'npm-shrinkwrap.json', 'package-lock.json'].map((file) =>
|
|
7
|
+
fs.pathExists(file)
|
|
8
|
+
)
|
|
9
|
+
)
|
|
10
|
+
).some((exists) => exists)
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
module.exports = hasYarnOrNpmLockfile
|