@astryxdesign/cli 0.6.9-canary.47eb0dd → 0.7.0-canary.0c4c661
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 +11 -9
- package/api/init/init.doc.mjs +5 -1
- package/api/init/init.type.d.mts +4 -1
- package/api/init/init.type.mjs +1 -1
- package/api/init/remove/remove.mjs +8 -3
- package/api/init/remove/remove.test.mjs +12 -0
- package/api/theme/build/build.d.mts +1 -2
- package/api/theme/build/build.mjs +14 -30
- package/api/theme/build/build.test.mjs +11 -24
- package/api/theme/targets/targets.test.mjs +0 -4
- package/api/theme/theme.type.d.mts +0 -4
- package/api/theme/theme.type.mjs +0 -1
- package/api/theme/themeTargets.doc.mjs +3 -4
- package/assets/codemods/transforms/next/README.md +15 -17
- package/assets/codemods/transforms/next/__tests__/migrate-deprecated-theme-surface.test.mjs +322 -0
- package/assets/codemods/transforms/next/index.mjs +11 -1
- package/assets/codemods/transforms/next/migrate-deprecated-theme-surface-v0.6-data.mjs +229 -0
- package/assets/codemods/transforms/next/migrate-deprecated-theme-surface.mjs +624 -0
- package/assets/codemods/transforms/v0.6.0/migrate-astryx-theme-selectors-to-data-attrs.mjs +38 -18
- package/assets/docs/tree/styling-advanced.doc.mjs +21 -14
- package/authoring/doctypes/base/type.ts +0 -9
- package/clients/cli/commands/build-theme.ascii-output.test.mjs +1 -1
- package/clients/cli/commands/build-theme.mjs +2 -13
- package/clients/cli/commands/build-theme.registry.test.mjs +0 -10
- package/clients/cli/commands/discover.mjs +2 -1
- package/clients/cli/commands/empty-argument.test.mjs +16 -0
- package/clients/cli/commands/swizzle.mjs +4 -1
- package/clients/cli/commands/template.mjs +7 -1
- package/clients/cli/commands/theme-targets.behavior.test.mjs +8 -6
- package/clients/cli/lib/cli-error.mjs +19 -0
- package/clients/cli/lib/component-format.mjs +111 -57
- package/clients/cli/lib/component-format.test.mjs +28 -39
- package/clients/cli/lib/doc-text-ascii.test.mjs +5 -2
- package/foundation/agent-docs/agent-docs.d.mts +2 -1
- package/foundation/agent-docs/agent-docs.mjs +5 -0
- package/foundation/discovery/theming-targets.d.mts +1 -20
- package/foundation/discovery/theming-targets.mjs +1 -38
- package/foundation/discovery/theming-targets.test.mjs +9 -175
- package/foundation/response/response-types.doc.mjs +10 -8
- package/foundation/response/response-types.doc.test.mjs +36 -14
- package/package.json +9 -9
package/README.md
CHANGED
|
@@ -423,7 +423,7 @@ Every response has a `type` discriminant. The full set is below (generated from
|
|
|
423
423
|
| Type | What `data` carries |
|
|
424
424
|
| --------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
425
425
|
| `init.run` | The install receipt: the `mode` (`default` \| `features`), the features run, agent-doc files written, any soft `docsError`, whether theme guidance was emitted, the template outcome (`workflow` \| `created` \| `skipped`) plus its path, and whether the next-steps were emitted. |
|
|
426
|
-
| `init.remove` |
|
|
426
|
+
| `init.remove` | The removal receipt — returned when --remove-agents is set: `data.removed` is true when a managed agent-docs block was found and removed, and false when there was none to remove. |
|
|
427
427
|
| `component.list` | The component catalog grouped by component group (each component's group field): `detail` (the level: names \| compact \| full) and `components`, the grouped map of names entries ({name, package, and optional canonical import for integrations}), brief entries ({name, package, description, import}), or a full ComponentDoc per entry with its package. |
|
|
428
428
|
| `component.batch` | The component specialization of the shared `BatchResponse` and `BatchRow` types. An explicit programmatic selector array, or two or more CLI selectors, returns one ordered receipt: `count` plus `results`, one row per selector including duplicates. Every row carries `selector` and `status` (found \| not_found \| ambiguous \| error). A found row carries `result`, the same {type, data} response as one selector. An ambiguous row carries `code`, `error`, and `candidates` ({package, component, kind, installed}). Other failed rows carry `code`, `error`, and optional `suggestions` ({name, reason}). |
|
|
429
429
|
| `component.detail` | One component's authored ComponentDoc plus ownership fields (package, the owner; import, the specifier; sourceAvailable, whether source exists) and parentDoc (present when the component is documented inside another component's doc, naming that doc). The envelope's package names the same owner. |
|
|
@@ -466,7 +466,7 @@ Every response has a `type` discriminant. The full set is below (generated from
|
|
|
466
466
|
| `theme.app` | The app theme record after add, remove, or use. It includes every added theme and its built imports, the default slug, generated module path, and the command change. After add, the envelope package names the npm package that owns the added theme; a local theme has none. |
|
|
467
467
|
| `theme.eject` | A local source-fork receipt with the resolved slug, displayName, source theme maintained flag, source-selector package, outputDir, source entry, exportName, and every file written, including the descriptor. The written local descriptor always uses maintained: false. |
|
|
468
468
|
| `theme.template` | A write receipt for the annotated theme template: the path (relative to cwd), whether it was written, and the reason it was not. `exists` when a file was already there, which is a success. |
|
|
469
|
-
| `theme.targets` | The whole themeable surface: the echoed filter, componentCount, and targets, one per theming target — {key, className, component, props, states
|
|
469
|
+
| `theme.targets` | The whole themeable surface: the echoed filter, componentCount, and targets, one per theming target — {key, className, component, props, states}, where props and states are its legal override keys. |
|
|
470
470
|
| `theme.palette.generate` | An author-reviewable OKLCH palette candidate, its reproducibility receipt, summary counts, and optional candidate/receipt file-write result. |
|
|
471
471
|
| `upgrade.list` | Every available codemod, oldest→newest, as {name, package, title, version, optional}; returned for --list without running anything. |
|
|
472
472
|
| `upgrade.registry` | The copied-composition receipt for --registry: applied, ok, the counts (found, current, wouldUpdate, updated, wouldMerge, merged, wouldRefreshReceipt, receiptsRefreshed, conflicts, missing, invalid, failed), and items. |
|
|
@@ -611,14 +611,16 @@ Do not guess that version in ordinary feature PRs. Add new codemods to
|
|
|
611
611
|
- leave `transforms/next/README.md` in place; it documents the staging area and
|
|
612
612
|
is never promoted.
|
|
613
613
|
|
|
614
|
-
During the Version Packages PR, `pnpm version-packages` runs
|
|
615
|
-
`scripts/promote-codemod-next.mjs` after
|
|
616
|
-
all staged entries except the
|
|
617
|
-
registers that version in
|
|
618
|
-
the promoted files from
|
|
614
|
+
During the release branch's Version Packages PR, `pnpm version-packages` runs
|
|
615
|
+
`scripts/promote-codemod-next.mjs` after it writes changelogs under the version
|
|
616
|
+
already declared at the cut. The script copies all staged entries except the
|
|
617
|
+
README into `transforms/v<declared-core-version>/`, registers that version in
|
|
618
|
+
`packages/cli/assets/codemods/registry.mjs`, and clears the promoted files from
|
|
619
|
+
`next`.
|
|
619
620
|
|
|
620
|
-
|
|
621
|
-
|
|
621
|
+
Feature PRs stage migration work without guessing a version. The marked release
|
|
622
|
+
branch assigns the exact cut declaration; the later merge-back carries those
|
|
623
|
+
exact promoted files to main without regenerating them.
|
|
622
624
|
|
|
623
625
|
## Integrations
|
|
624
626
|
|
package/api/init/init.doc.mjs
CHANGED
|
@@ -76,10 +76,14 @@ export const doc = {
|
|
|
76
76
|
{
|
|
77
77
|
type: 'init.remove',
|
|
78
78
|
description:
|
|
79
|
-
'
|
|
79
|
+
'The removal receipt, returned when `removeAgents` is set: `data.removed` is true when a managed agent-docs block was found and removed, and false when there was none to remove.',
|
|
80
80
|
},
|
|
81
81
|
],
|
|
82
82
|
throws: [
|
|
83
|
+
{
|
|
84
|
+
code: 'ERR_INVALID_ARGUMENT',
|
|
85
|
+
when: '--remove-agents is combined with --features, --all, --agent, or --agent-docs-path; or --all is combined with --features',
|
|
86
|
+
},
|
|
83
87
|
{
|
|
84
88
|
code: 'ERR_UNKNOWN_AGENT',
|
|
85
89
|
when: 'the agents feature runs (default mode, features includes agents, or all) and `agent` is not one of claude, cursor, codex, hermes, muse, all',
|
package/api/init/init.type.d.mts
CHANGED
|
@@ -52,8 +52,11 @@ export type InitRunResponse = {
|
|
|
52
52
|
};
|
|
53
53
|
export type InitRemoveResponse = {
|
|
54
54
|
type: "init.remove";
|
|
55
|
+
/**
|
|
56
|
+
* False when no managed agent-docs block was found, so nothing was removed.
|
|
57
|
+
*/
|
|
55
58
|
data: {
|
|
56
|
-
removed:
|
|
59
|
+
removed: boolean;
|
|
57
60
|
};
|
|
58
61
|
};
|
|
59
62
|
/**
|
package/api/init/init.type.mjs
CHANGED
|
@@ -23,7 +23,12 @@ import {logger} from '../../logger.mjs';
|
|
|
23
23
|
* @returns {Promise<import('../init.type.mjs').InitRemoveResponse>}
|
|
24
24
|
*/
|
|
25
25
|
export async function remove({cwd = process.cwd()} = {}) {
|
|
26
|
-
removeAgentDocs(cwd);
|
|
27
|
-
|
|
28
|
-
|
|
26
|
+
const removedFrom = removeAgentDocs(cwd);
|
|
27
|
+
const removed = removedFrom.length > 0;
|
|
28
|
+
logger.log(
|
|
29
|
+
removed
|
|
30
|
+
? '[ok] AI agent docs removed.'
|
|
31
|
+
: '[ok] Nothing to remove: no Astryx agent-docs block was found.',
|
|
32
|
+
);
|
|
33
|
+
return {type: 'init.remove', data: {removed}};
|
|
29
34
|
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
import {describe, it, expect, beforeEach, afterEach, vi} from 'vitest';
|
|
3
|
+
import * as fs from 'node:fs'; import * as path from 'node:path';
|
|
4
|
+
import {init} from '../init.mjs'; import {remove} from './remove.mjs'; import {logger} from '../../logger.mjs';
|
|
5
|
+
let dir;
|
|
6
|
+
beforeEach(() => { dir = fs.mkdtempSync(path.join(process.cwd(), '.astryx-rm-')); fs.writeFileSync(path.join(dir,'package.json'),JSON.stringify({name:'c',version:'1.0.0'})); });
|
|
7
|
+
afterEach(() => { fs.rmSync(dir,{recursive:true,force:true}); logger.setSilent(true); });
|
|
8
|
+
describe('init.remove says whether anything was removed', () => {
|
|
9
|
+
it('false on clean', async () => { const r=await remove({cwd:dir}); expect(r.type).toBe('init.remove'); expect(r.data.removed).toBe(false); });
|
|
10
|
+
it('true then false', async () => { await init({features:['agents']},{cwd:dir}); expect(fs.readFileSync(path.join(dir,'AGENTS.md'),'utf8')).toContain('<!-- ASTRYX:START -->'); const a=await remove({cwd:dir}); expect(a.data.removed).toBe(true); const b=await remove({cwd:dir}); expect(b.data.removed).toBe(false); });
|
|
11
|
+
it('human line', async () => { const l=[]; const s=vi.spyOn(console,'log').mockImplementation((...a)=>l.push(a.join(' '))); logger.setSilent(false); try{await remove({cwd:dir});}finally{logger.setSilent(true);s.mockRestore();} expect(l.join('\n')).toContain('Nothing to remove'); });
|
|
12
|
+
});
|
|
@@ -50,7 +50,7 @@ export function validateThemePrivateInputs(file: string, { cwd }?: {
|
|
|
50
50
|
* Validate component overrides against one discovered target registry.
|
|
51
51
|
*
|
|
52
52
|
* @param {{components?: Record<string, Record<string, unknown>>, onDark?: {components?: Record<string, Record<string, unknown>>}, onLight?: {components?: Record<string, Record<string, unknown>>}, __onDark?: {components?: Record<string, Record<string, unknown>>}, __onLight?: {components?: Record<string, Record<string, unknown>>}}} themeDef
|
|
53
|
-
* @param {{propsByKey: Record<string, string[]
|
|
53
|
+
* @param {{propsByKey: Record<string, string[]>}} knownComponents
|
|
54
54
|
* @returns {string[]}
|
|
55
55
|
*/
|
|
56
56
|
export function validateComponentOverridesAgainstRegistry(themeDef: {
|
|
@@ -69,7 +69,6 @@ export function validateComponentOverridesAgainstRegistry(themeDef: {
|
|
|
69
69
|
};
|
|
70
70
|
}, knownComponents: {
|
|
71
71
|
propsByKey: Record<string, string[]>;
|
|
72
|
-
deprecatedByKey: Record<string, string>;
|
|
73
72
|
}): string[];
|
|
74
73
|
/**
|
|
75
74
|
* Print the install snippet and font guidance once for a batch: the first
|
|
@@ -72,7 +72,7 @@ import {logger} from '../../logger.mjs';
|
|
|
72
72
|
import {loadComponentDoc} from '../../../foundation/discovery/component-loader.mjs';
|
|
73
73
|
import {
|
|
74
74
|
collectThemingTargets,
|
|
75
|
-
|
|
75
|
+
targetsByKey,
|
|
76
76
|
} from '../../../foundation/discovery/theming-targets.mjs';
|
|
77
77
|
import {
|
|
78
78
|
collectUnloadedFonts,
|
|
@@ -752,10 +752,8 @@ const _augmentationTargetCache = new Map();
|
|
|
752
752
|
* Resolve a rendered theme class token (the key without `astryx-`) to candidate
|
|
753
753
|
* public core subpaths and interface prefixes that may own its augmentable prop
|
|
754
754
|
* maps. Some tokens are subtargets documented by a parent component
|
|
755
|
-
* (`avatar-status-dot` augments `@astryxdesign/core/Avatar`)
|
|
756
|
-
*
|
|
757
|
-
* while the public API keeps `ProgressBar`/`StatusDot` casing. Component docs
|
|
758
|
-
* are the source of truth for the target token → owning component relationship.
|
|
755
|
+
* (`avatar-status-dot` augments `@astryxdesign/core/Avatar`). Component docs are
|
|
756
|
+
* the source of truth for the target token → owning component relationship.
|
|
759
757
|
*
|
|
760
758
|
* @param {string} componentName
|
|
761
759
|
* @returns {Promise<Array<{moduleName: string, interfacePrefix: string}>>}
|
|
@@ -832,8 +830,7 @@ async function resolveAugmentationTargetCandidates(componentName) {
|
|
|
832
830
|
|
|
833
831
|
// Try the exact rendered token first for documented subtargets such as
|
|
834
832
|
// avatar-status-dot → AvatarStatusDotVariantMap, then the owning public
|
|
835
|
-
// component name for
|
|
836
|
-
// progressbar → ProgressBarVariantMap/statusdot → StatusDotVariantMap.
|
|
833
|
+
// component name (for example, ProgressBar for progress-bar-fill).
|
|
837
834
|
addCandidate(moduleName, toPascalCase(componentName));
|
|
838
835
|
addCandidate(moduleName, moduleName);
|
|
839
836
|
if (Array.isArray(doc?.components)) {
|
|
@@ -1991,30 +1988,25 @@ export declare const ${iconInfo.exportName}: IconRegistry;
|
|
|
1991
1988
|
|
|
1992
1989
|
/**
|
|
1993
1990
|
* Load known theme target keys from core component docs: the visual props AND
|
|
1994
|
-
* runtime states each target reflects
|
|
1995
|
-
*
|
|
1996
|
-
* but every use receives actionable build guidance. Returns null when docs are
|
|
1997
|
-
* unavailable so validation skips warnings rather than guessing from a second
|
|
1998
|
-
* registry.
|
|
1991
|
+
* runtime states each target reflects. Returns null when docs are unavailable so
|
|
1992
|
+
* validation skips warnings rather than guessing from a second registry.
|
|
1999
1993
|
*
|
|
2000
|
-
* @returns {Promise<{propsByKey: Record<string, string[]
|
|
1994
|
+
* @returns {Promise<{propsByKey: Record<string, string[]>} | null>}
|
|
2001
1995
|
*/
|
|
2002
1996
|
async function loadKnownComponents() {
|
|
2003
1997
|
const coreRoot = resolveCoreRoot();
|
|
2004
1998
|
const coreSrc = coreRoot ? path.join(coreRoot, 'src') : null;
|
|
2005
1999
|
if (!coreSrc || !fs.existsSync(coreSrc)) return null;
|
|
2006
2000
|
|
|
2007
|
-
const
|
|
2008
|
-
|
|
2009
|
-
);
|
|
2010
|
-
return Object.keys(registry.propsByKey).length > 0 ? registry : null;
|
|
2001
|
+
const propsByKey = targetsByKey(await collectThemingTargets(coreSrc));
|
|
2002
|
+
return Object.keys(propsByKey).length > 0 ? {propsByKey} : null;
|
|
2011
2003
|
}
|
|
2012
2004
|
|
|
2013
|
-
/** @type {{propsByKey: Record<string, string[]
|
|
2005
|
+
/** @type {{propsByKey: Record<string, string[]>} | null | undefined} */
|
|
2014
2006
|
let knownComponentsCache;
|
|
2015
2007
|
|
|
2016
2008
|
/**
|
|
2017
|
-
* @returns {Promise<{propsByKey: Record<string, string[]
|
|
2009
|
+
* @returns {Promise<{propsByKey: Record<string, string[]>} | null>}
|
|
2018
2010
|
*/
|
|
2019
2011
|
async function getKnownComponents() {
|
|
2020
2012
|
if (knownComponentsCache === undefined) {
|
|
@@ -2027,7 +2019,7 @@ async function getKnownComponents() {
|
|
|
2027
2019
|
* Validate component overrides against one discovered target registry.
|
|
2028
2020
|
*
|
|
2029
2021
|
* @param {{components?: Record<string, Record<string, unknown>>, onDark?: {components?: Record<string, Record<string, unknown>>}, onLight?: {components?: Record<string, Record<string, unknown>>}, __onDark?: {components?: Record<string, Record<string, unknown>>}, __onLight?: {components?: Record<string, Record<string, unknown>>}}} themeDef
|
|
2030
|
-
* @param {{propsByKey: Record<string, string[]
|
|
2022
|
+
* @param {{propsByKey: Record<string, string[]>}} knownComponents
|
|
2031
2023
|
* @returns {string[]}
|
|
2032
2024
|
*/
|
|
2033
2025
|
export function validateComponentOverridesAgainstRegistry(
|
|
@@ -2053,9 +2045,8 @@ export function validateComponentOverridesAgainstRegistry(
|
|
|
2053
2045
|
}
|
|
2054
2046
|
}
|
|
2055
2047
|
|
|
2056
|
-
for (const {
|
|
2048
|
+
for (const {components} of layers) {
|
|
2057
2049
|
for (const [component, rules] of Object.entries(components)) {
|
|
2058
|
-
const location = layerName === 'base' ? '' : ` in ${layerName}`;
|
|
2059
2050
|
if (!(component in knownComponents.propsByKey)) {
|
|
2060
2051
|
const similar = Object.keys(knownComponents.propsByKey)
|
|
2061
2052
|
.filter(k => {
|
|
@@ -2081,13 +2072,6 @@ export function validateComponentOverridesAgainstRegistry(
|
|
|
2081
2072
|
continue;
|
|
2082
2073
|
}
|
|
2083
2074
|
|
|
2084
|
-
const replacement = knownComponents.deprecatedByKey[component];
|
|
2085
|
-
if (replacement != null) {
|
|
2086
|
-
warnings.push(
|
|
2087
|
-
`Deprecated component target "${component}"${location}. Use "${replacement}" instead.`,
|
|
2088
|
-
);
|
|
2089
|
-
}
|
|
2090
|
-
|
|
2091
2075
|
const knownProps = knownComponents.propsByKey[component];
|
|
2092
2076
|
for (const key of Object.keys(rules)) {
|
|
2093
2077
|
if (key === 'base') continue;
|
|
@@ -2114,7 +2098,7 @@ export function validateComponentOverridesAgainstRegistry(
|
|
|
2114
2098
|
|
|
2115
2099
|
/**
|
|
2116
2100
|
* Validate component overrides in a theme definition.
|
|
2117
|
-
* Warns on unknown component
|
|
2101
|
+
* Warns on unknown component and prop names.
|
|
2118
2102
|
*
|
|
2119
2103
|
* @param {{components?: Record<string, Record<string, unknown>>, onDark?: {components?: Record<string, Record<string, unknown>>}, onLight?: {components?: Record<string, Record<string, unknown>>}, __onDark?: {components?: Record<string, Record<string, unknown>>}, __onLight?: {components?: Record<string, Record<string, unknown>>}}} themeDef
|
|
2120
2104
|
* @returns {Promise<string[]>}
|
|
@@ -547,26 +547,17 @@ describe('themeBuild() — component override validation', () => {
|
|
|
547
547
|
]);
|
|
548
548
|
});
|
|
549
549
|
|
|
550
|
-
it('
|
|
550
|
+
it('deduplicates removed aliases as unknown across root and conditional layers', () => {
|
|
551
551
|
const registry = {
|
|
552
|
-
propsByKey: {
|
|
553
|
-
'old-target': ['variant'],
|
|
554
|
-
'new-target': ['variant'],
|
|
555
|
-
},
|
|
556
|
-
deprecatedByKey: {'old-target': 'new-target'},
|
|
552
|
+
propsByKey: {'new-target': ['variant']},
|
|
557
553
|
};
|
|
558
554
|
|
|
559
555
|
expect(
|
|
560
556
|
validateComponentOverridesAgainstRegistry(
|
|
561
557
|
{
|
|
562
|
-
components: {
|
|
563
|
-
'old-target': {base: {color: 'red'}},
|
|
564
|
-
'new-target': {base: {color: 'blue'}},
|
|
565
|
-
},
|
|
558
|
+
components: {'old-target': {base: {color: 'red'}}},
|
|
566
559
|
onDark: {
|
|
567
|
-
components: {
|
|
568
|
-
'old-target': {'variant:quiet': {color: 'pink'}},
|
|
569
|
-
},
|
|
560
|
+
components: {'old-target': {'variant:quiet': {color: 'pink'}}},
|
|
570
561
|
},
|
|
571
562
|
adaptations: {
|
|
572
563
|
rules: [
|
|
@@ -583,31 +574,27 @@ describe('themeBuild() — component override validation', () => {
|
|
|
583
574
|
},
|
|
584
575
|
registry,
|
|
585
576
|
),
|
|
586
|
-
).toEqual([
|
|
587
|
-
'Deprecated component target "old-target". Use "new-target" instead.',
|
|
588
|
-
'Deprecated component target "old-target" in onDark. Use "new-target" instead.',
|
|
589
|
-
'Deprecated component target "old-target" in adaptation rule 1. Use "new-target" instead.',
|
|
590
|
-
]);
|
|
577
|
+
).toEqual(['Unknown component "old-target".']);
|
|
591
578
|
});
|
|
592
579
|
|
|
593
|
-
it('
|
|
594
|
-
const themeFile = path.join(tmpDir, '
|
|
580
|
+
it('reports a removed target alias as an unknown component key', async () => {
|
|
581
|
+
const themeFile = path.join(tmpDir, 'removed-target.mjs');
|
|
595
582
|
fs.writeFileSync(
|
|
596
583
|
themeFile,
|
|
597
584
|
`export default {
|
|
598
|
-
name: '
|
|
585
|
+
name: 'removed-target',
|
|
599
586
|
tokens: {},
|
|
600
587
|
components: {progressbar: {base: {color: 'red'}}},
|
|
601
588
|
};\n`,
|
|
602
589
|
);
|
|
603
590
|
|
|
604
|
-
const result = await themeBuild('
|
|
591
|
+
const result = await themeBuild('removed-target.mjs', {}, {cwd: tmpDir});
|
|
605
592
|
|
|
606
593
|
expect(result?.data.warnings).toContain(
|
|
607
|
-
'
|
|
594
|
+
'Unknown component "progressbar". Did you mean: progress-bar?',
|
|
608
595
|
);
|
|
609
596
|
expect(
|
|
610
|
-
fs.readFileSync(path.join(tmpDir, '
|
|
597
|
+
fs.readFileSync(path.join(tmpDir, 'removed-target.css'), 'utf8'),
|
|
611
598
|
).toContain('.astryx-progressbar');
|
|
612
599
|
});
|
|
613
600
|
});
|
|
@@ -19,7 +19,6 @@ describe('themeTargets (api/theme/targets)', () => {
|
|
|
19
19
|
const allowedKeys = new Set([
|
|
20
20
|
'className',
|
|
21
21
|
'component',
|
|
22
|
-
'deprecatedFor',
|
|
23
22
|
'key',
|
|
24
23
|
'props',
|
|
25
24
|
'states',
|
|
@@ -35,9 +34,6 @@ describe('themeTargets (api/theme/targets)', () => {
|
|
|
35
34
|
expect(Object.keys(target).filter(key => !allowedKeys.has(key))).toEqual(
|
|
36
35
|
[],
|
|
37
36
|
);
|
|
38
|
-
if (target.deprecatedFor !== undefined) {
|
|
39
|
-
expect(target.deprecatedFor).toEqual(expect.any(String));
|
|
40
|
-
}
|
|
41
37
|
}
|
|
42
38
|
}, 60_000);
|
|
43
39
|
|
|
@@ -221,10 +221,6 @@ export type ThemeTargetEntry = {
|
|
|
221
221
|
component: string;
|
|
222
222
|
props: string[];
|
|
223
223
|
states: string[];
|
|
224
|
-
/**
|
|
225
|
-
* - exact canonical replacement for a deprecated target
|
|
226
|
-
*/
|
|
227
|
-
deprecatedFor?: string | undefined;
|
|
228
224
|
};
|
|
229
225
|
/**
|
|
230
226
|
* astryx --json theme targets [filter]
|
package/api/theme/theme.type.mjs
CHANGED
|
@@ -17,9 +17,8 @@ export const doc = {
|
|
|
17
17
|
summary: 'List every component theming target a theme can override.',
|
|
18
18
|
description:
|
|
19
19
|
'Enumerates the whole themeable surface: each `defineTheme` components key, the stable ' +
|
|
20
|
-
'class it paints, the component that declares it, the props and states that are legal ' +
|
|
21
|
-
'override keys under it
|
|
22
|
-
'Same source as the Theming table `astryx component <Name>` prints ' +
|
|
20
|
+
'class it paints, the component that declares it, and the props and states that are legal ' +
|
|
21
|
+
'override keys under it. Same source as the Theming table `astryx component <Name>` prints ' +
|
|
23
22
|
'(the component docs), so the list cannot drift from the components, and `theme build` ' +
|
|
24
23
|
'validates overrides against this exact set. A filter naming a component gives that ' +
|
|
25
24
|
"component's set; anything else is a case-insensitive substring search over each target's key, class and component.",
|
|
@@ -55,7 +54,7 @@ export const doc = {
|
|
|
55
54
|
{
|
|
56
55
|
type: 'theme.targets',
|
|
57
56
|
description:
|
|
58
|
-
'The echoed filter, how many components are represented, and the targets: each {key, className, component, props, states
|
|
57
|
+
'The echoed filter, how many components are represented, and the targets: each {key, className, component, props, states}.',
|
|
59
58
|
},
|
|
60
59
|
],
|
|
61
60
|
throws: [
|
|
@@ -2,29 +2,27 @@
|
|
|
2
2
|
|
|
3
3
|
Put new core codemods here while normal feature PRs are in flight.
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
the
|
|
8
|
-
|
|
9
|
-
here, then the release/versioning step promotes it into the actual versioned
|
|
10
|
-
folder.
|
|
5
|
+
The folder that ships a codemod is the target package version containing the
|
|
6
|
+
change. Feature PRs do not choose that version: main's fixed-group declaration is
|
|
7
|
+
the owner plan, and the marked release branch freezes it at cut. Contributors stage
|
|
8
|
+
work here; the release branch promotes it into the exact declared version folder.
|
|
11
9
|
|
|
12
10
|
## Authoring rules
|
|
13
11
|
|
|
14
12
|
- Add new transform modules directly under this directory.
|
|
15
|
-
- Add or update
|
|
16
|
-
|
|
17
|
-
-
|
|
18
|
-
- Do **not** guess a future `v0.x.y` folder in feature PRs.
|
|
13
|
+
- Add or update `index.mjs` so it exports transforms in run order.
|
|
14
|
+
- Keep tests beside each transform, following existing version-folder patterns.
|
|
15
|
+
- Do **not** guess a future `v0.x.y` folder in a feature PR.
|
|
19
16
|
- Do **not** put release-specific content in this README; it stays in `next`.
|
|
20
17
|
|
|
21
18
|
## Release promotion
|
|
22
19
|
|
|
23
|
-
`pnpm version-packages` runs
|
|
24
|
-
`
|
|
25
|
-
README into
|
|
26
|
-
|
|
20
|
+
On the marked release branch, `pnpm version-packages` runs
|
|
21
|
+
`scripts/promote-codemod-next.mjs` after writing changelogs under the cut's declared
|
|
22
|
+
version. It copies every entry except this README into
|
|
23
|
+
`packages/cli/assets/codemods/transforms/v<declared-core-version>/`, registers the
|
|
24
|
+
folder, and removes the promoted files from `next`.
|
|
27
25
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
26
|
+
The Version Packages PR reviews the generated folder with the changelogs. After
|
|
27
|
+
publication, trusted merge-back carries those exact promoted files to current main;
|
|
28
|
+
it does not regenerate them.
|