@marktiderman/genesis-cli 1.12.0 → 1.13.0
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 +10 -4
- package/dist/cli.js +83 -36
- package/dist/cli.js.map +1 -1
- package/dist/doctor.js +23 -11
- package/dist/doctor.js.map +1 -1
- package/dist/genesis-catalog.json +54 -15
- package/dist/index.d.ts +11 -1
- package/dist/index.js +81 -35
- package/dist/index.js.map +1 -1
- package/dist/vite.js +23 -11
- package/dist/vite.js.map +1 -1
- package/package.json +3 -3
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"packages": {
|
|
3
3
|
"@marktiderman/genesis-chat": {
|
|
4
|
-
"version": "0.3.
|
|
4
|
+
"version": "0.3.2",
|
|
5
5
|
"blocks": {
|
|
6
6
|
"chat": {
|
|
7
7
|
"feature": {
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
}
|
|
54
54
|
},
|
|
55
55
|
"@marktiderman/genesis-core": {
|
|
56
|
-
"version": "1.
|
|
56
|
+
"version": "1.13.0"
|
|
57
57
|
},
|
|
58
58
|
"@marktiderman/genesis-switchboard": {
|
|
59
59
|
"version": "2.1.0"
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
"version": "0.2.0"
|
|
66
66
|
},
|
|
67
67
|
"@marktiderman/genesis-features": {
|
|
68
|
-
"version": "0.
|
|
68
|
+
"version": "0.6.0"
|
|
69
69
|
},
|
|
70
70
|
"@marktiderman/genesis-forms": {
|
|
71
71
|
"version": "0.9.2"
|
|
@@ -83,19 +83,19 @@
|
|
|
83
83
|
"version": "0.3.1"
|
|
84
84
|
},
|
|
85
85
|
"@marktiderman/genesis-forms-studio": {
|
|
86
|
-
"version": "0.
|
|
86
|
+
"version": "0.6.0"
|
|
87
87
|
},
|
|
88
88
|
"@marktiderman/genesis-forms-web": {
|
|
89
89
|
"version": "0.6.3"
|
|
90
90
|
},
|
|
91
91
|
"@marktiderman/genesis": {
|
|
92
|
-
"version": "0.9.
|
|
92
|
+
"version": "0.9.13"
|
|
93
93
|
},
|
|
94
94
|
"@marktiderman/genesis-cli": {
|
|
95
|
-
"version": "1.
|
|
95
|
+
"version": "1.13.0"
|
|
96
96
|
},
|
|
97
97
|
"@marktiderman/genesis-native": {
|
|
98
|
-
"version": "0.4.
|
|
98
|
+
"version": "0.4.4",
|
|
99
99
|
"blocks": {
|
|
100
100
|
"push": {
|
|
101
101
|
"feature": {
|
|
@@ -273,7 +273,7 @@
|
|
|
273
273
|
}
|
|
274
274
|
},
|
|
275
275
|
"@marktiderman/genesis-notifications": {
|
|
276
|
-
"version": "0.2.
|
|
276
|
+
"version": "0.2.2",
|
|
277
277
|
"blocks": {
|
|
278
278
|
"notifications": {
|
|
279
279
|
"feature": {
|
|
@@ -329,7 +329,7 @@
|
|
|
329
329
|
}
|
|
330
330
|
},
|
|
331
331
|
"@marktiderman/genesis-sites": {
|
|
332
|
-
"version": "0.3.
|
|
332
|
+
"version": "0.3.3",
|
|
333
333
|
"blocks": {
|
|
334
334
|
"sites": {
|
|
335
335
|
"feature": {
|
|
@@ -373,13 +373,13 @@
|
|
|
373
373
|
}
|
|
374
374
|
},
|
|
375
375
|
"@marktiderman/genesis-studio": {
|
|
376
|
-
"version": "0.2.
|
|
376
|
+
"version": "0.2.1"
|
|
377
377
|
},
|
|
378
378
|
"@marktiderman/genesis-studio-server": {
|
|
379
379
|
"version": "0.3.1"
|
|
380
380
|
},
|
|
381
381
|
"@marktiderman/genesis-supabase": {
|
|
382
|
-
"version": "0.
|
|
382
|
+
"version": "0.7.0",
|
|
383
383
|
"blocks": {
|
|
384
384
|
"account": {
|
|
385
385
|
"feature": {
|
|
@@ -502,16 +502,55 @@
|
|
|
502
502
|
{
|
|
503
503
|
"file": "migrations/0008_genesis_feature_registry.sql",
|
|
504
504
|
"test": "migrations/tests/0008_genesis_feature_registry.test.sql"
|
|
505
|
+
},
|
|
506
|
+
{
|
|
507
|
+
"file": "migrations/0014_genesis_feature_registry_hardening.sql",
|
|
508
|
+
"test": "migrations/tests/0014_genesis_feature_registry_hardening.test.sql"
|
|
505
509
|
}
|
|
506
510
|
],
|
|
507
511
|
"steps": [
|
|
508
|
-
"Sync the registry on every deploy with the service key: syncFeatureRegistry(admin, features.json, { version: BUILD_TIME }). Grant paid features by writing feature_entitlements from your billing webhook."
|
|
512
|
+
"Sync the registry on every deploy with the service key: syncFeatureRegistry(admin, features.json, { version: BUILD_TIME } (the build time, from a production deployment only)). Grant paid features by writing feature_entitlements from your billing webhook."
|
|
513
|
+
]
|
|
514
|
+
},
|
|
515
|
+
"owner-access": {
|
|
516
|
+
"feature": {
|
|
517
|
+
"name": "Owner access",
|
|
518
|
+
"summary": "The owner-access contract: fail-closed wrappers (genesis_owner_readable, genesis_owner_allows) over the app's two hooks, for every Genesis block whose rows belong to a person, a team or the tenant.",
|
|
519
|
+
"keywords": [
|
|
520
|
+
"access",
|
|
521
|
+
"owners",
|
|
522
|
+
"row level security",
|
|
523
|
+
"tenants",
|
|
524
|
+
"teams"
|
|
525
|
+
],
|
|
526
|
+
"audience": [
|
|
527
|
+
"developer"
|
|
528
|
+
]
|
|
529
|
+
},
|
|
530
|
+
"platforms": [
|
|
531
|
+
"web",
|
|
532
|
+
"native"
|
|
533
|
+
],
|
|
534
|
+
"requires": [
|
|
535
|
+
"tenant-features"
|
|
536
|
+
],
|
|
537
|
+
"migrations": [
|
|
538
|
+
{
|
|
539
|
+
"file": "migrations/0009_genesis_owner_access.sql",
|
|
540
|
+
"test": "migrations/tests/0009_genesis_owner_access.test.sql"
|
|
541
|
+
}
|
|
542
|
+
],
|
|
543
|
+
"install": [
|
|
544
|
+
"@supabase/supabase-js@^2.118.0"
|
|
545
|
+
],
|
|
546
|
+
"steps": [
|
|
547
|
+
"Define private.genesis_owner_can(tenant, viewer, person_id, team_id, organization_id, action) and private.genesis_readable_owners(viewer) in your own migration, as the header of 0009 shows. Without them the wrappers answer no."
|
|
509
548
|
]
|
|
510
549
|
}
|
|
511
550
|
}
|
|
512
551
|
},
|
|
513
552
|
"@marktiderman/genesis-support": {
|
|
514
|
-
"version": "0.2.
|
|
553
|
+
"version": "0.2.4",
|
|
515
554
|
"blocks": {
|
|
516
555
|
"support-feedback": {
|
|
517
556
|
"feature": {
|
|
@@ -701,10 +740,10 @@
|
|
|
701
740
|
}
|
|
702
741
|
},
|
|
703
742
|
"@marktiderman/genesis-ui": {
|
|
704
|
-
"version": "2.
|
|
743
|
+
"version": "2.18.0"
|
|
705
744
|
},
|
|
706
745
|
"@marktiderman/genesis-ui-native": {
|
|
707
|
-
"version": "2.
|
|
746
|
+
"version": "2.6.0"
|
|
708
747
|
}
|
|
709
748
|
}
|
|
710
749
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -38,12 +38,19 @@ interface FieldSettings {
|
|
|
38
38
|
label?: string;
|
|
39
39
|
description?: string;
|
|
40
40
|
widget?: string;
|
|
41
|
+
/** Server-owned: clients never write it. */
|
|
42
|
+
readonly?: boolean;
|
|
43
|
+
/** Left out of lists, exports and previews unless a screen asks. */
|
|
44
|
+
sensitive?: boolean;
|
|
41
45
|
}
|
|
42
46
|
/** What a table comment's `@genesis {...}` may set. */
|
|
43
47
|
interface TableSettings {
|
|
44
48
|
label?: string;
|
|
45
49
|
labelField?: string;
|
|
46
50
|
description?: string;
|
|
51
|
+
/** What one row is called ("brand"), and several when not `noun` + "s". */
|
|
52
|
+
noun?: string;
|
|
53
|
+
nounPlural?: string;
|
|
47
54
|
}
|
|
48
55
|
|
|
49
56
|
type Sql = postgres.Sql;
|
|
@@ -83,6 +90,9 @@ interface EmitOptions {
|
|
|
83
90
|
/** Where the contract came from, for the header. Never include a secret. */
|
|
84
91
|
source: string;
|
|
85
92
|
}
|
|
93
|
+
/** Thrown when the contract can't be emitted as asked (a name clash, a labelField that isn't a column). */
|
|
94
|
+
declare class EmitError extends Error {
|
|
95
|
+
}
|
|
86
96
|
declare function emitContracts(tables: readonly IntrospectedTable[], options: EmitOptions): string;
|
|
87
97
|
|
|
88
98
|
interface ParsedComment<S> {
|
|
@@ -140,4 +150,4 @@ interface InitPlan {
|
|
|
140
150
|
declare function detectHost(facts: ProjectFacts): StudioHost;
|
|
141
151
|
declare function planStudioInit(facts: ProjectFacts, options?: InitOptions): InitPlan;
|
|
142
152
|
|
|
143
|
-
export { CommentSettingsError, type EmitOptions, type FieldSettings, type InitOptions, type InitPlan, type IntrospectedColumn, type IntrospectedTable, type OpenApiDocument, type PlannedFile, type ProjectFacts, type StorageType, type StudioHost, type TableSettings, detectHost, emitContracts, introspectOpenApi, introspectPostgres, parseColumnComment, parseTableComment, planStudioInit };
|
|
153
|
+
export { CommentSettingsError, EmitError, type EmitOptions, type FieldSettings, type InitOptions, type InitPlan, type IntrospectedColumn, type IntrospectedTable, type OpenApiDocument, type PlannedFile, type ProjectFacts, type StorageType, type StudioHost, type TableSettings, detectHost, emitContracts, introspectOpenApi, introspectPostgres, parseColumnComment, parseTableComment, planStudioInit };
|
package/dist/index.js
CHANGED
|
@@ -325,8 +325,8 @@ This consumer was bootstrapped with \`@marktiderman/genesis-cli init ${consumer}
|
|
|
325
325
|
|
|
326
326
|
// src/introspect/comments.ts
|
|
327
327
|
var MARKER = "@genesis";
|
|
328
|
-
var TABLE_KEYS =
|
|
329
|
-
var FIELD_KEYS =
|
|
328
|
+
var TABLE_KEYS = { label: "string", labelField: "string", description: "string", noun: "string", nounPlural: "string" };
|
|
329
|
+
var FIELD_KEYS = { label: "string", description: "string", widget: "string", readonly: "boolean", sensitive: "boolean" };
|
|
330
330
|
var CommentSettingsError = class extends Error {
|
|
331
331
|
};
|
|
332
332
|
function parse(comment, keys, where) {
|
|
@@ -346,13 +346,17 @@ function parse(comment, keys, where) {
|
|
|
346
346
|
}
|
|
347
347
|
const settings = {};
|
|
348
348
|
for (const [key2, v] of Object.entries(value)) {
|
|
349
|
-
|
|
350
|
-
|
|
349
|
+
const kind = keys[key2];
|
|
350
|
+
if (!kind) {
|
|
351
|
+
throw new CommentSettingsError(`${where}: unknown ${MARKER} setting "${key2}". Allowed: ${Object.keys(keys).join(", ")}.`);
|
|
351
352
|
}
|
|
352
|
-
if (typeof v !==
|
|
353
|
+
if (typeof v !== kind) throw new CommentSettingsError(`${where}: ${MARKER} "${key2}" must be a ${kind}.`);
|
|
353
354
|
settings[key2] = v;
|
|
354
355
|
}
|
|
355
|
-
return {
|
|
356
|
+
return {
|
|
357
|
+
...description ? { description } : {},
|
|
358
|
+
...Object.keys(settings).length ? { settings } : {}
|
|
359
|
+
};
|
|
356
360
|
}
|
|
357
361
|
function parseTableComment(comment, table) {
|
|
358
362
|
return parse(comment, TABLE_KEYS, table);
|
|
@@ -526,12 +530,16 @@ function typeName(table) {
|
|
|
526
530
|
const pascal = `${table.schema}_${table.table}`.split(/[^A-Za-z0-9]+/).filter(Boolean).map((p) => p[0].toUpperCase() + p.slice(1)).join("");
|
|
527
531
|
return `${/^[0-9]/.test(pascal) ? "T" : ""}${pascal}Row`;
|
|
528
532
|
}
|
|
533
|
+
function constName(table) {
|
|
534
|
+
const row = typeName(table).replace(/Row$/, "");
|
|
535
|
+
return row[0].toLowerCase() + row.slice(1);
|
|
536
|
+
}
|
|
529
537
|
function tsType(column) {
|
|
530
538
|
const base = column.enumValues?.length ? column.enumValues.map(quote).join(" | ") : TS_TYPE[column.type];
|
|
531
539
|
const element = column.array ? base.includes("|") ? `(${base})[]` : `${base}[]` : base;
|
|
532
540
|
return column.nullable ? `${element} | null` : element;
|
|
533
541
|
}
|
|
534
|
-
function field(column) {
|
|
542
|
+
function field(column, indent) {
|
|
535
543
|
const parts = [`name: ${quote(column.name)}`, `type: ${quote(column.type)}`, `dbType: ${quote(column.dbType)}`];
|
|
536
544
|
if (column.array) parts.push("array: true");
|
|
537
545
|
if (column.nullable) parts.push("nullable: true");
|
|
@@ -547,10 +555,25 @@ function field(column) {
|
|
|
547
555
|
if (label) parts.push(`label: ${quote(label)}`);
|
|
548
556
|
if (description) parts.push(`description: ${quote(description)}`);
|
|
549
557
|
if (column.settings?.widget) parts.push(`widget: ${quote(column.settings.widget)}`);
|
|
550
|
-
|
|
558
|
+
if (column.settings?.readonly) parts.push("readOnly: true");
|
|
559
|
+
if (column.settings?.sensitive) parts.push("sensitive: true");
|
|
560
|
+
return `${indent}{ ${parts.join(", ")} },`;
|
|
551
561
|
}
|
|
562
|
+
var EmitError = class extends Error {
|
|
563
|
+
};
|
|
552
564
|
function emitContracts(tables, options) {
|
|
553
565
|
const sorted = [...tables].sort((a, b) => a.name < b.name ? -1 : a.name > b.name ? 1 : 0);
|
|
566
|
+
const seen = /* @__PURE__ */ new Map();
|
|
567
|
+
for (const table of sorted) {
|
|
568
|
+
const id = typeName(table);
|
|
569
|
+
const other = seen.get(id);
|
|
570
|
+
if (other) throw new EmitError(`${other} and ${table.name} would both be named ${id}; rename one, or introspect them separately.`);
|
|
571
|
+
seen.set(id, table.name);
|
|
572
|
+
const labelField = table.settings?.labelField;
|
|
573
|
+
if (labelField && !table.columns.some((c) => c.name === labelField)) {
|
|
574
|
+
throw new EmitError(`${table.name}: @genesis labelField "${labelField}" isn't one of its columns.`);
|
|
575
|
+
}
|
|
576
|
+
}
|
|
554
577
|
const out = [
|
|
555
578
|
"// Generated by `genesis introspect` \u2014 do not edit by hand.",
|
|
556
579
|
`// Source: ${options.source}`,
|
|
@@ -559,31 +582,42 @@ function emitContracts(tables, options) {
|
|
|
559
582
|
"// Labels, widgets and descriptions come from `@genesis {...}` settings in",
|
|
560
583
|
"// table and column comments. Pass `contracts` to createStudioHandler: it",
|
|
561
584
|
"// wins over discovery for presentation, while types, keys and every",
|
|
562
|
-
"// permission still come from the live database.",
|
|
585
|
+
"// permission still come from the live database. Each contract goes through",
|
|
586
|
+
"// defineResource, so a bad @genesis setting fails to compile and views read the",
|
|
587
|
+
"// row type with RowOf<typeof contract>.",
|
|
563
588
|
"",
|
|
564
|
-
|
|
589
|
+
'import { defineResource } from "@marktiderman/genesis-core";',
|
|
590
|
+
""
|
|
565
591
|
];
|
|
566
592
|
for (const table of sorted) {
|
|
567
|
-
|
|
568
|
-
out.push(
|
|
569
|
-
out.push(`
|
|
570
|
-
|
|
571
|
-
|
|
593
|
+
const row = typeName(table);
|
|
594
|
+
out.push(`/** \`${table.name}\`. */`);
|
|
595
|
+
out.push(`export const ${constName(table)} = defineResource<${row}>()({`);
|
|
596
|
+
out.push(` name: ${quote(table.name)},`);
|
|
597
|
+
out.push(` key: ${table.key.length === 1 ? quote(table.key[0]) : `[${table.key.map(quote).join(", ")}]`},`);
|
|
598
|
+
if (table.settings?.label) out.push(` label: ${quote(table.settings.label)},`);
|
|
599
|
+
if (table.settings?.labelField) out.push(` labelField: ${quote(table.settings.labelField)},`);
|
|
600
|
+
if (table.settings?.noun) out.push(` noun: ${quote(table.settings.noun)},`);
|
|
601
|
+
if (table.settings?.nounPlural) out.push(` nounPlural: ${quote(table.settings.nounPlural)},`);
|
|
572
602
|
const description = table.settings?.description ?? table.description;
|
|
573
|
-
if (description) out.push(`
|
|
574
|
-
out.push("
|
|
575
|
-
for (const column of table.columns) out.push(field(column));
|
|
576
|
-
out.push("
|
|
577
|
-
out.push("
|
|
578
|
-
}
|
|
603
|
+
if (description) out.push(` description: ${quote(description)},`);
|
|
604
|
+
out.push(" fields: [");
|
|
605
|
+
for (const column of table.columns) out.push(field(column, " "));
|
|
606
|
+
out.push(" ],");
|
|
607
|
+
out.push("});", "");
|
|
608
|
+
}
|
|
609
|
+
out.push("export const contracts = {");
|
|
610
|
+
for (const table of sorted) out.push(` ${quote(table.name)}: ${constName(table)},`);
|
|
579
611
|
out.push("} as const;", "");
|
|
580
612
|
out.push("/** Every resource in this contract, `schema.table`. */");
|
|
581
613
|
out.push("export type GenesisResource = keyof typeof contracts;", "");
|
|
582
614
|
for (const table of sorted) {
|
|
583
615
|
out.push(`/** A row of \`${table.name}\`, as the studio handler returns it. */`);
|
|
584
|
-
out.push(`export
|
|
616
|
+
out.push(`export type ${typeName(table)} = {`);
|
|
585
617
|
for (const column of table.columns) out.push(` ${propKey(column.name)}: ${tsType(column)};`);
|
|
586
|
-
out.push("}", "");
|
|
618
|
+
out.push("};", "");
|
|
619
|
+
out.push(`/** The field names of \`${table.name}\`. */`);
|
|
620
|
+
out.push(`export type ${typeName(table).replace(/Row$/, "Field")} = keyof ${typeName(table)};`, "");
|
|
587
621
|
}
|
|
588
622
|
out.push("/** Row types by resource. */");
|
|
589
623
|
out.push("export interface GenesisRows {");
|
|
@@ -1795,7 +1829,9 @@ ${globs.join("\n")}`;
|
|
|
1795
1829
|
for (const dir of [...dirs].sort()) {
|
|
1796
1830
|
const manifest = path14.join(dir, "package.json");
|
|
1797
1831
|
if (!existsSync(manifest)) continue;
|
|
1798
|
-
if (!inside(real2, realpathSync(dir)))
|
|
1832
|
+
if (!inside(real2, realpathSync(dir))) {
|
|
1833
|
+
throw new LocalPackagesError(`${path14.relative(appRoot, dir) || dir} is outside the repository; localPackages may only list folders inside it`);
|
|
1834
|
+
}
|
|
1799
1835
|
let pkg;
|
|
1800
1836
|
try {
|
|
1801
1837
|
pkg = JSON.parse(readFileSync(manifest, "utf8"));
|
|
@@ -2516,7 +2552,7 @@ function namedImportsFrom(code, pkg) {
|
|
|
2516
2552
|
// src/doctor/native.ts
|
|
2517
2553
|
var SCRIPT_EXTS3 = /* @__PURE__ */ new Set([".ts", ".tsx", ".js", ".jsx", ".mts", ".cts", ".mjs", ".cjs"]);
|
|
2518
2554
|
var JSX_EXTS3 = /* @__PURE__ */ new Set([".tsx", ".jsx"]);
|
|
2519
|
-
var LAYOUT_NAME = /(?:Page|Screen|ScreenContainer)$/;
|
|
2555
|
+
var LAYOUT_NAME = /(?:Page|Screen|ScreenContainer)$|^NativeResourceView$/;
|
|
2520
2556
|
var NON_SCREEN_ROUTE = /(?:^|\/)(?:_layout|\+html|\+native-intent|\+middleware)\.[jt]sx?$|\+api\.[jt]sx?$/;
|
|
2521
2557
|
var PART_HEADER = /(?:Section|List|Card|Dialog|Table|Group|Column|Row|Cell|Accordion|Sheet|Drawer|Modal|Popover|Menu|Panel|Form)Header$/;
|
|
2522
2558
|
var HIDES_HEADER = /\bheaderShown\s*(?::|=\s*\{)\s*false\b/;
|
|
@@ -3313,7 +3349,7 @@ var SOURCE = /\.(?:[cm]?[jt]sx?)$/;
|
|
|
3313
3349
|
var SKIP_DIRS2 = /* @__PURE__ */ new Set(["node_modules", "dist", "build", "coverage", ".turbo"]);
|
|
3314
3350
|
var BUILTINS = new Set(builtinModules.flatMap((m) => [m, `node:${m}`]));
|
|
3315
3351
|
var IMPORT = /(?:\bfrom\s*|\bimport\s*\(\s*|\bimport\s+|\brequire\s*\(\s*)["']([^"']+)["']/g;
|
|
3316
|
-
var TYPE_ONLY = /\b(?:import|export)\s+type\
|
|
3352
|
+
var TYPE_ONLY = /\b(?:import|export)\s+type\s+(?:\{[^}]*\}|\*\s+as\s+[\w$]+|\*|[\w$]+)\s*from\s*["'][^"']+["']/g;
|
|
3317
3353
|
function sourceFiles(dir, rel = "") {
|
|
3318
3354
|
const out = [];
|
|
3319
3355
|
for (const entry of readdirSync(path14.join(dir, rel)).sort()) {
|
|
@@ -3452,7 +3488,7 @@ function checkExports(ctx, pkg, json) {
|
|
|
3452
3488
|
};
|
|
3453
3489
|
walk(json.exports);
|
|
3454
3490
|
for (const t of targets) {
|
|
3455
|
-
if (!t.startsWith("./") || t.includes("*") ||
|
|
3491
|
+
if (!t.startsWith("./") || t.includes("*") || !/\.(?:[cm]?tsx?|json)$/.test(t) || /\.d\.[cm]?ts$/.test(t)) continue;
|
|
3456
3492
|
if (!existsSync(path14.join(pkg.dir, t))) {
|
|
3457
3493
|
ctx.report({ rule: "package-export-missing", file: `${pkg.rel}/package.json`, subject: t, message: `${pkg.name} exports ${t}, which doesn't exist` });
|
|
3458
3494
|
}
|
|
@@ -3483,10 +3519,13 @@ function checkRegistered(ctx, pkg) {
|
|
|
3483
3519
|
} catch {
|
|
3484
3520
|
return;
|
|
3485
3521
|
}
|
|
3522
|
+
const top = git(ctx.root, ["rev-parse", "--show-toplevel"])?.trim();
|
|
3523
|
+
const forms = /* @__PURE__ */ new Set([pkg.rel]);
|
|
3524
|
+
if (top) forms.add(path14.relative(top, realpathSync(pkg.dir)).split(path14.sep).join("/"));
|
|
3486
3525
|
const covered = (doc.features ?? []).some(
|
|
3487
3526
|
(f) => (f.links?.code ?? []).some((c) => {
|
|
3488
3527
|
const norm = c.replace(/^\.\//, "").replace(/\/+$/, "");
|
|
3489
|
-
return norm ===
|
|
3528
|
+
return [...forms].some((rel) => norm === rel || norm.startsWith(`${rel}/`) || rel.startsWith(`${norm}/`));
|
|
3490
3529
|
})
|
|
3491
3530
|
);
|
|
3492
3531
|
if (!covered) {
|
|
@@ -3510,8 +3549,12 @@ function mergeBaseOf(root, base) {
|
|
|
3510
3549
|
return sha ? { sha } : { reason: `HEAD has no merge base with ${base} (fetch with depth 0)` };
|
|
3511
3550
|
}
|
|
3512
3551
|
function checkChanges(ctx, pkg, json, base, mergeBase) {
|
|
3513
|
-
const
|
|
3514
|
-
|
|
3552
|
+
const top = git(ctx.root, ["rev-parse", "--show-toplevel"])?.trim();
|
|
3553
|
+
if (!top) return;
|
|
3554
|
+
const appRelative = (fromTop) => path14.relative(realpathSync(ctx.root), path14.join(top, fromTop)).split(path14.sep).join("/");
|
|
3555
|
+
const inRepo = path14.relative(top, realpathSync(pkg.dir)).split(path14.sep).join("/");
|
|
3556
|
+
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");
|
|
3557
|
+
const untracked = (git(top, ["ls-files", "--others", "--exclude-standard", "--", inRepo]) ?? "").split("\n").filter(Boolean).map(appRelative);
|
|
3515
3558
|
const changed = [...diff.split("\n").filter(Boolean).map((row) => row.split(" ").at(-1)), ...untracked].filter(
|
|
3516
3559
|
(f) => !/(^|\/)(CHANGELOG\.md|node_modules\/)/.test(f)
|
|
3517
3560
|
);
|
|
@@ -3532,7 +3575,6 @@ function checkChanges(ctx, pkg, json, base, mergeBase) {
|
|
|
3532
3575
|
const now = typeof json.version === "string" ? parseVersion(json.version) : null;
|
|
3533
3576
|
const was = typeof versionBefore === "string" ? parseVersion(versionBefore) : null;
|
|
3534
3577
|
const bumped = before === null || now !== null && was !== null && compareVersions(now, was) > 0;
|
|
3535
|
-
const top = git(ctx.root, ["rev-parse", "--show-toplevel"])?.trim();
|
|
3536
3578
|
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)) : [];
|
|
3537
3579
|
const naming = changesets.filter((p) => existsSync(p) && changesetNames(readFileSync(p, "utf8")).has(json.name));
|
|
3538
3580
|
const named = naming.length > 0;
|
|
@@ -3550,6 +3592,9 @@ function checkChanges(ctx, pkg, json, base, mergeBase) {
|
|
|
3550
3592
|
const registry = (git(ctx.root, ["diff", "--relative", "--name-only", mergeBase, "--", "features.ts", "src/features.ts"]) ?? "").trim();
|
|
3551
3593
|
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` });
|
|
3552
3594
|
}
|
|
3595
|
+
if (bumped && !named && before !== null) {
|
|
3596
|
+
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` });
|
|
3597
|
+
}
|
|
3553
3598
|
if (!bumped && !named) {
|
|
3554
3599
|
ctx.report({
|
|
3555
3600
|
rule: "package-unversioned-change",
|
|
@@ -4346,8 +4391,9 @@ var CONTAINER = /(?:Card|CardContent|Dialog|DialogContent|Sheet|SheetContent|Dra
|
|
|
4346
4391
|
var SWITCHER = /<(TabsList|SubNavTabs)(?=[\s>/])/g;
|
|
4347
4392
|
var SHELL = /<AppShell(?=[\s>/])/;
|
|
4348
4393
|
var GENESIS_PACKAGE2 = /^@marktiderman\/genesis(?:-[\w-]+)?(?:\/|$)/;
|
|
4349
|
-
var PAGE_LAYOUT = /^(?!Breadcrumb)[A-Z]\w*(?:Page|PageShell)$/;
|
|
4350
|
-
var
|
|
4394
|
+
var PAGE_LAYOUT = /^(?:(?!Breadcrumb)[A-Z]\w*(?:Page|PageShell)|ResourceView)$/;
|
|
4395
|
+
var EMBEDDED_RESOURCE_VIEW = /<ResourceView\b[^>]*?\blayout\s*=\s*(?:(["'`]) {8}\1|\{\s*(["'`]) {8}\2\s*\})[^>]*>/g;
|
|
4396
|
+
var PACKAGE_SCREEN = /^(?:(?!Breadcrumb)[A-Z]\w*(?:Page|PageShell|Screen|Workspace)|ResourceView)$/;
|
|
4351
4397
|
var isNative = (ctx) => ctx.config.packs?.includes("native") ?? false;
|
|
4352
4398
|
var rendersRe = (names) => {
|
|
4353
4399
|
const list = [...names];
|
|
@@ -4461,7 +4507,7 @@ function checkPageLayouts(ctx) {
|
|
|
4461
4507
|
const rendersLayout = (code) => {
|
|
4462
4508
|
const names = new Set(layouts);
|
|
4463
4509
|
for (const n of namedImportsFrom(code, GENESIS_PACKAGE2)) if (PACKAGE_SCREEN.test(n)) names.add(n);
|
|
4464
|
-
return rendersRe(names)?.test(code) ?? false;
|
|
4510
|
+
return rendersRe(names)?.test(code.replace(EMBEDDED_RESOURCE_VIEW, "")) ?? false;
|
|
4465
4511
|
};
|
|
4466
4512
|
const cache2 = /* @__PURE__ */ new Map();
|
|
4467
4513
|
const provides = (r) => {
|
|
@@ -4619,6 +4665,6 @@ function formatReport(result) {
|
|
|
4619
4665
|
return lines.join("\n");
|
|
4620
4666
|
}
|
|
4621
4667
|
|
|
4622
|
-
export { CommentSettingsError, DoctorConfigError, GenesisConfigError, defineDoctorPlugin, detectHost, emitContracts, formatReport, introspectOpenApi, introspectPostgres, parseColumnComment, parseTableComment, planScaffold, planStudioInit, readGenesisConfig, runDoctor, runScaffold, validateConsumerName, validateLinks };
|
|
4668
|
+
export { CommentSettingsError, DoctorConfigError, EmitError, GenesisConfigError, defineDoctorPlugin, detectHost, emitContracts, formatReport, introspectOpenApi, introspectPostgres, parseColumnComment, parseTableComment, planScaffold, planStudioInit, readGenesisConfig, runDoctor, runScaffold, validateConsumerName, validateLinks };
|
|
4623
4669
|
//# sourceMappingURL=index.js.map
|
|
4624
4670
|
//# sourceMappingURL=index.js.map
|