@astryxdesign/cli 0.7.3-canary.f94e962 → 0.7.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/CHANGELOG.md +115 -0
- package/README.md +68 -68
- package/api/build/_adapter.mjs +37 -25
- package/api/build/blocks/blocks.d.mts +68 -18
- package/api/build/blocks/blocks.mjs +475 -116
- package/api/build/blocks/blocks.test.mjs +191 -61
- package/api/build/blocks/blocks.weights.json +1 -1
- package/api/build/build.type.mjs +1 -1
- package/api/build/kit/answer.d.mts +9 -5
- package/api/build/kit/answer.mjs +123 -13
- package/api/build/kit/answer.test.mjs +73 -3
- package/api/build/kit/signals.d.mts +19 -0
- package/api/build/kit/signals.mjs +18 -7
- package/api/build/kit/weights.d.mts +8 -22
- package/api/build/kit/weights.mjs +87 -8
- package/api/build/kit/weights.test.mjs +96 -0
- package/api/build/tree.mjs +2 -1
- package/api/build/tree.test.mjs +37 -29
- package/api/component/_adapter.mjs +39 -5
- package/api/component/component-replacement.test.mjs +1 -0
- package/api/component/component.mjs +1 -1
- package/api/component/doc-links.test.mjs +2 -2
- package/api/discover/_adapter.d.mts +1 -2
- package/api/discover/_adapter.mjs +6 -8
- package/api/discover/discover.mjs +0 -1
- package/api/docs/_adapter.d.mts +2 -2
- package/api/docs/_adapter.mjs +65 -18
- package/api/docs/docs-homes.test.mjs +127 -0
- package/api/docs/docs.doc.mjs +3 -3
- package/api/docs/docs.test.mjs +28 -18
- package/api/docs/integration-tree.test.mjs +20 -20
- package/api/docs/integrationDocs.test.mjs +1 -1
- package/api/docs/namespace-section.test.mjs +6 -6
- package/api/docs/reference-blocks.test.mjs +2 -2
- package/api/doctor/_adapter.d.mts +33 -13
- package/api/doctor/_adapter.mjs +55 -25
- package/api/doctor/doctor.d.mts +23 -5
- package/api/doctor/doctor.mjs +97 -28
- package/api/doctor/doctor.test.mjs +67 -9
- package/api/hook/hook.mjs +1 -1
- package/api/integration/validate-integration-fixes.test.mjs +6 -5
- package/api/integration/validate-integration-gaps.test.mjs +12 -1
- package/api/integration/validate-integration.d.mts +4 -0
- package/api/integration/validate-integration.mjs +48 -7
- package/api/integration/validate-integration.type.d.mts +36 -5
- package/api/integration/validate-integration.type.mjs +27 -6
- package/api/integration/validateIntegration.doc.mjs +1 -1
- package/api/search/_adapter.d.mts +16 -0
- package/api/search/_adapter.mjs +39 -0
- package/api/search/_adapter.test.mjs +173 -0
- package/api/search/_candidate-score.mjs +1 -1
- package/api/search/_entries.d.mts +11 -0
- package/api/search/_entries.mjs +35 -17
- package/api/search/_entries.test.mjs +48 -0
- package/api/search/_gather-docs.mjs +3 -3
- package/api/search/_gather-templates.d.mts +0 -1
- package/api/search/_gather-templates.mjs +25 -0
- package/api/search/search.doc.mjs +1 -1
- package/api/search/search.integration-block.test.mjs +100 -0
- package/api/search/search.mjs +6 -2
- package/api/search/search.test.mjs +14 -14
- package/api/template/template.mjs +5 -1
- package/assets/docs/author-a-theme.doc.mjs +2 -2
- package/assets/docs/tree/add-a-component.doc.mjs +1 -1
- package/assets/docs/tree/add-a-theme.doc.mjs +1 -1
- package/assets/docs/tree/add-a-topic.doc.mjs +1 -1
- package/assets/docs/tree/agent-guidance.doc.mjs +1 -1
- package/assets/docs/tree/{integrations.doc.mjs → authoring.doc.mjs} +15 -6
- package/assets/docs/tree/block-template.doc.mjs +1 -1
- package/assets/docs/tree/build-the-template.doc.mjs +1 -1
- package/assets/docs/tree/building-blocks.doc.mjs +2 -2
- package/assets/docs/tree/check-the-props.doc.mjs +1 -1
- package/assets/docs/tree/check-your-docs.doc.mjs +2 -2
- package/assets/docs/tree/checks.doc.mjs +2 -2
- package/assets/docs/tree/ci-and-containers.doc.mjs +13 -0
- package/assets/docs/tree/cli-command.doc.mjs +1 -1
- package/assets/docs/tree/cli.doc.mjs +1 -1
- package/assets/docs/tree/codemods.doc.mjs +1 -1
- package/assets/docs/tree/component-family.doc.mjs +1 -1
- package/assets/docs/tree/component-imports.doc.mjs +1 -1
- package/assets/docs/tree/components.doc.mjs +1 -1
- package/assets/docs/tree/configuration.doc.mjs +1 -1
- package/assets/docs/tree/debug-and-gap-reports.doc.mjs +1 -1
- package/assets/docs/tree/define-the-theme.doc.mjs +1 -1
- package/assets/docs/tree/describe-the-component.doc.mjs +1 -1
- package/assets/docs/tree/docs.doc.mjs +1 -1
- package/assets/docs/tree/document-the-template.doc.mjs +1 -1
- package/assets/docs/tree/document-the-theme.doc.mjs +1 -1
- package/assets/docs/tree/export-template-assets.doc.mjs +1 -1
- package/assets/docs/tree/extend-or-replace.doc.mjs +1 -1
- package/assets/docs/{authoring.doc.mjs → tree/field-reference.doc.mjs} +4 -3
- package/assets/docs/tree/fonts-and-assets.doc.mjs +1 -1
- package/assets/docs/tree/generate-a-palette.doc.mjs +1 -1
- package/assets/docs/tree/global-integrations.doc.mjs +2 -2
- package/assets/docs/tree/grade-template-with-agent.doc.mjs +4 -4
- package/assets/docs/tree/help.doc.mjs +2 -2
- package/assets/docs/tree/links.doc.mjs +1 -1
- package/assets/docs/tree/package-and-test.doc.mjs +1 -1
- package/assets/docs/tree/page-template.doc.mjs +1 -1
- package/assets/docs/tree/publishing.doc.mjs +1 -1
- package/assets/docs/tree/quick-start.doc.mjs +1 -1
- package/assets/docs/tree/replace-a-core-component.doc.mjs +1 -1
- package/assets/docs/tree/replace-a-core-template.doc.mjs +1 -1
- package/assets/docs/tree/sections-and-placement.doc.mjs +1 -1
- package/assets/docs/tree/see-it-in-an-app.doc.mjs +1 -1
- package/assets/docs/tree/ship.doc.mjs +2 -2
- package/assets/docs/tree/short-and-findable.doc.mjs +1 -1
- package/assets/docs/tree/single-component.doc.mjs +1 -1
- package/assets/docs/tree/start-a-template.doc.mjs +1 -1
- package/assets/docs/tree/subcomponent.doc.mjs +1 -1
- package/assets/docs/tree/template-assets.doc.mjs +1 -1
- package/assets/docs/tree/template-doc-overview.doc.mjs +2 -2
- package/assets/docs/tree/template-fonts.doc.mjs +1 -1
- package/assets/docs/tree/template-grading-rubric.doc.mjs +1 -1
- package/assets/docs/tree/template-icons.doc.mjs +1 -1
- package/assets/docs/tree/template-images-media.doc.mjs +1 -1
- package/assets/docs/tree/template-styles.doc.mjs +1 -1
- package/assets/docs/tree/templates.doc.mjs +1 -1
- package/assets/docs/tree/test-in-an-app.doc.mjs +1 -1
- package/assets/docs/tree/test-template-in-app.doc.mjs +1 -1
- package/assets/docs/tree/themes.doc.mjs +1 -1
- package/assets/docs/tree/troubleshooting.doc.mjs +1 -1
- package/assets/docs/tree/upgrading.doc.mjs +1 -1
- package/assets/docs/tree/use-a-theme-in-an-app.doc.mjs +1 -1
- package/assets/docs/tree/verify-packed-template.doc.mjs +1 -1
- package/assets/docs/tree/versioning.doc.mjs +5 -1
- package/assets/docs/tree/write-good-templates.doc.mjs +1 -1
- package/assets/docs/tree/write-the-template-file.doc.mjs +1 -1
- package/assets/docs/use-integrations.doc.mjs +120 -0
- package/authoring/doctypes/schema/schema.doc.mjs +1 -1
- package/authoring/integration/integration.doc.mjs +1 -1
- package/authoring/integration/type.ts +1 -1
- package/clients/cli/command-result-coverage.test.mjs +6 -5
- package/clients/cli/commands/build-theme.color-scheme.test.mjs +1 -1
- package/clients/cli/commands/{component/index.mjs → component.mjs} +37 -37
- package/clients/cli/commands/component.test.mjs +6 -6
- package/clients/cli/commands/docs.doc.mjs +2 -2
- package/clients/cli/commands/docs.mjs +1 -1
- package/clients/cli/commands/docs.test.mjs +14 -14
- package/clients/cli/commands/doctor-integration.test.mjs +49 -1
- package/clients/cli/commands/doctor.doc.mjs +1 -1
- package/clients/cli/commands/doctor.mjs +10 -0
- package/clients/cli/commands/{hook/index.mjs → hook.mjs} +22 -22
- package/clients/cli/commands/import-hint-correctness.test.mjs +1 -1
- package/clients/cli/commands/integration.doc.mjs +1 -1
- package/clients/cli/commands/manifest.doc.mjs +1 -1
- package/clients/cli/commands/manifest.mjs +67 -0
- package/clients/cli/commands/outside-project.test.mjs +99 -0
- package/clients/cli/commands/postinstall.doc.mjs +23 -0
- package/clients/cli/commands/postinstall.mjs +31 -0
- package/clients/cli/commands/setup-nudge.test.mjs +17 -0
- package/clients/cli/commands/{build-theme.mjs → theme.mjs} +1 -1
- package/clients/cli/index.mjs +35 -93
- package/clients/cli/lib/component-format.mjs +1 -1
- package/clients/cli/lib/define-command.mjs +12 -7
- package/clients/cli/lib/exit-codes.test.mjs +5 -0
- package/clients/cli/lib/manifest.test.mjs +12 -0
- package/clients/cli/lib/welcome-box.mjs +50 -0
- package/foundation/agent-docs/agent-doc-state.d.mts +12 -0
- package/foundation/agent-docs/agent-doc-state.mjs +24 -2
- package/foundation/agent-docs/agent-docs.mjs +7 -6
- package/foundation/agent-docs/agent-docs.test.mjs +5 -4
- package/foundation/agent-docs/computer-agent-text.d.mts +39 -2
- package/foundation/agent-docs/computer-agent-text.mjs +135 -8
- package/foundation/agent-docs/computer-agent-text.test.mjs +99 -2
- package/foundation/discovery/authoring-self-docs.d.mts +7 -0
- package/foundation/discovery/authoring-self-docs.mjs +16 -4
- package/foundation/discovery/authoring-self-docs.test.mjs +15 -3
- package/foundation/discovery/authoring-surface.d.mts +1 -1
- package/foundation/discovery/authoring-surface.mjs +2 -2
- package/foundation/discovery/authoring-surface.test.mjs +1 -1
- package/foundation/discovery/cli-self-docs.d.mts +2 -1
- package/foundation/discovery/cli-self-docs.mjs +4 -3
- package/foundation/discovery/cli-self-docs.test.mjs +2 -2
- package/foundation/discovery/runner-commands.mjs +1 -0
- package/foundation/discovery/stray-pointers.test.mjs +1 -1
- package/foundation/doc-compiler/doc-loads.test.mjs +21 -9
- package/foundation/doc-compiler/split-topic-keywords.test.mjs +3 -2
- package/foundation/doc-compiler/tree.d.mts +32 -6
- package/foundation/doc-compiler/tree.mjs +77 -43
- package/foundation/doc-compiler/tree.test.mjs +7 -7
- package/foundation/fs/read-record.d.mts +18 -0
- package/foundation/fs/read-record.mjs +131 -0
- package/foundation/fs/read-record.test.mjs +77 -0
- package/foundation/integrations/cli-peer-version.d.mts +36 -0
- package/foundation/integrations/cli-peer-version.mjs +132 -0
- package/foundation/integrations/cli-peer-version.test.mjs +354 -0
- package/foundation/integrations/exports-subpaths.d.mts +57 -0
- package/foundation/integrations/exports-subpaths.mjs +113 -0
- package/foundation/integrations/public-imports.d.mts +118 -0
- package/foundation/integrations/public-imports.mjs +1769 -0
- package/foundation/integrations/public-imports.test.mjs +1793 -0
- package/foundation/release/cache.test.mjs +24 -21
- package/foundation/release/global-state.d.mts +8 -4
- package/foundation/release/global-state.mjs +4 -2
- package/foundation/release/notices.d.mts +62 -8
- package/foundation/release/notices.mjs +136 -25
- package/foundation/release/notices.test.mjs +21 -0
- package/foundation/response/response-types.doc.mjs +1 -1
- package/foundation/text/string-utils.d.mts +2 -1
- package/foundation/text/string-utils.mjs +16 -5
- package/foundation/text/suggest-order.d.mts +72 -0
- package/foundation/text/suggest-order.mjs +363 -0
- package/foundation/text/suggest-order.test.mjs +259 -0
- package/package.json +9 -9
|
@@ -102,7 +102,15 @@ const RUNNERS = {
|
|
|
102
102
|
runs: SELF_DOCS,
|
|
103
103
|
sites: ['import ../../../api/blog/blog.doc.mjs', 'import ./blog.doc.mjs'],
|
|
104
104
|
},
|
|
105
|
-
'clients/cli/commands/
|
|
105
|
+
'clients/cli/commands/manifest.mjs': {
|
|
106
|
+
runs: SELF_DOCS,
|
|
107
|
+
sites: ['import ./manifest.doc.mjs'],
|
|
108
|
+
},
|
|
109
|
+
'clients/cli/commands/postinstall.mjs': {
|
|
110
|
+
runs: SELF_DOCS,
|
|
111
|
+
sites: ['import ./postinstall.doc.mjs'],
|
|
112
|
+
},
|
|
113
|
+
'clients/cli/commands/theme.mjs': {
|
|
106
114
|
runs: `${SELF_DOCS}; and \`astryx theme build\`, a child process per theme`,
|
|
107
115
|
sites: [
|
|
108
116
|
'child_process.spawn',
|
|
@@ -135,11 +143,11 @@ const RUNNERS = {
|
|
|
135
143
|
'import ./build.doc.mjs',
|
|
136
144
|
],
|
|
137
145
|
},
|
|
138
|
-
'clients/cli/commands/component
|
|
146
|
+
'clients/cli/commands/component.mjs': {
|
|
139
147
|
runs: SELF_DOCS,
|
|
140
148
|
sites: [
|
|
141
|
-
'import
|
|
142
|
-
'import
|
|
149
|
+
'import ../../../api/component/component.doc.mjs',
|
|
150
|
+
'import ./component.doc.mjs',
|
|
143
151
|
],
|
|
144
152
|
},
|
|
145
153
|
'clients/cli/commands/discover.mjs': {
|
|
@@ -180,11 +188,11 @@ const RUNNERS = {
|
|
|
180
188
|
'import ./gap-report.doc.mjs',
|
|
181
189
|
],
|
|
182
190
|
},
|
|
183
|
-
'clients/cli/commands/hook
|
|
191
|
+
'clients/cli/commands/hook.mjs': {
|
|
184
192
|
runs: SELF_DOCS,
|
|
185
193
|
sites: [
|
|
186
|
-
'import
|
|
187
|
-
'import
|
|
194
|
+
'import ../../../api/hook/hook.doc.mjs',
|
|
195
|
+
'import ./hook.doc.mjs',
|
|
188
196
|
],
|
|
189
197
|
},
|
|
190
198
|
'clients/cli/commands/init.mjs': {
|
|
@@ -233,8 +241,8 @@ const RUNNERS = {
|
|
|
233
241
|
],
|
|
234
242
|
},
|
|
235
243
|
'clients/cli/index.mjs': {
|
|
236
|
-
runs: 'the command modules, to register each command
|
|
237
|
-
sites: ['import
|
|
244
|
+
runs: 'the command modules, to register each command',
|
|
245
|
+
sites: ['import(<computed>)'],
|
|
238
246
|
},
|
|
239
247
|
'clients/cli/lib/manifest.mjs': {
|
|
240
248
|
runs: 'the manifest command doc, for the exit codes the manifest reports',
|
|
@@ -323,6 +331,10 @@ const RUNNERS = {
|
|
|
323
331
|
'require.cache',
|
|
324
332
|
],
|
|
325
333
|
},
|
|
334
|
+
'foundation/fs/read-record.mjs': {
|
|
335
|
+
runs: "nothing; it wraps node:fs's read calls to record the paths an operation reads, and republishes them to ESM imports",
|
|
336
|
+
sites: ['module.syncBuiltinESMExports'],
|
|
337
|
+
},
|
|
326
338
|
'foundation/fs/paths.mjs': {
|
|
327
339
|
runs: "Yarn's pnpapi, under Plug'n'Play, to find an installed package",
|
|
328
340
|
sites: ['require(pnpapi)'],
|
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
/**
|
|
4
4
|
* @file A topic split into a namespace of guides indexes each term once, a
|
|
5
5
|
* policy of the docs split itself (no spec clause states it). Below the CLI's own
|
|
6
|
-
* root namespaces (every one but `cli`, its command and API reference
|
|
6
|
+
* root namespaces (every one but `cli`, its command and API reference, and
|
|
7
|
+
* `authoring`, the integration guides `cli` held before this rule), a
|
|
7
8
|
* guide's search keywords are its own: none repeats a keyword its namespace,
|
|
8
9
|
* a sibling, or a guide of another split topic declares. A term several
|
|
9
10
|
* guides share belongs to their namespace, or to none.
|
|
@@ -45,7 +46,7 @@ describe('the keywords of a split topic', () => {
|
|
|
45
46
|
return doc?.name;
|
|
46
47
|
};
|
|
47
48
|
const roots = [...docs.values()]
|
|
48
|
-
.filter(doc => doc.type === 'namespace' && !parentOf(doc) && doc.name
|
|
49
|
+
.filter(doc => doc.type === 'namespace' && !parentOf(doc) && !['cli', 'authoring'].includes(doc.name))
|
|
49
50
|
.map(doc => doc.name);
|
|
50
51
|
expect(roots).toContain('layout');
|
|
51
52
|
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* the one adoption rule in its package that matches its group and kind. A
|
|
10
10
|
* placement that fails withdraws the doc; it never falls back to adoption. A
|
|
11
11
|
* doc with neither is a flat topic: it keeps its flat name as its route, and its
|
|
12
|
-
* home is the generated
|
|
12
|
+
* home is the generated level for its category. The CLI keeps its own routes: an
|
|
13
13
|
* integration's node that would take one is withdrawn with a diagnostic.
|
|
14
14
|
*
|
|
15
15
|
* @param {{namespaces: TreeNamespaceInput[], docs: TreeDocInput[], topics?: TreeTopicInput[]}} inputs
|
|
@@ -117,19 +117,39 @@ export const KIND_GROUPS: Readonly<Record<string, {
|
|
|
117
117
|
*/
|
|
118
118
|
/**
|
|
119
119
|
* A flat topic: a reference topic that no namespace places. The tree gives it
|
|
120
|
-
* a home in the generated
|
|
120
|
+
* a home in the generated level for its category (Guides or Foundations),
|
|
121
|
+
* under its own name.
|
|
121
122
|
* @typedef {object} TreeTopicInput
|
|
122
123
|
* @property {string} provider the package that owns the topic
|
|
123
124
|
* @property {string} providerId the provider's ProviderId
|
|
124
125
|
* @property {string} name the topic's name, which stays its route
|
|
125
126
|
* @property {string} title
|
|
126
127
|
* @property {string} summary
|
|
128
|
+
* @property {string | null} [category] the topic's sidebar group:
|
|
129
|
+
* `foundations` puts it in Foundations; anything else, in Guides
|
|
127
130
|
* @property {string} source where the topic comes from, for diagnostics
|
|
128
131
|
* @property {string[]} [aliases] every other name the topic answers to: the
|
|
129
132
|
* topics it replaced, directly or through a chain
|
|
130
133
|
*/
|
|
131
|
-
/**
|
|
132
|
-
|
|
134
|
+
/**
|
|
135
|
+
* The generated levels that hold the flat topics, by category
|
|
136
|
+
* (spec:AST-046 FR12). A topic keeps its own name as its route; its level is
|
|
137
|
+
* only where it sits. Readers see these titles in a topic's path, so each is
|
|
138
|
+
* a plain name for what the topics are.
|
|
139
|
+
*/
|
|
140
|
+
export const TOPIC_LEVELS: Readonly<{
|
|
141
|
+
guides: Readonly<{
|
|
142
|
+
route: "guides";
|
|
143
|
+
title: "Guides";
|
|
144
|
+
summary: "Guides that stand on their own: getting started, principles, theming, and working with AI. Each topic keeps its own name; open one by it.";
|
|
145
|
+
}>;
|
|
146
|
+
foundations: Readonly<{
|
|
147
|
+
route: "foundations";
|
|
148
|
+
title: "Foundations";
|
|
149
|
+
summary: "Color, elevation, icons, illustrations, motion, shape, and spacing: the visual foundations every component builds on. Each topic keeps its own name; open one by it.";
|
|
150
|
+
}>;
|
|
151
|
+
}>;
|
|
152
|
+
export function topicLevel(category: string | null | undefined): "guides" | "foundations";
|
|
133
153
|
export type NamespaceDoc = import("../../authoring/doctypes/namespace/type").NamespaceDoc;
|
|
134
154
|
export type DocPlacement = import("../../authoring/doctypes/base/type").DocPlacement;
|
|
135
155
|
export type CompilerDiagnostic = import("./diagnostics.mjs").CompilerDiagnostic;
|
|
@@ -200,7 +220,8 @@ export type TreeSlot = {
|
|
|
200
220
|
};
|
|
201
221
|
/**
|
|
202
222
|
* A flat topic: a reference topic that no namespace places. The tree gives it
|
|
203
|
-
* a home in the generated
|
|
223
|
+
* a home in the generated level for its category (Guides or Foundations),
|
|
224
|
+
* under its own name.
|
|
204
225
|
*/
|
|
205
226
|
export type TreeTopicInput = {
|
|
206
227
|
/**
|
|
@@ -217,6 +238,11 @@ export type TreeTopicInput = {
|
|
|
217
238
|
name: string;
|
|
218
239
|
title: string;
|
|
219
240
|
summary: string;
|
|
241
|
+
/**
|
|
242
|
+
* the topic's sidebar group:
|
|
243
|
+
* `foundations` puts it in Foundations; anything else, in Guides
|
|
244
|
+
*/
|
|
245
|
+
category?: string | null | undefined;
|
|
220
246
|
/**
|
|
221
247
|
* where the topic comes from, for diagnostics
|
|
222
248
|
*/
|
|
@@ -265,7 +291,7 @@ export type TreeNode = {
|
|
|
265
291
|
order: number | null;
|
|
266
292
|
/**
|
|
267
293
|
* made by the compiler (a `groupBy: 'kind'`
|
|
268
|
-
* level, or
|
|
294
|
+
* level, or a flat topics' level), not authored
|
|
269
295
|
*/
|
|
270
296
|
generated: boolean;
|
|
271
297
|
/**
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
* @position Between discovery and the readers: `astryx docs <route>`,
|
|
13
13
|
* `astryx doctor`, and the docsite build all read this tree. The CLI's docs
|
|
14
14
|
* and each integration's have a home here, and a flat topic's home is the
|
|
15
|
-
* generated
|
|
15
|
+
* generated level for its category: Guides or Foundations.
|
|
16
16
|
* A namespace never scans files and never lists its children: a child names
|
|
17
17
|
* its parent, or a namespace adopts a discovery group.
|
|
18
18
|
*/
|
|
@@ -113,20 +113,49 @@ export const KIND_GROUPS = Object.freeze({
|
|
|
113
113
|
|
|
114
114
|
/**
|
|
115
115
|
* A flat topic: a reference topic that no namespace places. The tree gives it
|
|
116
|
-
* a home in the generated
|
|
116
|
+
* a home in the generated level for its category (Guides or Foundations),
|
|
117
|
+
* under its own name.
|
|
117
118
|
* @typedef {object} TreeTopicInput
|
|
118
119
|
* @property {string} provider the package that owns the topic
|
|
119
120
|
* @property {string} providerId the provider's ProviderId
|
|
120
121
|
* @property {string} name the topic's name, which stays its route
|
|
121
122
|
* @property {string} title
|
|
122
123
|
* @property {string} summary
|
|
124
|
+
* @property {string | null} [category] the topic's sidebar group:
|
|
125
|
+
* `foundations` puts it in Foundations; anything else, in Guides
|
|
123
126
|
* @property {string} source where the topic comes from, for diagnostics
|
|
124
127
|
* @property {string[]} [aliases] every other name the topic answers to: the
|
|
125
128
|
* topics it replaced, directly or through a chain
|
|
126
129
|
*/
|
|
127
130
|
|
|
128
|
-
/**
|
|
129
|
-
|
|
131
|
+
/**
|
|
132
|
+
* The generated levels that hold the flat topics, by category
|
|
133
|
+
* (spec:AST-046 FR12). A topic keeps its own name as its route; its level is
|
|
134
|
+
* only where it sits. Readers see these titles in a topic's path, so each is
|
|
135
|
+
* a plain name for what the topics are.
|
|
136
|
+
*/
|
|
137
|
+
export const TOPIC_LEVELS = Object.freeze({
|
|
138
|
+
guides: Object.freeze({
|
|
139
|
+
route: 'guides',
|
|
140
|
+
title: 'Guides',
|
|
141
|
+
summary:
|
|
142
|
+
'Guides that stand on their own: getting started, principles, theming, and working with AI. Each topic keeps its own name; open one by it.',
|
|
143
|
+
}),
|
|
144
|
+
foundations: Object.freeze({
|
|
145
|
+
route: 'foundations',
|
|
146
|
+
title: 'Foundations',
|
|
147
|
+
summary:
|
|
148
|
+
'Color, elevation, icons, illustrations, motion, shape, and spacing: the visual foundations every component builds on. Each topic keeps its own name; open one by it.',
|
|
149
|
+
}),
|
|
150
|
+
});
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* The generated level a flat topic sits in.
|
|
154
|
+
* @param {string | null | undefined} category
|
|
155
|
+
* @returns {'guides' | 'foundations'}
|
|
156
|
+
*/
|
|
157
|
+
export const topicLevel = category =>
|
|
158
|
+
category === 'foundations' ? 'foundations' : 'guides';
|
|
130
159
|
|
|
131
160
|
/**
|
|
132
161
|
* @typedef {object} TreeNode
|
|
@@ -145,7 +174,7 @@ export const UNORGANIZED = 'unorganized';
|
|
|
145
174
|
* @property {string | null} slot the parent slot this node sits in
|
|
146
175
|
* @property {number | null} order
|
|
147
176
|
* @property {boolean} generated made by the compiler (a `groupBy: 'kind'`
|
|
148
|
-
* level, or
|
|
177
|
+
* level, or a flat topics' level), not authored
|
|
149
178
|
* @property {TreeSlot[]} slots a namespace's slots; empty for a leaf
|
|
150
179
|
* @property {string} source
|
|
151
180
|
* @property {any} [ref]
|
|
@@ -216,7 +245,7 @@ function resolveParent(parent, provider, declared) {
|
|
|
216
245
|
* the one adoption rule in its package that matches its group and kind. A
|
|
217
246
|
* placement that fails withdraws the doc; it never falls back to adoption. A
|
|
218
247
|
* doc with neither is a flat topic: it keeps its flat name as its route, and its
|
|
219
|
-
* home is the generated
|
|
248
|
+
* home is the generated level for its category. The CLI keeps its own routes: an
|
|
220
249
|
* integration's node that would take one is withdrawn with a diagnostic.
|
|
221
250
|
*
|
|
222
251
|
* @param {{namespaces: TreeNamespaceInput[], docs: TreeDocInput[], topics?: TreeTopicInput[]}} inputs
|
|
@@ -237,10 +266,15 @@ export function buildDocsTree({namespaces, docs, topics = []}) {
|
|
|
237
266
|
);
|
|
238
267
|
|
|
239
268
|
// Routes the CLI's own docs keep (spec:AST-046 FR11): the name of each of
|
|
240
|
-
// its flat topics, and the generated
|
|
241
|
-
// theirs by rank, because they go into the tree first.
|
|
242
|
-
// without case, as topic names do, so `CLI` claims `cli`.
|
|
243
|
-
|
|
269
|
+
// its flat topics, and the generated levels that hold flat topics. Its
|
|
270
|
+
// namespaces keep theirs by rank, because they go into the tree first.
|
|
271
|
+
// Routes compare without case, as topic names do, so `CLI` claims `cli`.
|
|
272
|
+
/** @type {Set<string>} */
|
|
273
|
+
const cliRoutes = new Set(
|
|
274
|
+
topics.length > 0
|
|
275
|
+
? Object.values(TOPIC_LEVELS).map(level => level.route)
|
|
276
|
+
: [],
|
|
277
|
+
);
|
|
244
278
|
for (const topic of topics) {
|
|
245
279
|
if (topic.provider === CLI_PROVIDER)
|
|
246
280
|
cliRoutes.add(topic.name.toLowerCase());
|
|
@@ -592,20 +626,21 @@ export function buildDocsTree({namespaces, docs, topics = []}) {
|
|
|
592
626
|
);
|
|
593
627
|
}
|
|
594
628
|
|
|
595
|
-
// The generated
|
|
596
|
-
//
|
|
597
|
-
// tree. A topic keeps its own name as its route.
|
|
598
|
-
|
|
629
|
+
// The generated levels (spec:AST-046 FR12): every flat topic sits in the
|
|
630
|
+
// level for its category, in the order the topic list reads, so every doc
|
|
631
|
+
// has a named home in the tree. A topic keeps its own name as its route.
|
|
632
|
+
for (const [key, level] of Object.entries(TOPIC_LEVELS)) {
|
|
633
|
+
const members = topics.filter(topic => topicLevel(topic.category) === key);
|
|
634
|
+
if (members.length === 0) continue;
|
|
599
635
|
const home = {
|
|
600
636
|
id: null,
|
|
601
|
-
route:
|
|
637
|
+
route: level.route,
|
|
602
638
|
kind: 'namespace',
|
|
603
639
|
provider: CLI_PROVIDER,
|
|
604
640
|
providerId: CLI_PROVIDER_ID,
|
|
605
|
-
name:
|
|
606
|
-
title:
|
|
607
|
-
summary:
|
|
608
|
-
'Every topic that no section places yet. Each keeps its own name; open one by it.',
|
|
641
|
+
name: level.route,
|
|
642
|
+
title: level.title,
|
|
643
|
+
summary: level.summary,
|
|
609
644
|
parent: null,
|
|
610
645
|
slot: null,
|
|
611
646
|
order: null,
|
|
@@ -613,30 +648,29 @@ export function buildDocsTree({namespaces, docs, topics = []}) {
|
|
|
613
648
|
slots: [{name: 'topics', title: 'Topics', children: []}],
|
|
614
649
|
source: 'generated',
|
|
615
650
|
};
|
|
616
|
-
if (addNode(home, {provider: CLI_PROVIDER, source: 'generated'}))
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
}
|
|
651
|
+
if (!addNode(home, {provider: CLI_PROVIDER, source: 'generated'})) continue;
|
|
652
|
+
members.forEach((topic, i) => {
|
|
653
|
+
addNode(
|
|
654
|
+
{
|
|
655
|
+
id: createDocId(topic.providerId, 'generic', topic.name),
|
|
656
|
+
route: topic.name,
|
|
657
|
+
kind: 'generic',
|
|
658
|
+
provider: topic.provider,
|
|
659
|
+
providerId: topic.providerId,
|
|
660
|
+
name: topic.name,
|
|
661
|
+
title: topic.title,
|
|
662
|
+
summary: topic.summary,
|
|
663
|
+
parent: level.route,
|
|
664
|
+
slot: 'topics',
|
|
665
|
+
order: i,
|
|
666
|
+
generated: false,
|
|
667
|
+
slots: [],
|
|
668
|
+
source: topic.source,
|
|
669
|
+
ref: {flatTopic: topic.name},
|
|
670
|
+
},
|
|
671
|
+
topic,
|
|
672
|
+
);
|
|
673
|
+
});
|
|
640
674
|
}
|
|
641
675
|
|
|
642
676
|
// Children, per slot, in reading order: order, then title, then id.
|
|
@@ -154,21 +154,21 @@ describe('buildDocsTree', () => {
|
|
|
154
154
|
source: `${provider}/${name}.doc.mjs`,
|
|
155
155
|
});
|
|
156
156
|
const cliNs = {...ns('cli'), provider: CLI, providerId: CLI, source: `${CLI}/tree/cli.doc.mjs`};
|
|
157
|
-
// An integration's topics named `CLI` and `
|
|
158
|
-
// namespace and
|
|
157
|
+
// An integration's topics named `CLI` and `GUIDES` claim the CLI's
|
|
158
|
+
// namespace and a generated level; both are withdrawn.
|
|
159
159
|
const tree = buildDocsTree({
|
|
160
160
|
namespaces: [cliNs],
|
|
161
161
|
docs: [],
|
|
162
|
-
topics: [topic('theme', CLI), topic('CLI'), topic('
|
|
162
|
+
topics: [topic('theme', CLI), topic('CLI'), topic('GUIDES')],
|
|
163
163
|
});
|
|
164
164
|
expect(tree.get('cli')?.provider).toBe(CLI);
|
|
165
|
-
expect(tree.get('
|
|
165
|
+
expect(tree.get('guides')?.provider).toBe(CLI);
|
|
166
166
|
expect(routes(tree)).not.toContain('CLI');
|
|
167
|
-
expect(routes(tree)).not.toContain('
|
|
167
|
+
expect(routes(tree)).not.toContain('GUIDES');
|
|
168
168
|
expect(problems(tree)).toEqual(
|
|
169
169
|
expect.arrayContaining([
|
|
170
170
|
['duplicate_route', expect.stringContaining('both have the route "CLI"')],
|
|
171
|
-
['duplicate_route', expect.stringContaining('takes the route "
|
|
171
|
+
['duplicate_route', expect.stringContaining('takes the route "GUIDES", which the CLI\'s own docs keep')],
|
|
172
172
|
]),
|
|
173
173
|
);
|
|
174
174
|
// It names both docs as their authors know them, never by artifact id,
|
|
@@ -502,7 +502,7 @@ describe("the CLI's own docs tree", () => {
|
|
|
502
502
|
async () => {
|
|
503
503
|
const tree = await loadDocsTree({fresh: true});
|
|
504
504
|
expect(tree.diagnostics).toEqual([]);
|
|
505
|
-
expect(tree.roots().map(node => node.route)).toEqual(['cli', 'global', 'internationalization', 'layout', 'migration', 'styling', 'styling-libraries', 'tokens', 'typography']);
|
|
505
|
+
expect(tree.roots().map(node => node.route)).toEqual(['authoring', 'cli', 'global', 'internationalization', 'layout', 'migration', 'styling', 'styling-libraries', 'tokens', 'typography']);
|
|
506
506
|
// Every slot child is a node one level below the namespace that places
|
|
507
507
|
// it, and every node but the root is placed. Read from the tree, so a
|
|
508
508
|
// restructure of the guides does not need this test edited.
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
// @generated by scripts/sync-api-types.mjs from the JSDoc in foundation/**/*.mjs.
|
|
2
|
+
// DO NOT EDIT — run `pnpm sync:api-types` to regenerate.
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Whether every recorded path is still in the state it had when it was read.
|
|
6
|
+
* @param {Map<string, string>} recorded - From recordReads.
|
|
7
|
+
* @returns {boolean}
|
|
8
|
+
*/
|
|
9
|
+
export function unchangedSince(recorded: Map<string, string>): boolean;
|
|
10
|
+
/**
|
|
11
|
+
* Run `fn`, adding to `seen` each path it reads, with that path's state when
|
|
12
|
+
* it was first read (see the file header).
|
|
13
|
+
* @template T
|
|
14
|
+
* @param {Map<string, string>} seen
|
|
15
|
+
* @param {() => T} fn
|
|
16
|
+
* @returns {T}
|
|
17
|
+
*/
|
|
18
|
+
export function recordReads<T>(seen: Map<string, string>, fn: () => T): T;
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @file Which files and folders an operation read, so a long-running caller
|
|
5
|
+
* can tell whether its inputs changed since.
|
|
6
|
+
*
|
|
7
|
+
* @input An operation run inside `recordReads(seen, fn)`.
|
|
8
|
+
* @output `seen` gets every file whose content the operation read through fs
|
|
9
|
+
* and every folder it listed or probed, each with its state when first
|
|
10
|
+
* read; `unchangedSince(seen)` says whether all are still in that state.
|
|
11
|
+
* @position Used by search's adapter to reuse a gathered catalog only while
|
|
12
|
+
* it is exact. Outside `recordReads` nothing is recorded and every fs call
|
|
13
|
+
* behaves as before.
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
import {AsyncLocalStorage} from 'node:async_hooks';
|
|
17
|
+
import {createRequire, syncBuiltinESMExports} from 'node:module';
|
|
18
|
+
import * as path from 'node:path';
|
|
19
|
+
import {fileURLToPath} from 'node:url';
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* The paths the running operation touched: every file it read and every
|
|
23
|
+
* folder it listed or probed.
|
|
24
|
+
* @type {AsyncLocalStorage<Map<string, string>>}
|
|
25
|
+
*/
|
|
26
|
+
const reads = new AsyncLocalStorage();
|
|
27
|
+
|
|
28
|
+
/** node:fs's module object, whose functions every import of it shares. */
|
|
29
|
+
const fs = createRequire(import.meta.url)('node:fs');
|
|
30
|
+
|
|
31
|
+
/** The fs reads whose path argument is recorded. */
|
|
32
|
+
const RECORDED = [
|
|
33
|
+
'readFileSync',
|
|
34
|
+
'readdirSync',
|
|
35
|
+
'statSync',
|
|
36
|
+
'lstatSync',
|
|
37
|
+
'existsSync',
|
|
38
|
+
'realpathSync',
|
|
39
|
+
'accessSync',
|
|
40
|
+
'openSync',
|
|
41
|
+
];
|
|
42
|
+
|
|
43
|
+
/** The reads that see a file's content, so the file itself is checked. */
|
|
44
|
+
const CONTENT_READS = new Set(['readFileSync', 'openSync']);
|
|
45
|
+
|
|
46
|
+
let recording = false;
|
|
47
|
+
|
|
48
|
+
/** fs.statSync as loaded, before installRecorder wraps it. */
|
|
49
|
+
const statSyncRaw = fs.statSync;
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Wrap fs's read calls once so that, inside `reads.run`, each path they are
|
|
53
|
+
* given is added to that run's set. Outside a run they behave exactly as
|
|
54
|
+
* before.
|
|
55
|
+
*/
|
|
56
|
+
function installRecorder() {
|
|
57
|
+
if (recording) return;
|
|
58
|
+
recording = true;
|
|
59
|
+
for (const name of RECORDED) {
|
|
60
|
+
const original = fs[name];
|
|
61
|
+
if (typeof original !== 'function') continue;
|
|
62
|
+
/**
|
|
63
|
+
* @this {unknown}
|
|
64
|
+
* @param {...any} args
|
|
65
|
+
*/
|
|
66
|
+
const wrapped = function (...args) {
|
|
67
|
+
const seen = reads.getStore();
|
|
68
|
+
const target = args[0];
|
|
69
|
+
if (seen && (typeof target === 'string' || target instanceof URL)) {
|
|
70
|
+
const file =
|
|
71
|
+
typeof target === 'string'
|
|
72
|
+
? path.resolve(target)
|
|
73
|
+
: fileURLToPath(target);
|
|
74
|
+
// A file read is checked itself; a probe or listing is checked by its
|
|
75
|
+
// folder, whose time changes when an entry is added, removed or
|
|
76
|
+
// renamed.
|
|
77
|
+
const checked =
|
|
78
|
+
CONTENT_READS.has(name) || name === 'readdirSync'
|
|
79
|
+
? file
|
|
80
|
+
: path.dirname(file);
|
|
81
|
+
// Its state is taken when it is first read, before the read, so a
|
|
82
|
+
// change made while the operation runs shows as a change afterwards.
|
|
83
|
+
if (!seen.has(checked)) seen.set(checked, stateOf(checked));
|
|
84
|
+
}
|
|
85
|
+
return original.apply(this, args);
|
|
86
|
+
};
|
|
87
|
+
Object.assign(wrapped, original);
|
|
88
|
+
fs[name] = wrapped;
|
|
89
|
+
}
|
|
90
|
+
// ESM imports of node:fs see the wrapped functions too.
|
|
91
|
+
syncBuiltinESMExports();
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* One path's state: its change time and size, or that it is absent.
|
|
96
|
+
* @param {string} file
|
|
97
|
+
* @returns {string}
|
|
98
|
+
*/
|
|
99
|
+
function stateOf(file) {
|
|
100
|
+
try {
|
|
101
|
+
const stat = statSyncRaw(file);
|
|
102
|
+
return `${stat.mtimeMs}\0${stat.size}`;
|
|
103
|
+
} catch {
|
|
104
|
+
return '-';
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* Whether every recorded path is still in the state it had when it was read.
|
|
110
|
+
* @param {Map<string, string>} recorded - From recordReads.
|
|
111
|
+
* @returns {boolean}
|
|
112
|
+
*/
|
|
113
|
+
export function unchangedSince(recorded) {
|
|
114
|
+
for (const [file, state] of recorded) {
|
|
115
|
+
if (stateOf(file) !== state) return false;
|
|
116
|
+
}
|
|
117
|
+
return true;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* Run `fn`, adding to `seen` each path it reads, with that path's state when
|
|
122
|
+
* it was first read (see the file header).
|
|
123
|
+
* @template T
|
|
124
|
+
* @param {Map<string, string>} seen
|
|
125
|
+
* @param {() => T} fn
|
|
126
|
+
* @returns {T}
|
|
127
|
+
*/
|
|
128
|
+
export function recordReads(seen, fn) {
|
|
129
|
+
installRecorder();
|
|
130
|
+
return reads.run(seen, fn);
|
|
131
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @file Tests for read-record: which paths an operation read, and whether
|
|
5
|
+
* any changed since, including a change made while the operation ran.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import {describe, it, expect} from 'vitest';
|
|
9
|
+
import * as fs from 'node:fs';
|
|
10
|
+
import * as os from 'node:os';
|
|
11
|
+
import * as path from 'node:path';
|
|
12
|
+
import {recordReads, unchangedSince} from './read-record.mjs';
|
|
13
|
+
|
|
14
|
+
function scratch() {
|
|
15
|
+
const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'astryx-read-record-'));
|
|
16
|
+
const file = path.join(dir, 'doc.txt');
|
|
17
|
+
fs.writeFileSync(file, 'one');
|
|
18
|
+
return {dir, file};
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
describe('recordReads', () => {
|
|
22
|
+
it('records a read file and a listed folder, and sees them unchanged', () => {
|
|
23
|
+
const {dir, file} = scratch();
|
|
24
|
+
/** @type {Map<string, string>} */
|
|
25
|
+
const seen = new Map();
|
|
26
|
+
recordReads(seen, () => {
|
|
27
|
+
fs.readFileSync(file, 'utf8');
|
|
28
|
+
fs.readdirSync(dir);
|
|
29
|
+
});
|
|
30
|
+
expect([...seen.keys()]).toEqual(expect.arrayContaining([file, dir]));
|
|
31
|
+
expect(unchangedSince(seen)).toBe(true);
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
it('sees an edit made after the operation', () => {
|
|
35
|
+
const {file} = scratch();
|
|
36
|
+
/** @type {Map<string, string>} */
|
|
37
|
+
const seen = new Map();
|
|
38
|
+
recordReads(seen, () => fs.readFileSync(file, 'utf8'));
|
|
39
|
+
const later = new Date(Date.now() + 5_000);
|
|
40
|
+
fs.writeFileSync(file, 'two, longer');
|
|
41
|
+
fs.utimesSync(file, later, later);
|
|
42
|
+
expect(unchangedSince(seen)).toBe(false);
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
it('sees an edit made while the operation ran, after the file was read', () => {
|
|
46
|
+
const {file} = scratch();
|
|
47
|
+
/** @type {Map<string, string>} */
|
|
48
|
+
const seen = new Map();
|
|
49
|
+
recordReads(seen, () => {
|
|
50
|
+
fs.readFileSync(file, 'utf8');
|
|
51
|
+
const later = new Date(Date.now() + 5_000);
|
|
52
|
+
fs.writeFileSync(file, 'edited mid-run');
|
|
53
|
+
fs.utimesSync(file, later, later);
|
|
54
|
+
});
|
|
55
|
+
expect(unchangedSince(seen)).toBe(false);
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
it('sees a file added to a folder it probed', () => {
|
|
59
|
+
const {dir} = scratch();
|
|
60
|
+
/** @type {Map<string, string>} */
|
|
61
|
+
const seen = new Map();
|
|
62
|
+
recordReads(seen, () => fs.existsSync(path.join(dir, 'missing.txt')));
|
|
63
|
+
const later = new Date(Date.now() + 5_000);
|
|
64
|
+
fs.writeFileSync(path.join(dir, 'missing.txt'), 'now here');
|
|
65
|
+
fs.utimesSync(dir, later, later);
|
|
66
|
+
expect(unchangedSince(seen)).toBe(false);
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
it('records nothing outside an operation', () => {
|
|
70
|
+
const {file} = scratch();
|
|
71
|
+
/** @type {Map<string, string>} */
|
|
72
|
+
const seen = new Map();
|
|
73
|
+
recordReads(seen, () => {});
|
|
74
|
+
fs.readFileSync(file, 'utf8');
|
|
75
|
+
expect(seen.size).toBe(0);
|
|
76
|
+
});
|
|
77
|
+
});
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
// @generated by scripts/sync-api-types.mjs from the JSDoc in foundation/**/*.mjs.
|
|
2
|
+
// DO NOT EDIT — run `pnpm sync:api-types` to regenerate.
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* The running CLI version.
|
|
6
|
+
* @returns {string}
|
|
7
|
+
*/
|
|
8
|
+
export function cliVersion(): string;
|
|
9
|
+
/**
|
|
10
|
+
* Why the running CLI is outside an integration's declared
|
|
11
|
+
* `@astryxdesign/cli` peer range, or null when it is inside it (or when no
|
|
12
|
+
* peer is declared or the package.json cannot be read).
|
|
13
|
+
*
|
|
14
|
+
* A CLI below the range is told to upgrade Core and the CLI together, with
|
|
15
|
+
* the project's own install command, and then to run the upgrade codemods.
|
|
16
|
+
* A CLI above it (the range has an upper bound, such as `^0.6.0`) is
|
|
17
|
+
* told to look for a release of the package that supports it, since
|
|
18
|
+
* upgrading the CLI cannot help there; the author of the package in the
|
|
19
|
+
* current folder is told to test with this CLI and widen the range.
|
|
20
|
+
*
|
|
21
|
+
* @param {import('./integrations.mjs').LoadedIntegration} integration
|
|
22
|
+
* @param {string} [version] the running CLI version; defaults to this CLI's
|
|
23
|
+
* own package.json version
|
|
24
|
+
* @param {string} [cwd] where the install command would run; decides the
|
|
25
|
+
* package manager it names
|
|
26
|
+
* @param {{own?: boolean, from?: string}} [options] `own`: the package is
|
|
27
|
+
* the one being authored in the current folder, so above the range its
|
|
28
|
+
* author is told to test with this CLI and widen the range instead; `from`:
|
|
29
|
+
* the version the project's upgrade starts from when it is not the running
|
|
30
|
+
* CLI's, such as the Core of a project with no CLI of its own
|
|
31
|
+
* @returns {string | null}
|
|
32
|
+
*/
|
|
33
|
+
export function cliPeerVersionProblem(integration: import("./integrations.mjs").LoadedIntegration, version?: string, cwd?: string, { own, from }?: {
|
|
34
|
+
own?: boolean;
|
|
35
|
+
from?: string;
|
|
36
|
+
}): string | null;
|