@marktiderman/genesis-cli 1.12.0 → 1.12.1
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/cli.js +18 -7
- package/dist/cli.js.map +1 -1
- package/dist/doctor.js +18 -7
- package/dist/doctor.js.map +1 -1
- package/dist/genesis-catalog.json +10 -10
- package/dist/index.js +18 -7
- package/dist/index.js.map +1 -1
- package/dist/vite.js +18 -7
- package/dist/vite.js.map +1 -1
- package/package.json +3 -3
package/dist/doctor.js
CHANGED
|
@@ -843,7 +843,9 @@ ${globs.join("\n")}`;
|
|
|
843
843
|
for (const dir of [...dirs].sort()) {
|
|
844
844
|
const manifest = path14.join(dir, "package.json");
|
|
845
845
|
if (!existsSync(manifest)) continue;
|
|
846
|
-
if (!inside(real2, realpathSync(dir)))
|
|
846
|
+
if (!inside(real2, realpathSync(dir))) {
|
|
847
|
+
throw new LocalPackagesError(`${path14.relative(appRoot, dir) || dir} is outside the repository; localPackages may only list folders inside it`);
|
|
848
|
+
}
|
|
847
849
|
let pkg;
|
|
848
850
|
try {
|
|
849
851
|
pkg = JSON.parse(readFileSync(manifest, "utf8"));
|
|
@@ -2361,7 +2363,7 @@ var SOURCE = /\.(?:[cm]?[jt]sx?)$/;
|
|
|
2361
2363
|
var SKIP_DIRS2 = /* @__PURE__ */ new Set(["node_modules", "dist", "build", "coverage", ".turbo"]);
|
|
2362
2364
|
var BUILTINS = new Set(builtinModules.flatMap((m) => [m, `node:${m}`]));
|
|
2363
2365
|
var IMPORT = /(?:\bfrom\s*|\bimport\s*\(\s*|\bimport\s+|\brequire\s*\(\s*)["']([^"']+)["']/g;
|
|
2364
|
-
var TYPE_ONLY = /\b(?:import|export)\s+type\
|
|
2366
|
+
var TYPE_ONLY = /\b(?:import|export)\s+type\s+(?:\{[^}]*\}|\*\s+as\s+[\w$]+|\*|[\w$]+)\s*from\s*["'][^"']+["']/g;
|
|
2365
2367
|
function sourceFiles(dir, rel = "") {
|
|
2366
2368
|
const out = [];
|
|
2367
2369
|
for (const entry of readdirSync(path14.join(dir, rel)).sort()) {
|
|
@@ -2500,7 +2502,7 @@ function checkExports(ctx, pkg, json) {
|
|
|
2500
2502
|
};
|
|
2501
2503
|
walk(json.exports);
|
|
2502
2504
|
for (const t of targets) {
|
|
2503
|
-
if (!t.startsWith("./") || t.includes("*") ||
|
|
2505
|
+
if (!t.startsWith("./") || t.includes("*") || !/\.(?:[cm]?tsx?|json)$/.test(t) || /\.d\.[cm]?ts$/.test(t)) continue;
|
|
2504
2506
|
if (!existsSync(path14.join(pkg.dir, t))) {
|
|
2505
2507
|
ctx.report({ rule: "package-export-missing", file: `${pkg.rel}/package.json`, subject: t, message: `${pkg.name} exports ${t}, which doesn't exist` });
|
|
2506
2508
|
}
|
|
@@ -2531,10 +2533,13 @@ function checkRegistered(ctx, pkg) {
|
|
|
2531
2533
|
} catch {
|
|
2532
2534
|
return;
|
|
2533
2535
|
}
|
|
2536
|
+
const top = git(ctx.root, ["rev-parse", "--show-toplevel"])?.trim();
|
|
2537
|
+
const forms = /* @__PURE__ */ new Set([pkg.rel]);
|
|
2538
|
+
if (top) forms.add(path14.relative(top, realpathSync(pkg.dir)).split(path14.sep).join("/"));
|
|
2534
2539
|
const covered = (doc.features ?? []).some(
|
|
2535
2540
|
(f) => (f.links?.code ?? []).some((c) => {
|
|
2536
2541
|
const norm = c.replace(/^\.\//, "").replace(/\/+$/, "");
|
|
2537
|
-
return norm ===
|
|
2542
|
+
return [...forms].some((rel) => norm === rel || norm.startsWith(`${rel}/`) || rel.startsWith(`${norm}/`));
|
|
2538
2543
|
})
|
|
2539
2544
|
);
|
|
2540
2545
|
if (!covered) {
|
|
@@ -2558,8 +2563,12 @@ function mergeBaseOf(root, base) {
|
|
|
2558
2563
|
return sha ? { sha } : { reason: `HEAD has no merge base with ${base} (fetch with depth 0)` };
|
|
2559
2564
|
}
|
|
2560
2565
|
function checkChanges(ctx, pkg, json, base, mergeBase) {
|
|
2561
|
-
const
|
|
2562
|
-
|
|
2566
|
+
const top = git(ctx.root, ["rev-parse", "--show-toplevel"])?.trim();
|
|
2567
|
+
if (!top) return;
|
|
2568
|
+
const appRelative = (fromTop) => path14.relative(realpathSync(ctx.root), path14.join(top, fromTop)).split(path14.sep).join("/");
|
|
2569
|
+
const inRepo = path14.relative(top, realpathSync(pkg.dir)).split(path14.sep).join("/");
|
|
2570
|
+
const diff = (git(top, ["diff", "--name-status", "-M", mergeBase, "--", inRepo]) ?? "").split("\n").filter(Boolean).map((row) => row.split(" ").map((cell, i) => i === 0 ? cell : appRelative(cell)).join(" ")).join("\n");
|
|
2571
|
+
const untracked = (git(top, ["ls-files", "--others", "--exclude-standard", "--", inRepo]) ?? "").split("\n").filter(Boolean).map(appRelative);
|
|
2563
2572
|
const changed = [...diff.split("\n").filter(Boolean).map((row) => row.split(" ").at(-1)), ...untracked].filter(
|
|
2564
2573
|
(f) => !/(^|\/)(CHANGELOG\.md|node_modules\/)/.test(f)
|
|
2565
2574
|
);
|
|
@@ -2580,7 +2589,6 @@ function checkChanges(ctx, pkg, json, base, mergeBase) {
|
|
|
2580
2589
|
const now = typeof json.version === "string" ? parseVersion(json.version) : null;
|
|
2581
2590
|
const was = typeof versionBefore === "string" ? parseVersion(versionBefore) : null;
|
|
2582
2591
|
const bumped = before === null || now !== null && was !== null && compareVersions(now, was) > 0;
|
|
2583
|
-
const top = git(ctx.root, ["rev-parse", "--show-toplevel"])?.trim();
|
|
2584
2592
|
const changesets = top ? (git(top, ["diff", "--name-only", "--diff-filter=A", mergeBase, "--", ".changeset"]) ?? "").split("\n").concat((git(top, ["ls-files", "--others", "--exclude-standard", "--", ".changeset"]) ?? "").split("\n")).filter((f) => f.endsWith(".md")).map((f) => path14.join(top, f)) : [];
|
|
2585
2593
|
const naming = changesets.filter((p) => existsSync(p) && changesetNames(readFileSync(p, "utf8")).has(json.name));
|
|
2586
2594
|
const named = naming.length > 0;
|
|
@@ -2598,6 +2606,9 @@ function checkChanges(ctx, pkg, json, base, mergeBase) {
|
|
|
2598
2606
|
const registry = (git(ctx.root, ["diff", "--relative", "--name-only", mergeBase, "--", "features.ts", "src/features.ts"]) ?? "").trim();
|
|
2599
2607
|
if (!registry) ctx.report({ rule: "package-unversioned-change", level: "warn", file: `${pkg.rel}/package.json`, message: `${pkg.name}'s blocks or exports changed but features.ts didn't; update the features they belong to` });
|
|
2600
2608
|
}
|
|
2609
|
+
if (bumped && !named && before !== null) {
|
|
2610
|
+
ctx.report({ rule: "package-unversioned-change", level: "warn", file: `${pkg.rel}/package.json`, message: `${pkg.name}'s version went up without a changeset; add one with a "Features:" line so the change is recorded` });
|
|
2611
|
+
}
|
|
2601
2612
|
if (!bumped && !named) {
|
|
2602
2613
|
ctx.report({
|
|
2603
2614
|
rule: "package-unversioned-change",
|