@astryxdesign/cli 0.4.4 → 0.4.5-canary.013e728

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.
Files changed (26) hide show
  1. package/CHANGELOG.md +5 -0
  2. package/api/component/_adapter.d.mts +22 -5
  3. package/api/component/_adapter.mjs +51 -3
  4. package/assets/codemods/transforms/v0.1.0/__tests__/drop-xds-prefix-imports.test.mjs +245 -0
  5. package/assets/codemods/transforms/v0.1.0/drop-xds-prefix-imports.mjs +139 -13
  6. package/assets/docs/layout.doc.dense.mjs +275 -30
  7. package/assets/docs/layout.doc.mjs +412 -78
  8. package/assets/docs/theme.doc.mjs +3 -3
  9. package/assets/templates/blocks/components/BottomSheet/BottomSheetSnapPoints.doc.mjs +23 -0
  10. package/assets/templates/blocks/components/BottomSheet/BottomSheetSnapPoints.tsx +155 -0
  11. package/assets/templates/blocks/components/Selector/SelectorOptionDescriptions.doc.mjs +14 -0
  12. package/assets/templates/blocks/components/Selector/SelectorOptionDescriptions.tsx +76 -0
  13. package/assets/templates/pages/dashboard-cohort-funnel/page.tsx +914 -0
  14. package/assets/templates/pages/dashboard-cohort-funnel/template.doc.mjs +12 -0
  15. package/assets/templates/pages/dashboard-data/page.tsx +894 -0
  16. package/assets/templates/pages/dashboard-data/template.doc.mjs +13 -0
  17. package/assets/templates/pages/dashboard-executive-summary/page.tsx +874 -0
  18. package/assets/templates/pages/dashboard-executive-summary/template.doc.mjs +13 -0
  19. package/assets/templates/pages/dashboard-project-status/page.tsx +1139 -0
  20. package/assets/templates/pages/dashboard-project-status/template.doc.mjs +13 -0
  21. package/assets/templates/pages/dashboard-service-monitoring/page.tsx +1590 -0
  22. package/assets/templates/pages/dashboard-service-monitoring/template.doc.mjs +12 -0
  23. package/authoring/doctypes/template/type.ts +2 -0
  24. package/clients/cli/commands/component-ownership.test.mjs +63 -3
  25. package/clients/cli/commands/theme-build.doc.mjs +1 -1
  26. package/package.json +9 -9
@@ -0,0 +1,12 @@
1
+ // Copyright (c) Meta Platforms, Inc. and affiliates.
2
+
3
+ /** @type {import('@astryxdesign/cli/authoring').TemplateDoc} */
4
+ export const doc = {
5
+ type: 'page',
6
+ name: 'Service Monitoring Dashboard',
7
+ displayName: 'Service Monitoring Dashboard',
8
+ description:
9
+ 'Live-ops service-health dashboard: traffic-light KPI tiles with sparklines, and multi-line latency and request-volume charts with a 1h/1d/7d window, beside a triage rail split into two independently scrolling sections: active alerts over a worst-first per-service breakdown with inline status coloring. Global environment, region, and auto-refresh controls; the rail folds into the content column as two cards below 1024px.',
10
+ isReady: false,
11
+ category: 'Dashboard - Monitoring',
12
+ };
@@ -94,6 +94,8 @@ export type TemplateCategory =
94
94
  | 'Dashboard - Tabbed'
95
95
  | 'Dashboard - Filterable'
96
96
  | 'Dashboard - Portfolio'
97
+ | 'Dashboard - Project Status'
98
+ | 'Dashboard - Funnel & Cohort'
97
99
  // Table
98
100
  | 'Table - Basic'
99
101
  | 'Table - Grouped'
@@ -47,7 +47,12 @@ const INTEGRATION_ISSUES = 'https://example.com/meta/issues';
47
47
  * Returns the absolute `components` dir so the Project.load mock can hand back a
48
48
  * resolved integration entry.
49
49
  */
