@v-office/site-checks 0.5.1 → 0.5.2
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.mjs +1 -1
- package/dist/{cli-DDeid5ml.mjs → cli-Xd9RQ91Q.mjs} +41 -10
- package/dist/index.mjs +1 -1
- package/instructions/CHANGELOG.md +1 -0
- package/instructions/MIGRATION.md +1 -0
- package/instructions/versions/0.5.2/CHANGELOG.md +18 -0
- package/instructions/versions/0.5.2/MIGRATION.md +9 -0
- package/package.json +1 -1
package/dist/bin.mjs
CHANGED
|
@@ -2526,6 +2526,25 @@ const sdkEnv = (root, processEnv = process.env) => {
|
|
|
2526
2526
|
};
|
|
2527
2527
|
/** What the developer's `.local` files set. */
|
|
2528
2528
|
const localEnv = (root) => Object.assign({}, ...LOCAL_ENV_FILES.map((file) => readEnvFile(root, file)));
|
|
2529
|
+
// src/packageBin.ts
|
|
2530
|
+
/**
|
|
2531
|
+
* The script an installed package's bin runs, for starting it with this Node
|
|
2532
|
+
* (`spawn(process.execPath, [script, ...args])`). `node_modules/.bin` holds shims: a shell script,
|
|
2533
|
+
* and on Windows a `.cmd`, which Node starts there only through a shell (CVE-2024-27980), and a
|
|
2534
|
+
* shell would split the temp paths under a user name with a space. Undefined when the package is
|
|
2535
|
+
* not installed or names no such bin.
|
|
2536
|
+
*/
|
|
2537
|
+
const packageBin = (root, pkg, name) => {
|
|
2538
|
+
const dir = path.join(root, "node_modules", ...pkg.split("/"));
|
|
2539
|
+
let bin;
|
|
2540
|
+
try {
|
|
2541
|
+
({bin} = JSON.parse(fs.readFileSync(path.join(dir, "package.json"), "utf8")));
|
|
2542
|
+
} catch {
|
|
2543
|
+
return;
|
|
2544
|
+
}
|
|
2545
|
+
const file = typeof bin === "string" ? bin : bin && typeof bin === "object" ? bin[name] : void 0;
|
|
2546
|
+
return typeof file === "string" ? path.join(dir, file) : void 0;
|
|
2547
|
+
};
|
|
2529
2548
|
// src/checks/v9.ts
|
|
2530
2549
|
/** The be-on! Hub endpoints per stage, as `@v-office/website-headless` resolves `CMS_STAGE` for v9
|
|
2531
2550
|
* (`sdk/endpoints.ts`). Production is what a live v9 site calls. */
|
|
@@ -2581,7 +2600,7 @@ const sdkVersion = (root) => {
|
|
|
2581
2600
|
const run = async (cli, args, cwd) => {
|
|
2582
2601
|
const { execFile } = await import("node:child_process");
|
|
2583
2602
|
return new Promise((resolve) => {
|
|
2584
|
-
execFile(cli, args, {
|
|
2603
|
+
execFile(process.execPath, [cli, ...args], {
|
|
2585
2604
|
cwd,
|
|
2586
2605
|
timeout: HUB_TIMEOUT_MS,
|
|
2587
2606
|
maxBuffer: 1048576
|
|
@@ -2626,8 +2645,8 @@ const v9HubFilters = {
|
|
|
2626
2645
|
customAttributeFilterDefinitions: list
|
|
2627
2646
|
};
|
|
2628
2647
|
}
|
|
2629
|
-
const cli =
|
|
2630
|
-
if (!fs.existsSync(cli)) return [{ message: "
|
|
2648
|
+
const cli = packageBin(ctx.root, "@v-office/website-sdk", "website-sdk");
|
|
2649
|
+
if (!cli || !fs.existsSync(cli)) return [{ message: "@v-office/website-sdk is not installed, so the Hub could not be asked. Install @v-office/website-sdk." }];
|
|
2631
2650
|
const config = cliConfig(env);
|
|
2632
2651
|
if (!config.apiKey || !config.graphqlUrl) return [{ message: "No HUB_API_KEY or Hub URLs in the build's env, so the Hub could not be asked." }];
|
|
2633
2652
|
const dir = fs.mkdtempSync(path.join(os.tmpdir(), "site-checks-hub-"));
|
|
@@ -4357,11 +4376,12 @@ async function cli(argv, io, cwd = process.cwd()) {
|
|
|
4357
4376
|
return 0;
|
|
4358
4377
|
}
|
|
4359
4378
|
/** Runs a child in the project with its output on ours: 0, 1 when it fails, 2 when it cannot
|
|
4360
|
-
* start. No stdin: a pre-push hook's stdin holds git's refs. */
|
|
4361
|
-
const exec = (command, args, root, env, io) => new Promise((resolve) => {
|
|
4379
|
+
* start. No stdin: a pre-push hook's stdin holds git's refs. `name` is what an error calls it. */
|
|
4380
|
+
const exec = (name, [command, args, shell = false], root, env, io) => new Promise((resolve) => {
|
|
4362
4381
|
const child = spawn(command, args, {
|
|
4363
4382
|
cwd: root,
|
|
4364
4383
|
env,
|
|
4384
|
+
shell,
|
|
4365
4385
|
stdio: [
|
|
4366
4386
|
"ignore",
|
|
4367
4387
|
"inherit",
|
|
@@ -4369,7 +4389,7 @@ const exec = (command, args, root, env, io) => new Promise((resolve) => {
|
|
|
4369
4389
|
]
|
|
4370
4390
|
});
|
|
4371
4391
|
child.on("error", (err) => {
|
|
4372
|
-
io.err(`site-checks: cannot run ${
|
|
4392
|
+
io.err(`site-checks: cannot run ${name}: ${err.message}`);
|
|
4373
4393
|
resolve(2);
|
|
4374
4394
|
});
|
|
4375
4395
|
child.on("close", (code) => resolve(code === 0 ? 0 : 1));
|
|
@@ -4404,11 +4424,22 @@ async function verify(root, site, io, cwd) {
|
|
|
4404
4424
|
const steps = [
|
|
4405
4425
|
["src", () => cli(["src", ...stageArgs], io, cwd)],
|
|
4406
4426
|
["astro check", async () => {
|
|
4407
|
-
if (fs.existsSync(path.join(root, "node_modules/@astrojs/check")))
|
|
4408
|
-
|
|
4409
|
-
|
|
4427
|
+
if (!fs.existsSync(path.join(root, "node_modules/@astrojs/check"))) {
|
|
4428
|
+
io.out("[site-checks] astro check skipped: @astrojs/check is not installed.");
|
|
4429
|
+
return "skipped";
|
|
4430
|
+
}
|
|
4431
|
+
const astro = packageBin(root, "astro", "astro");
|
|
4432
|
+
if (!astro) {
|
|
4433
|
+
io.err("site-checks: cannot run astro check: the astro package is not installed.");
|
|
4434
|
+
return 2;
|
|
4435
|
+
}
|
|
4436
|
+
return exec("astro check", [process.execPath, [astro, "check"]], root, env, io);
|
|
4410
4437
|
}],
|
|
4411
|
-
["build", () => exec(pm
|
|
4438
|
+
["build", () => exec(`${pm} run build`, process.platform === "win32" ? [
|
|
4439
|
+
`${pm} run build`,
|
|
4440
|
+
[],
|
|
4441
|
+
true
|
|
4442
|
+
] : [pm, ["run", "build"]], root, env, io)],
|
|
4412
4443
|
["dist", () => cli(["dist", ...stageArgs], io, cwd)]
|
|
4413
4444
|
];
|
|
4414
4445
|
const passed = [];
|
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { g as CONFIG_FILE, d as MAX_FINDINGS_PER_CHECK, f as MAX_MESSAGE_CHARS, p as MAX_PATH_CHARS, o as SITE_CHECKS_FILE, t as USAGE, m as blockingResults, v as checks, y as checksOf, n as cli, i as distChecks, s as findingLine, _ as loadOptions, b as readAstroConfig, c as refusalMessage, a as runDistChecks, h as runSiteChecks, r as runStage, l as summarizeBlocking, u as summaryLines } from "./cli-
|
|
1
|
+
export { g as CONFIG_FILE, d as MAX_FINDINGS_PER_CHECK, f as MAX_MESSAGE_CHARS, p as MAX_PATH_CHARS, o as SITE_CHECKS_FILE, t as USAGE, m as blockingResults, v as checks, y as checksOf, n as cli, i as distChecks, s as findingLine, _ as loadOptions, b as readAstroConfig, c as refusalMessage, a as runDistChecks, h as runSiteChecks, r as runStage, l as summarizeBlocking, u as summaryLines } from "./cli-Xd9RQ91Q.mjs";
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
Release notes of `@v-office/site-checks`, newest first. Each version has its own directory.
|
|
6
6
|
|
|
7
|
+
- `versions/0.5.2/CHANGELOG.md`: release notes for 0.5.2
|
|
7
8
|
- `versions/0.5.1/CHANGELOG.md`: release notes for 0.5.1
|
|
8
9
|
- `versions/0.5.0/CHANGELOG.md`: release notes for 0.5.0
|
|
9
10
|
- `versions/0.4.2/CHANGELOG.md`: release notes for 0.4.2
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
Migration guides of `@v-office/site-checks`, newest first. Apply them in order when skipping versions.
|
|
6
6
|
|
|
7
|
+
- `versions/0.5.2/MIGRATION.md`: Migration: 0.5.1 to 0.5.2
|
|
7
8
|
- `versions/0.5.1/MIGRATION.md`: Migration: 0.5.0 to 0.5.1
|
|
8
9
|
- `versions/0.5.0/MIGRATION.md`: Migration: 0.4.2 to 0.5.0
|
|
9
10
|
- `versions/0.4.2/MIGRATION.md`: Migration: 0.4.1 to 0.4.2
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# Changelog: 0.5.2
|
|
2
|
+
|
|
3
|
+
`site-checks verify` runs on Windows, so a pre-push hook that runs it no longer rejects every push
|
|
4
|
+
from there.
|
|
5
|
+
|
|
6
|
+
## Fixed
|
|
7
|
+
|
|
8
|
+
- `verify` starts `astro check` with Node from the astro package's own script instead of
|
|
9
|
+
`node_modules/.bin/astro`, which Windows cannot start (`spawn … ENOENT`).
|
|
10
|
+
- `verify` runs the build (`pnpm run build` or `npm run build`) through the shell on Windows, where
|
|
11
|
+
pnpm and npm are usually `.cmd` files.
|
|
12
|
+
- `v9-hub-filters` starts `website-sdk` with Node from the package's own script instead of
|
|
13
|
+
`website-sdk.cmd`, which Node refuses without a shell (`spawn EINVAL`). The check now runs on
|
|
14
|
+
Windows instead of reporting that it failed. Its message for a missing SDK now reads
|
|
15
|
+
"@v-office/website-sdk is not installed".
|
|
16
|
+
|
|
17
|
+
The rules, their levels, the configuration keys, the exit codes and the report's shape stay the
|
|
18
|
+
same.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@v-office/site-checks",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.2",
|
|
4
4
|
"description": "The checks over a v-office website in two stages, `site-checks src` before the build and `site-checks dist` after it, which AI Studio's build worker runs on every build from its own pinned copy; the report has the shape of the build worker's dist-check report, and a site excludes the findings it accepts in site-checks.config.json",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"repository": {
|