@jcoreio/toolchain 5.1.2 → 5.2.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/githooks.cjs
CHANGED
|
@@ -1,5 +1,26 @@
|
|
|
1
1
|
module.exports = {
|
|
2
|
-
'pre-commit':
|
|
2
|
+
'pre-commit': async (...args) => {
|
|
3
|
+
const execa = require('./util/execa.cjs')
|
|
4
|
+
await execa('lint-staged', args)
|
|
5
|
+
|
|
6
|
+
const pnpmVersion = (
|
|
7
|
+
await execa('pnpm', ['-v'], { stdio: 'pipe', maxBuffer: 10 * 1024 })
|
|
8
|
+
).stdout
|
|
9
|
+
const projectFs = require('./util/projectFs.cjs')
|
|
10
|
+
const { packageManager } = await projectFs.readJson('package.json')
|
|
11
|
+
const expectedPnpmVersion = packageManager.replace(/^pnpm@/, '')
|
|
12
|
+
if (pnpmVersion !== expectedPnpmVersion) {
|
|
13
|
+
const chalk = require('chalk')
|
|
14
|
+
// eslint-disable-next-line no-console
|
|
15
|
+
console.error(
|
|
16
|
+
chalk`{red Error: the pnpm on your $PATH is version ${pnpmVersion}, but your package.json has "packageManager": ${JSON.stringify(packageManager)}.
|
|
17
|
+
This may mean your pnpm-lock.yaml is the wrong version, which would cause installing dependencies in CI to fail.
|
|
18
|
+
It's recommended to use corepack (https://nodejs.org/api/corepack.html) to manage pnpm instead of installing it globally,
|
|
19
|
+
since corepack can automatically select the pnpm version specified in "packageManager"}`
|
|
20
|
+
)
|
|
21
|
+
process.exit(1)
|
|
22
|
+
}
|
|
23
|
+
},
|
|
3
24
|
'commit-msg': async (file) => {
|
|
4
25
|
const fs = require('./util/projectFs.cjs')
|
|
5
26
|
const parseCommitMessage = require('./util/parseCommitMessage.cjs')
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jcoreio/toolchain",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.2.0",
|
|
4
4
|
"description": "base JS build toolchain",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -23,6 +23,7 @@
|
|
|
23
23
|
"find-up": "^5.0.0",
|
|
24
24
|
"fs-extra": "^10.0.0",
|
|
25
25
|
"glob": "^11.0.0",
|
|
26
|
+
"js-yaml": "4.1.0",
|
|
26
27
|
"json5": "^2.2.1",
|
|
27
28
|
"lint-staged": "^15.2.2",
|
|
28
29
|
"minimatch": "^10.0.1",
|
|
@@ -39,7 +40,7 @@
|
|
|
39
40
|
"engines": {
|
|
40
41
|
"node": ">=16"
|
|
41
42
|
},
|
|
42
|
-
"packageManager": "pnpm@
|
|
43
|
+
"packageManager": "pnpm@10.6.5",
|
|
43
44
|
"devDependencies": {
|
|
44
45
|
"eslint": "*",
|
|
45
46
|
"@jcoreio/eslint-plugin-implicit-dependencies": "*"
|
|
@@ -147,6 +147,17 @@ async function migrateProjectPackageJson({ fromVersion }) {
|
|
|
147
147
|
},
|
|
148
148
|
},
|
|
149
149
|
pick(toolchainManaged, 'engines', 'packageManager'),
|
|
150
|
+
{
|
|
151
|
+
packageManager:
|
|
152
|
+
!packageJson.packageManager ||
|
|
153
|
+
!packageJson.packageManager.startsWith('pnpm@') ||
|
|
154
|
+
semver.lt(
|
|
155
|
+
packageJson.packageManager.replace(/^pnpm@/, ''),
|
|
156
|
+
toolchainManaged.packageManager.replace(/^pnpm@/, '')
|
|
157
|
+
)
|
|
158
|
+
? toolchainManaged.packageManager
|
|
159
|
+
: packageJson.packageManager,
|
|
160
|
+
},
|
|
150
161
|
pick(packageJson, 'engines')
|
|
151
162
|
)
|
|
152
163
|
if (!fromVersion && isEmpty(packageJson.config)) delete packageJson.config
|