@astryxdesign/cli 0.4.3 → 0.4.4-canary.0f4d45f

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 (54) hide show
  1. package/CHANGELOG.md +40 -0
  2. package/README.md +45 -43
  3. package/api/discover/_adapter.d.mts +5 -3
  4. package/api/discover/_adapter.mjs +6 -4
  5. package/api/template/cdn/cdn.d.mts +23 -0
  6. package/api/template/cdn/cdn.mjs +86 -0
  7. package/api/template/cdn/cdn.test.mjs +108 -0
  8. package/api/template/template.d.mts +2 -0
  9. package/api/template/template.doc.mjs +21 -3
  10. package/api/template/template.mjs +16 -2
  11. package/api/template/template.type.d.mts +19 -0
  12. package/api/template/template.type.mjs +12 -0
  13. package/api/theme/theme.type.d.mts +16 -0
  14. package/api/theme/theme.type.mjs +11 -0
  15. package/assets/cdn.template.html +124 -0
  16. package/assets/docs/theme.doc.dense.mjs +1 -1
  17. package/assets/docs/theme.doc.mjs +5 -4
  18. package/assets/docs/theme.doc.zh.mjs +1 -1
  19. package/assets/templates/blocks/components/BottomSheet/BottomSheetHeights.doc.mjs +21 -0
  20. package/assets/templates/blocks/components/BottomSheet/BottomSheetHeights.tsx +46 -0
  21. package/assets/templates/blocks/components/BottomSheet/BottomSheetMobileKeyboard.doc.mjs +23 -0
  22. package/assets/templates/blocks/components/BottomSheet/BottomSheetMobileKeyboard.tsx +100 -0
  23. package/assets/templates/blocks/components/BottomSheet/BottomSheetNoScrim.doc.mjs +22 -0
  24. package/assets/templates/blocks/components/BottomSheet/BottomSheetNoScrim.tsx +47 -0
  25. package/assets/templates/blocks/components/BottomSheet/BottomSheetShowcase.doc.mjs +22 -0
  26. package/assets/templates/blocks/components/BottomSheet/BottomSheetShowcase.tsx +51 -0
  27. package/assets/templates/blocks/components/BottomSheet/BottomSheetSwitcherShowcase.doc.mjs +26 -0
  28. package/assets/templates/blocks/components/BottomSheet/BottomSheetSwitcherShowcase.tsx +221 -0
  29. package/assets/theme.template.ts +4 -3
  30. package/authoring/doctypes/base/type.ts +9 -0
  31. package/clients/cli/commands/build-theme.mjs +154 -65
  32. package/clients/cli/commands/build-theme.multi.test.mjs +148 -0
  33. package/clients/cli/commands/build-theme.watch.test.mjs +67 -0
  34. package/clients/cli/commands/discover.broken-integration.test.mjs +112 -0
  35. package/clients/cli/commands/discover.mjs +12 -0
  36. package/clients/cli/commands/search.mjs +9 -0
  37. package/clients/cli/commands/template-cdn.behavior.test.mjs +113 -0
  38. package/clients/cli/commands/template.doc.mjs +12 -2
  39. package/clients/cli/commands/template.mjs +24 -3
  40. package/clients/cli/commands/theme-build.doc.mjs +11 -5
  41. package/clients/cli/lib/json-shim.test.mjs +1 -1
  42. package/clients/cli/lib/manifest.mjs +3 -2
  43. package/clients/cli/lib/manifest.test.mjs +4 -2
  44. package/foundation/integrations/integration-warnings.test.mjs +17 -0
  45. package/foundation/integrations/validate-contributions.mjs +7 -0
  46. package/foundation/response/response-types.doc.mjs +11 -0
  47. package/foundation/text/copyright-header.mjs +11 -4
  48. package/package.json +12 -9
  49. package/assets/templates/pages/table-page-chart/page.tsx +0 -577
  50. package/assets/templates/pages/table-page-chart/template.doc.mjs +0 -13
  51. package/assets/templates/pages/table-page-heatmap-status/page.tsx +0 -467
  52. package/assets/templates/pages/table-page-heatmap-status/template.doc.mjs +0 -13
  53. package/assets/templates/pages/table-page-shoe-store-heatmap/page.tsx +0 -931
  54. package/assets/templates/pages/table-page-shoe-store-heatmap/template.doc.mjs +0 -13
