@shortlink-org/portolan 0.2.0 → 0.2.2
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/cli/init.mjs +14 -6
- package/cli/init.test.mjs +8 -1
- package/cli/portolan.mjs +56 -7
- package/cli/portolan.test.mjs +47 -0
- package/package.json +7 -6
- package/plugins/extract-django/README.md +1 -1
- package/plugins/extract-django/extract_test.py +1 -1
- package/plugins/extract-django/openapi.py +4 -14
- package/plugins/extract-django/openapi_test.py +4 -4
- package/plugins/extract-go/options.schema.json +5 -0
- package/plugins/extract-project/options.schema.json +21 -0
- package/plugins/extract-ts/README.md +1 -1
- package/plugins/extract-ts/clients.ts +1 -1
- package/plugins/extract-ts/extract.test.ts +2 -2
- package/plugins/extract-ts/graphql.test.ts +2 -2
- package/plugins/extract-ts/openapi.test.ts +6 -7
- package/plugins/extract-ts/openapi.ts +3 -10
- package/plugins/portolan-go.wasm +0 -0
- package/public/404-cat-v1.webp +0 -0
- package/public/cat-about-v1.webp +0 -0
- package/public/cat-clear-skies-v1.webp +0 -0
- package/public/cat-no-changes-v1.webp +0 -0
- package/public/cat-onboarding-v1.webp +0 -0
- package/public/cat-trial-success-v1.webp +0 -0
- package/schema/portolan.schema.json +61 -0
- package/scripts/catalog-sources.mjs +12 -1
- package/scripts/catalog-sources.test.mjs +35 -0
- package/scripts/gen-likec4.mjs +242 -85
- package/scripts/gen-likec4.test.mjs +168 -14
- package/scripts/gen.mjs +5 -3
- package/scripts/host-plugins/fetch-git.mjs +22 -12
- package/scripts/host-plugins/fetch-git.test.mjs +25 -5
- package/scripts/local-api.mjs +368 -34
- package/scripts/local-api.test.mjs +197 -2
- package/scripts/package-smoke.mjs +19 -2
- package/scripts/plugin-host.mjs +14 -3
- package/scripts/plugin-host.test.mjs +8 -0
- package/scripts/schema.mjs +7 -0
- package/src/app/CatalogApp.tsx +19 -4
- package/src/app/CommandPalette.tsx +7 -2
- package/src/app/toast.tsx +11 -7
- package/src/catalog.test.ts +33 -0
- package/src/catalog.ts +190 -8
- package/src/components/CatIllustration.tsx +30 -0
- package/src/components/CommitLink.tsx +154 -0
- package/src/components/EditorLink.tsx +15 -8
- package/src/components/GrpcMethodReference.tsx +93 -0
- package/src/components/Markdown.tsx +17 -0
- package/src/components/MethodRows.tsx +8 -1
- package/src/components/PageHeader.test.ts +24 -0
- package/src/components/PageHeader.tsx +34 -0
- package/src/components/ShapeRows.tsx +12 -0
- package/src/components/SourceDoc.tsx +27 -12
- package/src/components/SourcePreview.tsx +124 -36
- package/src/enrich.test.ts +209 -2
- package/src/enrich.ts +284 -15
- package/src/er/RedisSchema.tsx +86 -5
- package/src/flow/FlowTable.tsx +19 -4
- package/src/flow/StepDetail.tsx +461 -101
- package/src/flow/StepRail.tsx +36 -13
- package/src/flow/answers-response.test.ts +100 -0
- package/src/flow/answers.ts +11 -8
- package/src/flow/chapters.ts +2 -1
- package/src/flow/labels.ts +10 -0
- package/src/flow/mermaid.test.ts +87 -3
- package/src/flow/mermaid.ts +26 -14
- package/src/index.css +132 -0
- package/src/landing/LandingPage.tsx +12 -8
- package/src/lib/api.test.ts +4 -6
- package/src/lib/build-info.test.ts +29 -0
- package/src/lib/build-info.ts +21 -0
- package/src/lib/data-model.ts +14 -0
- package/src/lib/flow-tree.ts +1 -1
- package/src/lib/github-catalog.test.ts +51 -0
- package/src/lib/github-catalog.ts +69 -0
- package/src/lib/grpc-reference.test.ts +72 -0
- package/src/lib/grpc-reference.ts +117 -0
- package/src/lib/local-api.ts +17 -4
- package/src/lib/product.ts +7 -0
- package/src/lib/queries.ts +16 -1
- package/src/lib/readme-assets.test.ts +19 -0
- package/src/lib/readme-assets.ts +34 -0
- package/src/lib/setup-info.test.ts +7 -0
- package/src/lib/setup-info.ts +5 -0
- package/src/lib/source-link.test.ts +106 -18
- package/src/lib/source-link.ts +22 -6
- package/src/merge.test.ts +55 -0
- package/src/merge.ts +30 -0
- package/src/pages/AdrDetail.tsx +3 -2
- package/src/pages/AdrIndex.tsx +10 -7
- package/src/pages/AggregatePage.tsx +34 -4
- package/src/pages/BlockPage.tsx +39 -32
- package/src/pages/Changes.tsx +7 -9
- package/src/pages/ContextMap.tsx +11 -2
- package/src/pages/ContextPage.tsx +11 -4
- package/src/pages/FlowIndex.tsx +16 -7
- package/src/pages/GraphPage.tsx +21 -7
- package/src/pages/Language.tsx +9 -9
- package/src/pages/NotFound.tsx +58 -15
- package/src/pages/Overview.tsx +6 -0
- package/src/pages/Problems.tsx +10 -8
- package/src/pages/RegistryIndex.tsx +10 -8
- package/src/pages/ServicePage.tsx +1 -1
- package/src/pages/Settings.tsx +382 -44
- package/src/routes.test.ts +2 -0
- package/src/routes.ts +2 -1
- package/src/selection/DetailPanel.tsx +213 -113
- package/src/testing/setup.ts +14 -0
- package/vite.config.ts +5 -1
|
@@ -37,7 +37,11 @@ export async function loadCatalog(manifestPath = "portolan.json", { exclude = []
|
|
|
37
37
|
if (!excluded.has(normalize(path))) paths.push(path);
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
-
|
|
40
|
+
const emptyWorkspace = Array.isArray(manifest.projects)
|
|
41
|
+
&& manifest.projects.length === 0
|
|
42
|
+
&& (manifest.extract ?? []).length === 0
|
|
43
|
+
&& (manifest.verify ?? []).length === 0;
|
|
44
|
+
if (paths.length === 0 && !emptyWorkspace) {
|
|
41
45
|
throw new Error(
|
|
42
46
|
`${manifestPath}: no catalog matched ${JSON.stringify(patterns)}`,
|
|
43
47
|
);
|
|
@@ -49,6 +53,13 @@ export async function loadCatalog(manifestPath = "portolan.json", { exclude = []
|
|
|
49
53
|
catalog: JSON.parse(readFileSync(path, "utf8")),
|
|
50
54
|
})),
|
|
51
55
|
);
|
|
56
|
+
if (paths.length === 0) {
|
|
57
|
+
// An intentionally empty workspace still needs a valid, deterministic
|
|
58
|
+
// catalog value for generators and the local preview. These are state
|
|
59
|
+
// markers, not provenance claims: there is no source file to stamp.
|
|
60
|
+
merged.catalog.generatedAt = "1970-01-01T00:00:00Z";
|
|
61
|
+
merged.catalog.commit = "empty";
|
|
62
|
+
}
|
|
52
63
|
|
|
53
64
|
// The edges the flows imply are added before validation, the same way the
|
|
54
65
|
// app does it, so a generator draws the same estate the reader sees.
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { mkdtempSync, rmSync, writeFileSync } from "node:fs";
|
|
2
|
+
import { tmpdir } from "node:os";
|
|
3
|
+
import { join } from "node:path";
|
|
4
|
+
import { afterEach, describe, expect, it } from "vitest";
|
|
5
|
+
|
|
6
|
+
import { loadCatalog } from "./catalog-sources.mjs";
|
|
7
|
+
|
|
8
|
+
const roots = [];
|
|
9
|
+
afterEach(() => {
|
|
10
|
+
for (const root of roots.splice(0)) rmSync(root, { recursive: true, force: true });
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
function manifest(value) {
|
|
14
|
+
const root = mkdtempSync(join(tmpdir(), "portolan-empty-catalog-"));
|
|
15
|
+
roots.push(root);
|
|
16
|
+
const path = join(root, "portolan.json");
|
|
17
|
+
writeFileSync(path, `${JSON.stringify(value, null, 2)}\n`);
|
|
18
|
+
return { path, missing: join(root, "portolan/*.json") };
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
describe("catalog sources", () => {
|
|
22
|
+
it("loads an intentional empty workspace as an empty catalog", async () => {
|
|
23
|
+
const { path, missing } = manifest({ sources: [], projects: [], extract: [], verify: [] });
|
|
24
|
+
writeFileSync(path, `${JSON.stringify({ sources: [missing], projects: [], extract: [], verify: [] }, null, 2)}\n`);
|
|
25
|
+
const loaded = await loadCatalog(path);
|
|
26
|
+
expect(loaded.sources).toEqual([]);
|
|
27
|
+
expect(loaded.catalog).toMatchObject({ contexts: [], defs: {}, flows: [], adrs: [] });
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
it("still reports missing sources for a configured project", async () => {
|
|
31
|
+
const { path, missing } = manifest({ sources: [], projects: [] });
|
|
32
|
+
writeFileSync(path, `${JSON.stringify({ sources: [missing], projects: [{ id: "billing" }], extract: [] }, null, 2)}\n`);
|
|
33
|
+
await expect(loadCatalog(path)).rejects.toThrow(/no catalog matched/);
|
|
34
|
+
});
|
|
35
|
+
});
|