@jcoreio/toolchain 1.0.0-beta.3 → 1.0.0-beta.4

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jcoreio/toolchain",
3
- "version": "1.0.0-beta.3",
3
+ "version": "1.0.0-beta.4",
4
4
  "description": "base JS build toolchain",
5
5
  "repository": {
6
6
  "type": "git",
@@ -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)
@@ -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