@astryxdesign/cli 0.6.6-canary.9613feb → 0.6.6-canary.c4df65c
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 +83 -83
- package/api/build/_adapter.d.mts +15 -0
- package/api/build/_adapter.mjs +22 -0
- package/api/build/build.doc.mjs +1 -1
- package/api/build/build.type.d.mts +4 -0
- package/api/build/build.type.mjs +1 -0
- package/api/build/help/help.mjs +1 -1
- package/api/build/kit/kit.mjs +12 -1
- package/api/doctor/_adapter.d.mts +7 -0
- package/api/doctor/_adapter.mjs +48 -0
- package/api/doctor/doctor.mjs +5 -3
- package/api/doctor/theme-checks.d.mts +12 -0
- package/api/doctor/theme-checks.mjs +115 -1
- package/api/doctor/theme-checks.test.mjs +142 -1
- package/api/init/run/run.mjs +1 -0
- package/api/layout/check/check.d.mts +1 -0
- package/api/layout/check/check.mjs +1 -0
- package/api/layout/expand/expand.d.mts +1 -0
- package/api/layout/expand/expand.mjs +1 -0
- package/api/layout/grammar/grammar.d.mts +1 -0
- package/api/layout/grammar/grammar.mjs +1 -0
- package/api/layout/layoutCheck.doc.mjs +1 -1
- package/api/layout/layoutExpand.doc.mjs +1 -1
- package/api/layout/layoutGrammar.doc.mjs +1 -1
- package/api/template/copy/copy.mjs +12 -0
- package/api/template/template.doc.mjs +1 -1
- package/api/template/template.type.d.mts +3 -0
- package/api/template/template.type.mjs +3 -0
- package/api/theme/build/build.mjs +2 -0
- package/assets/docs/author-a-theme.doc.mjs +1 -1
- package/assets/docs/styling-overview.doc.mjs +1 -1
- package/assets/docs/theme.doc.dense.mjs +1 -1
- package/assets/templates/pages/table-comparison/template.doc.mjs +1 -1
- package/authoring/doctypes/template/type.ts +1 -0
- package/clients/cli/commands/build-theme.mjs +4 -2
- package/clients/cli/commands/build.mjs +1 -0
- package/clients/cli/commands/doctor.doc.mjs +1 -1
- package/clients/cli/commands/layout-check.doc.mjs +1 -0
- package/clients/cli/commands/layout-expand.doc.mjs +1 -0
- package/clients/cli/commands/layout-grammar.doc.mjs +1 -0
- package/clients/cli/commands/layout.deprecation-lifecycle.test.mjs +140 -0
- package/clients/cli/commands/layout.doc.mjs +1 -0
- package/clients/cli/commands/layout.mjs +6 -11
- package/clients/cli/commands/template.mjs +2 -1
- package/clients/cli/lib/define-command.mjs +4 -0
- package/foundation/agent-docs/agent-docs.mjs +4 -1
- package/foundation/agent-docs/agent-docs.test.mjs +18 -0
- package/foundation/discovery/template-needs.d.mts +31 -0
- package/foundation/discovery/template-needs.mjs +156 -0
- package/foundation/discovery/template-needs.test.mjs +203 -0
- package/foundation/response/response-types.doc.mjs +4 -4
- package/package.json +9 -9
|
@@ -1,6 +1,18 @@
|
|
|
1
1
|
// @generated by scripts/sync-api-types.mjs from the JSDoc in api/**/*.mjs.
|
|
2
2
|
// DO NOT EDIT — run `pnpm sync:api-types` to regenerate.
|
|
3
3
|
|
|
4
|
+
/**
|
|
5
|
+
* The `themes` check that every released doctor report carries. Its id is
|
|
6
|
+
* stable, so it stays beside the app-theme checks. Without a generated theme
|
|
7
|
+
* module it reports what it always has: whether an `@astryxdesign/theme-*`
|
|
8
|
+
* package is installed, and whether the app's package.json names a theme in
|
|
9
|
+
* `astryx.theme`. With a generated module it reports the overall result of the
|
|
10
|
+
* app-theme checks.
|
|
11
|
+
* @param {string} cwd
|
|
12
|
+
* @param {DoctorCheck[]} appChecks - the checks {@link checkAppThemes} returned
|
|
13
|
+
* @returns {DoctorCheck}
|
|
14
|
+
*/
|
|
15
|
+
export function checkThemes(cwd: string, appChecks: DoctorCheck[]): DoctorCheck;
|
|
4
16
|
/**
|
|
5
17
|
* Run all ten app-theme checks.
|
|
6
18
|
* @param {string} cwd
|
|
@@ -17,6 +17,7 @@ import {
|
|
|
17
17
|
findDoctorCoreDir,
|
|
18
18
|
findDoctorInstalledPackage,
|
|
19
19
|
isLocalThemeOwner,
|
|
20
|
+
listDoctorThemePackages,
|
|
20
21
|
listProjectSourceFiles,
|
|
21
22
|
planThemeAppWrite,
|
|
22
23
|
readPackageJson,
|
|
@@ -52,6 +53,8 @@ const CHECKS = [
|
|
|
52
53
|
['theme-global-rules', 'Cross-theme global CSS rules'],
|
|
53
54
|
];
|
|
54
55
|
|
|
56
|
+
const APP_THEME_CHECK_IDS = new Set(CHECKS.map(([id]) => id));
|
|
57
|
+
|
|
55
58
|
/**
|
|
56
59
|
* @param {string} message
|
|
57
60
|
* @param {Error|null} [moduleError]
|
|
@@ -385,6 +388,117 @@ function unmigratedCopyCheck(projectDir) {
|
|
|
385
388
|
};
|
|
386
389
|
}
|
|
387
390
|
|
|
391
|
+
/**
|
|
392
|
+
* Whether the app's package.json names a theme in `astryx.theme`.
|
|
393
|
+
* @param {string} cwd
|
|
394
|
+
*/
|
|
395
|
+
function appPackageNamesTheme(cwd) {
|
|
396
|
+
let state;
|
|
397
|
+
try {
|
|
398
|
+
state = readThemeState(cwd);
|
|
399
|
+
} catch {
|
|
400
|
+
return false;
|
|
401
|
+
}
|
|
402
|
+
const pkg = readPackageJson(state.packageFile);
|
|
403
|
+
return Boolean(pkg?.astryx?.theme);
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
/**
|
|
407
|
+
* The `themes` check that every released doctor report carries. Its id is
|
|
408
|
+
* stable, so it stays beside the app-theme checks. Without a generated theme
|
|
409
|
+
* module it reports what it always has: whether an `@astryxdesign/theme-*`
|
|
410
|
+
* package is installed, and whether the app's package.json names a theme in
|
|
411
|
+
* `astryx.theme`. With a generated module it reports the overall result of the
|
|
412
|
+
* app-theme checks.
|
|
413
|
+
* @param {string} cwd
|
|
414
|
+
* @param {DoctorCheck[]} appChecks - the checks {@link checkAppThemes} returned
|
|
415
|
+
* @returns {DoctorCheck}
|
|
416
|
+
*/
|
|
417
|
+
export function checkThemes(cwd, appChecks) {
|
|
418
|
+
const label = 'Theme packages';
|
|
419
|
+
const managed = appChecks.some(
|
|
420
|
+
check => APP_THEME_CHECK_IDS.has(check.id) && check.status !== 'info',
|
|
421
|
+
);
|
|
422
|
+
if (managed) {
|
|
423
|
+
// A check passes only on its own evidence, so the rollup passes only when
|
|
424
|
+
// every check it summarizes passed. An `info` result here means a check
|
|
425
|
+
// could not prove its evidence.
|
|
426
|
+
const needsWork = appChecks.filter(
|
|
427
|
+
check => check.status === 'fail' || check.status === 'warn',
|
|
428
|
+
);
|
|
429
|
+
const unproven = appChecks.filter(check => check.status === 'info');
|
|
430
|
+
if (needsWork.length > 0) {
|
|
431
|
+
const ids = needsWork.map(check => check.id).join(', ');
|
|
432
|
+
return {
|
|
433
|
+
id: 'themes',
|
|
434
|
+
label,
|
|
435
|
+
status: needsWork.some(check => check.status === 'fail')
|
|
436
|
+
? 'fail'
|
|
437
|
+
: 'warn',
|
|
438
|
+
message:
|
|
439
|
+
needsWork.length === 1
|
|
440
|
+
? `One theme check needs attention: ${ids}.`
|
|
441
|
+
: `${needsWork.length} theme checks need attention: ${ids}.`,
|
|
442
|
+
fix:
|
|
443
|
+
needsWork.length === 1
|
|
444
|
+
? `Follow the fix on the ${ids} check.`
|
|
445
|
+
: `Follow the fix on each of these checks: ${ids}.`,
|
|
446
|
+
};
|
|
447
|
+
}
|
|
448
|
+
if (unproven.length > 0) {
|
|
449
|
+
const ids = unproven.map(check => check.id).join(', ');
|
|
450
|
+
return {
|
|
451
|
+
id: 'themes',
|
|
452
|
+
label,
|
|
453
|
+
status: 'info',
|
|
454
|
+
message:
|
|
455
|
+
unproven.length === 1
|
|
456
|
+
? `One theme check could not prove its result: ${ids}.`
|
|
457
|
+
: `${unproven.length} theme checks could not prove their results: ${ids}.`,
|
|
458
|
+
fix:
|
|
459
|
+
unproven.length === 1
|
|
460
|
+
? `See the ${ids} check.`
|
|
461
|
+
: `See each of these checks: ${ids}.`,
|
|
462
|
+
};
|
|
463
|
+
}
|
|
464
|
+
return {
|
|
465
|
+
id: 'themes',
|
|
466
|
+
label,
|
|
467
|
+
status: 'pass',
|
|
468
|
+
message:
|
|
469
|
+
'App themes come from the generated theme module, and every theme check passes.',
|
|
470
|
+
};
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
const run = getCliInvocation(cwd);
|
|
474
|
+
const packages = listDoctorThemePackages(cwd);
|
|
475
|
+
if (packages.length === 0) {
|
|
476
|
+
return {
|
|
477
|
+
id: 'themes',
|
|
478
|
+
label,
|
|
479
|
+
status: 'warn',
|
|
480
|
+
message: 'No @astryxdesign/theme-* packages are installed.',
|
|
481
|
+
fix: `Install a theme, e.g. \`npm install @astryxdesign/theme-neutral\`, then add it to the app with \`${run} theme add neutral --import\`.`,
|
|
482
|
+
};
|
|
483
|
+
}
|
|
484
|
+
const names = packages.join(', ');
|
|
485
|
+
if (!appPackageNamesTheme(cwd)) {
|
|
486
|
+
return {
|
|
487
|
+
id: 'themes',
|
|
488
|
+
label,
|
|
489
|
+
status: 'warn',
|
|
490
|
+
message: `Theme package(s) installed (${names}) but no theme appears wired.`,
|
|
491
|
+
fix: `Add one to the app with \`${run} theme add <slug> --import\`.`,
|
|
492
|
+
};
|
|
493
|
+
}
|
|
494
|
+
return {
|
|
495
|
+
id: 'themes',
|
|
496
|
+
label,
|
|
497
|
+
status: 'pass',
|
|
498
|
+
message: `Theme package(s) installed (${names}); wired via package.json astryx.theme.`,
|
|
499
|
+
};
|
|
500
|
+
}
|
|
501
|
+
|
|
388
502
|
/**
|
|
389
503
|
* Run all ten app-theme checks.
|
|
390
504
|
* @param {string} cwd
|
|
@@ -622,7 +736,7 @@ export async function checkAppThemes(cwd) {
|
|
|
622
736
|
label: 'App imports the theme module',
|
|
623
737
|
status: 'warn',
|
|
624
738
|
message: `Could not prove that project source imports ${state.module.path}${importEvidence.parseFailures ? `; ${importEvidence.parseFailures} source file(s) could not be parsed` : ''}.`,
|
|
625
|
-
fix: `Import {themes, defaultThemeSlug} from the generated module and render <Theme theme={themes[defaultThemeSlug]}>.`,
|
|
739
|
+
fix: `Import {themes, defaultThemeSlug} from the generated module and {Theme} from '@astryxdesign/core', then render <Theme theme={themes[defaultThemeSlug]}>.`,
|
|
626
740
|
});
|
|
627
741
|
}
|
|
628
742
|
|
|
@@ -6,7 +6,8 @@ import {afterEach, describe, expect, it} from 'vitest';
|
|
|
6
6
|
import * as fs from 'node:fs';
|
|
7
7
|
import * as path from 'node:path';
|
|
8
8
|
import {spawnSync} from 'node:child_process';
|
|
9
|
-
import {checkAppThemes} from './theme-checks.mjs';
|
|
9
|
+
import {checkAppThemes, checkThemes} from './theme-checks.mjs';
|
|
10
|
+
import {runChecks} from './doctor.mjs';
|
|
10
11
|
import {themeAdd} from '../theme/add/add.mjs';
|
|
11
12
|
import {themeEject} from '../theme/eject/eject.mjs';
|
|
12
13
|
import {themeBuild} from '../theme/build/build.mjs';
|
|
@@ -140,6 +141,146 @@ afterEach(() => {
|
|
|
140
141
|
}
|
|
141
142
|
});
|
|
142
143
|
|
|
144
|
+
describe('the released themes check', () => {
|
|
145
|
+
/** @param {string} name */
|
|
146
|
+
function emptyApp(name) {
|
|
147
|
+
const dir = fs.mkdtempSync(
|
|
148
|
+
path.join(process.cwd(), `.astryx-doctor-${name}-`),
|
|
149
|
+
);
|
|
150
|
+
dirs.push(dir);
|
|
151
|
+
write(path.join(dir, 'package.json'), '{"name":"app","private":true}\n');
|
|
152
|
+
return dir;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
/** @param {string} dir @param {string} slug */
|
|
156
|
+
function installThemePackage(dir, slug) {
|
|
157
|
+
write(
|
|
158
|
+
path.join(
|
|
159
|
+
dir,
|
|
160
|
+
'node_modules/@astryxdesign',
|
|
161
|
+
`theme-${slug}`,
|
|
162
|
+
'package.json',
|
|
163
|
+
),
|
|
164
|
+
JSON.stringify({name: `@astryxdesign/theme-${slug}`, version: '1.0.0'}),
|
|
165
|
+
);
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
it('keeps its released id, label, fields, and statuses without a generated theme module', async () => {
|
|
169
|
+
const dir = emptyApp('themes-none');
|
|
170
|
+
expect(checkThemes(dir, await checkAppThemes(dir))).toEqual({
|
|
171
|
+
id: 'themes',
|
|
172
|
+
label: 'Theme packages',
|
|
173
|
+
status: 'warn',
|
|
174
|
+
message: 'No @astryxdesign/theme-* packages are installed.',
|
|
175
|
+
fix: expect.stringContaining('theme add neutral --import'),
|
|
176
|
+
});
|
|
177
|
+
|
|
178
|
+
installThemePackage(dir, 'neutral');
|
|
179
|
+
const unwired = checkThemes(dir, await checkAppThemes(dir));
|
|
180
|
+
expect(unwired).toEqual({
|
|
181
|
+
id: 'themes',
|
|
182
|
+
label: 'Theme packages',
|
|
183
|
+
status: 'warn',
|
|
184
|
+
message:
|
|
185
|
+
'Theme package(s) installed (@astryxdesign/theme-neutral) but no theme appears wired.',
|
|
186
|
+
fix: expect.stringContaining('theme add <slug> --import'),
|
|
187
|
+
});
|
|
188
|
+
expect(unwired.fix).not.toContain('ASTRYX_THEME');
|
|
189
|
+
|
|
190
|
+
write(
|
|
191
|
+
path.join(dir, 'package.json'),
|
|
192
|
+
JSON.stringify({
|
|
193
|
+
name: 'app',
|
|
194
|
+
private: true,
|
|
195
|
+
astryx: {theme: '@astryxdesign/theme-neutral'},
|
|
196
|
+
}),
|
|
197
|
+
);
|
|
198
|
+
expect(checkThemes(dir, await checkAppThemes(dir))).toEqual({
|
|
199
|
+
id: 'themes',
|
|
200
|
+
label: 'Theme packages',
|
|
201
|
+
status: 'pass',
|
|
202
|
+
message:
|
|
203
|
+
'Theme package(s) installed (@astryxdesign/theme-neutral); wired via package.json astryx.theme.',
|
|
204
|
+
});
|
|
205
|
+
});
|
|
206
|
+
|
|
207
|
+
it('reports the overall result of the app-theme checks with a generated module', async () => {
|
|
208
|
+
const healthy = await fixture();
|
|
209
|
+
expect(checkThemes(healthy.dir, await checkAppThemes(healthy.dir))).toEqual(
|
|
210
|
+
{
|
|
211
|
+
id: 'themes',
|
|
212
|
+
label: 'Theme packages',
|
|
213
|
+
status: 'pass',
|
|
214
|
+
message:
|
|
215
|
+
'App themes come from the generated theme module, and every theme check passes.',
|
|
216
|
+
},
|
|
217
|
+
);
|
|
218
|
+
|
|
219
|
+
// A module is loaded once per process, so the broken one is a new fixture.
|
|
220
|
+
const {dir, packageDir} = await fixture();
|
|
221
|
+
write(
|
|
222
|
+
path.join(packageDir, 'dist/ocean.js'),
|
|
223
|
+
`import '@acme/definitely-missing-dep';\nexport const oceanTheme = {name: 'ocean', tokens: {}};\n`,
|
|
224
|
+
);
|
|
225
|
+
expect(checkThemes(dir, await checkAppThemes(dir))).toEqual({
|
|
226
|
+
id: 'themes',
|
|
227
|
+
label: 'Theme packages',
|
|
228
|
+
status: 'fail',
|
|
229
|
+
message: 'One theme check needs attention: theme-owners.',
|
|
230
|
+
fix: 'Follow the fix on the theme-owners check.',
|
|
231
|
+
});
|
|
232
|
+
}, 30_000);
|
|
233
|
+
|
|
234
|
+
it('passes the module rollup only when every summarized check passed', () => {
|
|
235
|
+
/** @param {string} id @param {'pass'|'warn'|'fail'|'info'} status */
|
|
236
|
+
const result = (id, status) => ({id, label: id, status, message: id});
|
|
237
|
+
const passing = [
|
|
238
|
+
result('theme-owners', 'pass'),
|
|
239
|
+
result('theme-module', 'pass'),
|
|
240
|
+
];
|
|
241
|
+
|
|
242
|
+
expect(
|
|
243
|
+
checkThemes(process.cwd(), [
|
|
244
|
+
...passing,
|
|
245
|
+
result('theme-stylesheet-imports', 'info'),
|
|
246
|
+
]),
|
|
247
|
+
).toEqual({
|
|
248
|
+
id: 'themes',
|
|
249
|
+
label: 'Theme packages',
|
|
250
|
+
status: 'info',
|
|
251
|
+
message:
|
|
252
|
+
'One theme check could not prove its result: theme-stylesheet-imports.',
|
|
253
|
+
fix: 'See the theme-stylesheet-imports check.',
|
|
254
|
+
});
|
|
255
|
+
expect(
|
|
256
|
+
checkThemes(process.cwd(), [
|
|
257
|
+
result('theme-owners', 'fail'),
|
|
258
|
+
result('theme-module', 'pass'),
|
|
259
|
+
result('theme-fonts', 'warn'),
|
|
260
|
+
result('theme-global-rules', 'info'),
|
|
261
|
+
]),
|
|
262
|
+
).toMatchObject({
|
|
263
|
+
status: 'fail',
|
|
264
|
+
message: '2 theme checks need attention: theme-owners, theme-fonts.',
|
|
265
|
+
});
|
|
266
|
+
expect(checkThemes(process.cwd(), passing)).toMatchObject({
|
|
267
|
+
status: 'pass',
|
|
268
|
+
});
|
|
269
|
+
});
|
|
270
|
+
|
|
271
|
+
it('appears once in the doctor report, right after version alignment, with and without a module', async () => {
|
|
272
|
+
const {dir} = await fixture();
|
|
273
|
+
for (const cwd of [emptyApp('themes-report'), dir]) {
|
|
274
|
+
const ids = (await runChecks({cwd})).checks.map(item => item.id);
|
|
275
|
+
expect(ids.filter(id => id === 'themes')).toHaveLength(1);
|
|
276
|
+
expect(ids.indexOf('themes')).toBe(ids.indexOf('version-alignment') + 1);
|
|
277
|
+
expect(ids.indexOf('themes')).toBeLessThan(
|
|
278
|
+
ids.findIndex(id => id === 'theme-management' || id === 'theme-owners'),
|
|
279
|
+
);
|
|
280
|
+
}
|
|
281
|
+
}, 30_000);
|
|
282
|
+
});
|
|
283
|
+
|
|
143
284
|
describe('app-theme doctor checks', () => {
|
|
144
285
|
it('returns ten positive passes for a healthy package theme', async () => {
|
|
145
286
|
const {dir} = await fixture();
|
package/api/init/run/run.mjs
CHANGED
|
@@ -54,6 +54,7 @@ export function getNextSteps(invocation) {
|
|
|
54
54
|
' 4. Add and wire a theme:',
|
|
55
55
|
' npm install @astryxdesign/theme-neutral',
|
|
56
56
|
` ${invocation} theme add neutral --import`,
|
|
57
|
+
" import { Theme } from '@astryxdesign/core'",
|
|
57
58
|
" import { themes, defaultThemeSlug } from './astryx-themes'",
|
|
58
59
|
' <Theme theme={themes[defaultThemeSlug]}>...</Theme>',
|
|
59
60
|
` Extend an imported theme to customize it. Run \`${invocation} theme eject <slug>\` only to fork source.`,
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
// DO NOT EDIT — run `pnpm sync:api-types` to regenerate.
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
|
+
* @deprecated DEP-0006: Use `build`, `template`, and `docs layout` instead. Removal in CLN-0006.
|
|
5
6
|
* `astryx layout check "<expr>" [--form compact|outline]`
|
|
6
7
|
* Validates without expanding; echoes both canonical surfaces.
|
|
7
8
|
*
|
|
@@ -15,6 +15,7 @@ import {toCompact, toOutline} from '../../../foundation/xle/print.mjs';
|
|
|
15
15
|
import {analyze, formatIssue} from '../_adapter.mjs';
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
|
+
* @deprecated DEP-0006: Use `build`, `template`, and `docs layout` instead. Removal in CLN-0006.
|
|
18
19
|
* `astryx layout check "<expr>" [--form compact|outline]`
|
|
19
20
|
* Validates without expanding; echoes both canonical surfaces.
|
|
20
21
|
*
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
// DO NOT EDIT — run `pnpm sync:api-types` to regenerate.
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
|
+
* @deprecated DEP-0006: Use `build`, `template`, and `docs layout` instead. Removal in CLN-0006.
|
|
5
6
|
* `astryx layout grammar` — the agent cheatsheet, with the alias table
|
|
6
7
|
* generated from this branch's registry (never hand-maintained).
|
|
7
8
|
*
|
|
@@ -13,6 +13,7 @@ import {buildRegistry} from '../../../foundation/xle/registry.mjs';
|
|
|
13
13
|
import {MAX_REPEAT} from '../../../foundation/xle/expand.mjs';
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
|
+
* @deprecated DEP-0006: Use `build`, `template`, and `docs layout` instead. Removal in CLN-0006.
|
|
16
17
|
* `astryx layout grammar` — the agent cheatsheet, with the alias table
|
|
17
18
|
* generated from this branch's registry (never hand-maintained).
|
|
18
19
|
*
|
|
@@ -20,7 +20,7 @@ export const doc = {
|
|
|
20
20
|
'expression without generating any TSX, and echoes it back in both canonical surfaces ' +
|
|
21
21
|
'(compact and outline). Validation failures are reported in the layout.check envelope ' +
|
|
22
22
|
'(valid: false) with line/col and suggestions (not thrown) so callers can lint an ' +
|
|
23
|
-
'expression and surface fixes.',
|
|
23
|
+
'expression and surface fixes. **Deprecated (DEP-0006).** Use `build`, `template`, and `docs layout` instead. This function will be removed in a future minor release.',
|
|
24
24
|
importPath: '@astryxdesign/cli/api',
|
|
25
25
|
signature:
|
|
26
26
|
'layoutCheck(expression: string, options?: LayoutCheckOptions): Promise<LayoutCheckResponse>',
|
|
@@ -20,7 +20,7 @@ export const doc = {
|
|
|
20
20
|
'expression, then expands it into ready-to-use XDS TSX, auto-routing structural children ' +
|
|
21
21
|
'into the right slots, scaffolding typed useState for interactive controls, and splicing or ' +
|
|
22
22
|
'importing any referenced template blocks. Returns the code (and metadata) in a layout.expand ' +
|
|
23
|
-
'envelope, optionally writing it to a path within cwd.',
|
|
23
|
+
'envelope, optionally writing it to a path within cwd. **Deprecated (DEP-0006).** Use `build`, `template`, and `docs layout` instead. This function will be removed in a future minor release.',
|
|
24
24
|
importPath: '@astryxdesign/cli/api',
|
|
25
25
|
signature:
|
|
26
26
|
'layoutExpand(expression: string, options?: LayoutExpandOptions): Promise<LayoutExpandResponse>',
|
|
@@ -18,7 +18,7 @@ export const doc = {
|
|
|
18
18
|
description:
|
|
19
19
|
'The reference behind `astryx layout grammar`: the agent cheatsheet for writing XLE/XLO ' +
|
|
20
20
|
"layout expressions, with the alias table generated from this branch's registry rather than " +
|
|
21
|
-
'hand-maintained, so short names always reflect the components actually installed.',
|
|
21
|
+
'hand-maintained, so short names always reflect the components actually installed. **Deprecated (DEP-0006).** Use `build`, `template`, and `docs layout` instead. This function will be removed in a future minor release.',
|
|
22
22
|
importPath: '@astryxdesign/cli/api',
|
|
23
23
|
signature:
|
|
24
24
|
'layoutGrammar(options?: LayoutGrammarOptions): Promise<LayoutGrammarResponse>',
|
|
@@ -19,6 +19,7 @@ import {
|
|
|
19
19
|
import {AstryxError, writeFailed} from '../../error.mjs';
|
|
20
20
|
import {ERROR_CODES} from '../../../foundation/response/error-codes.mjs';
|
|
21
21
|
import {pkgOf, replaceDemoMedia} from '../../../foundation/discovery/template-adapter.mjs';
|
|
22
|
+
import {analyzeTemplateNeeds} from '../../../foundation/discovery/template-needs.mjs';
|
|
22
23
|
|
|
23
24
|
/**
|
|
24
25
|
* Scaffold an already-resolved template to `targetPath` (relative to `cwd`) and
|
|
@@ -93,6 +94,14 @@ export function templateCopy(match, {targetPath, cwd, overwrite = false}) {
|
|
|
93
94
|
throw writeFailed(outputFilePath, cwd, err);
|
|
94
95
|
}
|
|
95
96
|
|
|
97
|
+
// Analyze what the template needs that the project lacks: external packages
|
|
98
|
+
// and the StyleX compiler. Derived from the source's own imports.
|
|
99
|
+
const {notes, missingPackages, installCommand} = analyzeTemplateNeeds(
|
|
100
|
+
outputSource,
|
|
101
|
+
cwd,
|
|
102
|
+
);
|
|
103
|
+
const missing = missingPackages;
|
|
104
|
+
|
|
96
105
|
const relOutput = path.relative(cwd, outputDir) || '.';
|
|
97
106
|
return {
|
|
98
107
|
type: 'template.copy',
|
|
@@ -103,6 +112,9 @@ export function templateCopy(match, {targetPath, cwd, overwrite = false}) {
|
|
|
103
112
|
fileName: outputFileName,
|
|
104
113
|
filesCopied: 1,
|
|
105
114
|
demoMediaReplaced,
|
|
115
|
+
notes,
|
|
116
|
+
missingPackages: missing,
|
|
117
|
+
installCommand,
|
|
106
118
|
},
|
|
107
119
|
};
|
|
108
120
|
}
|
|
@@ -124,7 +124,7 @@ export const doc = {
|
|
|
124
124
|
{
|
|
125
125
|
type: 'template.copy',
|
|
126
126
|
description:
|
|
127
|
-
'A receipt after scaffolding the template into the project: the template id, output directory, written file name, file count,
|
|
127
|
+
'A receipt after scaffolding the template into the project: the template id, output directory, written file name, file count, `demoMediaReplaced` — how many Astryx demo media references were replaced with placeholders, `notes` — setup notes naming what the template needs that the project lacks (missing packages, missing StyleX compiler; empty when satisfied), `missingPackages` — external package names the template imports that are not in the project, and `installCommand` — a ready-to-run install command with the detected package manager and workspace version ranges (null when nothing is missing).',
|
|
128
128
|
},
|
|
129
129
|
{
|
|
130
130
|
type: 'template.cdn',
|
|
@@ -80,6 +80,9 @@
|
|
|
80
80
|
* @property {string} data.fileName
|
|
81
81
|
* @property {number} data.filesCopied
|
|
82
82
|
* @property {number} data.demoMediaReplaced Astryx demo media references (images, posters, videos) replaced in the written file: images with a neutral placeholder, videos with an empty source. Swap in your own media at those points; no media is installed. 0 when the template carried none.
|
|
83
|
+
* @property {string[]} data.notes Setup notes: what the template needs that the project lacks (missing packages, missing StyleX compiler). Each note is one actionable line. Empty when the template needs nothing the project lacks.
|
|
84
|
+
* @property {string[]} data.missingPackages External package names the template imports that are not in the project's dependencies. Empty when none are missing.
|
|
85
|
+
* @property {string | null} data.installCommand A ready-to-run install command for the missing packages, using the project's package manager and the CLI workspace's version ranges. Null when no packages are missing.
|
|
83
86
|
*/
|
|
84
87
|
|
|
85
88
|
/**
|
|
@@ -2956,6 +2956,7 @@ async function themeBuildInternal(
|
|
|
2956
2956
|
logger.log(`
|
|
2957
2957
|
Install in your app (paths are relative to a file in src/; adjust if yours lives elsewhere):
|
|
2958
2958
|
|
|
2959
|
+
import { Theme } from '@astryxdesign/core';
|
|
2959
2960
|
import { ${exportName} } from '${jsImport}';
|
|
2960
2961
|
import '${cssImport}';
|
|
2961
2962
|
|
|
@@ -2965,6 +2966,7 @@ Install in your app (paths are relative to a file in src/; adjust if yours lives
|
|
|
2965
2966
|
|
|
2966
2967
|
Or with a <link> tag:
|
|
2967
2968
|
|
|
2969
|
+
import { Theme } from '@astryxdesign/core';
|
|
2968
2970
|
import { ${exportName} } from '${jsImport}';
|
|
2969
2971
|
|
|
2970
2972
|
<link rel="stylesheet" href="${cssImport}" />
|
|
@@ -118,7 +118,7 @@ export const docs = {
|
|
|
118
118
|
['ocean.d.ts', 'TypeScript declarations for the theme and icon registry exports'],
|
|
119
119
|
['ocean.variants.d.ts', "(Optional) Module augmentations for custom component prop values"],
|
|
120
120
|
]},
|
|
121
|
-
{type: 'code', lang: 'tsx', label: 'Using a custom built theme', code: "import {oceanTheme} from './themes/ocean';\nimport './themes/ocean.css';\n\n<Theme theme={oceanTheme}>\n <App />\n</Theme>"},
|
|
121
|
+
{type: 'code', lang: 'tsx', label: 'Using a custom built theme', code: "import {Theme} from '@astryxdesign/core';\nimport {oceanTheme} from './themes/ocean';\nimport './themes/ocean.css';\n\n<Theme theme={oceanTheme}>\n <App />\n</Theme>"},
|
|
122
122
|
{type: 'prose', text: "After upgrading Astryx, rerun `astryx theme build` for every custom prebuilt theme. Deploy the regenerated files together. The build also warns when the theme names font families it does not load. See {@link generic:typography} for the full recipe."},
|
|
123
123
|
{type: 'prose', text: 'For the runtime vs built tradeoff, see the Runtime vs Built section of {@link generic:use-a-theme}.'},
|
|
124
124
|
],
|
|
@@ -122,7 +122,7 @@ export const docs = {
|
|
|
122
122
|
content: [
|
|
123
123
|
{
|
|
124
124
|
type: 'prose',
|
|
125
|
-
text: 'Only needed when you swizzle a component (`astryx swizzle <Component>`) or write your own StyleX. The plain path already supports `xstyle` overrides \u2014 this path is for editing component internals.',
|
|
125
|
+
text: 'Only needed when you swizzle a component (`astryx swizzle <Component>`) or write your own StyleX. The plain path already supports `xstyle` overrides \u2014 this path is for editing component internals. Some built-in page templates also use StyleX for layout; if you scaffold one and see "Unexpected stylex.create call at runtime", add the compiler plugin for your bundler below.',
|
|
126
126
|
},
|
|
127
127
|
{
|
|
128
128
|
type: 'code',
|
|
@@ -9,7 +9,7 @@ export const docsDense = {
|
|
|
9
9
|
section: 'Wrap your app in a theme',
|
|
10
10
|
title: 'Quick start',
|
|
11
11
|
content: [
|
|
12
|
-
{type: 'prose', text:
|
|
12
|
+
{type: 'prose', text: "Install a theme, wrap in `<Theme>` (`import {Theme} from '@astryxdesign/core'`). {@link generic:use-a-theme} for full guide."},
|
|
13
13
|
],
|
|
14
14
|
},
|
|
15
15
|
{
|
|
@@ -8,5 +8,5 @@ export const doc = {
|
|
|
8
8
|
description:
|
|
9
9
|
'Transposed matrix that puts candidates in the columns and criteria in grouped rows, with a pinned label column that survives horizontal scroll, columns you can swap or add, and best-in-row marks you can toggle. Compare, comparison, matrix, spec sheet, feature grid, pricing table, benchmark, frozen column, sticky column, or side-by-side.',
|
|
10
10
|
isReady: true,
|
|
11
|
-
category: 'Table -
|
|
11
|
+
category: 'Table - Comparison',
|
|
12
12
|
};
|
|
@@ -361,7 +361,8 @@ function printThemeApp(result) {
|
|
|
361
361
|
emit(
|
|
362
362
|
text('Wire the generated module once in the app root:'),
|
|
363
363
|
code(
|
|
364
|
-
|
|
364
|
+
"import {Theme} from '@astryxdesign/core';\n" +
|
|
365
|
+
`import {themes, defaultThemeSlug} from './${stem}';\n\n` +
|
|
365
366
|
'<Theme theme={themes[defaultThemeSlug]}>\n <App />\n</Theme>',
|
|
366
367
|
),
|
|
367
368
|
);
|
|
@@ -823,7 +824,8 @@ export function registerTheme(program) {
|
|
|
823
824
|
'Use it in your app (import path is relative to a file in src/ — adjust if yours lives elsewhere):',
|
|
824
825
|
),
|
|
825
826
|
code(
|
|
826
|
-
|
|
827
|
+
"import { Theme } from '@astryxdesign/core';\n" +
|
|
828
|
+
`import { ${exportName} } from '${entryModule}';\n\n` +
|
|
827
829
|
`<Theme theme={${exportName}}>\n <App />\n</Theme>`,
|
|
828
830
|
),
|
|
829
831
|
text(
|
|
@@ -16,7 +16,7 @@ export const doc = {
|
|
|
16
16
|
summary: 'Diagnose Astryx projects and integration packages',
|
|
17
17
|
description:
|
|
18
18
|
'Runs read-only project health diagnostics by default: Node version, @astryxdesign/core ' +
|
|
19
|
-
'install and version alignment, generated app themes when present, earlier copied-theme migration, config, integrations (linked without a config entry, ' +
|
|
19
|
+
'install and version alignment, theme packages, generated app themes when present, earlier copied-theme migration, config, integrations (linked without a config entry, ' +
|
|
20
20
|
'provider identity, contribution issues), agent docs, core peer dependencies, package manager, ' +
|
|
21
21
|
"and the docs the CLI reads. It writes nothing, but loading astryx.config runs that file's code. " +
|
|
22
22
|
'The `integration` subcommands provide authoring checks for one integration package.',
|
|
@@ -62,5 +62,6 @@ export const doc = {
|
|
|
62
62
|
},
|
|
63
63
|
],
|
|
64
64
|
deprecated: 'DEP-0006: Use `astryx build` to start from a template, `astryx template` to scaffold, and `astryx docs layout` for guidance.',
|
|
65
|
+
notes: [{"type": "prose", "text": "**Deprecated (DEP-0006).** Use `astryx build` to choose the template to start from, `astryx template` to scaffold it, and `astryx docs layout` for layout guidance. This command will be removed in a future minor release."}],
|
|
65
66
|
related: ['layout expand', 'layout grammar'],
|
|
66
67
|
};
|
|
@@ -82,5 +82,6 @@ export const doc = {
|
|
|
82
82
|
},
|
|
83
83
|
],
|
|
84
84
|
deprecated: 'DEP-0006: Use `astryx build` to start from a template, `astryx template` to scaffold, and `astryx docs layout` for guidance.',
|
|
85
|
+
notes: [{"type": "prose", "text": "**Deprecated (DEP-0006).** Use `astryx build` to choose the template to start from, `astryx template` to scaffold it, and `astryx docs layout` for layout guidance. This command will be removed in a future minor release."}],
|
|
85
86
|
related: ['layout check', 'layout grammar'],
|
|
86
87
|
};
|
|
@@ -27,5 +27,6 @@ export const doc = {
|
|
|
27
27
|
{code: 1, when: 'the component registry cannot be read'},
|
|
28
28
|
],
|
|
29
29
|
deprecated: 'DEP-0006: Use `astryx build` to start from a template, `astryx template` to scaffold, and `astryx docs layout` for guidance.',
|
|
30
|
+
notes: [{"type": "prose", "text": "**Deprecated (DEP-0006).** Use `astryx build` to choose the template to start from, `astryx template` to scaffold it, and `astryx docs layout` for layout guidance. This command will be removed in a future minor release."}],
|
|
30
31
|
related: ['layout expand', 'layout check'],
|
|
31
32
|
};
|