50
- function createFixture({withSource = true, extraComponent = null} = {}) {
50
+ function createFixture({
51
+ withSource = true,
52
+ extraComponent = null,
53
+ packageExports = null,
54
+ entryPoint = null,
55
+ } = {}) {
51
56
  const realCoreDir = path.resolve(import.meta.dirname, '..', '..', '..', '..', 'core');
52
57
  const coreDir = path.join(tmpDir, 'packages', 'core');
53
58
  fs.mkdirSync(path.dirname(coreDir), {recursive: true});
@@ -58,7 +63,11 @@ function createFixture({withSource = true, extraComponent = null} = {}) {
58
63
  fs.mkdirSync(compDir, {recursive: true});
59
64
  fs.writeFileSync(
60
65
  path.join(intDir, 'package.json'),
61
- JSON.stringify({name: INTEGRATION_NAME, version: '1.2.3'}),
66
+ JSON.stringify({
67
+ name: INTEGRATION_NAME,
68
+ version: '1.2.3',
69
+ ...(packageExports ? {exports: packageExports} : {}),
70
+ }),
62
71
  );
63
72
  fs.writeFileSync(
64
73
  path.join(compDir, 'MetaAppShell.doc.mjs'),
@@ -81,6 +90,20 @@ function createFixture({withSource = true, extraComponent = null} = {}) {
81
90
  );
82
91
  }
83
92
 
93
+ // A component whose directory is an entry point exporting several
94
+ // components, so the directory name and the component name differ.
95
+ if (entryPoint) {
96
+ const entryDir = path.join(compDir, entryPoint.directory);
97
+ fs.mkdirSync(entryDir, {recursive: true});
98
+ const ownSpecifier = entryPoint.importSpec
99
+ ? `\n import: '${entryPoint.importSpec}',`
100
+ : '';
101
+ fs.writeFileSync(
102
+ path.join(entryDir, `${entryPoint.component}.doc.mjs`),
103
+ `export const docs = {\n name: '${entryPoint.component}',${ownSpecifier}\n usage: { description: '${entryPoint.component} from an entry point.' },\n};\n`,
104
+ );
105
+ }
106
+
84
107
  const integration = {
85
108
  name: INTEGRATION_NAME,
86
109
  version: '1.2.3',
@@ -88,6 +111,7 @@ function createFixture({withSource = true, extraComponent = null} = {}) {
88
111
  templates: undefined,
89
112
  codemods: undefined,
90
113
  issuesUrl: INTEGRATION_ISSUES,
114
+ __packageDir: intDir,
91
115
  };
92
116
  projectLoadMock.mockResolvedValue({
93
117
  integrations: [INTEGRATION_NAME],
@@ -162,7 +186,9 @@ describe('component() — integration ownership via config', () => {
162
186
  expect(result.data.name).toBe('MetaAppShell');
163
187
  expect(result.data.package).toBe(INTEGRATION_NAME);
164
188
  expect(result.data.sourceAvailable).toBe(true);
165
- expect(result.data.import).toBe(`${INTEGRATION_NAME}/MetaAppShell`);
189
+ // This fixture declares no `exports`, so there is no subpath to import
190
+ // from and the specifier is the package root.
191
+ expect(result.data.import).toBe(INTEGRATION_NAME);
166
192
  });
167
193
 
168
194
  it('--package resolves the integration component', async () => {
@@ -217,6 +243,40 @@ describe('component() — integration ownership via config', () => {
217
243
  expect(result.data.package).toBe(INTEGRATION_NAME);
218
244
  });
219
245
 
246
+ it('resolves the import specifier against the package exports map', async () => {
247
+ // The doc sits in a `Toolbar` directory but the component is
248
+ // `ToolbarSearch`, so a specifier built from the component name would
249
+ // point at a subpath the package does not export.
250
+ createFixture({
251
+ packageExports: {'.': './index.js', './Toolbar': './components/Toolbar/index.js'},
252
+ entryPoint: {directory: 'Toolbar', component: 'ToolbarSearch'},
253
+ });
254
+ const result = await component('ToolbarSearch', {cwd: tmpDir});
255
+ expect(result.data.import).toBe(`${INTEGRATION_NAME}/Toolbar`);
256
+ });
257
+
258
+ it('falls back to the package root when the directory is not an exported subpath', async () => {
259
+ createFixture({
260
+ packageExports: {'.': './index.js'},
261
+ entryPoint: {directory: 'Toolbar', component: 'ToolbarSearch'},
262
+ });
263
+ const result = await component('ToolbarSearch', {cwd: tmpDir});
264
+ expect(result.data.import).toBe(INTEGRATION_NAME);
265
+ });
266
+
267
+ it('keeps a specifier the doc file states for itself', async () => {
268
+ createFixture({
269
+ packageExports: {'.': './index.js', './Toolbar': './components/Toolbar/index.js'},
270
+ entryPoint: {
271
+ directory: 'Toolbar',
272
+ component: 'ToolbarSearch',
273
+ importSpec: `${INTEGRATION_NAME}/Toolbar/Search`,
274
+ },
275
+ });
276
+ const result = await component('ToolbarSearch', {cwd: tmpDir});
277
+ expect(result.data.import).toBe(`${INTEGRATION_NAME}/Toolbar/Search`);
278
+ });
279
+
220
280
  it('JSON list includes integration components as {name, package} objects', async () => {
221
281
  createFixture();
222
282
  const result = await component(undefined, {cwd: tmpDir, list: true});
@@ -19,7 +19,7 @@ export const doc = {
19
19
  'Compiles a file that calls defineTheme() into a scoped CSS file, a JS module, and ' +
20
20
  'type declarations: the exact CSS the <Theme> runtime emits. Takes any number of theme ' +
21
21
  'files and compiles them in one process, in argument order, stopping at the first ' +
22
- 'failure an app with several themes does not need a shell loop. With --check it writes ' +
22
+ 'failure; an app with several themes does not need a shell loop. With --check it writes ' +
23
23
  'nothing and instead reports whether the committed outputs have drifted from source. ' +
24
24
  'When a separate build step emits the icon registry, --icons-specifier declares the ' +
25
25
  'fully specified module path that the generated JS should import.',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@astryxdesign/cli",
3
- "version": "0.4.4",
3
+ "version": "0.4.5-canary.013e728",
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",
@@ -87,10 +87,10 @@
87
87
  "zod": "^4.4.3"
88
88
  },
89
89
  "peerDependencies": {
90
- "@astryxdesign/charts": "*",
91
- "@astryxdesign/core": "*",
92
- "@astryxdesign/lab": "*",
93
- "@astryxdesign/theme-neutral": "*",
90
+ "@astryxdesign/charts": "0.4.5-canary.013e728",
91
+ "@astryxdesign/core": "0.4.5-canary.013e728",
92
+ "@astryxdesign/lab": "0.4.5-canary.013e728",
93
+ "@astryxdesign/theme-neutral": "0.4.5-canary.013e728",
94
94
  "gpt-tokenizer": "^3.4.0"
95
95
  },
96
96
  "peerDependenciesMeta": {
@@ -108,10 +108,10 @@
108
108
  }
109
109
  },
110
110
  "devDependencies": {
111
- "@astryxdesign/charts": "*",
112
- "@astryxdesign/core": "*",
113
- "@astryxdesign/lab": "*",
114
- "@astryxdesign/theme-neutral": "*",
111
+ "@astryxdesign/charts": "0.4.5-canary.013e728",
112
+ "@astryxdesign/core": "0.4.5-canary.013e728",
113
+ "@astryxdesign/lab": "0.4.5-canary.013e728",
114
+ "@astryxdesign/theme-neutral": "0.4.5-canary.013e728",
115
115
  "gpt-tokenizer": "^3.4.0"
116
116
  },
117
117
  "scripts": {