@marktiderman/genesis-cli 1.17.1 → 1.17.3
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 +14 -2
- package/dist/cli.js +239 -52
- package/dist/cli.js.map +1 -1
- package/dist/doctor.d.ts +1 -1
- package/dist/doctor.js +101 -31
- package/dist/doctor.js.map +1 -1
- package/dist/genesis-catalog.json +9 -9
- package/dist/index.js +101 -31
- package/dist/index.js.map +1 -1
- package/dist/starter/.eas/workflows/e2e.yml +17 -3
- package/dist/starter/.eas/workflows/pr-preview.yml +45 -2
- package/dist/starter/.maestro/README.md +2 -1
- package/dist/starter/README.md +4 -3
- package/dist/templates/eas/workflows/e2e.yml +17 -3
- package/dist/templates/eas/workflows/pr-preview.yml +45 -2
- package/dist/vite.js +101 -31
- package/dist/vite.js.map +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -352,7 +352,18 @@ doesn't fit, is a warning.
|
|
|
352
352
|
| Codemod | Runs when | Changes |
|
|
353
353
|
| --- | --- | --- |
|
|
354
354
|
| `genesis-core-2-scope-names` | genesis-core crosses 2.0.0 | Genesis API usage only, never an app's own names that match (a view field means one inside `defineView(…)` or an object typed `ViewDefinition`/`ViewField`; the prop means an attribute of `<NativeResourceView>` or a key of an object typed `NativeResourceViewProps`; each with the name imported from Genesis): a view field's `timeZone: "practice"` → `"scope"`, NativeResourceView's `practiceTimeZone` (attribute or object key) → `scopeTimeZone`, `resolveZone("practice", …)` → `"scope"`, and DisplayTimeZones' `practice` (a `{ viewer, practice }` object's key, `.practice` on a value from `useDisplayTimeZones()` or typed `DisplayTimeZones`) → `scope`. `scope={{ practiceId }}` needs nothing (it is the app's own key in ResourceScope's open slot); when a file reads `scope.practiceId` and nothing declares it, the codemod prints the one-line `ResourceScope` augmentation that types it. The doctor's `removed-scope-name` rule finds what it would rewrite. |
|
|
355
|
-
3. Reinstalls,
|
|
355
|
+
3. Reinstalls. With pnpm, a release younger than the app's `minimumReleaseAge` is installed in
|
|
356
|
+
loose mode and pnpm pins it in `minimumReleaseAgeExclude`, in the pnpm-workspace.yaml pnpm reads (the nearest one at or above the app, else beside the lockfile)
|
|
357
|
+
(`'@marktiderman/genesis-ui@2.26.0'`). pnpm 11.1.3's frozen install honours only the first pinned
|
|
358
|
+
version of a package, so a second pin (this upgrade's next to an earlier one's, or two versions
|
|
359
|
+
of one package) fails `pnpm install --frozen-lockfile` in CI with
|
|
360
|
+
`ERR_PNPM_MINIMUM_RELEASE_AGE_VIOLATION`. The upgrade replaces every Genesis entry with one
|
|
361
|
+
pattern, `'@marktiderman/genesis-*'` (and the umbrella by its bare name), which both a resolving
|
|
362
|
+
and a frozen install honour on pnpm 11; every other entry, comment and line is left as it is,
|
|
363
|
+
since the list is the app's supply-chain guard. Then it runs `pnpm dedupe` (`npm dedupe` with
|
|
364
|
+
npm; bun and yarn are skipped), so a Genesis package isn't left installed at two versions
|
|
365
|
+
(`duplicate-genesis-package`), and commits pnpm-workspace.yaml with `--pr`.
|
|
366
|
+
Then it refreshes every file in `genesis.lock.json` from the newly installed package:
|
|
356
367
|
unchanged in the app, it takes the new version; changed by both, it is merged with `git
|
|
357
368
|
merge-file` against the old version (the base); a conflict goes to `<file>.genesis-next` and
|
|
358
369
|
your file is kept. `--keep-mine` never merges: the new text goes to `.genesis-next`. A file you
|
|
@@ -631,6 +642,7 @@ keep `raw-color`).
|
|
|
631
642
|
| `native-custom-header` | warn | A file that sets `headerShown: false` and draws its own header (a `<…Header>` of the app's own, or `style={styles.header}`); a screen that draws one when the `_layout` beside it hides the navigator's; a hand-built tab bar (`tabBar={…}` in a file with `<Tabs>`, or a `<…TabBar>` of the app's own). Section headers (`SectionHeader`, `ListHeader`, `CardHeader`, …) and Genesis components don't count. Only the `_layout` in the screen's own folder is followed, not ancestors. |
|
|
632
643
|
| `native-screen-layout` | warn | A route screen under the router root (`native.routerRoot`, default `src/app`, else `app`) that renders no Genesis screen layout, directly or through one local import (`./`, `../`, `@/`, `~/`). `_layout`, `+html`, `+native-intent`, `+middleware`, `+api` files, re-export-only routes and `<Redirect>` routes are skipped. Also a warning when the router root is missing, or when `src` leaves it unscanned. |
|
|
633
644
|
| `store-readiness` | warn | Static checks of `app.json`, `app.config.json` and (as text, best-effort) `app.config.{ts,js,mjs,cjs}`. **Usage strings**: Expo applies an installed module's config plugin even when it isn't listed, with a generic default string (`Allow $(PRODUCT_NAME) to access your camera`), and App Review rejects generic purpose strings; so a module without its own sentence (`ios.infoPlist.<Key>` or the plugin option) is flagged, and `false` (Expo's opt-out) counts as set. Covered: `expo-camera`, `expo-image-picker` (photos; camera only "if the app takes photos"), `expo-media-library`, `expo-location`, `expo-av` / `expo-audio` (microphone "if the app records audio"), `expo-contacts`, `expo-local-authentication` (Face ID). **Sign in with Apple**: third-party sign-in (`@react-native-google-signin/google-signin`, `react-native-fbsdk-next`, or a Supabase `signInWithOAuth` / `signInWithIdToken` with a non-Apple provider) without Apple sign-in (`expo-apple-authentication`, or Supabase's `apple` provider). Guideline 4.8 accepts any equivalent privacy-focused login, so this is a warning to `allow` with the reason when another option qualifies; `expo-auth-session` alone doesn't trigger it (it serves non-login OAuth too). Also the export-compliance flag (`ios.config.usesNonExemptEncryption` or `ITSAppUsesNonExemptEncryption`), `ios.privacyManifests`, and a missing Expo config. Those two count as set when the [Expo config plugin](#expo-config-plugin) (`@marktiderman/genesis-cli` in `plugins`) will set them: export compliance unless `exportCompliance: false`, the privacy manifest unless `privacyManifest: false` and only when a dependency needs one. |
|
|
645
|
+
| `eas-placeholder` | warn | A `REPLACE_WITH_…` placeholder from the EAS templates still in `eas.json` or `.eas/workflows/*.yml` (YAML comment lines aren't read): the store ids in `eas.json` `submit.production`, or `REPLACE_WITH_APP_FOLDER` in `pr-preview.yml`'s `paths`, which otherwise matches nothing, so code changes never start a preview. `genesis init --template native` fills the app folder in (`src`). |
|
|
634
646
|
|
|
635
647
|
**`supabase`**, for `supabase/migrations/*.sql` (`supabase.migrations`). The SQL is read
|
|
636
648
|
statement by statement with comments removed and string (`'…'`, `E'…'`) and dollar-quoted
|
|
@@ -638,7 +650,7 @@ bodies blanked, so text inside a function body never matches; the one exception
|
|
|
638
650
|
|
|
639
651
|
| Rule | Level | What it flags |
|
|
640
652
|
| --- | --- | --- |
|
|
641
|
-
| `migration-grants` | error / warn | In new migrations: `grant … on all functions in schema …` and `alter default privileges … grant … on functions` to `anon` or `public` (error) or `authenticated` (warn: it re-grants functions revoked from signed-in users); other roles (`service_role`, `postgres`) are fine. A function outside `exposedSchemas` granted to `anon` or `public` by name, and `grant usage on schema <unexposed> to anon/public` (error). Revokes, `revoke grant option for`, argument types and `granted by` are read correctly. Grant by name so an earlier revoke survives. |
|
|
653
|
+
| `migration-grants` | error / warn | In new migrations: `grant … on all functions in schema …` and `alter default privileges … grant … on functions` to `anon` or `public` (error) or `authenticated` (warn: it re-grants functions revoked from signed-in users); other roles (`service_role`, `postgres`) are fine. A function outside `exposedSchemas` granted to `anon` or `public` by name, and `grant usage on schema <unexposed> to anon/public` (error). A grant built as a string for `execute` in a body (`execute format('grant … to anon', f)` in a loop) to `anon`, `public` or a computed role (warn: what it grants can't be read). Revokes, `revoke grant option for`, argument types and `granted by` are read correctly. Grant by name so an earlier revoke survives. |
|
|
642
654
|
| `migration-rls` | error | A table in an exposed schema whose row level security is off once every migration has run: never enabled, or disabled later. Renames (`alter table … rename to`, `set schema`) and drops are followed. RLS enabled by dynamic SQL (a `do $$ … execute format('alter table %I enable row level security', t) … $$` loop) can't be traced, so such a block counts as enabling it for every table created before it. |
|
|
643
655
|
| `migration-definer-search-path` | error | A `security definer` function or procedure without `set search_path`. Functions are keyed by name and argument types, so overloads are separate; `alter function … security definer` makes one definer, `alter function … set search_path` fixes it, and renames, replaces and drops are followed. |
|
|
644
656
|
| `migration-edited` | error | A `.sql` migration that already exists at the merge base with `supabase.base` (default `origin/main`) was modified, deleted or renamed. Applied migrations are never edited; add a new one. Skipped outside a git repo; a **warn** when the base ref isn't available. |
|
package/dist/cli.js
CHANGED
|
@@ -238,32 +238,32 @@ function inside(parent, child) {
|
|
|
238
238
|
const rel = path28.relative(parent, child);
|
|
239
239
|
return rel === "" || !rel.startsWith("..") && !path28.isAbsolute(rel);
|
|
240
240
|
}
|
|
241
|
-
function readPackageFile(
|
|
241
|
+
function readPackageFile(packageDir2, rel) {
|
|
242
242
|
const safe = safeRelative(rel);
|
|
243
243
|
if (!safe) throw new Error(`"${rel}" is not a plain path inside the package`);
|
|
244
|
-
const root = realpathSync(
|
|
244
|
+
const root = realpathSync(packageDir2);
|
|
245
245
|
const file = path28.join(root, ...safe.split("/"));
|
|
246
246
|
if (!existsSync(file)) return null;
|
|
247
247
|
const real2 = realpathSync(file);
|
|
248
|
-
if (!inside(root, real2)) throw new Error(`${rel} in ${
|
|
248
|
+
if (!inside(root, real2)) throw new Error(`${rel} in ${packageDir2} points outside the package`);
|
|
249
249
|
if (!statSync(real2).isFile()) return null;
|
|
250
250
|
return readFileSync(real2, "utf8");
|
|
251
251
|
}
|
|
252
|
-
function readPackageDir(
|
|
252
|
+
function readPackageDir(packageDir2, rel, skipped = []) {
|
|
253
253
|
const safe = safeRelative(rel);
|
|
254
254
|
if (!safe) throw new Error(`"${rel}" is not a plain path inside the package`);
|
|
255
|
-
const root = realpathSync(
|
|
255
|
+
const root = realpathSync(packageDir2);
|
|
256
256
|
const dir = path28.join(root, ...safe.split("/"));
|
|
257
257
|
if (!existsSync(dir)) return null;
|
|
258
258
|
const real2 = realpathSync(dir);
|
|
259
|
-
if (!inside(root, real2) || !statSync(real2).isDirectory()) throw new Error(`${rel} in ${
|
|
259
|
+
if (!inside(root, real2) || !statSync(real2).isDirectory()) throw new Error(`${rel} in ${packageDir2} is not a folder inside the package`);
|
|
260
260
|
const out = [];
|
|
261
261
|
for (const entry of readdirSync(real2, { withFileTypes: true }).sort((a, b) => a.name.localeCompare(b.name))) {
|
|
262
262
|
if (!/^[A-Za-z0-9][A-Za-z0-9._-]*$/.test(entry.name) || entry.isDirectory()) {
|
|
263
263
|
skipped.push(`${safe}/${entry.name}`);
|
|
264
264
|
continue;
|
|
265
265
|
}
|
|
266
|
-
const content = readPackageFile(
|
|
266
|
+
const content = readPackageFile(packageDir2, `${safe}/${entry.name}`);
|
|
267
267
|
if (content !== null && entry.isFile()) out.push({ name: entry.name, content });
|
|
268
268
|
}
|
|
269
269
|
return out;
|
|
@@ -1952,18 +1952,21 @@ var init_versions = __esm({
|
|
|
1952
1952
|
UMBRELLA_PACKAGE = "@marktiderman/genesis";
|
|
1953
1953
|
}
|
|
1954
1954
|
});
|
|
1955
|
-
function
|
|
1955
|
+
function findLockfile(root) {
|
|
1956
1956
|
let dir = path28.resolve(root);
|
|
1957
1957
|
for (; ; ) {
|
|
1958
|
-
if (existsSync(path28.join(dir, "pnpm-lock.yaml"))) return "pnpm";
|
|
1959
|
-
if (existsSync(path28.join(dir, "bun.lock")) || existsSync(path28.join(dir, "bun.lockb"))) return "bun";
|
|
1960
|
-
if (existsSync(path28.join(dir, "yarn.lock"))) return "yarn";
|
|
1961
|
-
if (existsSync(path28.join(dir, "package-lock.json"))) return "npm";
|
|
1958
|
+
if (existsSync(path28.join(dir, "pnpm-lock.yaml"))) return { pm: "pnpm", dir };
|
|
1959
|
+
if (existsSync(path28.join(dir, "bun.lock")) || existsSync(path28.join(dir, "bun.lockb"))) return { pm: "bun", dir };
|
|
1960
|
+
if (existsSync(path28.join(dir, "yarn.lock"))) return { pm: "yarn", dir };
|
|
1961
|
+
if (existsSync(path28.join(dir, "package-lock.json"))) return { pm: "npm", dir };
|
|
1962
1962
|
const parent = path28.dirname(dir);
|
|
1963
|
-
if (parent === dir) return
|
|
1963
|
+
if (parent === dir) return null;
|
|
1964
1964
|
dir = parent;
|
|
1965
1965
|
}
|
|
1966
1966
|
}
|
|
1967
|
+
function detectPackageManager(root) {
|
|
1968
|
+
return findLockfile(root)?.pm ?? "npm";
|
|
1969
|
+
}
|
|
1967
1970
|
function addCommand(pm, specs, dev = false) {
|
|
1968
1971
|
const flag = dev ? ["-D"] : [];
|
|
1969
1972
|
if (pm === "npm") return ["npm", "install", ...flag, ...specs];
|
|
@@ -1972,6 +1975,11 @@ function addCommand(pm, specs, dev = false) {
|
|
|
1972
1975
|
function installCommand(pm) {
|
|
1973
1976
|
return pm === "yarn" ? ["yarn", "install"] : [pm, "install"];
|
|
1974
1977
|
}
|
|
1978
|
+
function dedupeCommand(pm) {
|
|
1979
|
+
if (pm === "pnpm") return ["pnpm", "dedupe"];
|
|
1980
|
+
if (pm === "npm") return ["npm", "dedupe"];
|
|
1981
|
+
return null;
|
|
1982
|
+
}
|
|
1975
1983
|
function pinnedVersion(root, name) {
|
|
1976
1984
|
const release = readReleaseManifest(root);
|
|
1977
1985
|
const fromRelease = release?.packages[name] ?? (name === "@marktiderman/genesis" ? release?.version : void 0);
|
|
@@ -2062,6 +2070,7 @@ var init_templates = __esm({
|
|
|
2062
2070
|
// src/blocks/init-native.ts
|
|
2063
2071
|
var init_native_exports = {};
|
|
2064
2072
|
__export(init_native_exports, {
|
|
2073
|
+
APP_FOLDER_PLACEHOLDER: () => APP_FOLDER_PLACEHOLDER,
|
|
2065
2074
|
appPnpmSettings: () => appPnpmSettings,
|
|
2066
2075
|
initNative: () => initNative,
|
|
2067
2076
|
runInitNative: () => runInitNative,
|
|
@@ -2123,7 +2132,13 @@ function initNative(options) {
|
|
|
2123
2132
|
const source = starterDir();
|
|
2124
2133
|
const read2 = (rel) => readFileSync(path28.join(source, rel), "utf8");
|
|
2125
2134
|
const was = starterIdentity(read2("starter.config.ts"));
|
|
2126
|
-
const substitutions = {
|
|
2135
|
+
const substitutions = {
|
|
2136
|
+
[was.bundleId]: bundleId,
|
|
2137
|
+
[was.slug]: slug,
|
|
2138
|
+
[was.scheme]: scheme,
|
|
2139
|
+
[was.name]: display,
|
|
2140
|
+
[APP_FOLDER_PLACEHOLDER]: "src"
|
|
2141
|
+
};
|
|
2127
2142
|
const files = /* @__PURE__ */ new Map();
|
|
2128
2143
|
for (const rel of walk(source, STARTER_EXCLUDE)) {
|
|
2129
2144
|
const to = rel.replace(new RegExp(`(^|/)${PACKED_GITIGNORE}$`), "$1.gitignore");
|
|
@@ -2206,7 +2221,7 @@ function initNative(options) {
|
|
|
2206
2221
|
async function runInitNative(options) {
|
|
2207
2222
|
return initNative({ ...options, blocks: catalogBlocks() });
|
|
2208
2223
|
}
|
|
2209
|
-
var SLUG, BUNDLE, SCHEME, METRO;
|
|
2224
|
+
var APP_FOLDER_PLACEHOLDER, SLUG, BUNDLE, SCHEME, METRO;
|
|
2210
2225
|
var init_init_native = __esm({
|
|
2211
2226
|
"src/blocks/init-native.ts"() {
|
|
2212
2227
|
init_discover();
|
|
@@ -2216,6 +2231,7 @@ var init_init_native = __esm({
|
|
|
2216
2231
|
init_pm();
|
|
2217
2232
|
init_templates();
|
|
2218
2233
|
init_walk();
|
|
2234
|
+
APP_FOLDER_PLACEHOLDER = "REPLACE_WITH_APP_FOLDER";
|
|
2219
2235
|
SLUG = /^[a-z][a-z0-9-]{1,40}$/;
|
|
2220
2236
|
BUNDLE = /^[a-zA-Z][a-zA-Z0-9]*(\.[a-zA-Z][a-zA-Z0-9]*)+$/;
|
|
2221
2237
|
SCHEME = /^[a-z][a-z0-9+.-]*$/;
|
|
@@ -2665,14 +2681,14 @@ function inherit(own, source) {
|
|
|
2665
2681
|
}
|
|
2666
2682
|
function resolveViews(relations) {
|
|
2667
2683
|
const done = /* @__PURE__ */ new Set();
|
|
2668
|
-
const
|
|
2684
|
+
const resolve25 = (relation, depth) => {
|
|
2669
2685
|
if (done.has(relation.oid) || !relation.origins || depth > MAX_VIEW_DEPTH) return;
|
|
2670
2686
|
done.add(relation.oid);
|
|
2671
2687
|
const sources = new Set([...relation.origins.values()].map((o) => o.relation));
|
|
2672
2688
|
if (sources.size !== 1) return;
|
|
2673
2689
|
const source = relations.get([...sources][0]);
|
|
2674
2690
|
if (!source) return;
|
|
2675
|
-
|
|
2691
|
+
resolve25(source, depth + 1);
|
|
2676
2692
|
const viewAttnumOf = /* @__PURE__ */ new Map();
|
|
2677
2693
|
for (const [attnum, origin] of relation.origins) {
|
|
2678
2694
|
const own = relation.columns.get(attnum);
|
|
@@ -2695,7 +2711,7 @@ function resolveViews(relations) {
|
|
|
2695
2711
|
};
|
|
2696
2712
|
if (Object.keys(inherited).length) relation.table.settings = { ...inherited, ...relation.table.settings };
|
|
2697
2713
|
};
|
|
2698
|
-
for (const relation of relations.values())
|
|
2714
|
+
for (const relation of relations.values()) resolve25(relation, 0);
|
|
2699
2715
|
}
|
|
2700
2716
|
async function introspectPostgres(sql, schemas, options = {}) {
|
|
2701
2717
|
const relations = /* @__PURE__ */ new Map();
|
|
@@ -3420,6 +3436,7 @@ var init_rules = __esm({
|
|
|
3420
3436
|
"native-custom-header",
|
|
3421
3437
|
"native-screen-layout",
|
|
3422
3438
|
"store-readiness",
|
|
3439
|
+
"eas-placeholder",
|
|
3423
3440
|
// supabase pack
|
|
3424
3441
|
"migration-grants",
|
|
3425
3442
|
"migration-rls",
|
|
@@ -3659,6 +3676,31 @@ function checkNativePack(ctx) {
|
|
|
3659
3676
|
checkCustomHeaders(ctx, pkg);
|
|
3660
3677
|
checkScreenLayouts(ctx, pkg);
|
|
3661
3678
|
checkStoreReadiness(ctx);
|
|
3679
|
+
checkEasPlaceholders(ctx);
|
|
3680
|
+
}
|
|
3681
|
+
function checkEasPlaceholders(ctx) {
|
|
3682
|
+
const files = [];
|
|
3683
|
+
if (existsSync(path28.join(ctx.root, "eas.json"))) files.push("eas.json");
|
|
3684
|
+
const workflows = path28.join(ctx.root, ".eas", "workflows");
|
|
3685
|
+
if (existsSync(workflows)) {
|
|
3686
|
+
for (const name of readdirSync(workflows).sort()) if (/\.ya?ml$/.test(name)) files.push(`.eas/workflows/${name}`);
|
|
3687
|
+
}
|
|
3688
|
+
for (const file of files) {
|
|
3689
|
+
const lines = readFileSync(path28.join(ctx.root, file), "utf8").split("\n");
|
|
3690
|
+
lines.forEach((text, i) => {
|
|
3691
|
+
if (!file.endsWith(".json") && /^\s*#/.test(text)) return;
|
|
3692
|
+
for (const m of text.matchAll(EAS_PLACEHOLDER)) {
|
|
3693
|
+
ctx.report({
|
|
3694
|
+
rule: "eas-placeholder",
|
|
3695
|
+
level: "warn",
|
|
3696
|
+
file,
|
|
3697
|
+
line: i + 1,
|
|
3698
|
+
subject: m[0],
|
|
3699
|
+
message: m[0] === "REPLACE_WITH_APP_FOLDER" ? "still names REPLACE_WITH_APP_FOLDER, so only config changes start a preview; replace it with the app's code folder (src, or apps/<name> in a monorepo)" : `still has the template placeholder ${m[0]}; replace it before the job that reads it runs (see docs/NATIVE-RELEASE.md in the Genesis repository)`
|
|
3700
|
+
});
|
|
3701
|
+
}
|
|
3702
|
+
});
|
|
3703
|
+
}
|
|
3662
3704
|
}
|
|
3663
3705
|
function checkRawPrimitives(ctx, pkg) {
|
|
3664
3706
|
const overlays = markedOverlays(ctx);
|
|
@@ -3937,7 +3979,7 @@ function checkStoreReadiness(ctx) {
|
|
|
3937
3979
|
});
|
|
3938
3980
|
}
|
|
3939
3981
|
}
|
|
3940
|
-
var SCRIPT_EXTS3, JSX_EXTS3, LAYOUT_NAME, NON_SCREEN_ROUTE, PART_HEADER, HIDES_HEADER, RN, LOADING_ROUTE_COMPANIONS, PERMISSIONS, SOCIAL_SIGN_IN, WEAK_SOCIAL_SIGN_IN, APPLE_SIGN_IN, EXPO_CONFIGS, SUPABASE_SIGN_IN, GENESIS_PLUGIN, GENESIS_PLUGIN_TEXT, GENESIS_PLUGIN_IMPORT;
|
|
3982
|
+
var SCRIPT_EXTS3, JSX_EXTS3, LAYOUT_NAME, NON_SCREEN_ROUTE, PART_HEADER, HIDES_HEADER, EAS_PLACEHOLDER, RN, LOADING_ROUTE_COMPANIONS, PERMISSIONS, SOCIAL_SIGN_IN, WEAK_SOCIAL_SIGN_IN, APPLE_SIGN_IN, EXPO_CONFIGS, SUPABASE_SIGN_IN, GENESIS_PLUGIN, GENESIS_PLUGIN_TEXT, GENESIS_PLUGIN_IMPORT;
|
|
3941
3983
|
var init_native = __esm({
|
|
3942
3984
|
"src/doctor/native.ts"() {
|
|
3943
3985
|
init_native_primitives();
|
|
@@ -3953,6 +3995,7 @@ var init_native = __esm({
|
|
|
3953
3995
|
NON_SCREEN_ROUTE = /(?:^|\/)(?:_layout|\+html|\+native-intent|\+middleware)\.[jt]sx?$|\+api\.[jt]sx?$/;
|
|
3954
3996
|
PART_HEADER = /(?:Section|List|Card|Dialog|Table|Group|Column|Row|Cell|Accordion|Sheet|Drawer|Modal|Popover|Menu|Panel|Form)Header$/;
|
|
3955
3997
|
HIDES_HEADER = /\bheaderShown\s*(?::|=\s*\{)\s*false\b/;
|
|
3998
|
+
EAS_PLACEHOLDER = /\bREPLACE_WITH_[A-Z0-9_]+/g;
|
|
3956
3999
|
RN = String.raw`["']react-native["']`;
|
|
3957
4000
|
LOADING_ROUTE_COMPANIONS = /* @__PURE__ */ new Set(["NativeLoadingState", "Stack.Screen", "Fragment", "React.Fragment"]);
|
|
3958
4001
|
PERMISSIONS = [
|
|
@@ -4585,7 +4628,7 @@ function toRegExp2(source, flags = "") {
|
|
|
4585
4628
|
if (source.startsWith("(?i)")) return new RegExp(source.slice(4), flags + "i");
|
|
4586
4629
|
return new RegExp(source, flags);
|
|
4587
4630
|
}
|
|
4588
|
-
function validateDeclaration(raw, packageName3,
|
|
4631
|
+
function validateDeclaration(raw, packageName3, packageDir2, ignored) {
|
|
4589
4632
|
const fail = (msg) => {
|
|
4590
4633
|
throw new PackageDeclarationError(`${packageName3}: genesis.doctor ${msg}`);
|
|
4591
4634
|
};
|
|
@@ -4605,9 +4648,9 @@ function validateDeclaration(raw, packageName3, packageDir3, ignored) {
|
|
|
4605
4648
|
}
|
|
4606
4649
|
});
|
|
4607
4650
|
if (typeof raw === "string") {
|
|
4608
|
-
if (!
|
|
4609
|
-
const file = path28.resolve(
|
|
4610
|
-
if (!inside(
|
|
4651
|
+
if (!packageDir2) fail(`points at ${raw}, but the package folder is unknown`);
|
|
4652
|
+
const file = path28.resolve(packageDir2, raw);
|
|
4653
|
+
if (!inside(packageDir2, file)) fail(`points outside the package (${raw})`);
|
|
4611
4654
|
if (!existsSync(file)) fail(`points at ${raw}, which doesn't exist (is it in package.json "files"?)`);
|
|
4612
4655
|
let parsed;
|
|
4613
4656
|
try {
|
|
@@ -4615,7 +4658,7 @@ function validateDeclaration(raw, packageName3, packageDir3, ignored) {
|
|
|
4615
4658
|
} catch (err) {
|
|
4616
4659
|
return fail(`file ${raw} is not valid JSON: ${err.message}`);
|
|
4617
4660
|
}
|
|
4618
|
-
return validateDeclaration(parsed, packageName3,
|
|
4661
|
+
return validateDeclaration(parsed, packageName3, packageDir2, ignored);
|
|
4619
4662
|
}
|
|
4620
4663
|
if (raw === false) fail(`is false; say why with { "enforce": false, "reason": "\u2026" }`);
|
|
4621
4664
|
if (!isObject3(raw)) fail(`must be an object (or a path to a JSON file in the package)`);
|
|
@@ -4653,10 +4696,10 @@ function validateDeclaration(raw, packageName3, packageDir3, ignored) {
|
|
|
4653
4696
|
});
|
|
4654
4697
|
let plugin;
|
|
4655
4698
|
if (typeof c.plugin === "string") {
|
|
4656
|
-
if (!
|
|
4699
|
+
if (!packageDir2) plugin = c.plugin;
|
|
4657
4700
|
else {
|
|
4658
|
-
plugin = path28.resolve(
|
|
4659
|
-
if (!inside(
|
|
4701
|
+
plugin = path28.resolve(packageDir2, c.plugin);
|
|
4702
|
+
if (!inside(packageDir2, plugin)) fail(`plugin points outside the package (${c.plugin})`);
|
|
4660
4703
|
}
|
|
4661
4704
|
}
|
|
4662
4705
|
return {
|
|
@@ -5529,6 +5572,23 @@ function checkTestingKit(ctx, migrations) {
|
|
|
5529
5572
|
function granteesOf(s) {
|
|
5530
5573
|
return s.replace(/\s+granted by .*$/, "").replace(/\s+with grant option$/, "").split(/\s*,\s*/).map((r) => r.replace(/^group\s+/, "").trim()).filter(Boolean);
|
|
5531
5574
|
}
|
|
5575
|
+
function dynamicGrants(body) {
|
|
5576
|
+
const out = [];
|
|
5577
|
+
const code = body.replace(/\/\*[\s\S]*?\*\/|--[^\n]*/g, "").replace(/(?<![\w."'$])raise\s+(?:(?:debug|log|info|notice|warning|exception|sqlstate|using)\b|')[^;]*;/g, ";");
|
|
5578
|
+
const strings2 = /(?<![\w$])e'((?:[^'\\]|\\[\s\S]|'')*)(?:'|$)|'((?:[^']|'')*)(?:'|$)|\$(\w*)\$([\s\S]*?)(?:\$\3\$|$)/g;
|
|
5579
|
+
for (const m of code.matchAll(strings2)) {
|
|
5580
|
+
for (const stmt of (m[1] ?? m[2] ?? m[4] ?? "").split(";")) {
|
|
5581
|
+
if (!/^\s*(?:grant|alter default privileges\b.*?\bgrant)\b/.test(stmt)) continue;
|
|
5582
|
+
const to = /\bto(?:\s+|$)([\s\S]*)$/.exec(stmt);
|
|
5583
|
+
if (!to) continue;
|
|
5584
|
+
const roles = to[1].replace(/\s+(?:with grant option|granted by)\b[\s\S]*$/, "").trim();
|
|
5585
|
+
const open = /\b(anon|public)\b/.exec(roles);
|
|
5586
|
+
if (open) out.push(open[1]);
|
|
5587
|
+
else if (!roles || roles.includes("%")) out.push(null);
|
|
5588
|
+
}
|
|
5589
|
+
}
|
|
5590
|
+
return out;
|
|
5591
|
+
}
|
|
5532
5592
|
function checkGrants(ctx, migrations, exposed) {
|
|
5533
5593
|
const fix = "grant by name (grant execute on function schema.fn(args) to role) so an earlier revoke survives";
|
|
5534
5594
|
const open = (roles) => roles.filter((r) => r === "anon" || r === "public");
|
|
@@ -5539,7 +5599,19 @@ function checkGrants(ctx, migrations, exposed) {
|
|
|
5539
5599
|
return null;
|
|
5540
5600
|
};
|
|
5541
5601
|
for (const { file, statements } of migrations) {
|
|
5542
|
-
for (const { sql, line } of statements) {
|
|
5602
|
+
for (const { sql, line, bodies } of statements) {
|
|
5603
|
+
const dynamic = bodies.flatMap(dynamicGrants);
|
|
5604
|
+
if (dynamic.length) {
|
|
5605
|
+
const named = [...new Set(dynamic.filter((r) => r !== null))];
|
|
5606
|
+
ctx.report({
|
|
5607
|
+
rule: "migration-grants",
|
|
5608
|
+
level: "warn",
|
|
5609
|
+
file,
|
|
5610
|
+
line,
|
|
5611
|
+
subject: "dynamic grant",
|
|
5612
|
+
message: named.length ? `builds a grant to ${named.join(" and ")} in dynamic SQL (execute), so the doctor can't check what it grants; name each object and role in a static grant, or make sure every target is in an exposed schema` : "builds a grant to a computed role in dynamic SQL (execute), so the doctor can't check it isn't anon or public; name the role in the grant"
|
|
5613
|
+
});
|
|
5614
|
+
}
|
|
5543
5615
|
const all = /^grant\b.*\bon all (?:functions|routines|procedures) in schema .+? to (.+)$/.exec(sql);
|
|
5544
5616
|
if (all) {
|
|
5545
5617
|
const hit = blanket(granteesOf(all[1]));
|
|
@@ -6190,7 +6262,71 @@ function bumpSummary(version, changes, skipped) {
|
|
|
6190
6262
|
...skipped.length ? ["", "Left alone:", "", ...skipped.map((s) => `- \`${s.name}\` ${s.spec} in ${s.file}: ${s.why}`)] : []
|
|
6191
6263
|
].join("\n");
|
|
6192
6264
|
}
|
|
6193
|
-
|
|
6265
|
+
function excludeReplacement(entry) {
|
|
6266
|
+
if (entry === GENESIS_PATTERN) return GENESIS_PATTERN;
|
|
6267
|
+
const at = entry.startsWith("@") ? entry.indexOf("@", 1) : entry.indexOf("@");
|
|
6268
|
+
const name = at === -1 ? entry : entry.slice(0, at);
|
|
6269
|
+
if (!GENESIS3.test(name)) return null;
|
|
6270
|
+
return name === UMBRELLA ? UMBRELLA : GENESIS_PATTERN;
|
|
6271
|
+
}
|
|
6272
|
+
function unquoteScalar(raw) {
|
|
6273
|
+
const s = raw.trim();
|
|
6274
|
+
if (s.length >= 2 && s.startsWith("'") && s.endsWith("'")) return s.slice(1, -1).replace(/''/g, "'");
|
|
6275
|
+
if (s.length >= 2 && s.startsWith('"') && s.endsWith('"')) return s.slice(1, -1);
|
|
6276
|
+
return s;
|
|
6277
|
+
}
|
|
6278
|
+
function normaliseReleaseAgeExcludes(text) {
|
|
6279
|
+
const eol = text.includes("\r\n") ? "\r\n" : "\n";
|
|
6280
|
+
const lines = text.split(/\r?\n/);
|
|
6281
|
+
const key2 = /^minimumReleaseAgeExclude:(.*)$/;
|
|
6282
|
+
const start = lines.findIndex((l) => key2.test(l));
|
|
6283
|
+
if (start === -1) return text;
|
|
6284
|
+
const seen = /* @__PURE__ */ new Set();
|
|
6285
|
+
const out = lines.slice(0, start);
|
|
6286
|
+
const flow = /^(\s*)\[(.*)\](\s*(?:#.*)?)$/.exec(key2.exec(lines[start])[1]);
|
|
6287
|
+
if (flow) {
|
|
6288
|
+
const kept = [];
|
|
6289
|
+
for (const raw of flow[2].split(",").map((s) => s.trim()).filter(Boolean)) {
|
|
6290
|
+
const replacement = excludeReplacement(unquoteScalar(raw));
|
|
6291
|
+
if (replacement === null) kept.push(raw);
|
|
6292
|
+
else if (!seen.has(replacement)) {
|
|
6293
|
+
seen.add(replacement);
|
|
6294
|
+
kept.push(`'${replacement}'`);
|
|
6295
|
+
}
|
|
6296
|
+
}
|
|
6297
|
+
return [...out, `minimumReleaseAgeExclude:${flow[1]}[${kept.join(", ")}]${flow[3]}`, ...lines.slice(start + 1)].join(eol);
|
|
6298
|
+
}
|
|
6299
|
+
const item = /^(\s*-\s+)('(?:[^']|'')*'|"[^"]*"|[^#\s][^#]*?)(\s+#.*)?\s*$/;
|
|
6300
|
+
out.push(lines[start]);
|
|
6301
|
+
let i = start + 1;
|
|
6302
|
+
for (; i < lines.length; i++) {
|
|
6303
|
+
const m = item.exec(lines[i]);
|
|
6304
|
+
if (!m) {
|
|
6305
|
+
if (/^\s*(#.*)?$/.test(lines[i])) {
|
|
6306
|
+
out.push(lines[i]);
|
|
6307
|
+
continue;
|
|
6308
|
+
}
|
|
6309
|
+
break;
|
|
6310
|
+
}
|
|
6311
|
+
const replacement = excludeReplacement(unquoteScalar(m[2]));
|
|
6312
|
+
if (replacement === null) out.push(lines[i]);
|
|
6313
|
+
else if (!seen.has(replacement)) {
|
|
6314
|
+
seen.add(replacement);
|
|
6315
|
+
out.push(`${m[1]}'${replacement}'${m[3] ?? ""}`);
|
|
6316
|
+
}
|
|
6317
|
+
}
|
|
6318
|
+
return [...out, ...lines.slice(i)].join(eol);
|
|
6319
|
+
}
|
|
6320
|
+
function pnpmWorkspaceFile(start, fallback, fs2) {
|
|
6321
|
+
for (let dir = start; ; ) {
|
|
6322
|
+
const file = fs2.join(dir, "pnpm-workspace.yaml");
|
|
6323
|
+
if (fs2.exists(file)) return file;
|
|
6324
|
+
const parent = fs2.dirname(dir);
|
|
6325
|
+
if (parent === dir) return fs2.join(fallback, "pnpm-workspace.yaml");
|
|
6326
|
+
dir = parent;
|
|
6327
|
+
}
|
|
6328
|
+
}
|
|
6329
|
+
var UMBRELLA, GENESIS3, EXACT, PLAIN, SECTIONS, GENESIS_PATTERN;
|
|
6194
6330
|
var init_bump_core = __esm({
|
|
6195
6331
|
"src/upgrade/bump-core.mjs"() {
|
|
6196
6332
|
UMBRELLA = "@marktiderman/genesis";
|
|
@@ -6198,6 +6334,7 @@ var init_bump_core = __esm({
|
|
|
6198
6334
|
EXACT = /^(\^|~|=)?(\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?)$/;
|
|
6199
6335
|
PLAIN = /^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?$/;
|
|
6200
6336
|
SECTIONS = ["dependencies", "devDependencies", "optionalDependencies"];
|
|
6337
|
+
GENESIS_PATTERN = "@marktiderman/genesis-*";
|
|
6201
6338
|
}
|
|
6202
6339
|
});
|
|
6203
6340
|
|
|
@@ -6632,23 +6769,42 @@ var init_api_usage = __esm({
|
|
|
6632
6769
|
};
|
|
6633
6770
|
}
|
|
6634
6771
|
});
|
|
6772
|
+
function specifierParts(spec) {
|
|
6773
|
+
return spec.trim().replace(/^type\s+/, "").split(/\s+as\s+/).map((part) => part.trim());
|
|
6774
|
+
}
|
|
6775
|
+
function tagOf(comment) {
|
|
6776
|
+
const doc = comment.replace(/^[ \t]*\*?[ \t]*/gm, "");
|
|
6777
|
+
const deprecated = /^@deprecated\b[ \t]*([\s\S]*?)(?=^@|(?![\s\S]))/m.exec(doc);
|
|
6778
|
+
const stability = /^@stability\s+(Experimental|Beta|Stable|Deprecated)\b/im.exec(doc)?.[1]?.toLowerCase();
|
|
6779
|
+
const note = deprecated?.[1].replace(/\s+/g, " ").trim();
|
|
6780
|
+
if (deprecated) return { stability: "deprecated", ...note ? { note } : {} };
|
|
6781
|
+
return stability ? { stability } : void 0;
|
|
6782
|
+
}
|
|
6635
6783
|
function stabilityTagsIn(dts) {
|
|
6636
6784
|
const tags = /* @__PURE__ */ new Map();
|
|
6637
6785
|
for (const m of dts.matchAll(DECLARATION)) {
|
|
6638
|
-
const
|
|
6639
|
-
|
|
6640
|
-
const stability = /^@stability\s+(Experimental|Beta|Stable|Deprecated)\b/im.exec(doc)?.[1]?.toLowerCase();
|
|
6641
|
-
const note = deprecated?.[1].replace(/\s+/g, " ").trim();
|
|
6642
|
-
if (deprecated) tags.set(m[2], { stability: "deprecated", ...note ? { note } : {} });
|
|
6643
|
-
else if (stability) tags.set(m[2], { stability });
|
|
6786
|
+
const tag = tagOf(m[1]);
|
|
6787
|
+
if (tag) tags.set(m[2], tag);
|
|
6644
6788
|
}
|
|
6789
|
+
for (const [name, tag] of taggedReexports(dts)) tags.set(name, tag);
|
|
6645
6790
|
return tags;
|
|
6646
6791
|
}
|
|
6647
|
-
function
|
|
6792
|
+
function* taggedReexports(dts) {
|
|
6793
|
+
for (const m of dts.matchAll(REEXPORT)) {
|
|
6794
|
+
const tag = tagOf(m[1]);
|
|
6795
|
+
if (!tag) continue;
|
|
6796
|
+
for (const spec of m[2].split(",")) {
|
|
6797
|
+
const name = specifierParts(spec).pop();
|
|
6798
|
+
if (name) yield [name, tag];
|
|
6799
|
+
}
|
|
6800
|
+
}
|
|
6801
|
+
}
|
|
6802
|
+
function genesisNamedImports(source) {
|
|
6648
6803
|
const out = [];
|
|
6804
|
+
const code = stripForImports(source) ?? source;
|
|
6649
6805
|
const re = /import\s+(?:type\s+)?(?:[\w$]+\s*,\s*)?\{([^}]*)\}\s*from\s*["']((@marktiderman\/genesis[\w-]*)(?:\/[^"']*)?)["']/g;
|
|
6650
6806
|
for (const m of code.matchAll(re)) {
|
|
6651
|
-
const names = m[1].split(",").map((n) => n
|
|
6807
|
+
const names = m[1].split(",").map((n) => specifierParts(n)[0]).filter(Boolean);
|
|
6652
6808
|
out.push({ pkg: m[3], specifier: m[2], names, line: code.slice(0, m.index).split("\n").length });
|
|
6653
6809
|
}
|
|
6654
6810
|
return out;
|
|
@@ -6661,13 +6817,6 @@ function declarationFiles(dir, out = []) {
|
|
|
6661
6817
|
}
|
|
6662
6818
|
return out;
|
|
6663
6819
|
}
|
|
6664
|
-
function packageDir2(root, pkg) {
|
|
6665
|
-
for (let dir = path28.resolve(root); ; dir = path28.dirname(dir)) {
|
|
6666
|
-
const candidate = path28.join(dir, "node_modules", ...pkg.split("/"));
|
|
6667
|
-
if (existsSync(path28.join(candidate, "package.json"))) return candidate;
|
|
6668
|
-
if (path28.dirname(dir) === dir) return null;
|
|
6669
|
-
}
|
|
6670
|
-
}
|
|
6671
6820
|
function readPackageTags(dir) {
|
|
6672
6821
|
const pkg = JSON.parse(readFileSync(path28.join(dir, "package.json"), "utf8"));
|
|
6673
6822
|
const tags = { dir, byFile: /* @__PURE__ */ new Map(), declaredIn: /* @__PURE__ */ new Map(), exports: typeof pkg.exports === "object" && pkg.exports ? pkg.exports : {} };
|
|
@@ -6676,11 +6825,12 @@ function readPackageTags(dir) {
|
|
|
6676
6825
|
for (const file of declarationFiles(dist)) {
|
|
6677
6826
|
const text = readFileSync(file, "utf8");
|
|
6678
6827
|
tags.byFile.set(file, stabilityTagsIn(text));
|
|
6828
|
+
const names = /* @__PURE__ */ new Set();
|
|
6679
6829
|
for (const m of text.matchAll(/^(?:export\s+)?(?:declare\s+)?(?:abstract\s+)?(?:function|const|let|class|interface|type|enum|namespace)\s+([A-Za-z_$][\w$]*)/gm)) {
|
|
6680
|
-
|
|
6681
|
-
if (!files.includes(file)) files.push(file);
|
|
6682
|
-
tags.declaredIn.set(m[1], files);
|
|
6830
|
+
names.add(m[1]);
|
|
6683
6831
|
}
|
|
6832
|
+
for (const [name] of taggedReexports(text)) names.add(name);
|
|
6833
|
+
for (const name of names) tags.declaredIn.set(name, [...tags.declaredIn.get(name) ?? [], file]);
|
|
6684
6834
|
}
|
|
6685
6835
|
return tags;
|
|
6686
6836
|
}
|
|
@@ -6700,7 +6850,7 @@ function checkStabilityImports(ctx) {
|
|
|
6700
6850
|
const cache2 = /* @__PURE__ */ new Map();
|
|
6701
6851
|
const tagsOf = (pkg) => {
|
|
6702
6852
|
if (!cache2.has(pkg)) {
|
|
6703
|
-
const dir =
|
|
6853
|
+
const dir = findPackageDir(ctx.root, pkg);
|
|
6704
6854
|
cache2.set(pkg, dir ? readPackageTags(dir) : null);
|
|
6705
6855
|
}
|
|
6706
6856
|
return cache2.get(pkg);
|
|
@@ -6722,11 +6872,14 @@ function checkStabilityImports(ctx) {
|
|
|
6722
6872
|
}
|
|
6723
6873
|
}
|
|
6724
6874
|
}
|
|
6725
|
-
var SCRIPT_EXTS6, DECLARATION;
|
|
6875
|
+
var SCRIPT_EXTS6, DECLARATION, REEXPORT;
|
|
6726
6876
|
var init_stability = __esm({
|
|
6727
6877
|
"src/doctor/stability.ts"() {
|
|
6878
|
+
init_genesis();
|
|
6879
|
+
init_trail();
|
|
6728
6880
|
SCRIPT_EXTS6 = /* @__PURE__ */ new Set([".ts", ".tsx", ".js", ".jsx", ".mts", ".cts", ".mjs", ".cjs"]);
|
|
6729
6881
|
DECLARATION = /\/\*\*((?:(?!\*\/)[\s\S])*)\*\/\s*\n(?:export\s+)?(?:declare\s+)?(?:abstract\s+)?(?:function|const|let|class|interface|type|enum|namespace)\s+([A-Za-z_$][\w$]*)/g;
|
|
6882
|
+
REEXPORT = /\/\*\*((?:(?!\*\/)[\s\S])*)\*\/\s*\nexport\s+(?:type\s+)?\{([^}]*)\}/g;
|
|
6730
6883
|
}
|
|
6731
6884
|
});
|
|
6732
6885
|
function git3(root, args) {
|
|
@@ -8922,6 +9075,21 @@ function npmLookup(cwd) {
|
|
|
8922
9075
|
}
|
|
8923
9076
|
};
|
|
8924
9077
|
}
|
|
9078
|
+
function readText(file) {
|
|
9079
|
+
try {
|
|
9080
|
+
return readFileSync(file, "utf8");
|
|
9081
|
+
} catch {
|
|
9082
|
+
return null;
|
|
9083
|
+
}
|
|
9084
|
+
}
|
|
9085
|
+
function tidyReleaseAgeExcludes(file) {
|
|
9086
|
+
const before = readText(file);
|
|
9087
|
+
if (before === null) return false;
|
|
9088
|
+
const after = normaliseReleaseAgeExcludes(before);
|
|
9089
|
+
if (after === before) return false;
|
|
9090
|
+
writeFileSync(file, after);
|
|
9091
|
+
return true;
|
|
9092
|
+
}
|
|
8925
9093
|
function packageJsons(root) {
|
|
8926
9094
|
try {
|
|
8927
9095
|
const out = execFileSync("git", ["ls-files", "-z", "--", ":(glob)**/package.json"], { cwd: root, encoding: "utf8", stdio: ["ignore", "pipe", "ignore"] });
|
|
@@ -8994,12 +9162,30 @@ async function runUpgrade(options) {
|
|
|
8994
9162
|
for (const f of changed) files.add(f);
|
|
8995
9163
|
}
|
|
8996
9164
|
const pm = detectPackageManager(root);
|
|
9165
|
+
let tidiedExcludes = null;
|
|
8997
9166
|
if (!options.dryRun && options.install !== false && bumped.size) {
|
|
9167
|
+
const workspaceFile = pm === "pnpm" ? pnpmWorkspaceFile(path28.resolve(root), findLockfile(root)?.dir ?? root, { exists: existsSync, join: path28.join, dirname: path28.dirname }) : null;
|
|
9168
|
+
const workspaceBefore = workspaceFile ? readText(workspaceFile) : null;
|
|
9169
|
+
const tidy = () => {
|
|
9170
|
+
if (!workspaceFile || !tidyReleaseAgeExcludes(workspaceFile)) return;
|
|
9171
|
+
tidiedExcludes = path28.relative(root, workspaceFile);
|
|
9172
|
+
log(`${tidiedExcludes}: minimumReleaseAgeExclude names Genesis packages by '${GENESIS_PATTERN}', not one entry per version`);
|
|
9173
|
+
};
|
|
8998
9174
|
if (typeof options.install === "function") options.install(root);
|
|
8999
9175
|
else {
|
|
9000
9176
|
log(`install: ${shellLine(installCommand(pm))}`);
|
|
9001
9177
|
run(root, installCommand(pm));
|
|
9002
9178
|
}
|
|
9179
|
+
tidy();
|
|
9180
|
+
const dedupe = options.dedupe ?? (typeof options.install === "function" ? false : true);
|
|
9181
|
+
const dedupeArgv = dedupeCommand(pm);
|
|
9182
|
+
if (typeof dedupe === "function") dedupe(root);
|
|
9183
|
+
else if (dedupe && dedupeArgv) {
|
|
9184
|
+
log(`dedupe: ${shellLine(dedupeArgv)}`);
|
|
9185
|
+
run(root, dedupeArgv);
|
|
9186
|
+
}
|
|
9187
|
+
if (dedupe) tidy();
|
|
9188
|
+
if (workspaceFile && readText(workspaceFile) !== workspaceBefore) files.add(path28.relative(root, workspaceFile));
|
|
9003
9189
|
}
|
|
9004
9190
|
const added = [];
|
|
9005
9191
|
const newMigrations = [];
|
|
@@ -9078,6 +9264,7 @@ async function runUpgrade(options) {
|
|
|
9078
9264
|
if (next.size) lines.push("", "Review and delete these before merging (not committed by --pr):", "", ...[...next].map((n) => `- ${n}`));
|
|
9079
9265
|
if (lock.substitutions && Object.keys(lock.substitutions).length) lines.push("", `Templates renamed with genesis.lock.json's substitutions: ${Object.entries(lock.substitutions).map(([a, b]) => `${a} \u2192 ${b}`).join(", ")}.`);
|
|
9080
9266
|
if (newMigrations.length) lines.push("", "New package migrations (run `genesis migrate` to copy them):", "", ...newMigrations.map((m) => `- ${m}`));
|
|
9267
|
+
if (tidiedExcludes) lines.push("", `pnpm pinned the new Genesis versions in \`${tidiedExcludes}\`'s \`minimumReleaseAgeExclude\` (they are younger than \`minimumReleaseAge\`); those entries are now \`'${GENESIS_PATTERN}'\`, which \`pnpm install --frozen-lockfile\` honours. Other entries are as they were.`);
|
|
9081
9268
|
if (warnings.length) lines.push("", "Warnings:", "", ...warnings.map((w) => `- ${w}`));
|
|
9082
9269
|
lines.push("", `\`genesis doctor\` ${doctor === "not run" ? "was not run" : doctor} after the upgrade.`);
|
|
9083
9270
|
const summary = lines.join("\n");
|
|
@@ -9743,7 +9930,7 @@ studio.command("init").description("Turn the Data Studio on in this app: a serve
|
|
|
9743
9930
|
const packageJson = JSON.parse(await fs.readFile(path28.join(root, "package.json"), "utf-8").catch(() => "{}"));
|
|
9744
9931
|
const existsSync36 = (await import('fs')).existsSync;
|
|
9745
9932
|
const readSync = (await import('fs')).readFileSync;
|
|
9746
|
-
const
|
|
9933
|
+
const readdirSync18 = (await import('fs')).readdirSync;
|
|
9747
9934
|
if (opts.host && !["next", "tanstack-start", "supabase-function"].includes(opts.host)) {
|
|
9748
9935
|
throw new Error("--host must be next, tanstack-start or supabase-function.");
|
|
9749
9936
|
}
|
|
@@ -9756,7 +9943,7 @@ studio.command("init").description("Turn the Data Studio on in this app: a serve
|
|
|
9756
9943
|
listDeep: (p) => {
|
|
9757
9944
|
const out = [];
|
|
9758
9945
|
const walk2 = (rel) => {
|
|
9759
|
-
for (const entry of
|
|
9946
|
+
for (const entry of readdirSync18(path28.join(root, rel), { withFileTypes: true })) {
|
|
9760
9947
|
const child = `${rel}/${entry.name}`;
|
|
9761
9948
|
if (entry.isDirectory()) walk2(child);
|
|
9762
9949
|
else out.push(child);
|
|
@@ -9770,7 +9957,7 @@ studio.command("init").description("Turn the Data Studio on in this app: a serve
|
|
|
9770
9957
|
},
|
|
9771
9958
|
list: (p) => {
|
|
9772
9959
|
try {
|
|
9773
|
-
return
|
|
9960
|
+
return readdirSync18(path28.join(root, p));
|
|
9774
9961
|
} catch {
|
|
9775
9962
|
return [];
|
|
9776
9963
|
}
|