@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/vite.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"));
|
|
@@ -2358,7 +2360,7 @@ var SOURCE = /\.(?:[cm]?[jt]sx?)$/;
|
|
|
2358
2360
|
var SKIP_DIRS2 = /* @__PURE__ */ new Set(["node_modules", "dist", "build", "coverage", ".turbo"]);
|
|
2359
2361
|
var BUILTINS = new Set(builtinModules.flatMap((m) => [m, `node:${m}`]));
|
|
2360
2362
|
var IMPORT = /(?:\bfrom\s*|\bimport\s*\(\s*|\bimport\s+|\brequire\s*\(\s*)["']([^"']+)["']/g;
|
|
2361
|
-
var TYPE_ONLY = /\b(?:import|export)\s+type\
|
|
2363
|
+
var TYPE_ONLY = /\b(?:import|export)\s+type\s+(?:\{[^}]*\}|\*\s+as\s+[\w$]+|\*|[\w$]+)\s*from\s*["'][^"']+["']/g;
|
|
2362
2364
|
function sourceFiles(dir, rel = "") {
|
|
2363
2365
|
const out = [];
|
|
2364
2366
|
for (const entry of readdirSync(path14.join(dir, rel)).sort()) {
|
|
@@ -2497,7 +2499,7 @@ function checkExports(ctx, pkg, json) {
|
|
|
2497
2499
|
};
|
|
2498
2500
|
walk(json.exports);
|
|
2499
2501
|
for (const t of targets) {
|
|
2500
|
-
if (!t.startsWith("./") || t.includes("*") ||
|
|
2502
|
+
if (!t.startsWith("./") || t.includes("*") || !/\.(?:[cm]?tsx?|json)$/.test(t) || /\.d\.[cm]?ts$/.test(t)) continue;
|
|
2501
2503
|
if (!existsSync(path14.join(pkg.dir, t))) {
|
|
2502
2504
|
ctx.report({ rule: "package-export-missing", file: `${pkg.rel}/package.json`, subject: t, message: `${pkg.name} exports ${t}, which doesn't exist` });
|
|
2503
2505
|
}
|
|
@@ -2528,10 +2530,13 @@ function checkRegistered(ctx, pkg) {
|
|
|
2528
2530
|
} catch {
|
|
2529
2531
|
return;
|
|
2530
2532
|
}
|
|
2533
|
+
const top = git(ctx.root, ["rev-parse", "--show-toplevel"])?.trim();
|
|
2534
|
+
const forms = /* @__PURE__ */ new Set([pkg.rel]);
|
|
2535
|
+
if (top) forms.add(path14.relative(top, realpathSync(pkg.dir)).split(path14.sep).join("/"));
|
|
2531
2536
|
const covered = (doc.features ?? []).some(
|
|
2532
2537
|
(f) => (f.links?.code ?? []).some((c) => {
|
|
2533
2538
|
const norm = c.replace(/^\.\//, "").replace(/\/+$/, "");
|
|
2534
|
-
return norm ===
|
|
2539
|
+
return [...forms].some((rel) => norm === rel || norm.startsWith(`${rel}/`) || rel.startsWith(`${norm}/`));
|
|
2535
2540
|
})
|
|
2536
2541
|
);
|
|
2537
2542
|
if (!covered) {
|
|
@@ -2555,8 +2560,12 @@ function mergeBaseOf(root, base) {
|
|
|
2555
2560
|
return sha ? { sha } : { reason: `HEAD has no merge base with ${base} (fetch with depth 0)` };
|
|
2556
2561
|
}
|
|
2557
2562
|
function checkChanges(ctx, pkg, json, base, mergeBase) {
|
|
2558
|
-
const
|
|
2559
|
-
|
|
2563
|
+
const top = git(ctx.root, ["rev-parse", "--show-toplevel"])?.trim();
|
|
2564
|
+
if (!top) return;
|
|
2565
|
+
const appRelative = (fromTop) => path14.relative(realpathSync(ctx.root), path14.join(top, fromTop)).split(path14.sep).join("/");
|
|
2566
|
+
const inRepo = path14.relative(top, realpathSync(pkg.dir)).split(path14.sep).join("/");
|
|
2567
|
+
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");
|
|
2568
|
+
const untracked = (git(top, ["ls-files", "--others", "--exclude-standard", "--", inRepo]) ?? "").split("\n").filter(Boolean).map(appRelative);
|
|
2560
2569
|
const changed = [...diff.split("\n").filter(Boolean).map((row) => row.split(" ").at(-1)), ...untracked].filter(
|
|
2561
2570
|
(f) => !/(^|\/)(CHANGELOG\.md|node_modules\/)/.test(f)
|
|
2562
2571
|
);
|
|
@@ -2577,7 +2586,6 @@ function checkChanges(ctx, pkg, json, base, mergeBase) {
|
|
|
2577
2586
|
const now = typeof json.version === "string" ? parseVersion(json.version) : null;
|
|
2578
2587
|
const was = typeof versionBefore === "string" ? parseVersion(versionBefore) : null;
|
|
2579
2588
|
const bumped = before === null || now !== null && was !== null && compareVersions(now, was) > 0;
|
|
2580
|
-
const top = git(ctx.root, ["rev-parse", "--show-toplevel"])?.trim();
|
|
2581
2589
|
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)) : [];
|
|
2582
2590
|
const naming = changesets.filter((p) => existsSync(p) && changesetNames(readFileSync(p, "utf8")).has(json.name));
|
|
2583
2591
|
const named = naming.length > 0;
|
|
@@ -2595,6 +2603,9 @@ function checkChanges(ctx, pkg, json, base, mergeBase) {
|
|
|
2595
2603
|
const registry = (git(ctx.root, ["diff", "--relative", "--name-only", mergeBase, "--", "features.ts", "src/features.ts"]) ?? "").trim();
|
|
2596
2604
|
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` });
|
|
2597
2605
|
}
|
|
2606
|
+
if (bumped && !named && before !== null) {
|
|
2607
|
+
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` });
|
|
2608
|
+
}
|
|
2598
2609
|
if (!bumped && !named) {
|
|
2599
2610
|
ctx.report({
|
|
2600
2611
|
rule: "package-unversioned-change",
|