@hublo/sentinel 1.2.0-alpha.2 → 1.2.0-alpha.20
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/dist/bin/sentinel.d.ts +1 -0
- package/dist/bin/sentinel.js +31 -5
- package/dist/{chunk-SA2RMTVI.js → chunk-RKVGZNJ7.js} +859 -577
- package/dist/index.js +1 -1
- package/dist/roles/build/nest/toolchain.d.ts +130 -0
- package/dist/roles/build/nest/toolchain.js +403 -0
- package/dist/roles/test/react/toolchain.d.ts +2 -0
- package/dist/roles/test/react/toolchain.js +9 -0
- package/package.json +24 -2
package/dist/bin/sentinel.d.ts
CHANGED
package/dist/bin/sentinel.js
CHANGED
|
@@ -8,27 +8,28 @@ import {
|
|
|
8
8
|
VERBS,
|
|
9
9
|
WORKSPACE_ROOT_MARKER,
|
|
10
10
|
availableTargets,
|
|
11
|
+
buildConfigFile,
|
|
11
12
|
declaredPresetFor,
|
|
12
13
|
describeFramework,
|
|
13
14
|
dispatch,
|
|
14
15
|
ensureWorkspacePrep,
|
|
15
16
|
findWorkspaceRoot,
|
|
16
17
|
inspectWorkspacePrep,
|
|
18
|
+
moduleName,
|
|
17
19
|
palette,
|
|
18
|
-
readNxProjectName,
|
|
19
20
|
readOwnVersion,
|
|
20
21
|
readProjectPackageJson,
|
|
21
22
|
registerAdapters,
|
|
22
23
|
resolve,
|
|
23
24
|
resolveBin
|
|
24
|
-
} from "../chunk-
|
|
25
|
+
} from "../chunk-RKVGZNJ7.js";
|
|
25
26
|
|
|
26
27
|
// bin/sentinel.ts
|
|
27
28
|
import { program } from "commander";
|
|
28
29
|
|
|
29
30
|
// src/core/context.ts
|
|
30
31
|
import { existsSync } from "fs";
|
|
31
|
-
import {
|
|
32
|
+
import { join as join2 } from "path";
|
|
32
33
|
|
|
33
34
|
// src/core/discover-modules.ts
|
|
34
35
|
import { execFileSync } from "child_process";
|
|
@@ -96,7 +97,7 @@ function resolveContext(cwd2, opts2) {
|
|
|
96
97
|
if (opts2.ci) {
|
|
97
98
|
throw new Error("--ci selects the affected set from the workspace root; run it there.");
|
|
98
99
|
}
|
|
99
|
-
const name =
|
|
100
|
+
const name = moduleName(cwd2);
|
|
100
101
|
return { modules: [{ name, root: cwd2 }], scope: "cwd-module" };
|
|
101
102
|
}
|
|
102
103
|
if (atRoot) {
|
|
@@ -113,6 +114,30 @@ function resolveContext(cwd2, opts2) {
|
|
|
113
114
|
);
|
|
114
115
|
}
|
|
115
116
|
|
|
117
|
+
// src/roles/build/declined.ts
|
|
118
|
+
import { existsSync as existsSync2, readFileSync as readFileSync2 } from "fs";
|
|
119
|
+
import { join as join3 } from "path";
|
|
120
|
+
var DEPRECATED_NX_BUILDER = "@nx/webpack:webpack";
|
|
121
|
+
function buildsWithDeprecatedExecutor(cwd2) {
|
|
122
|
+
const projectJson = join3(cwd2, "project.json");
|
|
123
|
+
if (!existsSync2(projectJson)) return false;
|
|
124
|
+
try {
|
|
125
|
+
const project = JSON.parse(readFileSync2(projectJson, "utf8"));
|
|
126
|
+
return project.targets?.build?.executor === DEPRECATED_NX_BUILDER;
|
|
127
|
+
} catch {
|
|
128
|
+
return false;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
function explainDecline(cwd2) {
|
|
132
|
+
if (buildConfigFile(cwd2) !== void 0) {
|
|
133
|
+
return ` This module HAS a Vite config, so detection is the likely problem: the build toolchain is declared at the workspace root, which makes a front app detect as "node". Pass --preset to say what it is.`;
|
|
134
|
+
}
|
|
135
|
+
if (buildsWithDeprecatedExecutor(cwd2)) {
|
|
136
|
+
return ` This module still builds through ${DEPRECATED_NX_BUILDER}, which Nx v24 removes. It has no Vite config yet, so there is nothing for --build to adopt: add one that imports @hublo/sentinel/build/nest, then run this again. See docs/build-adoption.md.`;
|
|
137
|
+
}
|
|
138
|
+
return ` This module has neither a Vite config nor an Nx build target, so it builds nothing and --build is out of scope for it. Nothing was written, and nothing is wrong.`;
|
|
139
|
+
}
|
|
140
|
+
|
|
116
141
|
// src/cli/run-init.ts
|
|
117
142
|
function asMessage(error) {
|
|
118
143
|
return error instanceof Error ? error.message : String(error);
|
|
@@ -151,9 +176,10 @@ async function runInit(ctx) {
|
|
|
151
176
|
} catch (error) {
|
|
152
177
|
if (error instanceof PresetUnsupportedError) {
|
|
153
178
|
if (ctx.targetsExplicit) {
|
|
179
|
+
const hint = type === "build" ? explainDecline(module.root) : ` Pass --preset if it was detected wrongly (hoisted dependencies make detection fall back to "node").`;
|
|
154
180
|
process.stderr.write(
|
|
155
181
|
`
|
|
156
|
-
sentinel (${type}): this module's preset is "${error.preset}", and --${type} has no adapter for it
|
|
182
|
+
sentinel (${type}): this module's preset is "${error.preset}", and --${type} has no adapter for it.${hint}
|
|
157
183
|
`
|
|
158
184
|
);
|
|
159
185
|
worst = Math.max(worst, 1);
|