@astryxdesign/cli 0.6.3-canary.dea6813 → 0.6.3-canary.df1837b
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 +79 -58
- package/api/blog/blog.doc.mjs +1 -0
- package/api/build/build.doc.mjs +1 -0
- package/api/component/component.doc.mjs +2 -1
- package/api/component/component.mjs +3 -3
- package/api/component/component.type.d.mts +5 -4
- package/api/component/component.type.mjs +5 -4
- package/api/component/detail/blocks/blocks.d.mts +2 -1
- package/api/component/detail/blocks/blocks.mjs +4 -3
- package/api/component/list/list.d.mts +0 -5
- package/api/component/list/list.mjs +37 -9
- package/api/discover/discover.doc.mjs +1 -0
- package/api/docs/_adapter.d.mts +3 -8
- package/api/docs/_adapter.mjs +13 -105
- package/api/docs/docs.doc.mjs +1 -0
- package/api/docs/list/list.mjs +3 -7
- package/api/doctor/doctor.d.mts +25 -3
- package/api/doctor/doctor.doc.mjs +1 -0
- package/api/doctor/doctor.mjs +185 -13
- package/api/doctor/doctor.test.mjs +326 -1
- package/api/gap-report/gap-report.doc.mjs +1 -0
- package/api/hook/_adapter.mjs +19 -5
- package/api/hook/hook.doc.mjs +1 -0
- package/api/hook/list/list.d.mts +1 -1
- package/api/hook/list/list.mjs +69 -17
- package/api/init/init.doc.mjs +1 -0
- package/api/integration/add-contribution.mjs +7 -7
- package/api/integration/add-contribution.test.mjs +37 -3
- package/api/integration/add-theme.mjs +34 -64
- package/api/integration/add-theme.test.mjs +105 -21
- package/api/integration/authoring-checks.test.mjs +8 -4
- package/api/integration/integration-block-exports.test.mjs +10 -6
- package/api/integration/integrationAdd.doc.mjs +1 -0
- package/api/integration/integrationAddAgentDoc.doc.mjs +1 -0
- package/api/integration/integrationAddCodemod.doc.mjs +1 -0
- package/api/integration/integrationAddComponent.doc.mjs +1 -0
- package/api/integration/integrationAddDoc.doc.mjs +1 -0
- package/api/integration/integrationAddTemplate.doc.mjs +1 -0
- package/api/integration/integrationAddTheme.doc.mjs +6 -5
- package/api/integration/integrationComponentConflicts.doc.mjs +1 -0
- package/api/integration/integrationDocConflicts.doc.mjs +1 -0
- package/api/integration/integrationPackCheck.doc.mjs +1 -0
- package/api/integration/integrationTemplateConflicts.doc.mjs +1 -0
- package/api/integration/pack-check.test.mjs +17 -47
- package/api/integration/summarizeIssues.doc.mjs +1 -0
- package/api/integration/validate-integration-fixes.test.mjs +1389 -0
- package/api/integration/validate-integration.mjs +50 -102
- package/api/integration/validate-integration.test.mjs +85 -23
- package/api/integration/validate-unread-theme-folders.test.mjs +110 -0
- package/api/integration/validateIntegration.doc.mjs +1 -0
- package/api/json/assertResponse.doc.mjs +1 -0
- package/api/json/isError.doc.mjs +1 -0
- package/api/json/parseResponse.doc.mjs +1 -0
- package/api/layout/layoutCheck.doc.mjs +1 -0
- package/api/layout/layoutExpand.doc.mjs +1 -0
- package/api/layout/layoutGrammar.doc.mjs +1 -0
- package/api/search/search.doc.mjs +1 -0
- package/api/search/search.mjs +16 -6
- package/api/swizzle/swizzle.doc.mjs +1 -0
- package/api/template/template-suffix.test.mjs +41 -21
- package/api/template/template.doc.mjs +1 -0
- package/api/theme/_adapter.d.mts +2 -3
- package/api/theme/_adapter.mjs +4 -5
- package/api/theme/add/add.binary.test.mjs +10 -17
- package/api/theme/add/add.test.mjs +14 -1
- package/api/theme/generateTonalPalette.doc.mjs +1 -0
- package/api/theme/integration-themes.test.mjs +39 -28
- package/api/theme/list/list.test.mjs +19 -20
- package/api/theme/listThemes.doc.mjs +6 -5
- package/api/theme/themeAdd.doc.mjs +4 -3
- package/api/theme/themeBuild.doc.mjs +1 -0
- package/api/theme/themeList.doc.mjs +6 -3
- package/api/theme/themeListAvailable.doc.mjs +5 -3
- package/api/theme/themePaletteGenerate.doc.mjs +1 -0
- package/api/theme/themeTargets.doc.mjs +1 -0
- package/api/theme/themeTemplate.doc.mjs +1 -0
- package/api/upgrade/_adapter.d.mts +32 -5
- package/api/upgrade/_adapter.mjs +97 -69
- package/api/upgrade/provider-agreement.test.mjs +152 -0
- package/api/upgrade/run/run.mjs +356 -59
- package/api/upgrade/upgrade.doc.mjs +6 -1
- package/api/upgrade/upgrade.type.d.mts +34 -0
- package/api/upgrade/upgrade.type.mjs +15 -0
- package/assets/codemods/__tests__/runner.test.mjs +330 -8
- package/assets/codemods/integration-discovery.mjs +8 -2
- package/assets/codemods/integration-discovery.test.mjs +15 -0
- package/assets/codemods/integration-runner.mjs +56 -4
- package/assets/codemods/integration-runner.protection.test.mjs +153 -0
- package/assets/codemods/run-codemod.mjs +177 -34
- package/assets/codemods/runner.mjs +350 -102
- package/assets/codemods/transform-prop.mjs +109 -0
- package/assets/codemods/transform-prop.test.mjs +95 -0
- package/assets/codemods/transforms/next/__tests__/migrate-native-picker-to-presentation.test.mjs +63 -0
- package/assets/codemods/transforms/next/__tests__/migrate-theme-catalog-to-descriptors.test.mjs +220 -0
- package/assets/codemods/transforms/next/index.mjs +19 -1
- package/assets/codemods/transforms/next/migrate-native-picker-to-presentation.mjs +148 -0
- package/assets/codemods/transforms/next/migrate-theme-catalog-to-descriptors.mjs +141 -0
- package/assets/codemods/transforms/v0.0.14/__tests__/rename-status-variants.test.mjs +86 -165
- package/assets/codemods/transforms/v0.0.14/rename-status-variants.mjs +72 -210
- package/assets/codemods/transforms/v0.1.8/__tests__/rename-avatar-size-scale.test.mjs +83 -115
- package/assets/codemods/transforms/v0.1.8/rename-avatar-size-scale.mjs +57 -186
- package/assets/docs/cli-integrations.doc.mjs +30 -30
- package/assets/docs/cli.doc.mjs +15 -0
- package/assets/docs/theme.doc.mjs +1 -1
- package/assets/templates/blocks/components/DateInput/DateInputDateRange.tsx +1 -1
- package/assets/templates/blocks/components/Item/ItemDocumentTabs.doc.mjs +14 -0
- package/assets/templates/blocks/components/Item/ItemDocumentTabs.tsx +100 -0
- package/assets/templates/blocks/components/ScrollableArea/ScrollableAreaInlineRail.doc.mjs +14 -0
- package/assets/templates/blocks/components/ScrollableArea/ScrollableAreaInlineRail.tsx +61 -0
- package/assets/templates/blocks/components/ScrollableArea/ScrollableAreaOverscrollChaining.doc.mjs +14 -0
- package/assets/templates/blocks/components/ScrollableArea/ScrollableAreaOverscrollChaining.tsx +126 -0
- package/assets/templates/blocks/components/ScrollableArea/ScrollableAreaShowcase.doc.mjs +15 -0
- package/assets/templates/blocks/components/ScrollableArea/ScrollableAreaShowcase.tsx +86 -0
- package/assets/templates/blocks/components/ScrollableArea/ScrollableAreaStickyGroupHeaders.doc.mjs +14 -0
- package/assets/templates/blocks/components/ScrollableArea/ScrollableAreaStickyGroupHeaders.tsx +99 -0
- package/assets/templates/blocks/components/ScrollableArea/ScrollableAreaStickyPassthrough.doc.mjs +14 -0
- package/assets/templates/blocks/components/ScrollableArea/ScrollableAreaStickyPassthrough.tsx +122 -0
- package/assets/templates/blocks/components/ScrollableArea/ScrollableAreaTwoAxisBoard.doc.mjs +14 -0
- package/assets/templates/blocks/components/ScrollableArea/ScrollableAreaTwoAxisBoard.tsx +95 -0
- package/assets/templates/blocks/components/TimeInput/TimeInputConstrained.tsx +1 -0
- package/assets/templates/themes/butter/butterTheme.doc.mjs +11 -0
- package/assets/templates/themes/chocolate/chocolateTheme.doc.mjs +11 -0
- package/assets/templates/themes/gothic/gothicTheme.doc.mjs +11 -0
- package/assets/templates/themes/matcha/matchaTheme.doc.mjs +11 -0
- package/assets/templates/themes/neutral/neutralTheme.doc.mjs +11 -0
- package/assets/templates/themes/stone/stoneTheme.doc.mjs +11 -0
- package/assets/templates/themes/y2k/y2kTheme.doc.mjs +11 -0
- package/authoring/codemod/codemod.doc.mjs +1 -1
- package/authoring/codemod/type.ts +12 -0
- package/authoring/config/config.doc.mjs +1 -1
- package/authoring/debug/debug.doc.d.mts +11 -0
- package/authoring/debug/debug.doc.mjs +182 -0
- package/authoring/doctypes/base/graph-fields.doc.mjs +1 -1
- package/authoring/doctypes/command/command.doc.mjs +1 -1
- package/authoring/doctypes/command/type.ts +1 -1
- package/authoring/doctypes/component/type.ts +2 -2
- package/authoring/doctypes/doctypes-new.test.mjs +48 -6
- package/authoring/doctypes/enum/enum.doc.mjs +1 -1
- package/authoring/doctypes/enum/type.ts +1 -1
- package/authoring/doctypes/function/function.doc.mjs +1 -1
- package/authoring/doctypes/function/type.ts +1 -1
- package/authoring/doctypes/hook/type.ts +2 -2
- package/authoring/doctypes/load-contract.test.mjs +2 -1
- package/authoring/doctypes/parse.d.mts +4 -2
- package/authoring/doctypes/parse.mjs +7 -3
- package/authoring/doctypes/reference/reference.doc.mjs +1 -1
- package/authoring/doctypes/reference/type.ts +2 -2
- package/authoring/doctypes/schema/schema.doc.mjs +1 -1
- package/authoring/doctypes/schema/type.ts +1 -2
- package/authoring/doctypes/template/template.doc.mjs +3 -3
- package/authoring/doctypes/theme/parse.d.mts +35 -0
- package/authoring/doctypes/theme/parse.mjs +76 -0
- package/authoring/doctypes/theme/theme.doc.d.mts +9 -0
- package/authoring/doctypes/theme/theme.doc.mjs +79 -0
- package/authoring/doctypes/theme/type.ts +42 -0
- package/authoring/doctypes/types.ts +2 -1
- package/authoring/gap-report/gap-report.doc.d.mts +12 -0
- package/authoring/gap-report/gap-report.doc.mjs +183 -0
- package/authoring/index.d.mts +1 -0
- package/authoring/index.d.ts +6 -4
- package/authoring/index.mjs +2 -1
- package/authoring/integration/integration.doc.mjs +2 -2
- package/authoring/integration/type.ts +3 -9
- package/clients/cli/__tests__/cliManifest.test.ts +27 -29
- package/clients/cli/commands/blog.doc.mjs +1 -1
- package/clients/cli/commands/build.doc.mjs +1 -1
- package/clients/cli/commands/component-package.test.mjs +28 -0
- package/clients/cli/commands/component.doc.mjs +1 -1
- package/clients/cli/commands/discover.doc.mjs +1 -1
- package/clients/cli/commands/docs.doc.mjs +1 -1
- package/clients/cli/commands/doctor-integration-components.doc.mjs +1 -1
- package/clients/cli/commands/doctor-integration-docs.doc.mjs +1 -1
- package/clients/cli/commands/doctor-integration-templates.doc.mjs +1 -1
- package/clients/cli/commands/doctor-integration-validate.doc.mjs +1 -1
- package/clients/cli/commands/doctor-integration.doc.mjs +1 -1
- package/clients/cli/commands/doctor-integration.test.mjs +15 -7
- package/clients/cli/commands/doctor.doc.mjs +1 -1
- package/clients/cli/commands/gap-report.doc.mjs +1 -1
- package/clients/cli/commands/hook.doc.mjs +1 -1
- package/clients/cli/commands/init.doc.mjs +1 -1
- package/clients/cli/commands/integration-add.controls.test.mjs +1 -1
- package/clients/cli/commands/integration-add.doc.mjs +1 -1
- package/clients/cli/commands/integration-pack.doc.mjs +1 -1
- package/clients/cli/commands/integration-real-world.test.mjs +3 -9
- package/clients/cli/commands/integration.doc.mjs +1 -1
- package/clients/cli/commands/layout-check.doc.mjs +1 -1
- package/clients/cli/commands/layout-expand.doc.mjs +1 -1
- package/clients/cli/commands/layout-grammar.doc.mjs +1 -1
- package/clients/cli/commands/layout.doc.mjs +1 -1
- package/clients/cli/commands/manifest.doc.mjs +1 -1
- package/clients/cli/commands/search.doc.mjs +1 -1
- package/clients/cli/commands/swizzle.doc.mjs +1 -1
- package/clients/cli/commands/template.doc.mjs +1 -1
- package/clients/cli/commands/theme-add.doc.mjs +2 -2
- package/clients/cli/commands/theme-build.doc.mjs +1 -1
- package/clients/cli/commands/theme-list.doc.mjs +2 -2
- package/clients/cli/commands/theme-palette-generate.doc.mjs +3 -3
- package/clients/cli/commands/theme-palette.doc.mjs +1 -1
- package/clients/cli/commands/theme-targets.doc.mjs +1 -1
- package/clients/cli/commands/theme-template.doc.mjs +1 -1
- package/clients/cli/commands/theme.doc.mjs +1 -1
- package/clients/cli/commands/upgrade.doc.mjs +3 -2
- package/clients/cli/commands/upgrade.file-protection.test.mjs +228 -0
- package/clients/cli/commands/upgrade.mjs +3 -0
- package/clients/cli/lib/hook-format.mjs +14 -5
- package/foundation/config/project-themes.test.mjs +11 -19
- package/foundation/config/project.d.mts +8 -0
- package/foundation/config/project.mjs +50 -21
- package/foundation/config/project.test.mjs +3 -16
- package/foundation/discovery/authoring-self-docs.d.mts +6 -0
- package/foundation/discovery/authoring-self-docs.mjs +17 -7
- package/foundation/discovery/authoring-surface.d.mts +74 -0
- package/foundation/discovery/authoring-surface.mjs +525 -0
- package/foundation/discovery/authoring-surface.test.mjs +392 -0
- package/foundation/discovery/cli-self-docs.d.mts +113 -0
- package/foundation/discovery/cli-self-docs.mjs +514 -0
- package/foundation/discovery/cli-self-docs.test.mjs +437 -0
- package/foundation/discovery/component-loader.d.mts +35 -38
- package/foundation/discovery/component-loader.mjs +53 -222
- package/foundation/discovery/docs-discovery.d.mts +3 -2
- package/foundation/discovery/docs-discovery.mjs +8 -12
- package/foundation/discovery/docs-discovery.test.mjs +8 -5
- package/foundation/discovery/template-adapter.d.mts +7 -0
- package/foundation/discovery/template-adapter.mjs +27 -40
- package/foundation/discovery/template-adapter.test.mjs +15 -0
- package/foundation/discovery/theme-discovery.d.mts +67 -7
- package/foundation/discovery/theme-discovery.mjs +916 -186
- package/foundation/discovery/theme-discovery.test.mjs +613 -219
- package/foundation/doc-compiler/bundle.d.mts +47 -0
- package/foundation/doc-compiler/bundle.mjs +218 -0
- package/foundation/doc-compiler/bundle.test.mjs +255 -0
- package/foundation/doc-compiler/compile.d.mts +200 -0
- package/foundation/doc-compiler/compile.mjs +254 -5
- package/foundation/doc-compiler/diagnostics.d.mts +126 -0
- package/foundation/doc-compiler/diagnostics.mjs +277 -0
- package/foundation/doc-compiler/doc-compiler.test.mjs +28 -1
- package/foundation/doc-compiler/doc-loads.test.mjs +1642 -0
- package/foundation/doc-compiler/import.d.mts +24 -0
- package/foundation/doc-compiler/import.mjs +59 -0
- package/foundation/doc-compiler/inputs.d.mts +102 -0
- package/foundation/doc-compiler/inputs.mjs +286 -0
- package/foundation/doc-compiler/inputs.test.mjs +299 -0
- package/foundation/doc-compiler/ir.d.mts +13 -0
- package/foundation/doc-compiler/ir.mjs +189 -12
- package/foundation/doc-compiler/lower-doc.test.mjs +492 -0
- package/foundation/doc-compiler/overlays.d.mts +37 -0
- package/foundation/doc-compiler/overlays.mjs +206 -0
- package/foundation/doc-compiler/parse-readable.d.mts +9 -0
- package/foundation/doc-compiler/parse-readable.mjs +29 -0
- package/foundation/doc-compiler/read.d.mts +126 -0
- package/foundation/doc-compiler/read.mjs +320 -0
- package/foundation/doc-compiler/read.test.mjs +313 -0
- package/foundation/doc-compiler/source.d.mts +33 -0
- package/foundation/doc-compiler/source.mjs +128 -0
- package/foundation/fs/file-protection.d.mts +33 -0
- package/foundation/fs/file-protection.mjs +825 -0
- package/foundation/fs/file-protection.test.mjs +250 -0
- package/foundation/integrations/autolink.d.mts +58 -1
- package/foundation/integrations/autolink.mjs +143 -57
- package/foundation/integrations/contribution-fixes.d.mts +145 -0
- package/foundation/integrations/contribution-fixes.mjs +1284 -0
- package/foundation/integrations/contribution-inventory.d.mts +1 -1
- package/foundation/integrations/contribution-inventory.mjs +17 -20
- package/foundation/integrations/contribution-inventory.test.mjs +67 -27
- package/foundation/integrations/integrations.d.mts +3 -0
- package/foundation/integrations/integrations.mjs +11 -97
- package/foundation/integrations/provider-ledger.test.mjs +275 -0
- package/foundation/integrations/provider-resolution.d.mts +152 -0
- package/foundation/integrations/provider-resolution.mjs +576 -0
- package/foundation/integrations/provider-resolution.test.mjs +369 -0
- package/foundation/integrations/theme-descriptor.d.mts +8 -0
- package/foundation/integrations/theme-descriptor.mjs +44 -0
- package/foundation/integrations/validate-contributions.mjs +104 -10
- package/foundation/response/error-codes.d.mts +3 -1
- package/foundation/response/error-codes.d.ts +2 -0
- package/foundation/response/error-codes.doc.mjs +12 -2
- package/foundation/response/error-codes.mjs +7 -1
- package/foundation/response/error-codes.test.mjs +55 -11
- package/foundation/response/response-types.doc.mjs +8 -8
- package/foundation/response/response-types.doc.test.mjs +158 -0
- package/foundation/response/response.doc.mjs +1 -1
- package/foundation/text/string-utils.mjs +22 -10
- package/package.json +10 -9
- package/assets/templates/themes/manifest.json +0 -95
|
@@ -44,7 +44,7 @@ function writeIntegration({
|
|
|
44
44
|
const stem = path.join(tmpDir, 'templates', id);
|
|
45
45
|
fs.mkdirSync(path.dirname(stem), {recursive: true});
|
|
46
46
|
fs.writeFileSync(
|
|
47
|
-
`${stem}.
|
|
47
|
+
`${stem}.doc.mjs`,
|
|
48
48
|
`export default {type: 'page', name: ${JSON.stringify(name)}, description: 'fixture'};\n`,
|
|
49
49
|
);
|
|
50
50
|
fs.writeFileSync(
|
|
@@ -124,7 +124,12 @@ describe('doctor integration — command', () => {
|
|
|
124
124
|
return true;
|
|
125
125
|
});
|
|
126
126
|
|
|
127
|
-
await createProgram().parseAsync([
|
|
127
|
+
await createProgram().parseAsync([
|
|
128
|
+
'node',
|
|
129
|
+
'astryx',
|
|
130
|
+
'doctor',
|
|
131
|
+
'integration',
|
|
132
|
+
]);
|
|
128
133
|
|
|
129
134
|
const output = writes.join('');
|
|
130
135
|
expect(output).toContain('validate [package]');
|
|
@@ -136,7 +141,9 @@ describe('doctor integration — command', () => {
|
|
|
136
141
|
|
|
137
142
|
it('explains the optional package argument in every leaf help', () => {
|
|
138
143
|
const program = createProgram();
|
|
139
|
-
const doctor = program.commands.find(
|
|
144
|
+
const doctor = program.commands.find(
|
|
145
|
+
command => command.name() === 'doctor',
|
|
146
|
+
);
|
|
140
147
|
const integration = doctor?.commands.find(
|
|
141
148
|
command => command.name() === 'integration',
|
|
142
149
|
);
|
|
@@ -152,7 +159,10 @@ describe('doctor integration — command', () => {
|
|
|
152
159
|
});
|
|
153
160
|
|
|
154
161
|
it('templates explains how to check an installed package when no local manifest exists', async () => {
|
|
155
|
-
fs.writeFileSync(
|
|
162
|
+
fs.writeFileSync(
|
|
163
|
+
path.join(tmpDir, 'package.json'),
|
|
164
|
+
JSON.stringify({name: 'plain'}),
|
|
165
|
+
);
|
|
156
166
|
process.chdir(tmpDir);
|
|
157
167
|
|
|
158
168
|
await createProgram().parseAsync([
|
|
@@ -278,9 +288,7 @@ describe('doctor integration — command', () => {
|
|
|
278
288
|
const output = logCalls.join('\n');
|
|
279
289
|
expect(output).toContain('[warn]');
|
|
280
290
|
expect(output).toContain(core.name);
|
|
281
|
-
expect(output).toContain(
|
|
282
|
-
`component ${core.name} --package @acme/widgets`,
|
|
283
|
-
);
|
|
291
|
+
expect(output).toContain(`component ${core.name} --package @acme/widgets`);
|
|
284
292
|
expect(process.exitCode).toBeUndefined();
|
|
285
293
|
});
|
|
286
294
|
|
|
@@ -12,7 +12,7 @@ export const doc = {
|
|
|
12
12
|
type: 'command',
|
|
13
13
|
name: 'doctor',
|
|
14
14
|
displayName: 'astryx doctor',
|
|
15
|
-
namespace: 'cli',
|
|
15
|
+
namespace: 'cli/commands',
|
|
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 ' +
|
|
@@ -10,7 +10,7 @@ export const doc = {
|
|
|
10
10
|
type: 'command',
|
|
11
11
|
name: 'gap-report',
|
|
12
12
|
displayName: 'astryx gap-report',
|
|
13
|
-
namespace: 'cli',
|
|
13
|
+
namespace: 'cli/commands',
|
|
14
14
|
summary: 'Route a design-system gap to its owning package',
|
|
15
15
|
description:
|
|
16
16
|
'Reports a missing component, variant, layout, styling, accessibility, API, or documentation capability. The command selects an explicit package first, then a unique component owner, then Core. The report fans out to every effective handler: project config first, then each loaded integration in config order. Public handlers require --confirm-public per handler; internal handlers always run. A handler failure is isolated and does not prevent later handlers.',
|
|
@@ -12,7 +12,7 @@ export const doc = {
|
|
|
12
12
|
type: 'command',
|
|
13
13
|
name: 'hook',
|
|
14
14
|
displayName: 'astryx hook',
|
|
15
|
-
namespace: 'cli',
|
|
15
|
+
namespace: 'cli/commands',
|
|
16
16
|
summary: 'List hooks or print hook docs',
|
|
17
17
|
description:
|
|
18
18
|
'Resolves a hook by name and prints its authored doc, or lists the catalog grouped ' +
|
|
@@ -12,7 +12,7 @@ export const doc = {
|
|
|
12
12
|
type: 'command',
|
|
13
13
|
name: 'init',
|
|
14
14
|
displayName: 'astryx init',
|
|
15
|
-
namespace: 'cli',
|
|
15
|
+
namespace: 'cli/commands',
|
|
16
16
|
summary: 'Initialize the design system in your project',
|
|
17
17
|
description:
|
|
18
18
|
'Non-interactive project setup (no prompts, so it behaves the same for humans, ' +
|
|
@@ -126,7 +126,7 @@ describe('integration add control definitions', () => {
|
|
|
126
126
|
);
|
|
127
127
|
expect(page.status).toBe(0);
|
|
128
128
|
expect(
|
|
129
|
-
fs.readFileSync(path.join(tmpDir, 'templates', 'acme-page.
|
|
129
|
+
fs.readFileSync(path.join(tmpDir, 'templates', 'acme-page.doc.mjs'), 'utf-8'),
|
|
130
130
|
).toContain("type: 'page'");
|
|
131
131
|
});
|
|
132
132
|
});
|
|
@@ -5,7 +5,7 @@ export const doc = {
|
|
|
5
5
|
type: 'command',
|
|
6
6
|
name: 'integration add',
|
|
7
7
|
displayName: 'astryx integration add',
|
|
8
|
-
namespace: 'cli',
|
|
8
|
+
namespace: 'cli/commands',
|
|
9
9
|
summary: 'Add one working contribution to an integration package',
|
|
10
10
|
description:
|
|
11
11
|
'Writes the complete minimum shape the selected contribution needs, creates the integration manifest on first use, declares the root only after a valid contribution exists, and verifies the result through the same discovery contract the packed-package check uses.',
|
|
@@ -5,7 +5,7 @@ export const doc = {
|
|
|
5
5
|
type: 'command',
|
|
6
6
|
name: 'integration pack',
|
|
7
7
|
displayName: 'astryx integration pack',
|
|
8
|
-
namespace: 'cli',
|
|
8
|
+
namespace: 'cli/commands',
|
|
9
9
|
summary: 'Prove the packed integration is what consumers receive',
|
|
10
10
|
description:
|
|
11
11
|
'Runs the package lifecycle, packs with npm, checks every required contribution file against the real tarball, extracts it into a scratch consumer, and compares the local and packed contribution inventories through one shared contract.',
|
|
@@ -201,13 +201,6 @@ export const oceanTheme = defineTheme({
|
|
|
201
201
|
});
|
|
202
202
|
`,
|
|
203
203
|
);
|
|
204
|
-
const catalogFile = path.join(providerDir, 'themes', 'manifest.json');
|
|
205
|
-
const catalog = JSON.parse(fs.readFileSync(catalogFile, 'utf-8'));
|
|
206
|
-
catalog.themes[0].files.push(
|
|
207
|
-
'tokens/ocean.palette.ts',
|
|
208
|
-
'tokens/ocean.palette.receipt.json',
|
|
209
|
-
);
|
|
210
|
-
writeJson(catalogFile, catalog);
|
|
211
204
|
|
|
212
205
|
const providerPackage = JSON.parse(
|
|
213
206
|
fs.readFileSync(path.join(providerDir, 'package.json'), 'utf-8'),
|
|
@@ -464,8 +457,9 @@ export const oceanTheme = defineTheme({
|
|
|
464
457
|
outputDir: target,
|
|
465
458
|
files: [
|
|
466
459
|
'oceanTheme.ts',
|
|
467
|
-
'
|
|
460
|
+
'oceanTheme.doc.mjs',
|
|
468
461
|
'tokens/ocean.palette.receipt.json',
|
|
462
|
+
'tokens/ocean.palette.ts',
|
|
469
463
|
],
|
|
470
464
|
},
|
|
471
465
|
});
|
|
@@ -612,7 +606,7 @@ export const oceanTheme = defineTheme({
|
|
|
612
606
|
expect(corruptedInstall.status).not.toBe(0);
|
|
613
607
|
expect(parseEnvelope(corruptedInstall.stdout)).toMatchObject({
|
|
614
608
|
code: 'ERR_THEME_INVALID',
|
|
615
|
-
error: expect.stringContaining('ocean.palette
|
|
609
|
+
error: expect.stringContaining('./tokens/ocean.palette'),
|
|
616
610
|
});
|
|
617
611
|
}, 120_000);
|
|
618
612
|
});
|
|
@@ -5,7 +5,7 @@ export const doc = {
|
|
|
5
5
|
type: 'command',
|
|
6
6
|
name: 'integration',
|
|
7
7
|
displayName: 'astryx integration',
|
|
8
|
-
namespace: 'cli',
|
|
8
|
+
namespace: 'cli/commands',
|
|
9
9
|
summary: 'Author and verify an Astryx integration package',
|
|
10
10
|
description:
|
|
11
11
|
'Add contributions that are valid on arrival, then prove the packed package exposes the same contributions a consumer will receive.',
|
|
@@ -13,7 +13,7 @@ export const doc = {
|
|
|
13
13
|
type: 'command',
|
|
14
14
|
name: 'layout expand',
|
|
15
15
|
displayName: 'astryx layout expand',
|
|
16
|
-
namespace: 'cli',
|
|
16
|
+
namespace: 'cli/commands',
|
|
17
17
|
summary: 'Expand a layout expression into validated XDS TSX',
|
|
18
18
|
description:
|
|
19
19
|
'Parses and validates a compressed XLE/XLO expression, then expands it into ' +
|
|
@@ -13,7 +13,7 @@ export const doc = {
|
|
|
13
13
|
type: 'command',
|
|
14
14
|
name: 'layout grammar',
|
|
15
15
|
displayName: 'astryx layout grammar',
|
|
16
|
-
namespace: 'cli',
|
|
16
|
+
namespace: 'cli/commands',
|
|
17
17
|
summary:
|
|
18
18
|
'Print the XLE/XLO cheatsheet (alias table generated from this branch)',
|
|
19
19
|
description:
|
|
@@ -12,7 +12,7 @@ export const doc = {
|
|
|
12
12
|
type: 'command',
|
|
13
13
|
name: 'layout',
|
|
14
14
|
displayName: 'astryx layout',
|
|
15
|
-
namespace: 'cli',
|
|
15
|
+
namespace: 'cli/commands',
|
|
16
16
|
summary: 'Generate XDS layouts from compressed expressions (XLE/XLO)',
|
|
17
17
|
description:
|
|
18
18
|
'The layout command group. Running astryx layout with no subcommand prints the ' +
|
|
@@ -12,7 +12,7 @@ export const doc = {
|
|
|
12
12
|
type: 'command',
|
|
13
13
|
name: 'manifest',
|
|
14
14
|
displayName: 'astryx manifest',
|
|
15
|
-
namespace: 'cli',
|
|
15
|
+
namespace: 'cli/commands',
|
|
16
16
|
summary: 'Print the full CLI capability manifest (use with --json).',
|
|
17
17
|
description:
|
|
18
18
|
'Emits the complete CLI surface: every command with its arguments, options, ' +
|
|
@@ -12,7 +12,7 @@ export const doc = {
|
|
|
12
12
|
type: 'command',
|
|
13
13
|
name: 'search',
|
|
14
14
|
displayName: 'astryx search',
|
|
15
|
-
namespace: 'cli',
|
|
15
|
+
namespace: 'cli/commands',
|
|
16
16
|
summary: 'Search components, hooks, docs, and templates in one ranked list',
|
|
17
17
|
description:
|
|
18
18
|
'Terminal front-end to search(): prints one ranked, greppable list across ' +
|
|
@@ -12,7 +12,7 @@ export const doc = {
|
|
|
12
12
|
type: 'command',
|
|
13
13
|
name: 'swizzle',
|
|
14
14
|
displayName: 'astryx swizzle',
|
|
15
|
-
namespace: 'cli',
|
|
15
|
+
namespace: 'cli/commands',
|
|
16
16
|
summary: 'Copy component source for customization',
|
|
17
17
|
description:
|
|
18
18
|
"Ejects a component's source from the resolved @astryxdesign/core (or its owning " +
|
|
@@ -13,7 +13,7 @@ export const doc = {
|
|
|
13
13
|
type: 'command',
|
|
14
14
|
name: 'template',
|
|
15
15
|
displayName: 'astryx template',
|
|
16
|
-
namespace: 'cli',
|
|
16
|
+
namespace: 'cli/commands',
|
|
17
17
|
summary: 'Inject a page or block template',
|
|
18
18
|
description:
|
|
19
19
|
'One entry point for the template family: with no name it lists the discovered ' +
|
|
@@ -13,7 +13,7 @@ export const doc = {
|
|
|
13
13
|
type: 'command',
|
|
14
14
|
name: 'theme add',
|
|
15
15
|
displayName: 'astryx theme add',
|
|
16
|
-
namespace: 'cli',
|
|
16
|
+
namespace: 'cli/commands',
|
|
17
17
|
summary: 'Scaffold a theme into your project as editable source',
|
|
18
18
|
description:
|
|
19
19
|
"Copies a bundled or installed integration theme's source into your project so you own it. " +
|
|
@@ -49,7 +49,7 @@ export const doc = {
|
|
|
49
49
|
{code: 0, when: 'success'},
|
|
50
50
|
{
|
|
51
51
|
code: 1,
|
|
52
|
-
when: 'unknown or ambiguous theme, a path escape, a missing
|
|
52
|
+
when: 'unknown or ambiguous theme, a path escape, a missing descriptor or source, or an existing file without --overwrite',
|
|
53
53
|
},
|
|
54
54
|
],
|
|
55
55
|
related: ['theme list', 'theme build'],
|
|
@@ -13,7 +13,7 @@ export const doc = {
|
|
|
13
13
|
type: 'command',
|
|
14
14
|
name: 'theme build',
|
|
15
15
|
displayName: 'astryx theme build',
|
|
16
|
-
namespace: 'cli',
|
|
16
|
+
namespace: 'cli/commands',
|
|
17
17
|
summary: 'Compile standalone themes or one keyed theme family',
|
|
18
18
|
description:
|
|
19
19
|
'Compiles defineTheme() sources through the same theme pipeline into scoped CSS, ' +
|
|
@@ -13,7 +13,7 @@ export const doc = {
|
|
|
13
13
|
type: 'command',
|
|
14
14
|
name: 'theme list',
|
|
15
15
|
displayName: 'astryx theme list',
|
|
16
|
-
namespace: 'cli',
|
|
16
|
+
namespace: 'cli/commands',
|
|
17
17
|
summary: 'List themes available to add',
|
|
18
18
|
description:
|
|
19
19
|
'Lists themes bundled with this CLI and source themes contributed by installed integrations, ' +
|
|
@@ -37,7 +37,7 @@ export const doc = {
|
|
|
37
37
|
{code: 0, when: 'success'},
|
|
38
38
|
{
|
|
39
39
|
code: 1,
|
|
40
|
-
when: '
|
|
40
|
+
when: 'a bundled or installed theme descriptor cannot be read',
|
|
41
41
|
},
|
|
42
42
|
],
|
|
43
43
|
related: ['theme add', 'theme build'],
|
|
@@ -5,7 +5,7 @@ export const doc = {
|
|
|
5
5
|
type: 'command',
|
|
6
6
|
name: 'theme palette generate',
|
|
7
7
|
displayName: 'astryx theme palette generate',
|
|
8
|
-
namespace: 'cli',
|
|
8
|
+
namespace: 'cli/commands',
|
|
9
9
|
summary: 'Generate an OKLCH palette candidate for human review',
|
|
10
10
|
description:
|
|
11
11
|
'Reads an explicit JSON request and runs the versioned astryx-oklch-v1 recipe. ' +
|
|
@@ -21,8 +21,8 @@ export const doc = {
|
|
|
21
21
|
'JSON is also supported. Existing author-owned files are left untouched unless --overwrite is explicit. ' +
|
|
22
22
|
'When used in a theme integration, keep the palette request under the theme slug, ' +
|
|
23
23
|
'write the candidate and receipt under that same slug, import the candidate from the theme source, ' +
|
|
24
|
-
|
|
25
|
-
'
|
|
24
|
+
'and keep all three inside the theme directory: `astryx theme add` copies that whole ' +
|
|
25
|
+
'directory into the consumer project, so nothing else has to list them.',
|
|
26
26
|
fn: 'themePaletteGenerate',
|
|
27
27
|
args: [{name: 'config', param: 'configPath', required: true}],
|
|
28
28
|
options: [
|
|
@@ -5,7 +5,7 @@ export const doc = {
|
|
|
5
5
|
type: 'command',
|
|
6
6
|
name: 'theme palette',
|
|
7
7
|
displayName: 'astryx theme palette',
|
|
8
|
-
namespace: 'cli',
|
|
8
|
+
namespace: 'cli/commands',
|
|
9
9
|
summary: 'Create and work with theme-owned color palettes',
|
|
10
10
|
description:
|
|
11
11
|
'Palette authoring tools. The initial generate command creates reviewable candidates. ' +
|
|
@@ -13,7 +13,7 @@ export const doc = {
|
|
|
13
13
|
type: 'command',
|
|
14
14
|
name: 'theme targets',
|
|
15
15
|
displayName: 'astryx theme targets',
|
|
16
|
-
namespace: 'cli',
|
|
16
|
+
namespace: 'cli/commands',
|
|
17
17
|
summary: 'List the component theming targets a theme can override',
|
|
18
18
|
description:
|
|
19
19
|
'Prints every `defineTheme` components key across the system: the stable class it paints, ' +
|
|
@@ -13,7 +13,7 @@ export const doc = {
|
|
|
13
13
|
type: 'command',
|
|
14
14
|
name: 'theme template',
|
|
15
15
|
displayName: 'astryx theme template',
|
|
16
|
-
namespace: 'cli',
|
|
16
|
+
namespace: 'cli/commands',
|
|
17
17
|
summary: 'Write the annotated theme template into your project',
|
|
18
18
|
description:
|
|
19
19
|
'Writes theme.template.ts: the annotated reference for the whole theme surface, covering every ' +
|
|
@@ -12,7 +12,7 @@ export const doc = {
|
|
|
12
12
|
type: 'command',
|
|
13
13
|
name: 'theme',
|
|
14
14
|
displayName: 'astryx theme',
|
|
15
|
-
namespace: 'cli',
|
|
15
|
+
namespace: 'cli/commands',
|
|
16
16
|
summary: 'Theme tools: build, export, and manage themes',
|
|
17
17
|
description:
|
|
18
18
|
'The theme command group. Running astryx theme with no subcommand prints the ' +
|
|
@@ -12,7 +12,7 @@ export const doc = {
|
|
|
12
12
|
type: 'command',
|
|
13
13
|
name: 'upgrade',
|
|
14
14
|
displayName: 'astryx upgrade',
|
|
15
|
-
namespace: 'cli',
|
|
15
|
+
namespace: 'cli/commands',
|
|
16
16
|
summary: 'Migrate versions and update ShadCN-copied compositions',
|
|
17
17
|
description:
|
|
18
18
|
'Migrates project source from a previous Astryx version to the installed one by ' +
|
|
@@ -101,13 +101,14 @@ export const doc = {
|
|
|
101
101
|
{label: 'Apply a migration', cli: 'astryx upgrade --from 0.1.0 --apply'},
|
|
102
102
|
],
|
|
103
103
|
exitCodes: [
|
|
104
|
-
{code: 0, when: 'success
|
|
104
|
+
{code: 0, when: 'success, including complete dry-run previews'},
|
|
105
105
|
{
|
|
106
106
|
code: 1,
|
|
107
107
|
when:
|
|
108
108
|
'missing or invalid --from, --registry with --list or a migration flag, a --path escape, ' +
|
|
109
109
|
'no installed @astryxdesign/core (or legacy @xds/core), jscodeshift missing and not installed by --install-deps, ' +
|
|
110
110
|
'an astryx.config that fails validation and that no pending config codemod repairs, ' +
|
|
111
|
+
'an unreadable or invalid protection declaration, a protected file that still requires a codemod change, ' +
|
|
111
112
|
'an unknown codemod, a codemod or post-codemod hook failure, or unresolved registry items',
|
|
112
113
|
},
|
|
113
114
|
],
|
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @file End-to-end protection and regeneration behavior for `astryx upgrade`.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import {afterEach, beforeEach, describe, expect, it} from 'vitest';
|
|
8
|
+
import {spawnSync} from 'node:child_process';
|
|
9
|
+
import * as fs from 'node:fs';
|
|
10
|
+
import * as os from 'node:os';
|
|
11
|
+
import * as path from 'node:path';
|
|
12
|
+
import {fileURLToPath} from 'node:url';
|
|
13
|
+
|
|
14
|
+
const CLI = path.resolve(
|
|
15
|
+
path.dirname(fileURLToPath(import.meta.url)),
|
|
16
|
+
'..',
|
|
17
|
+
'bin',
|
|
18
|
+
'astryx.mjs',
|
|
19
|
+
);
|
|
20
|
+
let root;
|
|
21
|
+
|
|
22
|
+
function write(relative, contents) {
|
|
23
|
+
const file = path.join(root, relative);
|
|
24
|
+
fs.mkdirSync(path.dirname(file), {recursive: true});
|
|
25
|
+
fs.writeFileSync(file, contents);
|
|
26
|
+
return file;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function run(args) {
|
|
30
|
+
const result = spawnSync(
|
|
31
|
+
process.execPath,
|
|
32
|
+
[CLI, '--json', 'upgrade', ...args],
|
|
33
|
+
{
|
|
34
|
+
cwd: root,
|
|
35
|
+
encoding: 'utf8',
|
|
36
|
+
timeout: 60_000,
|
|
37
|
+
env: {...process.env, FORCE_COLOR: '0', CI: ''},
|
|
38
|
+
},
|
|
39
|
+
);
|
|
40
|
+
return {...result, envelope: JSON.parse(result.stdout)};
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
function seed({hook = false} = {}) {
|
|
44
|
+
write('package.json', JSON.stringify({name: 'consumer', private: true}));
|
|
45
|
+
write(
|
|
46
|
+
'node_modules/@astryxdesign/core/package.json',
|
|
47
|
+
JSON.stringify({name: '@astryxdesign/core', version: '0.6.0'}),
|
|
48
|
+
);
|
|
49
|
+
write('.gitattributes', 'generated/** linguist-generated=true\n');
|
|
50
|
+
const source =
|
|
51
|
+
"import {useResizable} from '@astryxdesign/core';\n" +
|
|
52
|
+
'export const usePanel = () => useResizable({minSizePx: 200});\n';
|
|
53
|
+
write('src/owned.tsx', source);
|
|
54
|
+
write('generated/panel.tsx', `// @generated\n${source}`);
|
|
55
|
+
write(
|
|
56
|
+
'astryx.config.mjs',
|
|
57
|
+
hook
|
|
58
|
+
? `export default {hooks: {postCodemod: [{name: 'regenerate', buildCommand: () => ({command: process.execPath, args: ['-e', ${JSON.stringify("const fs=require('node:fs');const p='generated/panel.tsx';const s=fs.readFileSync(p,'utf8');fs.writeFileSync(p,s.replaceAll('minSizePx','minSize')); ")} ]})}]}};\n`
|
|
59
|
+
: 'export default {};\n',
|
|
60
|
+
);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
beforeEach(() => {
|
|
64
|
+
root = fs.mkdtempSync(path.join(os.tmpdir(), 'astryx-protected-upgrade-'));
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
afterEach(() => {
|
|
68
|
+
fs.rmSync(root, {recursive: true, force: true});
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
const ARGS = [
|
|
72
|
+
'--from',
|
|
73
|
+
'0.5.0',
|
|
74
|
+
'--codemod',
|
|
75
|
+
'rename-resizable-pixel-bounds',
|
|
76
|
+
'--path',
|
|
77
|
+
'.',
|
|
78
|
+
];
|
|
79
|
+
|
|
80
|
+
describe('upgrade protected-file contract', () => {
|
|
81
|
+
it('reports the same protected candidate in dry-run and apply while retaining owned edits', () => {
|
|
82
|
+
seed();
|
|
83
|
+
|
|
84
|
+
const dry = run(ARGS);
|
|
85
|
+
expect(dry.status).toBe(1);
|
|
86
|
+
expect(dry.envelope).toMatchObject({
|
|
87
|
+
type: 'upgrade.run',
|
|
88
|
+
data: {
|
|
89
|
+
complete: false,
|
|
90
|
+
errorCode: 'ERR_CODEMOD_PROTECTED',
|
|
91
|
+
modifiedFiles: ['src/owned.tsx'],
|
|
92
|
+
protectedFiles: [
|
|
93
|
+
{
|
|
94
|
+
file: 'generated/panel.tsx',
|
|
95
|
+
reasons: ['generated'],
|
|
96
|
+
declarations: expect.arrayContaining([
|
|
97
|
+
'linguist-generated in .gitattributes:1',
|
|
98
|
+
'@generated in the leading comment block',
|
|
99
|
+
]),
|
|
100
|
+
},
|
|
101
|
+
],
|
|
102
|
+
},
|
|
103
|
+
});
|
|
104
|
+
expect(fs.readFileSync(path.join(root, 'src/owned.tsx'), 'utf8')).toContain(
|
|
105
|
+
'minSizePx',
|
|
106
|
+
);
|
|
107
|
+
|
|
108
|
+
const applied = run([...ARGS, '--apply']);
|
|
109
|
+
expect(applied.status).toBe(1);
|
|
110
|
+
expect(applied.envelope.data.protectedFiles).toEqual(
|
|
111
|
+
dry.envelope.data.protectedFiles,
|
|
112
|
+
);
|
|
113
|
+
expect(fs.readFileSync(path.join(root, 'src/owned.tsx'), 'utf8')).toContain(
|
|
114
|
+
'minSize: 200',
|
|
115
|
+
);
|
|
116
|
+
expect(
|
|
117
|
+
fs.readFileSync(path.join(root, 'generated/panel.tsx'), 'utf8'),
|
|
118
|
+
).toContain('minSizePx');
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
it('preserves a protected config migration when strict config loading fails', () => {
|
|
122
|
+
write('package.json', JSON.stringify({name: 'consumer', private: true}));
|
|
123
|
+
write(
|
|
124
|
+
'node_modules/@astryxdesign/core/package.json',
|
|
125
|
+
JSON.stringify({name: '@astryxdesign/core', version: '0.1.3'}),
|
|
126
|
+
);
|
|
127
|
+
write(
|
|
128
|
+
'astryx.config.mjs',
|
|
129
|
+
`// @generated\nexport default {layout: {components: {KpiCard: '@/KpiCard'}}};\n`,
|
|
130
|
+
);
|
|
131
|
+
write('src/index.ts', 'export {};\n');
|
|
132
|
+
|
|
133
|
+
const result = run([
|
|
134
|
+
'--from',
|
|
135
|
+
'0.1.2',
|
|
136
|
+
'--codemod',
|
|
137
|
+
'migrate-layout-components-to-experimental',
|
|
138
|
+
'--path',
|
|
139
|
+
'src',
|
|
140
|
+
'--apply',
|
|
141
|
+
]);
|
|
142
|
+
|
|
143
|
+
expect(result.status).toBe(1);
|
|
144
|
+
expect(result.envelope).toMatchObject({
|
|
145
|
+
type: 'upgrade.run',
|
|
146
|
+
data: {
|
|
147
|
+
complete: false,
|
|
148
|
+
errorCode: 'ERR_CODEMOD_PROTECTED',
|
|
149
|
+
protectedFiles: [expect.objectContaining({file: 'astryx.config.mjs'})],
|
|
150
|
+
},
|
|
151
|
+
});
|
|
152
|
+
expect(
|
|
153
|
+
fs.readFileSync(path.join(root, 'astryx.config.mjs'), 'utf8'),
|
|
154
|
+
).toContain('layout');
|
|
155
|
+
});
|
|
156
|
+
|
|
157
|
+
it('fails before writes when a protection declaration cannot be parsed', () => {
|
|
158
|
+
seed();
|
|
159
|
+
write('.hgignore', 'syntax: regexp\n[bad\n');
|
|
160
|
+
|
|
161
|
+
const result = run([...ARGS, '--apply']);
|
|
162
|
+
|
|
163
|
+
expect(result.status).toBe(1);
|
|
164
|
+
expect(result.envelope).toMatchObject({
|
|
165
|
+
code: 'ERR_CODEMOD_PROTECTION_SOURCE',
|
|
166
|
+
});
|
|
167
|
+
expect(result.envelope.error).toContain('.hgignore');
|
|
168
|
+
expect(fs.readFileSync(path.join(root, 'src/owned.tsx'), 'utf8')).toContain(
|
|
169
|
+
'minSizePx',
|
|
170
|
+
);
|
|
171
|
+
});
|
|
172
|
+
|
|
173
|
+
it('preserves protected-file facts when regeneration fails', () => {
|
|
174
|
+
seed();
|
|
175
|
+
write(
|
|
176
|
+
'astryx.config.mjs',
|
|
177
|
+
`export default {hooks: {postCodemod: [{name: 'regenerate', buildCommand: () => ({command: process.execPath, args: ['-e', 'process.exit(7)']})}]}};\n`,
|
|
178
|
+
);
|
|
179
|
+
|
|
180
|
+
const applied = run([...ARGS, '--apply']);
|
|
181
|
+
|
|
182
|
+
expect(applied.status).toBe(1);
|
|
183
|
+
expect(applied.envelope).toMatchObject({
|
|
184
|
+
type: 'upgrade.run',
|
|
185
|
+
data: {
|
|
186
|
+
complete: false,
|
|
187
|
+
errorCode: 'ERR_CODEMOD_PROTECTED',
|
|
188
|
+
protectedFiles: [
|
|
189
|
+
expect.objectContaining({file: 'generated/panel.tsx'}),
|
|
190
|
+
],
|
|
191
|
+
errors: [
|
|
192
|
+
expect.objectContaining({
|
|
193
|
+
codemod: 'post-codemod-hook',
|
|
194
|
+
error: expect.stringContaining('Post-codemod hook failed'),
|
|
195
|
+
}),
|
|
196
|
+
],
|
|
197
|
+
},
|
|
198
|
+
});
|
|
199
|
+
});
|
|
200
|
+
|
|
201
|
+
it('runs declared regeneration and clears a generated-file block after reevaluation', () => {
|
|
202
|
+
seed({hook: true});
|
|
203
|
+
|
|
204
|
+
const applied = run([...ARGS, '--apply']);
|
|
205
|
+
|
|
206
|
+
expect(applied.status, applied.stderr).toBe(0);
|
|
207
|
+
expect(applied.envelope).toMatchObject({
|
|
208
|
+
type: 'upgrade.run',
|
|
209
|
+
data: {
|
|
210
|
+
complete: true,
|
|
211
|
+
modifiedFiles: ['src/owned.tsx', 'generated/panel.tsx'],
|
|
212
|
+
protectedFiles: [],
|
|
213
|
+
declinedCandidates: [],
|
|
214
|
+
},
|
|
215
|
+
});
|
|
216
|
+
expect(fs.readFileSync(path.join(root, 'src/owned.tsx'), 'utf8')).toContain(
|
|
217
|
+
'minSize: 200',
|
|
218
|
+
);
|
|
219
|
+
expect(
|
|
220
|
+
fs.readFileSync(path.join(root, 'generated/panel.tsx'), 'utf8'),
|
|
221
|
+
).toContain('minSize: 200');
|
|
222
|
+
|
|
223
|
+
const second = run([...ARGS, '--apply']);
|
|
224
|
+
expect(second.status, second.stderr).toBe(0);
|
|
225
|
+
expect(second.envelope.data.complete).toBe(true);
|
|
226
|
+
expect(second.envelope.data.filesChanged).toBe(0);
|
|
227
|
+
});
|
|
228
|
+
});
|
|
@@ -65,6 +65,9 @@ export function registerUpgrade(program) {
|
|
|
65
65
|
? result.data.registryCompositions
|
|
66
66
|
: undefined;
|
|
67
67
|
if (registrySummary && !registrySummary.ok) process.exitCode = 1;
|
|
68
|
+
if (result.type === 'upgrade.run' && result.data.complete === false) {
|
|
69
|
+
process.exitCode = 1;
|
|
70
|
+
}
|
|
68
71
|
|
|
69
72
|
// `--list` is the one lookup here: which migrations exist for the
|
|
70
73
|
// range. Everything else migrates the project — an effect, reported by
|