@astryxdesign/cli 0.6.7 → 0.6.8-canary.e8160da
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/api/docs/docOverlays.test.mjs +14 -0
- package/api/integration/pack-check.mjs +2 -2
- package/api/integration/pack-check.test.mjs +10 -2
- package/assets/docs/theme.doc.dense.mjs +2 -0
- package/assets/docs/theme.doc.mjs +10 -0
- package/assets/docs/theme.doc.zh.mjs +1 -1
- package/assets/docs/tree/checks.doc.mjs +1 -1
- package/assets/docs/tree/replace-a-core-template.doc.mjs +1 -1
- package/assets/docs/tree/template-doc-overview.doc.mjs +1 -1
- package/assets/docs/tree/troubleshooting.doc.mjs +3 -3
- package/assets/docs/tree/versioning.doc.mjs +2 -2
- package/assets/theme.template.ts +24 -8
- package/authoring/doctypes/template/template.doc.mjs +2 -2
- package/authoring/doctypes/template/type.ts +4 -3
- package/foundation/integrations/cli-requirement.d.mts +21 -10
- package/foundation/integrations/cli-requirement.mjs +25 -13
- package/foundation/integrations/cli-requirement.test.mjs +90 -23
- package/package.json +9 -9
|
@@ -171,4 +171,18 @@ describe('the reported defect: docs tokens --dense (#2182)', () => {
|
|
|
171
171
|
expect(titles).not.toContain('Dark mode');
|
|
172
172
|
expect(titles).toContain('深色模式');
|
|
173
173
|
});
|
|
174
|
+
|
|
175
|
+
it('teaches committed palette references in every theme-doc variant', async () => {
|
|
176
|
+
for (const options of [{}, {dense: true}, {zh: true}]) {
|
|
177
|
+
const result = await docs('theme', null, options);
|
|
178
|
+
const rendered = JSON.stringify(result.data.sections);
|
|
179
|
+
expect(rendered).toContain(
|
|
180
|
+
'astryx theme palette generate palette.config.json --out palette.generated.ts',
|
|
181
|
+
);
|
|
182
|
+
expect(rendered).toContain(
|
|
183
|
+
"import {palette} from './palette.generated';",
|
|
184
|
+
);
|
|
185
|
+
expect(rendered).toContain('palette.neutral.light[100]');
|
|
186
|
+
}
|
|
187
|
+
});
|
|
174
188
|
});
|
|
@@ -1131,8 +1131,8 @@ export async function integrationPackCheck(options = {}) {
|
|
|
1131
1131
|
}
|
|
1132
1132
|
}
|
|
1133
1133
|
// A template that sets `replaces` (spec:AST-035) or `keywords` needs a CLI
|
|
1134
|
-
// that reads the field: an older CLI drops that template and
|
|
1135
|
-
// package's docs.
|
|
1134
|
+
// that reads the field: an older CLI drops that template and can hide the
|
|
1135
|
+
// package's docs. Each field has its own floor.
|
|
1136
1136
|
if (loaded.templates) {
|
|
1137
1137
|
const found = await discoverIntegrationTemplatesForOne(loaded).catch(
|
|
1138
1138
|
() => ({templates: [], errors: []}),
|
|
@@ -1025,9 +1025,11 @@ describe('integrationPackCheck', () => {
|
|
|
1025
1025
|
expect(await codes()).toContain('replaces_needs_cli');
|
|
1026
1026
|
peer('^0.6.0');
|
|
1027
1027
|
expect(await codes()).toContain('replaces_needs_cli');
|
|
1028
|
-
// `replaces
|
|
1029
|
-
peer('>=0.6.
|
|
1028
|
+
// Published 0.6.3 rejects `replaces`; published 0.6.4 applies it.
|
|
1029
|
+
peer('>=0.6.3');
|
|
1030
1030
|
expect(await codes()).toContain('replaces_needs_cli');
|
|
1031
|
+
peer('>=0.6.4');
|
|
1032
|
+
expect(await codes()).not.toContain('replaces_needs_cli');
|
|
1031
1033
|
peer('>=0.7.0');
|
|
1032
1034
|
expect(await codes()).not.toContain('replaces_needs_cli');
|
|
1033
1035
|
}, 120_000);
|
|
@@ -1062,6 +1064,12 @@ describe('integrationPackCheck', () => {
|
|
|
1062
1064
|
expect(await codes()).toContain('keywords_needs_cli');
|
|
1063
1065
|
peer('^0.6.0');
|
|
1064
1066
|
expect(await codes()).toContain('keywords_needs_cli');
|
|
1067
|
+
// Published 0.6.4 and 0.6.5 drop a template that sets `keywords`;
|
|
1068
|
+
// published 0.6.6 reads it.
|
|
1069
|
+
peer('>=0.6.5');
|
|
1070
|
+
expect(await codes()).toContain('keywords_needs_cli');
|
|
1071
|
+
peer('>=0.6.6');
|
|
1072
|
+
expect(await codes()).not.toContain('keywords_needs_cli');
|
|
1065
1073
|
peer('>=0.7.0');
|
|
1066
1074
|
expect(await codes()).not.toContain('keywords_needs_cli');
|
|
1067
1075
|
}, 120_000);
|
|
@@ -17,6 +17,8 @@ export const docsDense = {
|
|
|
17
17
|
title: 'Custom themes',
|
|
18
18
|
content: [
|
|
19
19
|
{type: 'prose', text: '`defineTheme` + token overrides + component overrides. {@link generic:author-a-theme} for full guide.'},
|
|
20
|
+
null,
|
|
21
|
+
{type: 'prose', text: "new palette: `astryx theme palette generate palette.config.json --out palette.generated.ts` → review + commit module and receipt → `import {palette} from './palette.generated';` → map semantic tokens to stable stops such as `palette.neutral.light[100]` / `palette.neutral.dark[15]`. regeneration updates mapped roles; generation does not rewrite the theme."},
|
|
20
22
|
],
|
|
21
23
|
},
|
|
22
24
|
{
|
|
@@ -41,6 +41,16 @@ export const docs = {
|
|
|
41
41
|
label: 'Quick start',
|
|
42
42
|
code: 'astryx theme add stone --import # use an existing theme\nastryx theme eject stone # fork its source to customize\nastryx theme build src/themes/stone/stoneTheme.ts',
|
|
43
43
|
},
|
|
44
|
+
{
|
|
45
|
+
type: 'prose',
|
|
46
|
+
text: 'For a new coordinated color system, run `astryx theme palette generate palette.config.json --out palette.generated.ts`. Review and commit the generated palette module and receipt, import its `palette` export, then reference stable stops from semantic tokens. Regenerating an accepted palette updates every mapped token that keeps those references; generation does not rewrite the theme.',
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
type: 'code',
|
|
50
|
+
lang: 'tsx',
|
|
51
|
+
label: 'Map semantic tokens to generated palette stops',
|
|
52
|
+
code: "import {defineTheme} from '@astryxdesign/core/theme';\nimport {palette} from './palette.generated';\n\nconst myTheme = defineTheme({\n name: 'my-theme',\n tokens: {\n '--color-background-surface': [\n palette.neutral.light[100],\n palette.neutral.dark[15],\n ],\n },\n});",
|
|
53
|
+
},
|
|
44
54
|
],
|
|
45
55
|
},
|
|
46
56
|
{
|
|
@@ -21,7 +21,7 @@ export const docsZh = {
|
|
|
21
21
|
content: [
|
|
22
22
|
{
|
|
23
23
|
type: 'prose',
|
|
24
|
-
text: '使用 `defineTheme`
|
|
24
|
+
text: '使用 `defineTheme` 进行令牌覆盖、比例配置和组件样式覆盖。新建完整调色板时,请运行 `astryx theme palette generate palette.config.json --out palette.generated.ts`,审核并提交生成的模块和收据,再使用 `import {palette} from \'./palette.generated\';` 导入调色板,让语义令牌引用稳定的色阶,例如 `palette.neutral.light[100]` 和 `palette.neutral.dark[15]`。重新生成已接受的调色板时,所有保留这些引用的映射令牌会一并更新;生成操作不会自动修改主题。完整指南请参阅 {@link generic:author-a-theme}。',
|
|
25
25
|
},
|
|
26
26
|
],
|
|
27
27
|
},
|
|
@@ -107,7 +107,7 @@ export const docs = {
|
|
|
107
107
|
'It lists the components, templates, themes, docs, and codemods the temporary app sees, and compares them with your source.',
|
|
108
108
|
"It resolves each component's `import`, and each template's public import, the way Node does, and checks that the module exports the component, or a default export for a template.",
|
|
109
109
|
'For each theme, it rebuilds the source, compares the built module and production CSS with the authored outputs, and proves the module, CSS, and optional font CSS exports resolve from the packed package.',
|
|
110
|
-
'It fails a package that needs an `@astryxdesign/cli` peer and lacks it: `>=0.
|
|
110
|
+
'It fails a package that needs an `@astryxdesign/cli` peer and lacks it: `>=0.6.6` for a template that sets `keywords`, and `>=0.6.4` for a template that sets `replaces`, a docs section, a placed guide, a doc section with an `id`, or a theme.',
|
|
111
111
|
],
|
|
112
112
|
},
|
|
113
113
|
{
|
|
@@ -84,7 +84,7 @@ export const docs = {
|
|
|
84
84
|
},
|
|
85
85
|
{
|
|
86
86
|
type: 'prose',
|
|
87
|
-
text: 'Note: `keywords` needs `@astryxdesign/cli` 0.
|
|
87
|
+
text: 'Note: `keywords` needs `@astryxdesign/cli` 0.6.6 or later. A stable CLI before 0.6.6 rejects the field and drops that template, and one before 0.6.4 also hides your doc topics: `template --list` and `search` print one warning, and `docs` and `build` say nothing. Declare the CLI floor as an optional peer ({@link generic:versioning}); `integration verify` fails until you do.',
|
|
88
88
|
},
|
|
89
89
|
],
|
|
90
90
|
},
|
|
@@ -91,7 +91,7 @@ export const docs = {
|
|
|
91
91
|
],
|
|
92
92
|
[
|
|
93
93
|
'`replaces_needs_cli`: The package has a template that sets `replaces` but declares no @astryxdesign/cli peer.',
|
|
94
|
-
"Run `npm pkg set 'peerDependencies.@astryxdesign/cli=>=0.
|
|
94
|
+
"Run `npm pkg set 'peerDependencies.@astryxdesign/cli=>=0.6.4'` and `npm pkg set 'peerDependenciesMeta.@astryxdesign/cli.optional=true' --json`. A stable CLI before 0.6.4 rejects `replaces`, drops that template, and hides your doc topics.",
|
|
95
95
|
],
|
|
96
96
|
[
|
|
97
97
|
'`component_replaces_needs_cli` (a warning): The package has a component that sets `replaces` but declares no @astryxdesign/cli peer, or a peer range that admits an earlier CLI.',
|
|
@@ -99,7 +99,7 @@ export const docs = {
|
|
|
99
99
|
],
|
|
100
100
|
[
|
|
101
101
|
'`keywords_needs_cli`: The package has a template that sets `keywords` but declares no @astryxdesign/cli peer.',
|
|
102
|
-
|
|
102
|
+
"Run `npm pkg set 'peerDependencies.@astryxdesign/cli=>=0.6.6'` and `npm pkg set 'peerDependenciesMeta.@astryxdesign/cli.optional=true' --json`. A stable CLI before 0.6.6 rejects `keywords` and drops that template, and one before 0.6.4 also hides your doc topics.",
|
|
103
103
|
],
|
|
104
104
|
[
|
|
105
105
|
'`themes_need_cli`: The package ships a theme but declares no @astryxdesign/cli peer.',
|
|
@@ -143,7 +143,7 @@ export const docs = {
|
|
|
143
143
|
],
|
|
144
144
|
[
|
|
145
145
|
'Your docs section, templates, or themes are missing only in some apps',
|
|
146
|
-
'Those apps run a CLI too old to read them: a stable CLI before 0.
|
|
146
|
+
'Those apps run a CLI too old to read them: a stable CLI before 0.6.6 for a template that sets `keywords`, or before 0.6.4 for a template that sets `replaces`, a docs section, or a theme. Update `@astryxdesign/cli` there, and keep your optional `@astryxdesign/cli` peer so npm warns about an old CLI.',
|
|
147
147
|
],
|
|
148
148
|
],
|
|
149
149
|
},
|
|
@@ -110,7 +110,7 @@ export const docs = {
|
|
|
110
110
|
[
|
|
111
111
|
'`@astryxdesign/cli`',
|
|
112
112
|
'You ship a docs section, a placed guide, a template that sets `replaces` or `keywords`, a doc section with an `id`, or a theme',
|
|
113
|
-
'`>=0.
|
|
113
|
+
'`>=0.6.6` when you ship a template that sets `keywords`, otherwise `>=0.6.4`. Optional in `peerDependenciesMeta`',
|
|
114
114
|
],
|
|
115
115
|
],
|
|
116
116
|
},
|
|
@@ -140,7 +140,7 @@ export const docs = {
|
|
|
140
140
|
'An unknown field in `astryx.integration.mjs` is ignored with an `unknown_manifest_key` warning, and the rest of the manifest still loads.',
|
|
141
141
|
'A named export that the CLI does not know is ignored with no warning, so `debug` and `gapReport` are safe to add.',
|
|
142
142
|
'A stable CLI before 0.7.0 prints each `{@link ...}` as written.',
|
|
143
|
-
'
|
|
143
|
+
'Published 0.6.3 and earlier reject a template that sets `replaces` or `keywords`, drop that template, and hide every doc topic your package ships. Published 0.6.4 and 0.6.5 still drop a template that sets `keywords`.',
|
|
144
144
|
'A stable CLI before 0.6.4 cannot read a docs section, a section `id`, or a theme folder that `integration add theme` writes. It can then hide every doc topic your package ships.',
|
|
145
145
|
'Stable 0.6.3 still loads your components, but 0.6.0 cannot read the component docs that `integration add component` writes: `component AcmeCarousel` fails there.',
|
|
146
146
|
],
|
package/assets/theme.template.ts
CHANGED
|
@@ -81,6 +81,7 @@
|
|
|
81
81
|
*/
|
|
82
82
|
|
|
83
83
|
import {defineTheme} from '@astryxdesign/core/theme';
|
|
84
|
+
// import {palette} from './palette.generated';
|
|
84
85
|
// import {dracula} from '@astryxdesign/core/theme/syntax';
|
|
85
86
|
// import {neutralTheme} from '@astryxdesign/theme-neutral';
|
|
86
87
|
|
|
@@ -99,15 +100,25 @@ export const myTheme = defineTheme({
|
|
|
99
100
|
// extends: neutralTheme,
|
|
100
101
|
|
|
101
102
|
// ───────────────────────────────────────────────────────────────────────
|
|
102
|
-
// Scale configs —
|
|
103
|
-
//
|
|
104
|
-
//
|
|
103
|
+
// Scale configs — concise inputs for typography, radius, and motion.
|
|
104
|
+
// The color scale remains supported for existing themes, but it is not the
|
|
105
|
+
// recommended starting point for a new palette; see its note below.
|
|
105
106
|
// ───────────────────────────────────────────────────────────────────────
|
|
106
107
|
|
|
107
108
|
/**
|
|
108
|
-
*
|
|
109
|
-
*
|
|
110
|
-
*
|
|
109
|
+
* Supported compatibility path for existing themes. This expands one accent
|
|
110
|
+
* seed into the neutral ramp, surfaces, text, icons, borders, muted fills,
|
|
111
|
+
* hover and pressed overlays — light and dark both. It is not an accent-only
|
|
112
|
+
* edit.
|
|
113
|
+
*
|
|
114
|
+
* For a new complete palette, run:
|
|
115
|
+
*
|
|
116
|
+
* astryx theme palette generate palette.config.json --out palette.generated.ts
|
|
117
|
+
*
|
|
118
|
+
* Review the generated candidate, then commit the palette module and receipt.
|
|
119
|
+
* Uncomment the `palette` import above and reference its stops from semantic
|
|
120
|
+
* tokens below. Regenerating an accepted palette then updates every mapped
|
|
121
|
+
* token that keeps those references. Generation does not rewrite the theme.
|
|
111
122
|
*
|
|
112
123
|
* accent seed hex, or a [light, dark] pair to seed each scheme's
|
|
113
124
|
* palette from its own colour; omit to keep the default
|
|
@@ -134,7 +145,7 @@ export const myTheme = defineTheme({
|
|
|
134
145
|
* `astryx docs tokens/tokens-color` for every colour token and its light/dark
|
|
135
146
|
* default.
|
|
136
147
|
*/
|
|
137
|
-
color: {accent: '#0064E0', neutralStyle: 'cool', contrast: 'standard'},
|
|
148
|
+
// color: {accent: '#0064E0', neutralStyle: 'cool', contrast: 'standard'},
|
|
138
149
|
|
|
139
150
|
/**
|
|
140
151
|
* Type scale and the three font roles.
|
|
@@ -213,12 +224,17 @@ export const myTheme = defineTheme({
|
|
|
213
224
|
// --color-syntax-* code highlighting · --color-data-* charts
|
|
214
225
|
// ───────────────────────────────────────────────────────────────────────
|
|
215
226
|
tokens: {
|
|
227
|
+
// Keep generated roles connected to the accepted palette. Uncomment the
|
|
228
|
+
// import above, then map each reviewed semantic role this way.
|
|
229
|
+
// '--color-background-surface': [
|
|
230
|
+
// palette.neutral.light[100],
|
|
231
|
+
// palette.neutral.dark[15],
|
|
232
|
+
// ],
|
|
216
233
|
'--color-accent': ['#0064E0', '#2694FE'],
|
|
217
234
|
// Changing an accent means owning its on-colour: this is the label that
|
|
218
235
|
// sits on top of the fill above, in each mode.
|
|
219
236
|
'--color-on-accent': ['#FFFFFF', '#FFFFFF'],
|
|
220
237
|
'--color-background-body': ['#F1F4F7', '#111112'],
|
|
221
|
-
'--color-background-surface': ['#FFFFFF', '#1F1F22'],
|
|
222
238
|
'--focus-outline-color': 'var(--color-accent)',
|
|
223
239
|
'--shadow-low': '0 1px 2px light-dark(#0000001A, #00000066)',
|
|
224
240
|
},
|
|
@@ -56,13 +56,13 @@ export const doc = {
|
|
|
56
56
|
name: 'keywords',
|
|
57
57
|
type: 'string[]',
|
|
58
58
|
description:
|
|
59
|
-
"Search keywords for CLI discovery: the ideas, domains, and other names a builder might use for what the template serves (e.g. ['monitoring', 'uptime', 'on-call'] for a service-health dashboard). Lowercase. `astryx search` matches them as it matches the description and `astryx build` ranks page templates on them, so keep them out of `description`. Integration templates need @astryxdesign/cli 0.
|
|
59
|
+
"Search keywords for CLI discovery: the ideas, domains, and other names a builder might use for what the template serves (e.g. ['monitoring', 'uptime', 'on-call'] for a service-health dashboard). Lowercase. `astryx search` matches them as it matches the description and `astryx build` ranks page templates on them, so keep them out of `description`. Integration templates need @astryxdesign/cli 0.6.6 or later: earlier CLIs reject the field and drop that template, and CLIs before 0.6.4 also hide the package's doc topics.",
|
|
60
60
|
},
|
|
61
61
|
{
|
|
62
62
|
name: 'replaces',
|
|
63
63
|
type: 'string',
|
|
64
64
|
description:
|
|
65
|
-
"Integration templates only: the exact id of the Core template this one replaces for unqualified lookup. Find it with `astryx --json template --list --package @astryxdesign/core`; the Core original stays selectable with `--package @astryxdesign/core`. A page replaces only a Core page and a block only a Core block. Needs @astryxdesign/cli 0.
|
|
65
|
+
"Integration templates only: the exact id of the Core template this one replaces for unqualified lookup. Find it with `astryx --json template --list --package @astryxdesign/core`; the Core original stays selectable with `--package @astryxdesign/core`. A page replaces only a Core page and a block only a Core block. Needs @astryxdesign/cli 0.6.4 or later: earlier CLIs reject the field, drop that template, and hide the package's doc topics.",
|
|
66
66
|
},
|
|
67
67
|
{
|
|
68
68
|
name: 'isReady',
|
|
@@ -32,8 +32,9 @@ export interface BaseTemplateDoc extends AuthoredDocGraphFields {
|
|
|
32
32
|
* `astryx search` matches them as it matches the description, and
|
|
33
33
|
* `astryx build` ranks page templates on them, so the `description` can
|
|
34
34
|
* stay a description of the layout. Integration templates need
|
|
35
|
-
* `@astryxdesign/cli` 0.
|
|
36
|
-
* that template, and hide the package's doc
|
|
35
|
+
* `@astryxdesign/cli` 0.6.6 or later: earlier CLIs reject the field and
|
|
36
|
+
* drop that template, and CLIs before 0.6.4 also hide the package's doc
|
|
37
|
+
* topics. */
|
|
37
38
|
keywords?: string[];
|
|
38
39
|
|
|
39
40
|
/** Optional stable slug override and prior aliases for registry output. */
|
|
@@ -43,7 +44,7 @@ export interface BaseTemplateDoc extends AuthoredDocGraphFields {
|
|
|
43
44
|
* replaces for unqualified lookup (find it with
|
|
44
45
|
* `astryx --json template --list --package @astryxdesign/core`). The Core
|
|
45
46
|
* original stays selectable with `--package @astryxdesign/core`. Needs
|
|
46
|
-
* `@astryxdesign/cli` 0.
|
|
47
|
+
* `@astryxdesign/cli` 0.6.4 or later: earlier CLIs reject the field,
|
|
47
48
|
* drop that template, and hide the package's doc topics. */
|
|
48
49
|
replaces?: string;
|
|
49
50
|
/** Whether this template is ready for use. Templates with
|
|
@@ -30,9 +30,10 @@ export function cliRangeProblem(pkg: any, feature: string, loss: string, floor:
|
|
|
30
30
|
*/
|
|
31
31
|
export function docsTreeCliProblem(pkg: any): string | null;
|
|
32
32
|
/**
|
|
33
|
-
* Why a package with a template that sets `replaces` would lose
|
|
34
|
-
* doc topics on an older CLI (spec:AST-035), or null when its
|
|
35
|
-
* range admits only CLIs that
|
|
33
|
+
* Why a package with a template that sets `replaces` would lose that template
|
|
34
|
+
* and its doc topics on an older CLI (spec:AST-035 FR1), or null when its
|
|
35
|
+
* declared CLI range admits only CLIs that apply the field. Published 0.6.3
|
|
36
|
+
* rejects the field; published 0.6.4 applies it.
|
|
36
37
|
* @param {any} pkg package.json
|
|
37
38
|
* @returns {string | null}
|
|
38
39
|
*/
|
|
@@ -67,9 +68,10 @@ export function sectionIdsCliProblem(pkg: any): string | null;
|
|
|
67
68
|
export function themesCliProblem(pkg: any): string | null;
|
|
68
69
|
/**
|
|
69
70
|
* Why a package with a template that sets `keywords` would lose that template
|
|
70
|
-
*
|
|
71
|
-
*
|
|
72
|
-
*
|
|
71
|
+
* on an older CLI, or null when its declared CLI range admits only CLIs that
|
|
72
|
+
* read the field. Published 0.6.4 and 0.6.5 reject the field and drop that
|
|
73
|
+
* template; 0.6.3 and earlier also hide the package's doc topics. Published
|
|
74
|
+
* 0.6.6 reads it.
|
|
73
75
|
* @param {any} pkg package.json
|
|
74
76
|
* @returns {string | null}
|
|
75
77
|
*/
|
|
@@ -98,11 +100,20 @@ export const CLI_PACKAGE: "@astryxdesign/cli";
|
|
|
98
100
|
*/
|
|
99
101
|
export const NAMESPACE_DOCS_CLI: "0.6.4";
|
|
100
102
|
/**
|
|
101
|
-
* The first CLI release that
|
|
102
|
-
*
|
|
103
|
-
*
|
|
103
|
+
* The first stable CLI release that applies a template's `replaces`
|
|
104
|
+
* (spec:AST-035 FR1). Published 0.6.3 and earlier reject the field, drop that
|
|
105
|
+
* template, and hide every doc topic the package ships. Published 0.6.4 lists
|
|
106
|
+
* the template, keeps the topics, answers the Core id with the replacement,
|
|
107
|
+
* and still selects the Core original with `--package @astryxdesign/core`.
|
|
104
108
|
*/
|
|
105
|
-
export const
|
|
109
|
+
export const TEMPLATE_REPLACES_CLI: "0.6.4";
|
|
110
|
+
/**
|
|
111
|
+
* The first stable CLI release that reads a template's `keywords`. Published
|
|
112
|
+
* 0.6.4 and 0.6.5 reject the field and drop that template but keep the
|
|
113
|
+
* package's doc topics; 0.6.3 and earlier also hide them. Published 0.6.6
|
|
114
|
+
* lists the template, and search matches its keywords.
|
|
115
|
+
*/
|
|
116
|
+
export const KEYWORDS_CLI: "0.6.6";
|
|
106
117
|
/**
|
|
107
118
|
* The first stable CLI release that applies a component's `replaces`
|
|
108
119
|
* (spec:AST-035 FR10). It is also the opt-in: a CLI applies a package's
|
|
@@ -26,11 +26,21 @@ export const CLI_PACKAGE = '@astryxdesign/cli';
|
|
|
26
26
|
export const NAMESPACE_DOCS_CLI = '0.6.4';
|
|
27
27
|
|
|
28
28
|
/**
|
|
29
|
-
* The first CLI release that
|
|
30
|
-
*
|
|
31
|
-
*
|
|
29
|
+
* The first stable CLI release that applies a template's `replaces`
|
|
30
|
+
* (spec:AST-035 FR1). Published 0.6.3 and earlier reject the field, drop that
|
|
31
|
+
* template, and hide every doc topic the package ships. Published 0.6.4 lists
|
|
32
|
+
* the template, keeps the topics, answers the Core id with the replacement,
|
|
33
|
+
* and still selects the Core original with `--package @astryxdesign/core`.
|
|
32
34
|
*/
|
|
33
|
-
export const
|
|
35
|
+
export const TEMPLATE_REPLACES_CLI = '0.6.4';
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* The first stable CLI release that reads a template's `keywords`. Published
|
|
39
|
+
* 0.6.4 and 0.6.5 reject the field and drop that template but keep the
|
|
40
|
+
* package's doc topics; 0.6.3 and earlier also hide them. Published 0.6.6
|
|
41
|
+
* lists the template, and search matches its keywords.
|
|
42
|
+
*/
|
|
43
|
+
export const KEYWORDS_CLI = '0.6.6';
|
|
34
44
|
|
|
35
45
|
/**
|
|
36
46
|
* The first stable CLI release that applies a component's `replaces`
|
|
@@ -166,9 +176,10 @@ export function docsTreeCliProblem(pkg) {
|
|
|
166
176
|
}
|
|
167
177
|
|
|
168
178
|
/**
|
|
169
|
-
* Why a package with a template that sets `replaces` would lose
|
|
170
|
-
* doc topics on an older CLI (spec:AST-035), or null when its
|
|
171
|
-
* range admits only CLIs that
|
|
179
|
+
* Why a package with a template that sets `replaces` would lose that template
|
|
180
|
+
* and its doc topics on an older CLI (spec:AST-035 FR1), or null when its
|
|
181
|
+
* declared CLI range admits only CLIs that apply the field. Published 0.6.3
|
|
182
|
+
* rejects the field; published 0.6.4 applies it.
|
|
172
183
|
* @param {any} pkg package.json
|
|
173
184
|
* @returns {string | null}
|
|
174
185
|
*/
|
|
@@ -177,7 +188,7 @@ export function replacesCliProblem(pkg) {
|
|
|
177
188
|
pkg,
|
|
178
189
|
'has a template that sets `replaces`',
|
|
179
190
|
"rejects the field, drops that template, and hides the package's doc topics",
|
|
180
|
-
|
|
191
|
+
TEMPLATE_REPLACES_CLI,
|
|
181
192
|
);
|
|
182
193
|
}
|
|
183
194
|
|
|
@@ -235,9 +246,10 @@ export function themesCliProblem(pkg) {
|
|
|
235
246
|
|
|
236
247
|
/**
|
|
237
248
|
* Why a package with a template that sets `keywords` would lose that template
|
|
238
|
-
*
|
|
239
|
-
*
|
|
240
|
-
*
|
|
249
|
+
* on an older CLI, or null when its declared CLI range admits only CLIs that
|
|
250
|
+
* read the field. Published 0.6.4 and 0.6.5 reject the field and drop that
|
|
251
|
+
* template; 0.6.3 and earlier also hide the package's doc topics. Published
|
|
252
|
+
* 0.6.6 reads it.
|
|
241
253
|
* @param {any} pkg package.json
|
|
242
254
|
* @returns {string | null}
|
|
243
255
|
*/
|
|
@@ -245,8 +257,8 @@ export function keywordsCliProblem(pkg) {
|
|
|
245
257
|
return cliRangeProblem(
|
|
246
258
|
pkg,
|
|
247
259
|
'has a template that sets `keywords`',
|
|
248
|
-
"rejects the field
|
|
249
|
-
|
|
260
|
+
"rejects the field and drops that template, and one before 0.6.4 also hides the package's doc topics",
|
|
261
|
+
KEYWORDS_CLI,
|
|
250
262
|
);
|
|
251
263
|
}
|
|
252
264
|
|
|
@@ -6,9 +6,10 @@ import {semverCompare} from '../env/semver.mjs';
|
|
|
6
6
|
import * as requirement from './cli-requirement.mjs';
|
|
7
7
|
import {
|
|
8
8
|
COMPONENT_REPLACES_CLI,
|
|
9
|
+
KEYWORDS_CLI,
|
|
9
10
|
NAMESPACE_DOCS_CLI,
|
|
10
|
-
REPLACES_CLI,
|
|
11
11
|
SECTION_IDS_CLI,
|
|
12
|
+
TEMPLATE_REPLACES_CLI,
|
|
12
13
|
cliRangeProblem,
|
|
13
14
|
componentReplacesCliProblem,
|
|
14
15
|
THEMES_CLI,
|
|
@@ -91,20 +92,78 @@ describe('docsTreeCliProblem', () => {
|
|
|
91
92
|
});
|
|
92
93
|
|
|
93
94
|
describe('replacesCliProblem', () => {
|
|
94
|
-
|
|
95
|
+
// Published 0.6.4 applies a template's `replaces`. Published 0.6.3 and
|
|
96
|
+
// earlier reject the field, drop the template, and hide the package's doc
|
|
97
|
+
// topics.
|
|
98
|
+
it('asks a package that sets replaces for a CLI from 0.6.4', () => {
|
|
95
99
|
expect(replacesCliProblem({name: '@acme/kit'})).toContain(
|
|
96
100
|
'sets `replaces`',
|
|
97
101
|
);
|
|
98
|
-
expect(
|
|
99
|
-
|
|
100
|
-
)
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
102
|
+
expect(replacesCliProblem({name: '@acme/kit'})).toContain(
|
|
103
|
+
"A stable CLI before 0.6.4 rejects the field, drops that template, and hides the package's doc topics.",
|
|
104
|
+
);
|
|
105
|
+
for (const range of ['>=0.6.4', '^0.6.4', '>=0.6.5', '>=0.7.0']) {
|
|
106
|
+
expect(
|
|
107
|
+
replacesCliProblem({peerDependencies: {'@astryxdesign/cli': range}}),
|
|
108
|
+
).toBeNull();
|
|
109
|
+
}
|
|
110
|
+
for (const range of ['>=0.6.3', '^0.6.0', '*']) {
|
|
111
|
+
expect(
|
|
112
|
+
replacesCliProblem({peerDependencies: {'@astryxdesign/cli': range}}),
|
|
113
|
+
).toContain('admits a stable CLI before 0.6.4');
|
|
114
|
+
}
|
|
115
|
+
});
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
describe('keywordsCliProblem', () => {
|
|
119
|
+
// Published 0.6.6 reads a template's `keywords`. Published 0.6.4 and 0.6.5
|
|
120
|
+
// reject the field and drop the template; 0.6.3 and earlier also hide the
|
|
121
|
+
// package's doc topics.
|
|
122
|
+
it('asks a package that sets keywords for a CLI from 0.6.6', () => {
|
|
123
|
+
expect(keywordsCliProblem({name: '@acme/kit'})).toContain(
|
|
124
|
+
'sets `keywords`',
|
|
125
|
+
);
|
|
126
|
+
expect(keywordsCliProblem({name: '@acme/kit'})).toContain(
|
|
127
|
+
"A stable CLI before 0.6.6 rejects the field and drops that template, and one before 0.6.4 also hides the package's doc topics.",
|
|
128
|
+
);
|
|
129
|
+
for (const range of ['>=0.6.6', '^0.6.6', '>=0.6.7', '>=0.7.0']) {
|
|
130
|
+
expect(
|
|
131
|
+
keywordsCliProblem({peerDependencies: {'@astryxdesign/cli': range}}),
|
|
132
|
+
).toBeNull();
|
|
133
|
+
}
|
|
134
|
+
for (const range of ['>=0.6.5', '>=0.6.4', '^0.6.4', '^0.6.0']) {
|
|
135
|
+
expect(
|
|
136
|
+
keywordsCliProblem({peerDependencies: {'@astryxdesign/cli': range}}),
|
|
137
|
+
).toContain('admits a stable CLI before 0.6.6');
|
|
138
|
+
}
|
|
139
|
+
});
|
|
140
|
+
});
|
|
141
|
+
|
|
142
|
+
describe('template replaces and keywords floors in the shipped docs', () => {
|
|
143
|
+
// The range an author is told to declare is the range `integration verify`
|
|
144
|
+
// accepts, so following the docs never fails the check or asks for a CLI
|
|
145
|
+
// no release satisfies.
|
|
146
|
+
const read = (/** @type {string} */ file) =>
|
|
147
|
+
fs.readFileSync(new URL(file, import.meta.url), 'utf-8');
|
|
148
|
+
|
|
149
|
+
it('shows the replaces floor in the replace-a-core-template guide', () => {
|
|
150
|
+
const named = [
|
|
151
|
+
...read(
|
|
152
|
+
'../../assets/docs/tree/replace-a-core-template.doc.mjs',
|
|
153
|
+
).matchAll(/"@astryxdesign\/cli":\s*">=(\d+\.\d+\.\d+)"/g),
|
|
154
|
+
].map(match => match[1]);
|
|
155
|
+
expect(named.length).toBeGreaterThan(0);
|
|
156
|
+
expect(new Set(named)).toEqual(new Set([TEMPLATE_REPLACES_CLI]));
|
|
157
|
+
});
|
|
158
|
+
|
|
159
|
+
it.each([
|
|
160
|
+
['`replaces_needs_cli`', TEMPLATE_REPLACES_CLI],
|
|
161
|
+
['`keywords_needs_cli`', KEYWORDS_CLI],
|
|
162
|
+
])('gives the %s fix the floor the check asks for', (code, floor) => {
|
|
163
|
+
const row = read('../../assets/docs/tree/troubleshooting.doc.mjs')
|
|
164
|
+
.split('],')
|
|
165
|
+
.find(part => part.includes(`${code}:`));
|
|
166
|
+
expect(row).toContain(`@astryxdesign/cli=>=${floor}'`);
|
|
108
167
|
});
|
|
109
168
|
});
|
|
110
169
|
|
|
@@ -193,17 +252,17 @@ describe('themesCliProblem and sectionIdsCliProblem', () => {
|
|
|
193
252
|
}
|
|
194
253
|
});
|
|
195
254
|
|
|
196
|
-
it('
|
|
255
|
+
it('gives replaces and keywords their own floors', () => {
|
|
256
|
+
// `>=0.6.4` admits published 0.6.4 and 0.6.5, which drop a template that
|
|
257
|
+
// sets `keywords` but apply one that sets `replaces`.
|
|
197
258
|
const pkg = {peerDependencies: {'@astryxdesign/cli': '>=0.6.4'}};
|
|
198
259
|
expect(docsTreeCliProblem(pkg)).toBeNull();
|
|
199
|
-
expect(replacesCliProblem(pkg)).
|
|
200
|
-
'admits a stable CLI before 0.7.0',
|
|
201
|
-
);
|
|
260
|
+
expect(replacesCliProblem(pkg)).toBeNull();
|
|
202
261
|
expect(keywordsCliProblem(pkg)).toContain(
|
|
203
|
-
'admits a stable CLI before 0.
|
|
262
|
+
'admits a stable CLI before 0.6.6',
|
|
204
263
|
);
|
|
205
264
|
expect(
|
|
206
|
-
keywordsCliProblem({peerDependencies: {'@astryxdesign/cli': '>=0.
|
|
265
|
+
keywordsCliProblem({peerDependencies: {'@astryxdesign/cli': '>=0.6.6'}}),
|
|
207
266
|
).toBeNull();
|
|
208
267
|
});
|
|
209
268
|
|
|
@@ -211,7 +270,13 @@ describe('themesCliProblem and sectionIdsCliProblem', () => {
|
|
|
211
270
|
const {version} = JSON.parse(
|
|
212
271
|
fs.readFileSync(new URL('../../package.json', import.meta.url), 'utf-8'),
|
|
213
272
|
);
|
|
214
|
-
for (const floor of [
|
|
273
|
+
for (const floor of [
|
|
274
|
+
NAMESPACE_DOCS_CLI,
|
|
275
|
+
THEMES_CLI,
|
|
276
|
+
SECTION_IDS_CLI,
|
|
277
|
+
TEMPLATE_REPLACES_CLI,
|
|
278
|
+
KEYWORDS_CLI,
|
|
279
|
+
]) {
|
|
215
280
|
expect(semverCompare(floor, version.split('-')[0])).toBeLessThanOrEqual(
|
|
216
281
|
0,
|
|
217
282
|
);
|
|
@@ -252,8 +317,8 @@ describe('every feature check names its CLI floor', () => {
|
|
|
252
317
|
const FLOORS = {
|
|
253
318
|
componentReplacesCliProblem: COMPONENT_REPLACES_CLI,
|
|
254
319
|
docsTreeCliProblem: '0.6.4',
|
|
255
|
-
replacesCliProblem:
|
|
256
|
-
keywordsCliProblem:
|
|
320
|
+
replacesCliProblem: TEMPLATE_REPLACES_CLI,
|
|
321
|
+
keywordsCliProblem: KEYWORDS_CLI,
|
|
257
322
|
sectionIdsCliProblem: '0.6.4',
|
|
258
323
|
themesCliProblem: '0.6.4',
|
|
259
324
|
};
|
|
@@ -279,8 +344,10 @@ describe('every feature check names its CLI floor', () => {
|
|
|
279
344
|
// Tied to the next patch slot: the first stable release that ships
|
|
280
345
|
// component replacement.
|
|
281
346
|
componentReplacesCliProblem: '0.6.7',
|
|
282
|
-
|
|
283
|
-
|
|
347
|
+
// Measured on published releases: 0.6.4 applies a template's
|
|
348
|
+
// `replaces`, and 0.6.6 reads its `keywords`.
|
|
349
|
+
replacesCliProblem: '0.6.4',
|
|
350
|
+
keywordsCliProblem: '0.6.6',
|
|
284
351
|
});
|
|
285
352
|
});
|
|
286
353
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@astryxdesign/cli",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.8-canary.e8160da",
|
|
4
4
|
"displayName": "CLI",
|
|
5
5
|
"description": "Scaffold projects, browse templates, generate themes, and get agent-ready docs from the command line.",
|
|
6
6
|
"author": "Meta Open Source",
|
|
@@ -101,10 +101,10 @@
|
|
|
101
101
|
"zod": "^4.4.3"
|
|
102
102
|
},
|
|
103
103
|
"peerDependencies": {
|
|
104
|
-
"@astryxdesign/charts": "
|
|
105
|
-
"@astryxdesign/core": "
|
|
106
|
-
"@astryxdesign/lab": "
|
|
107
|
-
"@astryxdesign/theme-neutral": "
|
|
104
|
+
"@astryxdesign/charts": "0.6.8-canary.e8160da",
|
|
105
|
+
"@astryxdesign/core": "0.6.8-canary.e8160da",
|
|
106
|
+
"@astryxdesign/lab": "0.6.8-canary.e8160da",
|
|
107
|
+
"@astryxdesign/theme-neutral": "0.6.8-canary.e8160da"
|
|
108
108
|
},
|
|
109
109
|
"peerDependenciesMeta": {
|
|
110
110
|
"@astryxdesign/charts": {
|
|
@@ -121,10 +121,10 @@
|
|
|
121
121
|
}
|
|
122
122
|
},
|
|
123
123
|
"devDependencies": {
|
|
124
|
-
"@astryxdesign/charts": "
|
|
125
|
-
"@astryxdesign/core": "
|
|
126
|
-
"@astryxdesign/lab": "
|
|
127
|
-
"@astryxdesign/theme-neutral": "
|
|
124
|
+
"@astryxdesign/charts": "0.6.8-canary.e8160da",
|
|
125
|
+
"@astryxdesign/core": "0.6.8-canary.e8160da",
|
|
126
|
+
"@astryxdesign/lab": "0.6.8-canary.e8160da",
|
|
127
|
+
"@astryxdesign/theme-neutral": "0.6.8-canary.e8160da",
|
|
128
128
|
"@heroicons/react": "^2.2.0",
|
|
129
129
|
"@stylexjs/stylex": "^0.19.0",
|
|
130
130
|
"@types/babel__core": "^7.20.5",
|