@@ -146,8 +146,10 @@ describe('manifest: shape', () => {
146
146
  const component = allEntries.find((c) => c.name === 'component');
147
147
  expect(component.arguments.map((a) => a.name)).toContain('name');
148
148
  const themeBuild = allEntries.find((c) => c.name === 'theme build');
149
- expect(themeBuild.arguments.map((a) => a.name)).toContain('file');
150
- expect(themeBuild.arguments.find((a) => a.name === 'file').required).toBe(true);
149
+ expect(themeBuild.arguments.map((a) => a.name)).toContain('files');
150
+ const files = themeBuild.arguments.find((a) => a.name === 'files');
151
+ expect(files.required).toBe(true);
152
+ expect(files.variadic).toBe(true);
151
153
  });
152
154
  });
153
155
 
@@ -68,6 +68,23 @@ describe('warnOnIntegrationIssues', () => {
68
68
  expect(errLines).toHaveLength(0);
69
69
  });
70
70
 
71
+ it('warns for a manifest that failed to load, which declares no roots', async () => {
72
+ // loadIntegrations records __loadError and no contribution roots, so every
73
+ // on-disk check finds nothing — without the load error itself counting as
74
+ // an issue, a stale manifest is silent everywhere.
75
+ const integration = {
76
+ ...loaded({name: '@acme/stale'}),
77
+ __loadError: 'createIntegration is not a function',
78
+ };
79
+ await warnOnIntegrationIssues([integration], {json: false});
80
+
81
+ expect(errLines).toHaveLength(1);
82
+ expect(errLines[0]).toBe(
83
+ 'Warning: @acme/stale has 1 integration issue(s). ' +
84
+ 'Run: astryx validate-integration @acme/stale',
85
+ );
86
+ });
87
+
71
88
  it('emits nothing for an integration with no issues', async () => {
72
89
  // Existing components root with no broken contributions → no issues.
73
90
  const componentsRoot = path.join(tmpDir, 'components');
@@ -149,6 +149,13 @@ export async function validateLoadedIntegration(loaded) {
149
149
  /** @type {Issue[]} */
150
150
  const issues = [];
151
151
  if (!loaded || typeof loaded !== 'object') return issues;
152
+ // A manifest that threw on import (or failed the schema) carries a load-error
153
+ // marker and no contribution roots, so every check below would find nothing
154
+ // and report a clean integration — which is how a stale manifest used to go
155
+ // silently invisible. The load error IS the issue.
156
+ if (loaded.__loadError) {
157
+ return [issueError('integration_error', loaded.__loadError)];
158
+ }
152
159
  checkRoots(
153
160
  {
154
161
  components: loaded.components,
@@ -150,6 +150,12 @@ export const doc = {
150
150
  'A scaffold receipt: template id, output directory, written file name, and file count.',
151
151
  },
152
152
 
153
+ {
154
+ value: 'template.cdn',
155
+ description:
156
+ 'A write receipt for the no-build-step CDN starter page: the path (relative to cwd), the Astryx version every CDN URL was pinned to, whether it was written, and the reason it was not — `exists` when a file was already there, which is a success.',
157
+ },
158
+
153
159
  // hook
154
160
  {
155
161
  value: 'hook.list',
@@ -173,6 +179,11 @@ export const doc = {
173
179
  description:
174
180
  'The --check receipt: theme name, an upToDate flag, the stale outputs (each {path, reason: missing | outdated}), and the full list of checked paths. Writes nothing.',
175
181
  },
182
+ {
183
+ value: 'theme.build.batch',
184
+ description:
185
+ 'Several themes built in one invocation: `count` plus one {file, receipt} per theme in argument order, where receipt is that theme\'s theme.build (or theme.build.check) envelope, or null when it produced no CSS.',
186
+ },
176
187
  {
177
188
  value: 'theme.list',
178
189
  description:
@@ -6,9 +6,9 @@
6
6
  *
7
7
  * Every file in this repo carries the Meta copyright header, and several
8
8
  * commands copy repo files out verbatim — `theme add` (bundled theme sources),
9
- * `init --features theme` (the annotated theme template). A consumer's own
10
- * source tree should not inherit our boilerplate, and their lint may well
11
- * reject it.
9
+ * `init --features theme` (the annotated theme template), `template --cdn` (the
10
+ * CDN starter page). A consumer's own source tree should not inherit our
11
+ * boilerplate, and their lint may well reject it.
12
12
  *
13
13
  * SYNC: the same regex is applied by apps/docsite/src/lib/codeExamples.ts for
14
14
  * rendered code samples. That copy lives in a different package (the docsite
@@ -23,6 +23,11 @@
23
23
  const META_COPYRIGHT_HEADER_RE =
24
24
  /^(\uFEFF?(?:#![^\r\n]*(?:\r?\n))?)\/\/ Copyright \(c\) Meta Platforms, Inc\. and affiliates\.\r?\n(?:\r?\n)*/;
25
25
 
26
+ /** The same header in HTML comment syntax, as scripts/add-copyright.sh writes
27
+ * it into the .html assets we scaffold. */
28
+ const META_COPYRIGHT_HEADER_HTML_RE =
29
+ /^(\uFEFF?)<!-- Copyright \(c\) Meta Platforms, Inc\. and affiliates\. -->\r?\n(?:\r?\n)*/;
30
+
26
31
  /**
27
32
  * Remove the leading Meta copyright header, preserving any BOM/shebang before
28
33
  * it. Returns the source unchanged when the header is absent.
@@ -31,5 +36,7 @@ const META_COPYRIGHT_HEADER_RE =
31
36
  * @returns {string}
32
37
  */
33
38
  export function stripCopyrightHeader(source) {
34
- return source.replace(META_COPYRIGHT_HEADER_RE, '$1');
39
+ return source
40
+ .replace(META_COPYRIGHT_HEADER_RE, '$1')
41
+ .replace(META_COPYRIGHT_HEADER_HTML_RE, '$1');
35
42
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@astryxdesign/cli",
3
- "version": "0.4.3",
3
+ "version": "0.4.4-canary.0f4d45f",
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",
@@ -25,6 +25,9 @@
25
25
  "agent-docs"
26
26
  ],
27
27
  "type": "module",
28
+ "engines": {
29
+ "node": ">=22.13.0"
30
+ },
28
31
  "bin": {
29
32
  "astryx": "./clients/cli/bin/astryx.mjs",
30
33
  "cli": "./clients/cli/bin/astryx.mjs"
@@ -84,10 +87,10 @@
84
87
  "zod": "^4.4.3"
85
88
  },
86
89
  "peerDependencies": {
87
- "@astryxdesign/charts": "*",
88
- "@astryxdesign/core": "*",
89
- "@astryxdesign/lab": "*",
90
- "@astryxdesign/theme-neutral": "*",
90
+ "@astryxdesign/charts": "0.4.4-canary.0f4d45f",
91
+ "@astryxdesign/core": "0.4.4-canary.0f4d45f",
92
+ "@astryxdesign/lab": "0.4.4-canary.0f4d45f",
93
+ "@astryxdesign/theme-neutral": "0.4.4-canary.0f4d45f",
91
94
  "gpt-tokenizer": "^3.4.0"
92
95
  },
93
96
  "peerDependenciesMeta": {
@@ -105,10 +108,10 @@
105
108
  }
106
109
  },
107
110
  "devDependencies": {
108
- "@astryxdesign/charts": "*",
109
- "@astryxdesign/core": "*",
110
- "@astryxdesign/lab": "*",
111
- "@astryxdesign/theme-neutral": "*",
111
+ "@astryxdesign/charts": "0.4.4-canary.0f4d45f",
112
+ "@astryxdesign/core": "0.4.4-canary.0f4d45f",
113
+ "@astryxdesign/lab": "0.4.4-canary.0f4d45f",
114
+ "@astryxdesign/theme-neutral": "0.4.4-canary.0f4d45f",
112
115
  "gpt-tokenizer": "^3.4.0"
113
116
  },
114
117
  "scripts": {