@hublo/sentinel 1.4.0-alpha.6 → 1.4.0-alpha.7
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.js
CHANGED
|
@@ -5404,7 +5404,7 @@ function registerLint() {
|
|
|
5404
5404
|
import { spawnSync as spawnSync5 } from "child_process";
|
|
5405
5405
|
import { mkdtempSync as mkdtempSync2, readFileSync as readFileSync30 } from "fs";
|
|
5406
5406
|
import { tmpdir as tmpdir2 } from "os";
|
|
5407
|
-
import { join as join37 } from "path";
|
|
5407
|
+
import { isAbsolute as isAbsolute3, join as join37, resolve as resolve6 } from "path";
|
|
5408
5408
|
|
|
5409
5409
|
// src/roles/test/presets/toolchain.json
|
|
5410
5410
|
var toolchain_default2 = {
|
|
@@ -8847,13 +8847,16 @@ var VitestAdapter = class extends BaseAdapter {
|
|
|
8847
8847
|
`using the MODULE's vitest, not sentinel's. An adopted config gets its plugins from sentinel, and two copies fail in ways that never mention a version. Remove vitest from this module's package.json.`
|
|
8848
8848
|
);
|
|
8849
8849
|
}
|
|
8850
|
-
const { options, paths } = splitToolArgs(ctx.cwd, ctx.toolArgs, {
|
|
8850
|
+
const { options: typedOptions, paths: typedPaths } = splitToolArgs(ctx.cwd, ctx.toolArgs, {
|
|
8851
|
+
valueFlags: ["--config", "-c"]
|
|
8852
|
+
});
|
|
8853
|
+
const { cwd: runFrom, options, paths } = fromWorkspaceRoot(ctx.cwd, typedOptions, typedPaths);
|
|
8851
8854
|
const watching = options.includes("--watch") || options.includes("-w");
|
|
8852
8855
|
const proving = !watching && hasReference(ctx.cwd);
|
|
8853
8856
|
const reportFile = proving ? join37(mkdtempSync2(join37(tmpdir2(), "sentinel-run-")), "vitest.json") : void 0;
|
|
8854
8857
|
const reporters = reportFile === void 0 ? [] : ["--reporter=default", "--reporter=json", `--outputFile=${reportFile}`];
|
|
8855
8858
|
const argv = watching ? [...options, ...paths] : ["run", ...reporters, ...options, ...paths];
|
|
8856
|
-
const result = spawnSync5(bin, argv, { cwd:
|
|
8859
|
+
const result = spawnSync5(bin, argv, { cwd: runFrom, stdio: "inherit" });
|
|
8857
8860
|
if (result.error) {
|
|
8858
8861
|
this.say(`could not run vitest (${result.error.message})`);
|
|
8859
8862
|
return Promise.resolve({ ok: false, code: 1 });
|
|
@@ -8881,6 +8884,31 @@ var VitestAdapter = class extends BaseAdapter {
|
|
|
8881
8884
|
`);
|
|
8882
8885
|
}
|
|
8883
8886
|
};
|
|
8887
|
+
function fromWorkspaceRoot(moduleDir, options, paths) {
|
|
8888
|
+
const root = findWorkspaceRoot(moduleDir);
|
|
8889
|
+
if (root === void 0 || root === moduleDir) {
|
|
8890
|
+
return { cwd: moduleDir, options: [...options], paths: [...paths] };
|
|
8891
|
+
}
|
|
8892
|
+
const absolute = (value) => isAbsolute3(value) ? value : resolve6(moduleDir, value);
|
|
8893
|
+
const moved = [];
|
|
8894
|
+
let previousWasConfig = false;
|
|
8895
|
+
for (const option of options) {
|
|
8896
|
+
if (previousWasConfig) {
|
|
8897
|
+
moved.push(absolute(option));
|
|
8898
|
+
previousWasConfig = false;
|
|
8899
|
+
continue;
|
|
8900
|
+
}
|
|
8901
|
+
if (option.startsWith("--config=")) moved.push(`--config=${absolute(option.slice(9))}`);
|
|
8902
|
+
else moved.push(option);
|
|
8903
|
+
previousWasConfig = option === "--config" || option === "-c";
|
|
8904
|
+
}
|
|
8905
|
+
return {
|
|
8906
|
+
cwd: root,
|
|
8907
|
+
// `--root` LAST, so a caller cannot be silently overridden by our own flag.
|
|
8908
|
+
options: [...moved, "--root", moduleDir],
|
|
8909
|
+
paths: paths.map((path) => absolute(path))
|
|
8910
|
+
};
|
|
8911
|
+
}
|
|
8884
8912
|
|
|
8885
8913
|
// src/roles/test/register.ts
|
|
8886
8914
|
function registerTest() {
|
|
@@ -9636,7 +9664,7 @@ function replaceLines(current, replacements) {
|
|
|
9636
9664
|
|
|
9637
9665
|
// src/core/apply-plan.ts
|
|
9638
9666
|
import { existsSync as existsSync32, readFileSync as readFileSync33, renameSync, rmSync as rmSync4, writeFileSync as writeFileSync4 } from "fs";
|
|
9639
|
-
import { resolve as
|
|
9667
|
+
import { resolve as resolve7, sep } from "path";
|
|
9640
9668
|
import { applyEdits as applyEdits3, findNodeAtLocation, modify, parseTree } from "jsonc-parser";
|
|
9641
9669
|
|
|
9642
9670
|
// src/shared/deep-merge.ts
|
|
@@ -9646,8 +9674,8 @@ function isPlainObject(value) {
|
|
|
9646
9674
|
|
|
9647
9675
|
// src/core/apply-plan.ts
|
|
9648
9676
|
function resolveWithinRoot(cwd, relativePath) {
|
|
9649
|
-
const root =
|
|
9650
|
-
const absolutePath =
|
|
9677
|
+
const root = resolve7(cwd);
|
|
9678
|
+
const absolutePath = resolve7(root, relativePath);
|
|
9651
9679
|
if (absolutePath !== root && !absolutePath.startsWith(root + sep)) {
|
|
9652
9680
|
throw new Error(`Refusing to write outside the module root: "${relativePath}".`);
|
|
9653
9681
|
}
|
package/dist/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hublo/sentinel",
|
|
3
|
-
"version": "1.4.0-alpha.
|
|
3
|
+
"version": "1.4.0-alpha.7",
|
|
4
4
|
"description": "One CLI that guards code health across Hublo repos: shared lint/typescript/build/test presets, static & dynamic analysis, and architecture checks.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|