@digdir/designsystemet 1.1.9 → 1.2.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/dist/bin/config.js +14 -14
- package/dist/bin/designsystemet.js +61 -63
- package/dist/src/config.d.ts +1 -1
- package/dist/src/config.d.ts.map +1 -1
- package/dist/src/config.js +8 -8
- package/dist/src/index.js +22 -22
- package/dist/src/migrations/beta-to-v1.js +5 -5
- package/dist/src/migrations/codemods/css/plugins.js +3 -3
- package/dist/src/migrations/codemods/css/run.js +2 -2
- package/dist/src/migrations/color-rename-next49.js +5 -5
- package/dist/src/migrations/index.js +5 -5
- package/dist/src/scripts/createJsonSchema.js +4 -4
- package/dist/src/scripts/update-design-tokens.js +2 -2
- package/dist/src/scripts/update-preview-tokens.js +22 -22
- package/dist/src/scripts/update-template.js +11 -11
- package/dist/src/tokens/build.js +33 -33
- package/dist/src/tokens/create/generators/$designsystemet.js +9 -9
- package/dist/src/tokens/create/write.d.ts.map +1 -1
- package/dist/src/tokens/create/write.js +18 -20
- package/dist/src/tokens/format.js +22 -22
- package/dist/src/tokens/index.js +22 -22
- package/dist/src/tokens/process/configs/color.js +2 -2
- package/dist/src/tokens/process/configs/semantic.js +2 -2
- package/dist/src/tokens/process/configs/typography.js +2 -2
- package/dist/src/tokens/process/configs.js +4 -4
- package/dist/src/tokens/process/formats/css/color.js +2 -2
- package/dist/src/tokens/process/formats/css/semantic.js +2 -2
- package/dist/src/tokens/process/formats/css/typography.js +2 -2
- package/dist/src/tokens/process/formats/css.js +2 -2
- package/dist/src/tokens/process/output/declarations.js +13 -13
- package/dist/src/tokens/process/output/theme.js +12 -12
- package/dist/src/tokens/process/platform.js +10 -10
- package/dist/src/tokens/process/utils/getMultidimensionalThemes.js +4 -4
- package/dist/src/utils.js +10 -10
- package/package.json +9 -9
package/dist/src/index.js
CHANGED
|
@@ -2566,17 +2566,17 @@ function generateTypographyGroup(themes) {
|
|
|
2566
2566
|
}
|
|
2567
2567
|
|
|
2568
2568
|
// src/tokens/process/output/theme.ts
|
|
2569
|
-
import
|
|
2569
|
+
import pc from "picocolors";
|
|
2570
2570
|
import * as R7 from "ramda";
|
|
2571
2571
|
|
|
2572
2572
|
// package.json
|
|
2573
2573
|
var package_default = {
|
|
2574
2574
|
name: "@digdir/designsystemet",
|
|
2575
|
-
version: "1.
|
|
2575
|
+
version: "1.2.0",
|
|
2576
2576
|
description: "CLI for Designsystemet",
|
|
2577
2577
|
author: "Designsystemet team",
|
|
2578
2578
|
engines: {
|
|
2579
|
-
node: ">=22.
|
|
2579
|
+
node: ">=22.18.0"
|
|
2580
2580
|
},
|
|
2581
2581
|
repository: {
|
|
2582
2582
|
type: "git",
|
|
@@ -2636,7 +2636,6 @@ var package_default = {
|
|
|
2636
2636
|
"@commander-js/extra-typings": "^14.0.0",
|
|
2637
2637
|
"@tokens-studio/sd-transforms": "1.3.0",
|
|
2638
2638
|
"apca-w3": "^0.1.9",
|
|
2639
|
-
chalk: "^5.4.1",
|
|
2640
2639
|
"change-case": "^5.4.4",
|
|
2641
2640
|
"chroma-js": "^3.1.2",
|
|
2642
2641
|
"colorjs.io": "^0.6.0-alpha.1",
|
|
@@ -2644,25 +2643,26 @@ var package_default = {
|
|
|
2644
2643
|
"fast-glob": "^3.3.3",
|
|
2645
2644
|
hsluv: "^1.0.1",
|
|
2646
2645
|
"object-hash": "^3.0.0",
|
|
2646
|
+
picocolors: "^1.1.1",
|
|
2647
2647
|
postcss: "^8.5.6",
|
|
2648
2648
|
ramda: "^0.31.3",
|
|
2649
2649
|
"style-dictionary": "^5.0.1",
|
|
2650
|
-
zod: "^
|
|
2651
|
-
"zod-validation-error": "^
|
|
2650
|
+
zod: "^4.0.17",
|
|
2651
|
+
"zod-validation-error": "^4.0.1"
|
|
2652
2652
|
},
|
|
2653
2653
|
devDependencies: {
|
|
2654
2654
|
"@tokens-studio/types": "0.5.2",
|
|
2655
2655
|
"@types/apca-w3": "^0.1.3",
|
|
2656
2656
|
"@types/chroma-js": "^3.1.1",
|
|
2657
2657
|
"@types/fs-extra": "^11.0.4",
|
|
2658
|
-
"@types/node": "^22.
|
|
2658
|
+
"@types/node": "^22.17.1",
|
|
2659
2659
|
"@types/object-hash": "^3.0.6",
|
|
2660
|
-
"@types/ramda": "^0.
|
|
2661
|
-
"fs-extra": "^11.3.
|
|
2660
|
+
"@types/ramda": "^0.31.0",
|
|
2661
|
+
"fs-extra": "^11.3.1",
|
|
2662
2662
|
tslib: "^2.8.1",
|
|
2663
2663
|
tsup: "^8.5.0",
|
|
2664
2664
|
tsx: "^4.20.3",
|
|
2665
|
-
typescript: "^5.
|
|
2665
|
+
typescript: "^5.9.2"
|
|
2666
2666
|
}
|
|
2667
2667
|
};
|
|
2668
2668
|
|
|
@@ -2702,10 +2702,10 @@ var createThemeCSSFiles = ({
|
|
|
2702
2702
|
});
|
|
2703
2703
|
if (sortIndex === -1) {
|
|
2704
2704
|
console.error(
|
|
2705
|
-
|
|
2705
|
+
pc.yellow(`WARNING: CSS section does not have a defined sort order: ${filePath.replace(".css", "")}`)
|
|
2706
2706
|
);
|
|
2707
2707
|
console.log(
|
|
2708
|
-
|
|
2708
|
+
pc.dim(
|
|
2709
2709
|
`
|
|
2710
2710
|
The section will currently be added to the end of the entry file, but the exact
|
|
2711
2711
|
order may change due to nondeterminism.`.trim()
|
|
@@ -2738,7 +2738,7 @@ ${fileHeader}
|
|
|
2738
2738
|
};
|
|
2739
2739
|
|
|
2740
2740
|
// src/tokens/process/platform.ts
|
|
2741
|
-
import
|
|
2741
|
+
import pc3 from "picocolors";
|
|
2742
2742
|
import * as R17 from "ramda";
|
|
2743
2743
|
import StyleDictionary2 from "style-dictionary";
|
|
2744
2744
|
|
|
@@ -3279,8 +3279,8 @@ var typographyVariables = ({ theme, typography: typography2 }) => {
|
|
|
3279
3279
|
};
|
|
3280
3280
|
|
|
3281
3281
|
// src/tokens/process/utils/getMultidimensionalThemes.ts
|
|
3282
|
-
import chalk2 from "chalk";
|
|
3283
3282
|
import { kebabCase } from "change-case";
|
|
3283
|
+
import pc2 from "picocolors";
|
|
3284
3284
|
import * as R15 from "ramda";
|
|
3285
3285
|
var getMultidimensionalThemes = (processed$themes, dimensions) => {
|
|
3286
3286
|
const verboseLogging = buildOptions?.verbose;
|
|
@@ -3290,8 +3290,8 @@ var getMultidimensionalThemes = (processed$themes, dimensions) => {
|
|
|
3290
3290
|
const keys2 = R15.keys(grouped$themes);
|
|
3291
3291
|
const nonDependentKeys = keys2.filter((x) => ![...ALL_DEPENDENT_ON, ...dimensions].includes(x));
|
|
3292
3292
|
if (verboseLogging) {
|
|
3293
|
-
console.log(
|
|
3294
|
-
console.log(
|
|
3293
|
+
console.log(pc2.cyan(`\u{1F50E} Finding theme permutations for ${dimensions}`));
|
|
3294
|
+
console.log(pc2.cyan(` (ignoring permutations for ${nonDependentKeys})`));
|
|
3295
3295
|
}
|
|
3296
3296
|
return permutations.filter((val) => {
|
|
3297
3297
|
const filters = nonDependentKeys.map((x) => val.permutation[x] === grouped$themes[x][0].name);
|
|
@@ -3518,18 +3518,18 @@ async function processPlatform(options) {
|
|
|
3518
3518
|
const UNSAFE_DEFAULT_COLOR = process.env.UNSAFE_DEFAULT_COLOR ?? "";
|
|
3519
3519
|
if (UNSAFE_DEFAULT_COLOR) {
|
|
3520
3520
|
console.warn(
|
|
3521
|
-
|
|
3521
|
+
pc3.yellow(
|
|
3522
3522
|
`
|
|
3523
|
-
\u26A0\uFE0F UNSAFE_DEFAULT_COLOR is set to ${
|
|
3523
|
+
\u26A0\uFE0F UNSAFE_DEFAULT_COLOR is set to ${pc3.blue(UNSAFE_DEFAULT_COLOR)}. This will override the default color.`
|
|
3524
3524
|
)
|
|
3525
3525
|
);
|
|
3526
3526
|
}
|
|
3527
3527
|
const UNSAFE_COLOR_GROUPS = Array.from(process.env.UNSAFE_COLOR_GROUPS?.split(",") ?? []);
|
|
3528
3528
|
if (UNSAFE_COLOR_GROUPS.length > 0) {
|
|
3529
3529
|
console.warn(
|
|
3530
|
-
|
|
3530
|
+
pc3.yellow(
|
|
3531
3531
|
`
|
|
3532
|
-
\u26A0\uFE0F UNSAFE_COLOR_GROUPS is set to ${
|
|
3532
|
+
\u26A0\uFE0F UNSAFE_COLOR_GROUPS is set to ${pc3.blue(`[${UNSAFE_COLOR_GROUPS.join(", ")}]`)}. This will override the default color groups.`
|
|
3533
3533
|
)
|
|
3534
3534
|
);
|
|
3535
3535
|
}
|
|
@@ -3544,7 +3544,7 @@ async function processPlatform(options) {
|
|
|
3544
3544
|
}
|
|
3545
3545
|
if (buildOptions.defaultColor) {
|
|
3546
3546
|
console.log(`
|
|
3547
|
-
\u{1F3A8} Using ${
|
|
3547
|
+
\u{1F3A8} Using ${pc3.blue(buildOptions.defaultColor)} as default color`);
|
|
3548
3548
|
}
|
|
3549
3549
|
const buildAndSdConfigs = R17.map((buildConfig) => {
|
|
3550
3550
|
const sdConfigs = getConfigsForThemeDimensions(
|
|
@@ -3588,7 +3588,7 @@ async function processPlatform(options) {
|
|
|
3588
3588
|
}
|
|
3589
3589
|
if (sdConfigs.length > 0) {
|
|
3590
3590
|
console.log(`
|
|
3591
|
-
\u{1F371} Building ${
|
|
3591
|
+
\u{1F371} Building ${pc3.green(buildConfig.name ?? buildName)}`);
|
|
3592
3592
|
const results = await Promise.all(
|
|
3593
3593
|
sdConfigs.map(async (sdConfig) => {
|
|
3594
3594
|
const { config, permutation } = sdConfig;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
// src/migrations/codemods/css/plugins.ts
|
|
2
|
-
import chalk from "chalk";
|
|
3
2
|
import hash from "object-hash";
|
|
3
|
+
import pc from "picocolors";
|
|
4
4
|
import * as R from "ramda";
|
|
5
|
-
var printDelete = (text) => console.log(`${
|
|
6
|
-
var deleteMsg = (decl, from) => `${
|
|
5
|
+
var printDelete = (text) => console.log(`${pc.red("Deleted:")} ${text}`.replace(/"|'/g, ""));
|
|
6
|
+
var deleteMsg = (decl, from) => `${pc.yellow(from)} @ ${pc.gray(`${JSON.stringify(decl.source?.input.file)}:${decl.source?.start?.line}:${decl.source?.start?.column}`)}`;
|
|
7
7
|
var cssClassRename = (dictionary) => ({
|
|
8
8
|
postcssPlugin: `Renames CSS classes ${hash(dictionary)}`,
|
|
9
9
|
Rule(rule) {
|
|
@@ -48,10 +48,10 @@ import postcss from "postcss";
|
|
|
48
48
|
|
|
49
49
|
// src/utils.ts
|
|
50
50
|
import fs from "fs/promises";
|
|
51
|
-
import
|
|
51
|
+
import pc2 from "picocolors";
|
|
52
52
|
var readFile = async (path, dry, allowFileNotFound) => {
|
|
53
53
|
if (dry) {
|
|
54
|
-
console.log(`${
|
|
54
|
+
console.log(`${pc2.blue("readFile")} ${path}`);
|
|
55
55
|
return Promise.resolve("");
|
|
56
56
|
}
|
|
57
57
|
try {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
// src/migrations/codemods/css/plugins.ts
|
|
2
|
-
import chalk from "chalk";
|
|
3
2
|
import hash from "object-hash";
|
|
3
|
+
import pc from "picocolors";
|
|
4
4
|
import * as R from "ramda";
|
|
5
|
-
var printDelete = (text) => console.log(`${
|
|
6
|
-
var deleteMsg = (decl, from) => `${
|
|
5
|
+
var printDelete = (text) => console.log(`${pc.red("Deleted:")} ${text}`.replace(/"|'/g, ""));
|
|
6
|
+
var deleteMsg = (decl, from) => `${pc.yellow(from)} @ ${pc.gray(`${JSON.stringify(decl.source?.input.file)}:${decl.source?.start?.line}:${decl.source?.start?.column}`)}`;
|
|
7
7
|
var cssClassRename = (dictionary) => ({
|
|
8
8
|
postcssPlugin: `Renames CSS classes ${hash(dictionary)}`,
|
|
9
9
|
Rule(rule) {
|
|
@@ -5,10 +5,10 @@ import postcss from "postcss";
|
|
|
5
5
|
|
|
6
6
|
// src/utils.ts
|
|
7
7
|
import fs from "fs/promises";
|
|
8
|
-
import
|
|
8
|
+
import pc from "picocolors";
|
|
9
9
|
var readFile = async (path, dry, allowFileNotFound) => {
|
|
10
10
|
if (dry) {
|
|
11
|
-
console.log(`${
|
|
11
|
+
console.log(`${pc.blue("readFile")} ${path}`);
|
|
12
12
|
return Promise.resolve("");
|
|
13
13
|
}
|
|
14
14
|
try {
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
import * as R2 from "ramda";
|
|
3
3
|
|
|
4
4
|
// src/migrations/codemods/css/plugins.ts
|
|
5
|
-
import chalk from "chalk";
|
|
6
5
|
import hash from "object-hash";
|
|
6
|
+
import pc from "picocolors";
|
|
7
7
|
import * as R from "ramda";
|
|
8
|
-
var printDelete = (text) => console.log(`${
|
|
9
|
-
var deleteMsg = (decl, from) => `${
|
|
8
|
+
var printDelete = (text) => console.log(`${pc.red("Deleted:")} ${text}`.replace(/"|'/g, ""));
|
|
9
|
+
var deleteMsg = (decl, from) => `${pc.yellow(from)} @ ${pc.gray(`${JSON.stringify(decl.source?.input.file)}:${decl.source?.start?.line}:${decl.source?.start?.column}`)}`;
|
|
10
10
|
var cssVarRename = (dictionary) => ({
|
|
11
11
|
postcssPlugin: `Replaces CSS variables ${hash(dictionary)}`,
|
|
12
12
|
Declaration(decl) {
|
|
@@ -39,10 +39,10 @@ import postcss from "postcss";
|
|
|
39
39
|
|
|
40
40
|
// src/utils.ts
|
|
41
41
|
import fs from "fs/promises";
|
|
42
|
-
import
|
|
42
|
+
import pc2 from "picocolors";
|
|
43
43
|
var readFile = async (path, dry, allowFileNotFound) => {
|
|
44
44
|
if (dry) {
|
|
45
|
-
console.log(`${
|
|
45
|
+
console.log(`${pc2.blue("readFile")} ${path}`);
|
|
46
46
|
return Promise.resolve("");
|
|
47
47
|
}
|
|
48
48
|
try {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
// src/migrations/codemods/css/plugins.ts
|
|
2
|
-
import chalk from "chalk";
|
|
3
2
|
import hash from "object-hash";
|
|
3
|
+
import pc from "picocolors";
|
|
4
4
|
import * as R from "ramda";
|
|
5
|
-
var printDelete = (text) => console.log(`${
|
|
6
|
-
var deleteMsg = (decl, from) => `${
|
|
5
|
+
var printDelete = (text) => console.log(`${pc.red("Deleted:")} ${text}`.replace(/"|'/g, ""));
|
|
6
|
+
var deleteMsg = (decl, from) => `${pc.yellow(from)} @ ${pc.gray(`${JSON.stringify(decl.source?.input.file)}:${decl.source?.start?.line}:${decl.source?.start?.column}`)}`;
|
|
7
7
|
var cssClassRename = (dictionary) => ({
|
|
8
8
|
postcssPlugin: `Renames CSS classes ${hash(dictionary)}`,
|
|
9
9
|
Rule(rule) {
|
|
@@ -48,10 +48,10 @@ import postcss from "postcss";
|
|
|
48
48
|
|
|
49
49
|
// src/utils.ts
|
|
50
50
|
import fs from "fs/promises";
|
|
51
|
-
import
|
|
51
|
+
import pc2 from "picocolors";
|
|
52
52
|
var readFile = async (path, dry, allowFileNotFound) => {
|
|
53
53
|
if (dry) {
|
|
54
|
-
console.log(`${
|
|
54
|
+
console.log(`${pc2.blue("readFile")} ${path}`);
|
|
55
55
|
return Promise.resolve("");
|
|
56
56
|
}
|
|
57
57
|
try {
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
// src/scripts/createJsonSchema.ts
|
|
2
2
|
import { writeFile } from "fs/promises";
|
|
3
3
|
import { resolve } from "path";
|
|
4
|
-
import { z as z2 } from "zod
|
|
4
|
+
import { z as z2 } from "zod";
|
|
5
5
|
|
|
6
6
|
// src/config.ts
|
|
7
|
-
import
|
|
7
|
+
import pc from "picocolors";
|
|
8
8
|
import * as R7 from "ramda";
|
|
9
|
-
import { z } from "zod
|
|
10
|
-
import { fromError } from "zod-validation-error
|
|
9
|
+
import { z } from "zod";
|
|
10
|
+
import { fromError } from "zod-validation-error";
|
|
11
11
|
|
|
12
12
|
// src/colors/colorMetadata.ts
|
|
13
13
|
import * as R from "ramda";
|
|
@@ -3,10 +3,10 @@ import path from "path";
|
|
|
3
3
|
|
|
4
4
|
// src/utils.ts
|
|
5
5
|
import fs from "fs/promises";
|
|
6
|
-
import
|
|
6
|
+
import pc from "picocolors";
|
|
7
7
|
var cp = async (src, dest, dry, filter) => {
|
|
8
8
|
if (dry) {
|
|
9
|
-
console.log(`${
|
|
9
|
+
console.log(`${pc.blue("cp")} ${src} ${dest}`);
|
|
10
10
|
return Promise.resolve();
|
|
11
11
|
}
|
|
12
12
|
return fs.cp(src, dest, { recursive: true, filter });
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// src/scripts/update-preview-tokens.ts
|
|
2
2
|
import path from "path";
|
|
3
|
-
import
|
|
3
|
+
import pc4 from "picocolors";
|
|
4
4
|
|
|
5
5
|
// ../theme/configs/designsystemet.config.json
|
|
6
6
|
var designsystemet_config_default = {
|
|
@@ -2434,7 +2434,7 @@ var createTokens = async (opts) => {
|
|
|
2434
2434
|
};
|
|
2435
2435
|
|
|
2436
2436
|
// src/tokens/process/platform.ts
|
|
2437
|
-
import
|
|
2437
|
+
import pc2 from "picocolors";
|
|
2438
2438
|
import * as R16 from "ramda";
|
|
2439
2439
|
import StyleDictionary2 from "style-dictionary";
|
|
2440
2440
|
|
|
@@ -2975,8 +2975,8 @@ var typographyVariables = ({ theme, typography: typography2 }) => {
|
|
|
2975
2975
|
};
|
|
2976
2976
|
|
|
2977
2977
|
// src/tokens/process/utils/getMultidimensionalThemes.ts
|
|
2978
|
-
import chalk from "chalk";
|
|
2979
2978
|
import { kebabCase } from "change-case";
|
|
2979
|
+
import pc from "picocolors";
|
|
2980
2980
|
import * as R14 from "ramda";
|
|
2981
2981
|
var getMultidimensionalThemes = (processed$themes, dimensions) => {
|
|
2982
2982
|
const verboseLogging = buildOptions?.verbose;
|
|
@@ -2986,8 +2986,8 @@ var getMultidimensionalThemes = (processed$themes, dimensions) => {
|
|
|
2986
2986
|
const keys2 = R14.keys(grouped$themes);
|
|
2987
2987
|
const nonDependentKeys = keys2.filter((x) => ![...ALL_DEPENDENT_ON, ...dimensions].includes(x));
|
|
2988
2988
|
if (verboseLogging) {
|
|
2989
|
-
console.log(
|
|
2990
|
-
console.log(
|
|
2989
|
+
console.log(pc.cyan(`\u{1F50E} Finding theme permutations for ${dimensions}`));
|
|
2990
|
+
console.log(pc.cyan(` (ignoring permutations for ${nonDependentKeys})`));
|
|
2991
2991
|
}
|
|
2992
2992
|
return permutations.filter((val) => {
|
|
2993
2993
|
const filters = nonDependentKeys.map((x) => val.permutation[x] === grouped$themes[x][0].name);
|
|
@@ -3214,18 +3214,18 @@ async function processPlatform(options) {
|
|
|
3214
3214
|
const UNSAFE_DEFAULT_COLOR = process.env.UNSAFE_DEFAULT_COLOR ?? "";
|
|
3215
3215
|
if (UNSAFE_DEFAULT_COLOR) {
|
|
3216
3216
|
console.warn(
|
|
3217
|
-
|
|
3217
|
+
pc2.yellow(
|
|
3218
3218
|
`
|
|
3219
|
-
\u26A0\uFE0F UNSAFE_DEFAULT_COLOR is set to ${
|
|
3219
|
+
\u26A0\uFE0F UNSAFE_DEFAULT_COLOR is set to ${pc2.blue(UNSAFE_DEFAULT_COLOR)}. This will override the default color.`
|
|
3220
3220
|
)
|
|
3221
3221
|
);
|
|
3222
3222
|
}
|
|
3223
3223
|
const UNSAFE_COLOR_GROUPS = Array.from(process.env.UNSAFE_COLOR_GROUPS?.split(",") ?? []);
|
|
3224
3224
|
if (UNSAFE_COLOR_GROUPS.length > 0) {
|
|
3225
3225
|
console.warn(
|
|
3226
|
-
|
|
3226
|
+
pc2.yellow(
|
|
3227
3227
|
`
|
|
3228
|
-
\u26A0\uFE0F UNSAFE_COLOR_GROUPS is set to ${
|
|
3228
|
+
\u26A0\uFE0F UNSAFE_COLOR_GROUPS is set to ${pc2.blue(`[${UNSAFE_COLOR_GROUPS.join(", ")}]`)}. This will override the default color groups.`
|
|
3229
3229
|
)
|
|
3230
3230
|
);
|
|
3231
3231
|
}
|
|
@@ -3240,7 +3240,7 @@ async function processPlatform(options) {
|
|
|
3240
3240
|
}
|
|
3241
3241
|
if (buildOptions.defaultColor) {
|
|
3242
3242
|
console.log(`
|
|
3243
|
-
\u{1F3A8} Using ${
|
|
3243
|
+
\u{1F3A8} Using ${pc2.blue(buildOptions.defaultColor)} as default color`);
|
|
3244
3244
|
}
|
|
3245
3245
|
const buildAndSdConfigs = R16.map((buildConfig) => {
|
|
3246
3246
|
const sdConfigs = getConfigsForThemeDimensions(
|
|
@@ -3284,7 +3284,7 @@ async function processPlatform(options) {
|
|
|
3284
3284
|
}
|
|
3285
3285
|
if (sdConfigs.length > 0) {
|
|
3286
3286
|
console.log(`
|
|
3287
|
-
\u{1F371} Building ${
|
|
3287
|
+
\u{1F371} Building ${pc2.green(buildConfig.name ?? buildName)}`);
|
|
3288
3288
|
const results = await Promise.all(
|
|
3289
3289
|
sdConfigs.map(async (sdConfig) => {
|
|
3290
3290
|
const { config, permutation } = sdConfig;
|
|
@@ -3318,10 +3318,10 @@ async function processPlatform(options) {
|
|
|
3318
3318
|
|
|
3319
3319
|
// src/utils.ts
|
|
3320
3320
|
import fs from "fs/promises";
|
|
3321
|
-
import
|
|
3321
|
+
import pc3 from "picocolors";
|
|
3322
3322
|
var mkdir = async (dir, dry) => {
|
|
3323
3323
|
if (dry) {
|
|
3324
|
-
console.log(`${
|
|
3324
|
+
console.log(`${pc3.blue("mkdir")} ${dir}`);
|
|
3325
3325
|
return Promise.resolve();
|
|
3326
3326
|
}
|
|
3327
3327
|
const exists = await fs.access(dir, fs.constants.F_OK).then(() => true).catch(() => false);
|
|
@@ -3332,22 +3332,22 @@ var mkdir = async (dir, dry) => {
|
|
|
3332
3332
|
};
|
|
3333
3333
|
var writeFile = async (path2, data, dry) => {
|
|
3334
3334
|
if (dry) {
|
|
3335
|
-
console.log(`${
|
|
3335
|
+
console.log(`${pc3.blue("writeFile")} ${path2}`);
|
|
3336
3336
|
return Promise.resolve();
|
|
3337
3337
|
}
|
|
3338
3338
|
return fs.writeFile(path2, data, { encoding: "utf-8" }).catch((error) => {
|
|
3339
|
-
console.error(
|
|
3340
|
-
console.error(
|
|
3339
|
+
console.error(pc3.red(`Error writing file: ${path2}`));
|
|
3340
|
+
console.error(pc3.red(error));
|
|
3341
3341
|
throw error;
|
|
3342
3342
|
});
|
|
3343
3343
|
};
|
|
3344
3344
|
var cleanDir = async (dir, dry) => {
|
|
3345
3345
|
if (dry) {
|
|
3346
|
-
console.log(`${
|
|
3346
|
+
console.log(`${pc3.blue("cleanDir")} ${dir}`);
|
|
3347
3347
|
return Promise.resolve();
|
|
3348
3348
|
}
|
|
3349
3349
|
console.log(`
|
|
3350
|
-
\u{1F525} Cleaning dir ${
|
|
3350
|
+
\u{1F525} Cleaning dir ${pc3.red(`${dir.trim()}`)} `);
|
|
3351
3351
|
return fs.rm(dir, { recursive: true, force: true });
|
|
3352
3352
|
};
|
|
3353
3353
|
|
|
@@ -3357,7 +3357,7 @@ async function write(files, outDir, dry) {
|
|
|
3357
3357
|
if (destination) {
|
|
3358
3358
|
const filePath = path.join(outDir, destination);
|
|
3359
3359
|
const fileDir = path.dirname(filePath);
|
|
3360
|
-
console.log(`Writing file: ${
|
|
3360
|
+
console.log(`Writing file: ${pc4.green(filePath)}`);
|
|
3361
3361
|
await mkdir(fileDir, dry);
|
|
3362
3362
|
await writeFile(filePath, output, dry);
|
|
3363
3363
|
}
|
|
@@ -3388,14 +3388,14 @@ var formatTheme = async (themeConfig) => {
|
|
|
3388
3388
|
await cleanDir(outDir, false);
|
|
3389
3389
|
console.log(
|
|
3390
3390
|
buildOptions?.buildTokenFormats ? `
|
|
3391
|
-
\u{1F3D7}\uFE0F Start building preview tokens for ${
|
|
3391
|
+
\u{1F3D7}\uFE0F Start building preview tokens for ${pc4.blue("Designsystemet")}
|
|
3392
3392
|
` : "\n\u{1F6AB} No token formats to build."
|
|
3393
3393
|
);
|
|
3394
3394
|
const tokensGroupedByType = {};
|
|
3395
3395
|
if (buildOptions?.buildTokenFormats) {
|
|
3396
3396
|
for (const [destination, tokenFormats] of Object.entries(buildOptions.buildTokenFormats)) {
|
|
3397
3397
|
if (destination === "typography/secondary.css") continue;
|
|
3398
|
-
console.log(`Processing preview tokens for ${
|
|
3398
|
+
console.log(`Processing preview tokens for ${pc4.green(destination)}`);
|
|
3399
3399
|
const splits = destination.replace(".css", "").split("/");
|
|
3400
3400
|
const [type, name] = splits;
|
|
3401
3401
|
tokensGroupedByType[type] = tokensGroupedByType[type] === void 0 ? {} : tokensGroupedByType[type];
|
|
@@ -3428,7 +3428,7 @@ var formatTheme = async (themeConfig) => {
|
|
|
3428
3428
|
);
|
|
3429
3429
|
}
|
|
3430
3430
|
console.log(`
|
|
3431
|
-
\u2705 Finished building preview tokens for ${
|
|
3431
|
+
\u2705 Finished building preview tokens for ${pc4.blue("Designsystemet")}`);
|
|
3432
3432
|
}
|
|
3433
3433
|
};
|
|
3434
3434
|
formatTheme({
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// src/scripts/update-template.ts
|
|
2
2
|
import path from "path";
|
|
3
|
-
import
|
|
3
|
+
import pc2 from "picocolors";
|
|
4
4
|
import * as R from "ramda";
|
|
5
5
|
|
|
6
6
|
// ../../internal/design-tokens/semantic/color.json
|
|
@@ -1083,10 +1083,10 @@ var digdir_default = {
|
|
|
1083
1083
|
|
|
1084
1084
|
// src/utils.ts
|
|
1085
1085
|
import fs from "fs/promises";
|
|
1086
|
-
import
|
|
1086
|
+
import pc from "picocolors";
|
|
1087
1087
|
var mkdir = async (dir, dry) => {
|
|
1088
1088
|
if (dry) {
|
|
1089
|
-
console.log(`${
|
|
1089
|
+
console.log(`${pc.blue("mkdir")} ${dir}`);
|
|
1090
1090
|
return Promise.resolve();
|
|
1091
1091
|
}
|
|
1092
1092
|
const exists = await fs.access(dir, fs.constants.F_OK).then(() => true).catch(() => false);
|
|
@@ -1097,34 +1097,34 @@ var mkdir = async (dir, dry) => {
|
|
|
1097
1097
|
};
|
|
1098
1098
|
var writeFile = async (path2, data, dry) => {
|
|
1099
1099
|
if (dry) {
|
|
1100
|
-
console.log(`${
|
|
1100
|
+
console.log(`${pc.blue("writeFile")} ${path2}`);
|
|
1101
1101
|
return Promise.resolve();
|
|
1102
1102
|
}
|
|
1103
1103
|
return fs.writeFile(path2, data, { encoding: "utf-8" }).catch((error) => {
|
|
1104
|
-
console.error(
|
|
1105
|
-
console.error(
|
|
1104
|
+
console.error(pc.red(`Error writing file: ${path2}`));
|
|
1105
|
+
console.error(pc.red(error));
|
|
1106
1106
|
throw error;
|
|
1107
1107
|
});
|
|
1108
1108
|
};
|
|
1109
1109
|
var cp = async (src, dest, dry, filter) => {
|
|
1110
1110
|
if (dry) {
|
|
1111
|
-
console.log(`${
|
|
1111
|
+
console.log(`${pc.blue("cp")} ${src} ${dest}`);
|
|
1112
1112
|
return Promise.resolve();
|
|
1113
1113
|
}
|
|
1114
1114
|
return fs.cp(src, dest, { recursive: true, filter });
|
|
1115
1115
|
};
|
|
1116
1116
|
var cleanDir = async (dir, dry) => {
|
|
1117
1117
|
if (dry) {
|
|
1118
|
-
console.log(`${
|
|
1118
|
+
console.log(`${pc.blue("cleanDir")} ${dir}`);
|
|
1119
1119
|
return Promise.resolve();
|
|
1120
1120
|
}
|
|
1121
1121
|
console.log(`
|
|
1122
|
-
\u{1F525} Cleaning dir ${
|
|
1122
|
+
\u{1F525} Cleaning dir ${pc.red(`${dir.trim()}`)} `);
|
|
1123
1123
|
return fs.rm(dir, { recursive: true, force: true });
|
|
1124
1124
|
};
|
|
1125
1125
|
var readFile = async (path2, dry, allowFileNotFound) => {
|
|
1126
1126
|
if (dry) {
|
|
1127
|
-
console.log(`${
|
|
1127
|
+
console.log(`${pc.blue("readFile")} ${path2}`);
|
|
1128
1128
|
return Promise.resolve("");
|
|
1129
1129
|
}
|
|
1130
1130
|
try {
|
|
@@ -1199,7 +1199,7 @@ var updateTemplates = async () => {
|
|
|
1199
1199
|
path.join(TEMPLATE_FILES_PATH, `themes/theme.template.json`),
|
|
1200
1200
|
JSON.stringify(themeColorTemplate, null, 2).replaceAll("digdir.accent", "<theme>.<color>")
|
|
1201
1201
|
);
|
|
1202
|
-
console.log(
|
|
1202
|
+
console.log(pc2.green("Templates updated"));
|
|
1203
1203
|
};
|
|
1204
1204
|
await updateTemplates();
|
|
1205
1205
|
export {
|