@openedx/paragon 23.7.0 → 23.8.0
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/bin/paragon-scripts.js +5 -0
- package/lib/__tests__/build-tokens.test.js +19 -0
- package/lib/build-tokens.js +16 -12
- package/package.json +1 -1
package/bin/paragon-scripts.js
CHANGED
|
@@ -96,6 +96,11 @@ const COMMANDS = {
|
|
|
96
96
|
Can be provided as a comma-separated list (e.g., "light,dark") or multiple arguments (e.g., "-t light -t dark").`,
|
|
97
97
|
defaultValue: 'light',
|
|
98
98
|
},
|
|
99
|
+
{
|
|
100
|
+
name: '--exclude-core',
|
|
101
|
+
description: 'Exclude core from the token build.',
|
|
102
|
+
defaultValue: false,
|
|
103
|
+
},
|
|
99
104
|
{
|
|
100
105
|
name: '-v, --verbose',
|
|
101
106
|
description: 'Enable verbose logging.',
|
|
@@ -63,6 +63,25 @@ describe('buildTokensCommand', () => {
|
|
|
63
63
|
}));
|
|
64
64
|
});
|
|
65
65
|
|
|
66
|
+
it('should handle the exclude-core flag', async () => {
|
|
67
|
+
await buildTokensCommand(['--exclude-core']);
|
|
68
|
+
|
|
69
|
+
// only light theme, not core
|
|
70
|
+
expect(StyleDictionary).toHaveBeenCalledTimes(1);
|
|
71
|
+
const callArgs = StyleDictionary.mock.calls[0][0];
|
|
72
|
+
for (const file of callArgs.platforms.css.files) {
|
|
73
|
+
expect(file.destination).toContain('themes/light');
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
// Verify only light theme index files are created
|
|
77
|
+
expect(createIndexCssFile).toHaveBeenCalledTimes(1);
|
|
78
|
+
expect(createIndexCssFile).toHaveBeenCalledWith(expect.objectContaining({
|
|
79
|
+
buildDir: defaultBuildDir,
|
|
80
|
+
isThemeVariant: true,
|
|
81
|
+
themeVariant: 'light',
|
|
82
|
+
}));
|
|
83
|
+
});
|
|
84
|
+
|
|
66
85
|
it('should use custom build path', async () => {
|
|
67
86
|
const customBuildDir = './custom-build/';
|
|
68
87
|
await buildTokensCommand(['--build-dir', customBuildDir]);
|
package/lib/build-tokens.js
CHANGED
|
@@ -22,6 +22,7 @@ async function buildTokensCommand(commandArgs) {
|
|
|
22
22
|
'build-dir': './build/',
|
|
23
23
|
'source-tokens-only': false,
|
|
24
24
|
'output-references': true,
|
|
25
|
+
'exclude-core': false,
|
|
25
26
|
verbose: false,
|
|
26
27
|
};
|
|
27
28
|
|
|
@@ -38,12 +39,13 @@ async function buildTokensCommand(commandArgs) {
|
|
|
38
39
|
'output-references': outputReferences,
|
|
39
40
|
themes,
|
|
40
41
|
verbose,
|
|
42
|
+
'exclude-core': excludeCore,
|
|
41
43
|
} = minimist(
|
|
42
44
|
commandArgs,
|
|
43
45
|
{
|
|
44
46
|
alias,
|
|
45
47
|
default: defaultParams,
|
|
46
|
-
boolean: ['source-tokens-only', 'output-references', 'verbose'],
|
|
48
|
+
boolean: ['source-tokens-only', 'output-references', 'exclude-core', 'verbose'],
|
|
47
49
|
},
|
|
48
50
|
);
|
|
49
51
|
|
|
@@ -144,17 +146,19 @@ async function buildTokensCommand(commandArgs) {
|
|
|
144
146
|
},
|
|
145
147
|
});
|
|
146
148
|
|
|
147
|
-
// Create list of style-dictionary configurations to build
|
|
148
|
-
const configs = [
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
149
|
+
// Create list of style-dictionary configurations to build
|
|
150
|
+
const configs = [];
|
|
151
|
+
|
|
152
|
+
// Add core if it isn't excluded
|
|
153
|
+
if (!excludeCore) {
|
|
154
|
+
configs.push({ config: coreConfig });
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
// Add theme variants
|
|
158
|
+
for (const themeVariant of parsedThemes) {
|
|
159
|
+
const config = getStyleDictionaryConfig(themeVariant);
|
|
160
|
+
configs.push({ config, themeVariant });
|
|
161
|
+
}
|
|
158
162
|
|
|
159
163
|
// Build tokens for each configuration
|
|
160
164
|
await Promise.all(configs.map(async ({ config, themeVariant }) => {
|