@marktiderman/genesis-cli 1.11.0 → 1.11.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/README.md +1 -1
- package/dist/cli.js +23 -3
- package/dist/cli.js.map +1 -1
- package/dist/doctor.js +22 -2
- package/dist/doctor.js.map +1 -1
- package/dist/genesis-catalog.json +5 -5
- package/dist/index.js +22 -2
- package/dist/index.js.map +1 -1
- package/dist/vite.js +22 -2
- package/dist/vite.js.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -358,7 +358,7 @@ Exit codes: `0` pass, `1` findings, `2` the doctor couldn't run (bad config, Gen
|
|
|
358
358
|
| `raw-color` | error | Hex and `rgb()/hsl()` literals in code and CSS, via the same lexer as the repo's `check:token-usage` (comments, issue refs and `hsl(var(--x))` are fine). A brand file that defines token values needs an `allow` entry. |
|
|
359
359
|
| `undefined-token` | error | `var(--x)` where the theme doesn't define `--x`. Tokens declared in the app's CSS (or only `tokenFiles`) and inline style custom properties count as defined; `--tw-*` and `--radix-*` are ignored. |
|
|
360
360
|
| `shadowed-export` | error | An exported value named like a Genesis export (`export function Button`). Reuse or extend it. |
|
|
361
|
-
| `duplicate-genesis-package` | warn | More than one copy of a `@marktiderman/genesis-*` package that the app can load, with each copy's path, version and the ranges that asked for it. Found by resolving
|
|
361
|
+
| `duplicate-genesis-package` | warn | More than one copy of a `@marktiderman/genesis-*` package that the app can load, with each copy's path, version and the ranges that asked for it. Found by resolving the app's dependency graph the way Node does, from each package's real folder (starting from the app's own `package.json`), so npm/yarn/bun hoisted and nested trees, pnpm's `.pnpm` store (in the app, or at the workspace root above a sub-app) and bun's isolated `.bun` store all count; a store entry nothing resolves to is ignored. Two copies are two module instances: a `DataProvider` from one is invisible to hooks from the other. A copy reached only through dev tooling (the app's `devDependencies`, or anything under `@marktiderman/genesis-cli`, wherever it's listed) is `[dev only]`: every path to it from the app runs through declared tooling (test runners, `@types/*`, linters and formatters, compilers and bundlers, Storybook, release tools, or the CLI). Other devDependencies count as runtime: a bundler ships what the app imports from them. When exactly one copy is reached from a declared runtime dependency and every other copy is dev-only, the finding is `info` (it can't split the app's contexts). Anything else warns, a copy reached through an undeclared hoisted package included. An app with no runtime dependencies at all (a bundled SPA listing everything in `devDependencies`) has its devDependencies taken as runtime. A copy that only walking up the folders finds is left out: in an app with its own install inside another app's folder (a lockfile of its own, like `apps/mobile`), a peer dependency the app doesn't declare or install is unmet rather than met by the parent's copy, and the parent's CLI isn't followed unless the app declares it. A regular dependency that resolves up to the parent still counts. |
|
|
362
362
|
| `peer-range-mismatch` | warn | An installed Genesis package's `peerDependencies` range on another Genesis package that the copy it resolves (looked up from its own folder, as Node does) doesn't satisfy: the package, the range and the installed version. Missing peers and non-semver ranges (`workspace:*`) are skipped. Ranges are read with npm's grammar (`^ ~ x - ||`, prereleases only when the range names one). A mismatch inside a dev-only copy (the CLI's own tree) is `info`. |
|
|
363
363
|
| `hand-rolled-sub-nav` | warn | A route under the layout that renders `AppShell` that switches its sections with its own page-level `<TabsList>` or `<SubNavTabs>`, when the installed Genesis has `useAppShellSubNav`. Tabs inside a card, dialog, sheet, popover, accordion, panel, table or another tab's content are fine, as are pages that call the hook. Use `useAppShellSubNav(items, { mode: "tabs" })`, `AppShellPageHeader` and `AppShellSubNavEnd` from `@marktiderman/genesis-ui/layout` ([sub-navigation](../ui/SKILL.md)). |
|
|
364
364
|
| `local-genesis-copy` | warn | An app component definition named like a component of `uiPackage` or of `componentPackages` (forms-studio's `ResourceHeader`, `SettingsSection`, `ResourceSettingsPage`, `HeadlineNumbers`, `SummaryCard`, `ShareDialog`, …): "Genesis already has X". A definition renders JSX, isn't in a file that imports the Genesis one, and is exported or lives outside the routes folder; a route's own non-exported functions and anything passed as `component` / `errorComponent` / `pendingComponent` / `notFoundComponent` (TanStack's `FormError`) are not copies. An exported genesis-ui value is `shadowed-export` instead; `const X = lazy(() => import("@marktiderman/genesis-…"))` is fine. |
|
package/dist/cli.js
CHANGED
|
@@ -3582,6 +3582,10 @@ var init_semver = __esm({
|
|
|
3582
3582
|
ver = (major, minor, patch, pre = []) => ({ major, minor, patch, pre });
|
|
3583
3583
|
}
|
|
3584
3584
|
});
|
|
3585
|
+
function nodeModulesOf(dir) {
|
|
3586
|
+
const parent = path32.dirname(dir);
|
|
3587
|
+
return path32.basename(parent).startsWith("@") ? path32.dirname(parent) : parent;
|
|
3588
|
+
}
|
|
3585
3589
|
function packagesIn(nodeModules) {
|
|
3586
3590
|
if (!existsSync(nodeModules)) return [];
|
|
3587
3591
|
const out = [];
|
|
@@ -3630,18 +3634,33 @@ function genesisInstalls(root) {
|
|
|
3630
3634
|
for (const r of roots) visit(r.dir, r.by, r.range);
|
|
3631
3635
|
while (queue.length) {
|
|
3632
3636
|
const { real: from, manifest, label } = queue.shift();
|
|
3633
|
-
const deps = { ...manifest.
|
|
3637
|
+
const deps = { ...manifest.optionalDependencies, ...manifest.dependencies };
|
|
3634
3638
|
for (const [name, range] of Object.entries(deps)) {
|
|
3635
3639
|
const dir = findPackageDir(from, name);
|
|
3636
3640
|
if (dir) visit(dir, label, range);
|
|
3637
3641
|
}
|
|
3642
|
+
for (const [name, range] of Object.entries(manifest.peerDependencies ?? {})) {
|
|
3643
|
+
if (name in deps) continue;
|
|
3644
|
+
const dir = peerOf(from, name);
|
|
3645
|
+
if (dir) visit(dir, label, range);
|
|
3646
|
+
}
|
|
3638
3647
|
}
|
|
3639
3648
|
};
|
|
3649
|
+
const peerOf = (from, name) => {
|
|
3650
|
+
const dir = findPackageDir(from, name);
|
|
3651
|
+
if (!dir) return null;
|
|
3652
|
+
if (!ownInstall || name in declared) return dir;
|
|
3653
|
+
const realDir = real(dir);
|
|
3654
|
+
if (realDir.startsWith(realRoot + path32.sep)) return dir;
|
|
3655
|
+
return nodeModulesOf(realDir) === nodeModulesOf(from) ? dir : null;
|
|
3656
|
+
};
|
|
3640
3657
|
const rootsOf = (deps, by) => Object.entries(deps).flatMap(([name, range]) => {
|
|
3641
3658
|
const dir = findPackageDir(root, name);
|
|
3642
3659
|
return dir ? [{ dir, by, ...range ? { range } : {} }] : [];
|
|
3643
3660
|
});
|
|
3644
3661
|
const app = readManifest(root);
|
|
3662
|
+
const ownInstall = LOCKFILES.some((f) => existsSync(path32.join(root, f)));
|
|
3663
|
+
const declared = { ...app?.devDependencies, ...app?.peerDependencies, ...app?.optionalDependencies, ...app?.dependencies };
|
|
3645
3664
|
const declaredDev = Object.entries(app?.devDependencies ?? {});
|
|
3646
3665
|
const runtimeDeps = {
|
|
3647
3666
|
...Object.fromEntries(declaredDev.filter(([n]) => !NON_SHIPPING.test(n))),
|
|
@@ -3660,7 +3679,7 @@ function genesisInstalls(root) {
|
|
|
3660
3679
|
}).map((dir) => ({ dir, by: "hoisted, not a direct dependency" }))
|
|
3661
3680
|
);
|
|
3662
3681
|
const devRoots = { ...devDeps };
|
|
3663
|
-
for (const tool of DEV_TOOLS) if (!(tool in devRoots)) devRoots[tool] = runtimeDeps[tool];
|
|
3682
|
+
for (const tool of DEV_TOOLS) if (!(tool in devRoots) && tool in runtimeDeps) devRoots[tool] = runtimeDeps[tool];
|
|
3664
3683
|
walk2("dev", rootsOf(devRoots, "the app (dev)"));
|
|
3665
3684
|
for (const [key2, copy] of copies) {
|
|
3666
3685
|
const kinds = via.get(key2);
|
|
@@ -3720,7 +3739,7 @@ function checkPeerRanges(ctx) {
|
|
|
3720
3739
|
}
|
|
3721
3740
|
}
|
|
3722
3741
|
}
|
|
3723
|
-
var GENESIS, DEV_TOOLS, NON_SHIPPING, readManifest, real;
|
|
3742
|
+
var GENESIS, DEV_TOOLS, NON_SHIPPING, readManifest, real, LOCKFILES;
|
|
3724
3743
|
var init_installs = __esm({
|
|
3725
3744
|
"src/doctor/installs.ts"() {
|
|
3726
3745
|
init_genesis();
|
|
@@ -3742,6 +3761,7 @@ var init_installs = __esm({
|
|
|
3742
3761
|
return p;
|
|
3743
3762
|
}
|
|
3744
3763
|
};
|
|
3764
|
+
LOCKFILES = ["bun.lock", "bun.lockb", "package-lock.json", "npm-shrinkwrap.json", "yarn.lock", "pnpm-lock.yaml"];
|
|
3745
3765
|
}
|
|
3746
3766
|
});
|
|
3747
3767
|
function stripForImports(code) {
|