@jcoreio/toolchain 5.4.4 → 5.4.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 +2 -1
- package/util/findUps.cjs +16 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jcoreio/toolchain",
|
|
3
|
-
"version": "5.4.
|
|
3
|
+
"version": "5.4.5",
|
|
4
4
|
"description": "base JS build toolchain",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -22,6 +22,7 @@
|
|
|
22
22
|
"@eslint/js": "^9.23.0",
|
|
23
23
|
"@jcoreio/eslint-plugin-implicit-dependencies": "^1.1.1",
|
|
24
24
|
"chalk": "^4.0.0",
|
|
25
|
+
"debug": "^4.4.0",
|
|
25
26
|
"dedent-js": "^1.0.1",
|
|
26
27
|
"eslint": "^9.17.0",
|
|
27
28
|
"eslint-config-prettier": "^9.1.0",
|
package/util/findUps.cjs
CHANGED
|
@@ -6,15 +6,18 @@ const merge = require('./merge.cjs')
|
|
|
6
6
|
const once = require('./once.cjs')
|
|
7
7
|
const { name } = require('../package.json')
|
|
8
8
|
const configSchema = require('./configSchema.cjs')
|
|
9
|
+
const debug = require('debug')('@jcoreio/toolchain:findUps')
|
|
9
10
|
|
|
10
11
|
// First see if the cwd is within a project dir
|
|
11
12
|
let dir = process
|
|
12
13
|
.cwd()
|
|
13
14
|
.replace(/\/node_modules(\/.*|$)|\\node_modules(\\.*|$)/, '')
|
|
15
|
+
|
|
14
16
|
let packageJsonFile = findUp.sync('package.json', {
|
|
15
17
|
cwd: dir,
|
|
16
18
|
type: 'file',
|
|
17
19
|
})
|
|
20
|
+
debug({ step: 0, cwd: process.cwd(), dir, packageJsonFile })
|
|
18
21
|
|
|
19
22
|
if (!packageJsonFile) {
|
|
20
23
|
// When the cwd is not within a project dir, see if this file is within a project dir
|
|
@@ -25,7 +28,10 @@ if (!packageJsonFile) {
|
|
|
25
28
|
type: 'file',
|
|
26
29
|
})
|
|
27
30
|
}
|
|
31
|
+
debug({ step: 1, dir, packageJsonFile })
|
|
32
|
+
|
|
28
33
|
if (!packageJsonFile) {
|
|
34
|
+
debug(`failed to find project package.json in a parent directory of ${dir}`)
|
|
29
35
|
throw new Error(
|
|
30
36
|
`failed to find project package.json in a parent directory of ${dir}`
|
|
31
37
|
)
|
|
@@ -36,12 +42,19 @@ if (!packageJsonFile) {
|
|
|
36
42
|
// if @jcoreio/toolchains is operating on itself. But if we're invoking the CLI from
|
|
37
43
|
// a working copy of the monorepo from a cwd outside of it, we want to error out
|
|
38
44
|
let packageJson = fs.readJsonSync(packageJsonFile)
|
|
45
|
+
debug({ step: 2, 'packageJson.name': packageJson.name })
|
|
46
|
+
|
|
39
47
|
if (packageJson.name === name) {
|
|
40
48
|
packageJsonFile = findUp.sync('package.json', {
|
|
41
49
|
cwd: Path.dirname(Path.dirname(packageJsonFile)),
|
|
42
50
|
type: 'file',
|
|
43
51
|
})
|
|
44
52
|
packageJson = packageJsonFile ? fs.readJsonSync(packageJsonFile) : undefined
|
|
53
|
+
debug({
|
|
54
|
+
step: 3,
|
|
55
|
+
packageJsonFile,
|
|
56
|
+
'packageJson.name': packageJson.name,
|
|
57
|
+
})
|
|
45
58
|
if (
|
|
46
59
|
// When vscode-prettier is trying to format a file in this monorepo, the
|
|
47
60
|
// cwd may be outside the monorepo, which would make our logic decide
|
|
@@ -54,6 +67,7 @@ if (packageJson.name === name) {
|
|
|
54
67
|
!packageJson ||
|
|
55
68
|
packageJson.name !== '@jcoreio/toolchains'
|
|
56
69
|
) {
|
|
70
|
+
debug(`failed to find project package.json in a parent directory of ${dir}`)
|
|
57
71
|
throw new Error(
|
|
58
72
|
`failed to find project package.json in a parent directory of ${dir}`
|
|
59
73
|
)
|
|
@@ -227,3 +241,5 @@ for (const toolchainPkgJson of Object.values(toolchainPackageJsons)) {
|
|
|
227
241
|
}
|
|
228
242
|
}
|
|
229
243
|
}
|
|
244
|
+
|
|
245
|
+
debug(exports)
|