@astryxdesign/cli 0.1.1-canary.d5f107c → 0.1.1-canary.e3e409f
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@astryxdesign/cli",
|
|
3
|
-
"version": "0.1.1-canary.
|
|
3
|
+
"version": "0.1.1-canary.e3e409f",
|
|
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",
|
|
@@ -54,9 +54,9 @@
|
|
|
54
54
|
"jscodeshift": "^17.3.0"
|
|
55
55
|
},
|
|
56
56
|
"peerDependencies": {
|
|
57
|
-
"@astryxdesign/core": "0.1.1-canary.
|
|
58
|
-
"@astryxdesign/lab": "0.1.1-canary.
|
|
59
|
-
"@astryxdesign/theme-neutral": "0.1.1-canary.
|
|
57
|
+
"@astryxdesign/core": "0.1.1-canary.e3e409f",
|
|
58
|
+
"@astryxdesign/lab": "0.1.1-canary.e3e409f",
|
|
59
|
+
"@astryxdesign/theme-neutral": "0.1.1-canary.e3e409f"
|
|
60
60
|
},
|
|
61
61
|
"peerDependenciesMeta": {
|
|
62
62
|
"@astryxdesign/core": {
|
|
@@ -70,9 +70,9 @@
|
|
|
70
70
|
}
|
|
71
71
|
},
|
|
72
72
|
"devDependencies": {
|
|
73
|
-
"@astryxdesign/core": "0.1.1-canary.
|
|
74
|
-
"@astryxdesign/lab": "0.1.1-canary.
|
|
75
|
-
"@astryxdesign/theme-neutral": "0.1.1-canary.
|
|
73
|
+
"@astryxdesign/core": "0.1.1-canary.e3e409f",
|
|
74
|
+
"@astryxdesign/lab": "0.1.1-canary.e3e409f",
|
|
75
|
+
"@astryxdesign/theme-neutral": "0.1.1-canary.e3e409f"
|
|
76
76
|
},
|
|
77
77
|
"scripts": {
|
|
78
78
|
"astryx": "node bin/astryx.mjs",
|
package/src/commands/init.mjs
CHANGED
|
@@ -29,6 +29,37 @@ import {requireInteractive} from '../utils/interactive.mjs';
|
|
|
29
29
|
const VALID_FEATURES = ['agents', 'theme', 'template'];
|
|
30
30
|
const run = getRunPrefix();
|
|
31
31
|
|
|
32
|
+
/**
|
|
33
|
+
* Build the "Next steps" lines printed at the end of `astryx init`.
|
|
34
|
+
*
|
|
35
|
+
* Theme guidance must match the runtime recommendation emitted by core's
|
|
36
|
+
* <Theme> component (packages/core/src/theme/Theme.tsx): the pre-built theme
|
|
37
|
+
* path (`/built` import + `theme.css`) plus the base CSS import, so users
|
|
38
|
+
* don't end up with an unstyled app or the slower runtime style-injection
|
|
39
|
+
* path. See https://github.com/facebook/astryx/issues/3080.
|
|
40
|
+
*
|
|
41
|
+
* Exported for testing.
|
|
42
|
+
*
|
|
43
|
+
* @param {string} runPrefix package-manager run prefix (e.g. `npx`)
|
|
44
|
+
* @returns {string[]} ordered list of human-facing lines
|
|
45
|
+
*/
|
|
46
|
+
export function getNextSteps(runPrefix) {
|
|
47
|
+
return [
|
|
48
|
+
'',
|
|
49
|
+
' Next steps:',
|
|
50
|
+
" 1. Import base styles: import '@astryxdesign/core/reset.css'",
|
|
51
|
+
" and import '@astryxdesign/core/astryx.css'",
|
|
52
|
+
" 2. Import components: import { Button } from '@astryxdesign/core'",
|
|
53
|
+
' 3. Optionally add a theme (use the pre-built path for performance):',
|
|
54
|
+
" import { neutralTheme } from '@astryxdesign/theme-neutral/built'",
|
|
55
|
+
" import '@astryxdesign/theme-neutral/theme.css'",
|
|
56
|
+
' <Theme theme={neutralTheme}>...</Theme>',
|
|
57
|
+
` For custom themes, run \`${runPrefix} astryx theme build <file>\` to generate the built artifacts.`,
|
|
58
|
+
` 4. ${runPrefix} astryx --help for all commands`,
|
|
59
|
+
'',
|
|
60
|
+
];
|
|
61
|
+
}
|
|
62
|
+
|
|
32
63
|
function isCancel(value) {
|
|
33
64
|
if (p.isCancel(value)) {
|
|
34
65
|
p.cancel('Setup cancelled.');
|
|
@@ -250,13 +281,8 @@ export function registerInit(program) {
|
|
|
250
281
|
// Outro
|
|
251
282
|
p.outro('Design system initialized!');
|
|
252
283
|
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
humanLog(' 2. Optionally add a theme:');
|
|
257
|
-
humanLog(" import { neutralTheme } from '@astryxdesign/theme-neutral'");
|
|
258
|
-
humanLog(' <Theme theme={neutralTheme}>...</Theme>');
|
|
259
|
-
humanLog(` 3. ${run} astryx --help for all commands`);
|
|
260
|
-
humanLog('');
|
|
284
|
+
for (const line of getNextSteps(run)) {
|
|
285
|
+
humanLog(line);
|
|
286
|
+
}
|
|
261
287
|
});
|
|
262
288
|
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @file Regression test for `astryx init` "Next steps" theme guidance.
|
|
5
|
+
*
|
|
6
|
+
* The init command previously steered users toward the slower runtime
|
|
7
|
+
* style-injection path:
|
|
8
|
+
*
|
|
9
|
+
* import { neutralTheme } from '@astryxdesign/theme-neutral'
|
|
10
|
+
* <Theme theme={neutralTheme}>...</Theme>
|
|
11
|
+
*
|
|
12
|
+
* ...which contradicted the runtime console warning emitted by core's
|
|
13
|
+
* <Theme> component (packages/core/src/theme/Theme.tsx) recommending the
|
|
14
|
+
* pre-built path, and left users with an unstyled app because the base CSS
|
|
15
|
+
* imports were never mentioned (facebook/astryx#3080).
|
|
16
|
+
*
|
|
17
|
+
* These assertions lock in the corrected guidance: base CSS imports, the
|
|
18
|
+
* pre-built (`/built` + `theme.css`) theme path, and the custom-theme build
|
|
19
|
+
* command.
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
import {describe, it, expect} from 'vitest';
|
|
23
|
+
import {getNextSteps} from './init.mjs';
|
|
24
|
+
|
|
25
|
+
describe('init Next steps theme guidance', () => {
|
|
26
|
+
const text = getNextSteps('npx').join('\n');
|
|
27
|
+
|
|
28
|
+
it('mentions the base CSS imports so the app is not left unstyled', () => {
|
|
29
|
+
expect(text).toContain("'@astryxdesign/core/reset.css'");
|
|
30
|
+
expect(text).toContain("'@astryxdesign/core/astryx.css'");
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
it('uses the pre-built theme path matching the runtime recommendation', () => {
|
|
34
|
+
expect(text).toContain("'@astryxdesign/theme-neutral/built'");
|
|
35
|
+
expect(text).toContain("'@astryxdesign/theme-neutral/theme.css'");
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
it('mentions building custom themes via `astryx theme build`', () => {
|
|
39
|
+
expect(text).toContain('astryx theme build <file>');
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
it('does not steer users to the runtime style-injection import', () => {
|
|
43
|
+
// The bare source import (no `/built`) is the slow runtime-injection path.
|
|
44
|
+
expect(text).not.toContain("from '@astryxdesign/theme-neutral'");
|
|
45
|
+
});
|
|
46
|
+
});
|