@digdir/designsystemet 1.0.6 → 1.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/configs/digdir.config.json +59 -0
  2. package/configs/test-tokens.config.json +45 -0
  3. package/dist/bin/config.d.ts +12 -0
  4. package/dist/bin/config.d.ts.map +1 -0
  5. package/dist/bin/config.js +516 -0
  6. package/dist/bin/designsystemet.js +3389 -3337
  7. package/dist/config.schema.json +39 -27
  8. package/dist/src/config.d.ts +46 -187
  9. package/dist/src/config.d.ts.map +1 -1
  10. package/dist/src/config.js +69 -36
  11. package/dist/src/index.js +60 -36
  12. package/dist/src/migrations/beta-to-v1.js +11 -4
  13. package/dist/src/migrations/codemods/css/run.js +11 -4
  14. package/dist/src/migrations/color-rename-next49.js +11 -4
  15. package/dist/src/migrations/index.js +11 -4
  16. package/dist/src/scripts/createJsonSchema.js +40 -1295
  17. package/dist/src/scripts/update-design-tokens.js +4 -4
  18. package/dist/src/scripts/update-template.js +16 -9
  19. package/dist/src/tokens/build.d.ts +1 -1
  20. package/dist/src/tokens/build.d.ts.map +1 -1
  21. package/dist/src/tokens/build.js +72 -53
  22. package/dist/src/tokens/create/generators/$designsystemet.js +18 -18
  23. package/dist/src/tokens/create/write.js +29 -22
  24. package/dist/src/tokens/format.d.ts +1 -1
  25. package/dist/src/tokens/format.d.ts.map +1 -1
  26. package/dist/src/tokens/format.js +60 -36
  27. package/dist/src/tokens/index.js +60 -36
  28. package/dist/src/tokens/process/configs/color.js +12 -10
  29. package/dist/src/tokens/process/configs/semantic.js +11 -9
  30. package/dist/src/tokens/process/configs/storefront.js +11 -1
  31. package/dist/src/tokens/process/configs/typography.js +11 -9
  32. package/dist/src/tokens/process/configs.js +13 -26
  33. package/dist/src/tokens/process/formats/css/color.js +3 -1
  34. package/dist/src/tokens/process/formats/css.js +3 -1
  35. package/dist/src/tokens/process/formats/js-tokens.js +11 -1
  36. package/dist/src/tokens/process/platform.d.ts +3 -5
  37. package/dist/src/tokens/process/platform.d.ts.map +1 -1
  38. package/dist/src/tokens/process/platform.js +41 -14
  39. package/dist/src/tokens/process/theme.d.ts.map +1 -1
  40. package/dist/src/tokens/process/theme.js +18 -21
  41. package/dist/src/tokens/process/utils/getMultidimensionalThemes.js +5 -4
  42. package/dist/src/tokens/types.d.ts +2 -2
  43. package/dist/src/tokens/types.d.ts.map +1 -1
  44. package/dist/src/tokens/utils.d.ts +2 -2
  45. package/dist/src/tokens/utils.d.ts.map +1 -1
  46. package/dist/src/tokens/utils.js +11 -1
  47. package/dist/src/utils.d.ts +1 -1
  48. package/dist/src/utils.d.ts.map +1 -1
  49. package/dist/src/utils.js +10 -3
  50. package/package.json +18 -18
@@ -4,6 +4,14 @@ import { createPropertyFormatter as createPropertyFormatter2, fileHeader } from
4
4
 
5
5
  // src/tokens/utils.ts
6
6
  import * as R from "ramda";
7
+
8
+ // src/tokens/types.ts
9
+ var colorCategories = {
10
+ main: "main",
11
+ support: "support"
12
+ };
13
+
14
+ // src/tokens/utils.ts
7
15
  var mapToLowerCase = R.map(R.toLower);
8
16
  var hasAnyTruth = R.any(R.equals(true));
9
17
  var getType = (token) => (token.$type ?? token.type) || "";
@@ -28,7 +36,9 @@ var pathStartsWithOneOf = R.curry(
28
36
  );
29
37
  function isColorCategoryToken(token, category) {
30
38
  if (!category) {
31
- return ["main", "support"].some((c) => isColorCategoryToken(token, c));
39
+ return Object.keys(colorCategories).some(
40
+ (colorCategory) => isColorCategoryToken(token, colorCategory)
41
+ );
32
42
  }
33
43
  return R.startsWith(["color", category], token.path);
34
44
  }
@@ -5,25 +5,23 @@ type SharedOptions = {
5
5
  /** Enable verbose output */
6
6
  verbose: boolean;
7
7
  /** Set the default color for ":root" */
8
- rootColor?: string;
8
+ defaultColor?: string;
9
9
  /** Dry run, no files will be written */
10
10
  dry?: boolean;
11
- /** Clean the output path before building tokens */
12
- clean?: boolean;
13
11
  /** Generate preview tokens */
14
12
  preview: boolean;
15
13
  /** Token Studio `$themes.json` content */
16
14
  $themes: ThemeObject[];
17
15
  };
18
16
  export type BuildOptions = {
19
- process: 'build';
17
+ type: 'build';
20
18
  /** Design tokens path */
21
19
  tokensDir: string;
22
20
  /** Output directory for built tokens */
23
21
  outDir: string;
24
22
  } & SharedOptions;
25
23
  export type FormatOptions = {
26
- process: 'format';
24
+ type: 'format';
27
25
  /** Tokensets */
28
26
  tokenSets: Map<string, TokenSet>;
29
27
  } & SharedOptions;
@@ -1 +1 @@
1
- {"version":3,"file":"platform.d.ts","sourceRoot":"","sources":["../../../../src/tokens/process/platform.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAIxD,OAAO,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACxD,OAAO,EAAoB,KAAK,gBAAgB,EAAmB,MAAM,aAAa,CAAC;AAIvF,KAAK,aAAa,GAAG;IACnB,4BAA4B;IAC5B,OAAO,EAAE,OAAO,CAAC;IACjB,wCAAwC;IACxC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,wCAAwC;IACxC,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,mDAAmD;IACnD,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,8BAA8B;IAC9B,OAAO,EAAE,OAAO,CAAC;IACjB,0CAA0C;IAC1C,OAAO,EAAE,WAAW,EAAE,CAAC;CACxB,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG;IACzB,OAAO,EAAE,OAAO,CAAC;IACjB,yBAAyB;IACzB,SAAS,EAAE,MAAM,CAAC;IAClB,wCAAwC;IACxC,MAAM,EAAE,MAAM,CAAC;CAChB,GAAG,aAAa,CAAC;AAElB,MAAM,MAAM,aAAa,GAAG;IAC1B,OAAO,EAAE,QAAQ,CAAC;IAClB,gBAAgB;IAChB,SAAS,EAAE,GAAG,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;CAClC,GAAG,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C;IAClB,wCAAwC;IACxC,MAAM,EAAE,MAAM,CAAC;CAChB,GAAG,aAAa,CAAC;AAElB,MAAM,MAAM,aAAa,GAAG;IAC1B,IAAI,EAAE,QAAQ,CAAC;IACf,gBAAgB;IAChB,SAAS,EAAE,GAAG,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;CAClC,GAAG,aAAa,CAAC;AAElB,KAAK,cAAc,GAAG,YAAY,GAAG,aAAa,CAAC;AAEnD,KAAK,qBAAqB,CAAC,CAAC,IAAI,MAAM,CAAC,MAAM,OAAO,YAAY,GAAG,OAAO,EAAE,CAAC,CAAC,CAAC;AAE/E,MAAM,MAAM,aAAa,GAAG,qBAAqB,CAAC,WAAW,EAAE,CAAC,CAAC;AAEjE,KAAK,WAAW,GAAG;IACjB,WAAW,EAAE,gBAAgB,CAAC;IAC9B,SAAS,EAAE,UAAU,EAAE,CAAC;CACzB,CAAC;AAeF,eAAO,IAAI,YAAY,EAAE,cAAc,GAAG,SAAS,CAAC;AAkBpD,QAAA,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAsCqB,CAAC;AAExC,wBAAsB,eAAe,CAAC,CAAC,EAAE,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,aAAa,CAAC,CA0IxF"}
@@ -49,7 +49,9 @@ function isGlobalColorToken(token) {
49
49
  }
50
50
  function isColorCategoryToken(token, category) {
51
51
  if (!category) {
52
- return ["main", "support"].some((c) => isColorCategoryToken(token, c));
52
+ return Object.keys(colorCategories).some(
53
+ (colorCategory2) => isColorCategoryToken(token, colorCategory2)
54
+ );
53
55
  }
54
56
  return R.startsWith(["color", category], token.path);
55
57
  }
@@ -386,7 +388,7 @@ var colorCategoryVariables = (opts) => ({ "color-scheme": colorScheme2, theme, .
386
388
  );
387
389
  }
388
390
  const layer = `ds.theme.color`;
389
- const isRootColor = color === buildOptions?.rootColor;
391
+ const isRootColor = color === buildOptions?.defaultColor;
390
392
  const selector = isRootColor ? `:root, [data-color-scheme], [data-color="${color}"]` : `[data-color="${color}"], [data-color-scheme][data-color="${color}"]`;
391
393
  const config = {
392
394
  preprocessors: ["tokens-studio"],
@@ -793,8 +795,7 @@ function processThemeObject(theme) {
793
795
  }
794
796
  function groupThemes(themes) {
795
797
  const groups = {};
796
- for (const rawTheme of themes) {
797
- const theme = processThemeObject(rawTheme);
798
+ for (const theme of themes) {
798
799
  if (theme.group) {
799
800
  const groupKey = theme.group;
800
801
  groups[groupKey] = [...groups[groupKey] ?? [], theme];
@@ -945,9 +946,12 @@ var initResult = {
945
946
  };
946
947
  var buildOptions;
947
948
  var sd = new StyleDictionary2();
948
- var getCustomColors = (processed$themes) => processed$themes.filter(
949
- (x) => x.group && [colorCategories.main, colorCategories.support].map((c) => `${c}-color`).includes(x.group)
950
- ).map((x) => x.name);
949
+ var getCustomColors = (processed$themes, colorGroups) => processed$themes.filter((x) => {
950
+ if (!x.group) {
951
+ return false;
952
+ }
953
+ return colorGroups.includes(x.group);
954
+ }).map((x) => x.name);
951
955
  var buildConfigs = {
952
956
  typography: { getConfig: configs.typographyVariables, dimensions: ["typography"] },
953
957
  "color-scheme": { getConfig: configs.colorSchemeVariables, dimensions: ["color-scheme"] },
@@ -988,17 +992,40 @@ var buildConfigs = {
988
992
  // },
989
993
  };
990
994
  async function processPlatform(options) {
991
- const { process, $themes } = options;
995
+ const { type, $themes } = options;
992
996
  const platform = "css";
993
- const tokenSets = process === "format" ? options.tokenSets : void 0;
994
- const tokensDir = process === "build" ? options.tokensDir : void 0;
997
+ const tokenSets = type === "format" ? options.tokenSets : void 0;
998
+ const tokensDir = type === "build" ? options.tokensDir : void 0;
999
+ const UNSAFE_DEFAULT_COLOR = process.env.UNSAFE_DEFAULT_COLOR ?? "";
1000
+ if (UNSAFE_DEFAULT_COLOR) {
1001
+ console.warn(
1002
+ chalk2.yellow(
1003
+ `
1004
+ \u26A0\uFE0F UNSAFE_DEFAULT_COLOR is set to ${chalk2.blue(UNSAFE_DEFAULT_COLOR)}. This will override the default color.`
1005
+ )
1006
+ );
1007
+ }
1008
+ const UNSAFE_COLOR_GROUPS = Array.from(process.env.UNSAFE_COLOR_GROUPS?.split(",") ?? []);
1009
+ if (UNSAFE_COLOR_GROUPS.length > 0) {
1010
+ console.warn(
1011
+ chalk2.yellow(
1012
+ `
1013
+ \u26A0\uFE0F UNSAFE_COLOR_GROUPS is set to ${chalk2.blue(`[${UNSAFE_COLOR_GROUPS.join(", ")}]`)}. This will override the default color groups.`
1014
+ )
1015
+ );
1016
+ }
1017
+ const colorGroups = UNSAFE_COLOR_GROUPS.length > 0 ? UNSAFE_COLOR_GROUPS : [colorCategories.main, colorCategories.support].map((c) => `${c}-color`);
995
1018
  buildOptions = options;
1019
+ buildOptions.defaultColor = UNSAFE_DEFAULT_COLOR;
996
1020
  const processed$themes = $themes.map(processThemeObject).filter((theme) => R12.not(theme.group === "size" && theme.name !== "medium"));
997
- const customColors = getCustomColors(processed$themes);
998
- if (!buildOptions.rootColor) {
1021
+ const customColors = getCustomColors(processed$themes, colorGroups);
1022
+ if (!buildOptions.defaultColor) {
999
1023
  const firstMainColor = R12.head(customColors);
1000
- buildOptions.rootColor = firstMainColor;
1001
- console.log(`Using first main color; ${chalk2.blue(firstMainColor)}, as ${chalk2.green(`":root"`)} color`);
1024
+ buildOptions.defaultColor = firstMainColor;
1025
+ }
1026
+ if (buildOptions.defaultColor) {
1027
+ console.log(`
1028
+ \u{1F3A8} Using ${chalk2.blue(buildOptions.defaultColor)} as default color`);
1002
1029
  }
1003
1030
  const buildAndSdConfigs = R12.map((buildConfig) => {
1004
1031
  const sdConfigs = getConfigsForThemeDimensions(buildConfig.getConfig, processed$themes, buildConfig.dimensions, {
@@ -1 +1 @@
1
- {"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../../../src/tokens/process/theme.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAEnD,eAAO,MAAM,iBAAiB,QAA2B,CAAC;AAE1D,KAAK,mBAAmB,GAAG;IACzB,6GAA6G;IAC7G,eAAe,EAAE,aAAa,CAAC;IAC/B,iEAAiE;IACjE,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,mBAAmB,GAAI,kCAGjC,mBAAmB,KAAG,UAAU,EAiFlC,CAAC"}
1
+ {"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../../../src/tokens/process/theme.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAEnD,eAAO,MAAM,iBAAiB,QAA2B,CAAC;AAE1D,KAAK,mBAAmB,GAAG;IACzB,6GAA6G;IAC7G,eAAe,EAAE,aAAa,CAAC;IAC/B,iEAAiE;IACjE,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,mBAAmB,GAAI,kCAGjC,mBAAmB,KAAG,UAAU,EA8ElC,CAAC"}
@@ -5,11 +5,11 @@ import chalk from "chalk";
5
5
  // package.json
6
6
  var package_default = {
7
7
  name: "@digdir/designsystemet",
8
- version: "1.0.6",
8
+ version: "1.0.8",
9
9
  description: "CLI for Designsystemet",
10
10
  author: "Designsystemet team",
11
11
  engines: {
12
- node: ">=22.15.0"
12
+ node: ">=22.16.0"
13
13
  },
14
14
  repository: {
15
15
  type: "git",
@@ -20,7 +20,8 @@ var package_default = {
20
20
  type: "module",
21
21
  main: "./dist/src/index.js",
22
22
  files: [
23
- "./dist/**"
23
+ "./dist/**",
24
+ "./configs/**"
24
25
  ],
25
26
  bin: "dist/bin/designsystemet.js",
26
27
  exports: {
@@ -39,23 +40,23 @@ var package_default = {
39
40
  },
40
41
  scripts: {
41
42
  designsystemet: "tsx ./bin/designsystemet.ts",
42
- "build:tokens": "pnpm run designsystemet tokens build -p -t ../../design-tokens -o ../../packages/theme/brand --clean",
43
- "build:tokens:debug": "tsx --inspect-brk ./bin/designsystemet.ts tokens build -p -t ../../design-tokens -o ../../packages/theme/brand --clean",
43
+ "build:tokens": "pnpm run designsystemet tokens build -p -t ../../internal/design-tokens -o ../../packages/theme/brand --clean",
44
+ "build:tokens:debug": "tsx --inspect-brk ./bin/designsystemet.ts tokens build -p -t ../../internal/design-tokens -o ../../packages/theme/brand --clean",
44
45
  build: "tsup && pnpm build:types && pnpm build:json-schema",
45
46
  "build:types": "tsc --emitDeclarationOnly --declaration",
46
47
  "build:json-schema": "tsx ./src/scripts/createJsonSchema.ts",
47
48
  types: "tsc --noEmit",
48
- "test:tokens-create-options": 'pnpm run designsystemet tokens create -m dominant:"#007682" -n "#003333" -b 99 -o ./test-tokens/options --theme options --clean',
49
- "test:tokens-create-config": "pnpm run designsystemet tokens create --config ./test/test-tokens.config.json",
50
- "test:tokens-build": "pnpm run designsystemet tokens build -t ./test-tokens/options -o ./test-tokens/options-build --clean",
51
- "test:tokens-build-config": "pnpm run designsystemet tokens build -t ./test-tokens/config -o ./test-tokens/config-build --clean",
49
+ "test:tokens-create-options": 'pnpm run designsystemet tokens create -m dominant:"#007682" -n "#003333" -b 99 -o ./temp/options/design-tokens --theme options --clean',
50
+ "test:tokens-create-config": "pnpm run designsystemet tokens create --config ./configs/test-tokens.config.json",
51
+ "test:tokens-build": "pnpm run designsystemet tokens build -t ./temp/options/design-tokens -o ./temp/options/build --clean",
52
+ "test:tokens-build-config": "pnpm run designsystemet tokens build -t ./temp/config/design-tokens -o ./temp/config/build --clean",
52
53
  "test:tokens-create-and-build-options": "pnpm test:tokens-create-options && pnpm test:tokens-build",
53
54
  "test:tokens-create-and-build-config": "pnpm test:tokens-create-config && pnpm test:tokens-build-config",
54
55
  test: "pnpm test:tokens-create-and-build-options && pnpm test:tokens-create-and-build-config",
55
- "internal:tokens-create": "pnpm run designsystemet tokens create --config ./internal.config.json",
56
+ "digdir:tokens-create": "pnpm run designsystemet tokens create --config ./configs/digdir.config.json",
56
57
  "update:template": "tsx ./src/scripts/update-template.ts",
57
- "update:design-tokens": "pnpm internal:tokens-create && tsx ./src/scripts/update-design-tokens.ts",
58
- verify: "pnpm test && pnpm update:template && pnpm update:design-tokens"
58
+ "update:theme-digdir": "pnpm digdir:tokens-create && tsx ./src/scripts/update-design-tokens.ts",
59
+ verify: "pnpm test && pnpm update:template && pnpm update:theme-digdir && pnpm build:tokens"
59
60
  },
60
61
  dependencies: {
61
62
  "@commander-js/extra-typings": "^13.1.0",
@@ -72,8 +73,8 @@ var package_default = {
72
73
  postcss: "^8.5.3",
73
74
  ramda: "^0.30.1",
74
75
  "style-dictionary": "^4.4.0",
75
- zod: "^3.24.4",
76
- "zod-validation-error": "^3.4.0"
76
+ zod: "^3.25.30",
77
+ "zod-validation-error": "^3.4.1"
77
78
  },
78
79
  devDependencies: {
79
80
  "@tokens-studio/types": "0.5.2",
@@ -82,16 +83,15 @@ var package_default = {
82
83
  "@types/fs-extra": "^11.0.4",
83
84
  "@types/glob": "^8.1.0",
84
85
  "@types/jscodeshift": "^0.12.0",
85
- "@types/node": "^22.15.3",
86
+ "@types/node": "^22.15.21",
86
87
  "@types/object-hash": "^3.0.6",
87
88
  "@types/ramda": "^0.30.2",
88
89
  "fs-extra": "^11.3.0",
89
90
  "ts-toolbelt": "^9.6.0",
90
91
  tslib: "^2.8.1",
91
- tsup: "^8.4.0",
92
+ tsup: "^8.5.0",
92
93
  tsx: "^4.19.4",
93
- typescript: "^5.8.3",
94
- "zod-to-json-schema": "^3.24.5"
94
+ typescript: "^5.8.3"
95
95
  }
96
96
  };
97
97
 
@@ -145,9 +145,6 @@ order may change due to nondeterminism.`.trim()
145
145
  return sortIndex;
146
146
  });
147
147
  const header = `@charset "UTF-8";
148
-
149
- @layer ds.theme, ds.base, ds.utilities, ds.components;
150
-
151
148
  /*
152
149
  ${fileHeader}
153
150
  */
@@ -217,7 +217,9 @@ function isGlobalColorToken(token) {
217
217
  }
218
218
  function isColorCategoryToken(token, category) {
219
219
  if (!category) {
220
- return ["main", "support"].some((c) => isColorCategoryToken(token, c));
220
+ return Object.keys(colorCategories).some(
221
+ (colorCategory2) => isColorCategoryToken(token, colorCategory2)
222
+ );
221
223
  }
222
224
  return R.startsWith(["color", category], token.path);
223
225
  }
@@ -542,7 +544,7 @@ var colorCategoryVariables = (opts) => ({ "color-scheme": colorScheme2, theme, .
542
544
  );
543
545
  }
544
546
  const layer = `ds.theme.color`;
545
- const isRootColor = color === buildOptions?.rootColor;
547
+ const isRootColor = color === buildOptions?.defaultColor;
546
548
  const selector = isRootColor ? `:root, [data-color-scheme], [data-color="${color}"]` : `[data-color="${color}"], [data-color-scheme][data-color="${color}"]`;
547
549
  const config = {
548
550
  preprocessors: ["tokens-studio"],
@@ -850,8 +852,7 @@ function processThemeObject(theme) {
850
852
  }
851
853
  function groupThemes(themes) {
852
854
  const groups = {};
853
- for (const rawTheme of themes) {
854
- const theme = processThemeObject(rawTheme);
855
+ for (const theme of themes) {
855
856
  if (theme.group) {
856
857
  const groupKey = theme.group;
857
858
  groups[groupKey] = [...groups[groupKey] ?? [], theme];
@@ -1,5 +1,5 @@
1
1
  import type { Config as SDConfig } from 'style-dictionary/types';
2
- import type { ThemeConfig } from '../config.js';
2
+ import type { ConfigSchemaTheme } from '../config.js';
3
3
  import type { GetStyleDictionaryConfig } from './process/configs/shared.js';
4
4
  export type Token = {
5
5
  $value: string | Record<string, string>[];
@@ -13,7 +13,7 @@ export type Colors = Theme['colors'];
13
13
  export type Typography = Theme['typography'];
14
14
  export type Theme = {
15
15
  name: string;
16
- } & Required<ThemeConfig>;
16
+ } & Required<ConfigSchemaTheme>;
17
17
  export declare const colorCategories: {
18
18
  readonly main: "main";
19
19
  readonly support: "support";
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"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E,wBAAwB,CAAC;IACpC,0FAA0F;IAC1F,UAAU,EAAE,cAAc,EAAE,CAAC;IAC7B,+DAA+D;IAC/D,OAAO,CAAC,EAAE,MAAM,OAAO,CAAC;IACxB,0BAA0B;IAC1B,GAAG,CAAC,EAAE,CAAC,MAAM,EAAE,2BAA2B,KAAK,MAAM,CAAC;CACvD,CAAC;AAEF,MAAM,MAAM,2BAA2B,GAAG;IAAE,WAAW,EAAE,gBAAgB,CAAC;IAAC,MAAM,EAAE,QAAQ,CAAA;CAAE,CAAC;AAE9F,MAAM,MAAM,UAAU,GAAG;IACvB,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,GAAG,SAAS,CAAC;CACjC,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC"}
@@ -1,6 +1,6 @@
1
1
  import type { Tokens } from 'style-dictionary';
2
2
  import type { DesignToken, TransformedToken } from 'style-dictionary/types';
3
- import type { TokenSet } from './types.js';
3
+ import { type ColorCategories, type TokenSet } from './types.js';
4
4
  /**
5
5
  * Returns type based on design token format used. Read more:https://v4.styledictionary.com/info/dtcg/
6
6
  * @param token Transformed token
@@ -27,7 +27,7 @@ export declare const pathStartsWithOneOf: (paths: string[], token: TransformedTo
27
27
  export declare function isSemanticToken(token: TransformedToken): boolean;
28
28
  export declare function isSemanticColorToken(token: TransformedToken, color: string): boolean;
29
29
  export declare function isGlobalColorToken(token: TransformedToken): boolean;
30
- export declare function isColorCategoryToken(token: TransformedToken, category?: 'main' | 'support'): boolean;
30
+ export declare function isColorCategoryToken(token: TransformedToken, category?: ColorCategories): boolean;
31
31
  export declare const isDigit: (s: string) => boolean;
32
32
  /** Copied from Style Dictionary and added types
33
33
  @see https://github.com/amzn/style-dictionary/blob/31c29df0382a61b085f6392dc3225c5009fbffc5/lib/utils/combineJSON.js#L33 */
@@ -1 +1 @@
1
- {"version":3,"file":"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E,eAAe,GAAG,OAAO,CAOjG;AAED,eAAO,MAAM,OAAO,GAAI,GAAG,MAAM,YAAoB,CAAC;AAEtD;2HAC2H;AAC3H,wBAAgB,WAAW,CACzB,GAAG,EAAE,MAAM,GAAG,QAAQ,EACtB,EAAE,EAAE,CAAC,GAAG,EAAE,QAAQ,GAAG,MAAM,GAAG,WAAW,EAAE,GAAG,EAAE,MAAM,MAAM,GAAG,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,WAAW,GAAG,MAAM,KAAK,IAAI,4DAYrH;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,YAAY,CAAC,YAAY,EAAE,CAAC,CAAC,EAAE,gBAAgB,KAAK,OAAO,EAAE,MAAM,EAAE,gBAAgB,EAAE,sBAetG"}
@@ -1,5 +1,13 @@
1
1
  // src/tokens/utils.ts
2
2
  import * as R from "ramda";
3
+
4
+ // src/tokens/types.ts
5
+ var colorCategories = {
6
+ main: "main",
7
+ support: "support"
8
+ };
9
+
10
+ // src/tokens/utils.ts
3
11
  var mapToLowerCase = R.map(R.toLower);
4
12
  var hasAnyTruth = R.any(R.equals(true));
5
13
  var getType = (token) => (token.$type ?? token.type) || "";
@@ -33,7 +41,9 @@ function isGlobalColorToken(token) {
33
41
  }
34
42
  function isColorCategoryToken(token, category) {
35
43
  if (!category) {
36
- return ["main", "support"].some((c) => isColorCategoryToken(token, c));
44
+ return Object.keys(colorCategories).some(
45
+ (colorCategory) => isColorCategoryToken(token, colorCategory)
46
+ );
37
47
  }
38
48
  return R.startsWith(["color", category], token.path);
39
49
  }
@@ -14,5 +14,5 @@ export declare const writeFile: (path: string, data: string, dry?: boolean) => P
14
14
  export declare const cp: (src: string, dest: string, dry?: boolean, filter?: CopyOptions["filter"]) => Promise<void>;
15
15
  export declare const copyFile: (src: string, dest: string, dry?: boolean) => Promise<void>;
16
16
  export declare const cleanDir: (dir: string, dry?: boolean) => Promise<void>;
17
- export declare const readFile: (path: string, dry?: boolean) => Promise<string>;
17
+ export declare const readFile: (path: string, dry?: boolean, allowFileNotFound?: boolean) => Promise<string>;
18
18
  //# sourceMappingURL=utils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAI3C;;;;;;;;;GASG;AACH,eAAO,MAAM,KAAK,GAAU,KAAK,MAAM,EAAE,MAAM,OAAO,2BAgBrD,CAAC;AAEF,eAAO,MAAM,SAAS,GAAU,MAAM,MAAM,EAAE,MAAM,MAAM,EAAE,MAAM,OAAO,kBAWxE,CAAC;AAEF,eAAO,MAAM,EAAE,GAAU,KAAK,MAAM,EAAE,MAAM,MAAM,EAAE,MAAM,OAAO,EAAE,SAAS,WAAW,CAAC,QAAQ,CAAC,kBAOhG,CAAC;AAEF,eAAO,MAAM,QAAQ,GAAU,KAAK,MAAM,EAAE,MAAM,MAAM,EAAE,MAAM,OAAO,kBAOtE,CAAC;AAEF,eAAO,MAAM,QAAQ,GAAU,KAAK,MAAM,EAAE,MAAM,OAAO,kBASxD,CAAC;AAEF,eAAO,MAAM,QAAQ,GAAU,MAAM,MAAM,EAAE,MAAM,OAAO,oBAOzD,CAAC"}
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAI3C;;;;;;;;;GASG;AACH,eAAO,MAAM,KAAK,GAAU,KAAK,MAAM,EAAE,MAAM,OAAO,2BAgBrD,CAAC;AAEF,eAAO,MAAM,SAAS,GAAU,MAAM,MAAM,EAAE,MAAM,MAAM,EAAE,MAAM,OAAO,kBAWxE,CAAC;AAEF,eAAO,MAAM,EAAE,GAAU,KAAK,MAAM,EAAE,MAAM,MAAM,EAAE,MAAM,OAAO,EAAE,SAAS,WAAW,CAAC,QAAQ,CAAC,kBAOhG,CAAC;AAEF,eAAO,MAAM,QAAQ,GAAU,KAAK,MAAM,EAAE,MAAM,MAAM,EAAE,MAAM,OAAO,kBAOtE,CAAC;AAEF,eAAO,MAAM,QAAQ,GAAU,KAAK,MAAM,EAAE,MAAM,OAAO,kBASxD,CAAC;AAEF,eAAO,MAAM,QAAQ,GAAU,MAAM,MAAM,EAAE,MAAM,OAAO,EAAE,oBAAoB,OAAO,oBActF,CAAC"}
package/dist/src/utils.js CHANGED
@@ -1,5 +1,5 @@
1
1
  // src/utils.ts
2
- import fs from "node:fs/promises";
2
+ import fs from "fs/promises";
3
3
  import chalk from "chalk";
4
4
  var mkdir = async (dir, dry) => {
5
5
  if (dry) {
@@ -46,12 +46,19 @@ var cleanDir = async (dir, dry) => {
46
46
  \u{1F525} Cleaning dir ${chalk.red(`${dir.trim()}`)} `);
47
47
  return fs.rm(dir, { recursive: true, force: true });
48
48
  };
49
- var readFile = async (path, dry) => {
49
+ var readFile = async (path, dry, allowFileNotFound) => {
50
50
  if (dry) {
51
51
  console.log(`${chalk.blue("readFile")} ${path}`);
52
52
  return Promise.resolve("");
53
53
  }
54
- return fs.readFile(path, "utf-8");
54
+ try {
55
+ return await fs.readFile(path, "utf-8");
56
+ } catch (error) {
57
+ if (allowFileNotFound && error.code === "ENOENT") {
58
+ return "";
59
+ }
60
+ throw error;
61
+ }
55
62
  };
56
63
  export {
57
64
  cleanDir,
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@digdir/designsystemet",
3
- "version": "1.0.6",
3
+ "version": "1.0.8",
4
4
  "description": "CLI for Designsystemet",
5
5
  "author": "Designsystemet team",
6
6
  "engines": {
7
- "node": ">=22.15.0"
7
+ "node": ">=22.16.0"
8
8
  },
9
9
  "repository": {
10
10
  "type": "git",
@@ -15,7 +15,8 @@
15
15
  "type": "module",
16
16
  "main": "./dist/src/index.js",
17
17
  "files": [
18
- "./dist/**"
18
+ "./dist/**",
19
+ "./configs/**"
19
20
  ],
20
21
  "bin": "dist/bin/designsystemet.js",
21
22
  "exports": {
@@ -47,8 +48,8 @@
47
48
  "postcss": "^8.5.3",
48
49
  "ramda": "^0.30.1",
49
50
  "style-dictionary": "^4.4.0",
50
- "zod": "^3.24.4",
51
- "zod-validation-error": "^3.4.0"
51
+ "zod": "^3.25.30",
52
+ "zod-validation-error": "^3.4.1"
52
53
  },
53
54
  "devDependencies": {
54
55
  "@tokens-studio/types": "0.5.2",
@@ -57,35 +58,34 @@
57
58
  "@types/fs-extra": "^11.0.4",
58
59
  "@types/glob": "^8.1.0",
59
60
  "@types/jscodeshift": "^0.12.0",
60
- "@types/node": "^22.15.3",
61
+ "@types/node": "^22.15.21",
61
62
  "@types/object-hash": "^3.0.6",
62
63
  "@types/ramda": "^0.30.2",
63
64
  "fs-extra": "^11.3.0",
64
65
  "ts-toolbelt": "^9.6.0",
65
66
  "tslib": "^2.8.1",
66
- "tsup": "^8.4.0",
67
+ "tsup": "^8.5.0",
67
68
  "tsx": "^4.19.4",
68
- "typescript": "^5.8.3",
69
- "zod-to-json-schema": "^3.24.5"
69
+ "typescript": "^5.8.3"
70
70
  },
71
71
  "scripts": {
72
72
  "designsystemet": "tsx ./bin/designsystemet.ts",
73
- "build:tokens": "pnpm run designsystemet tokens build -p -t ../../design-tokens -o ../../packages/theme/brand --clean",
74
- "build:tokens:debug": "tsx --inspect-brk ./bin/designsystemet.ts tokens build -p -t ../../design-tokens -o ../../packages/theme/brand --clean",
73
+ "build:tokens": "pnpm run designsystemet tokens build -p -t ../../internal/design-tokens -o ../../packages/theme/brand --clean",
74
+ "build:tokens:debug": "tsx --inspect-brk ./bin/designsystemet.ts tokens build -p -t ../../internal/design-tokens -o ../../packages/theme/brand --clean",
75
75
  "build": "tsup && pnpm build:types && pnpm build:json-schema",
76
76
  "build:types": "tsc --emitDeclarationOnly --declaration",
77
77
  "build:json-schema": "tsx ./src/scripts/createJsonSchema.ts",
78
78
  "types": "tsc --noEmit",
79
- "test:tokens-create-options": "pnpm run designsystemet tokens create -m dominant:\"#007682\" -n \"#003333\" -b 99 -o ./test-tokens/options --theme options --clean",
80
- "test:tokens-create-config": "pnpm run designsystemet tokens create --config ./test/test-tokens.config.json",
81
- "test:tokens-build": "pnpm run designsystemet tokens build -t ./test-tokens/options -o ./test-tokens/options-build --clean",
82
- "test:tokens-build-config": "pnpm run designsystemet tokens build -t ./test-tokens/config -o ./test-tokens/config-build --clean",
79
+ "test:tokens-create-options": "pnpm run designsystemet tokens create -m dominant:\"#007682\" -n \"#003333\" -b 99 -o ./temp/options/design-tokens --theme options --clean",
80
+ "test:tokens-create-config": "pnpm run designsystemet tokens create --config ./configs/test-tokens.config.json",
81
+ "test:tokens-build": "pnpm run designsystemet tokens build -t ./temp/options/design-tokens -o ./temp/options/build --clean",
82
+ "test:tokens-build-config": "pnpm run designsystemet tokens build -t ./temp/config/design-tokens -o ./temp/config/build --clean",
83
83
  "test:tokens-create-and-build-options": "pnpm test:tokens-create-options && pnpm test:tokens-build",
84
84
  "test:tokens-create-and-build-config": "pnpm test:tokens-create-config && pnpm test:tokens-build-config",
85
85
  "test": "pnpm test:tokens-create-and-build-options && pnpm test:tokens-create-and-build-config",
86
- "internal:tokens-create": "pnpm run designsystemet tokens create --config ./internal.config.json",
86
+ "digdir:tokens-create": "pnpm run designsystemet tokens create --config ./configs/digdir.config.json",
87
87
  "update:template": "tsx ./src/scripts/update-template.ts",
88
- "update:design-tokens": "pnpm internal:tokens-create && tsx ./src/scripts/update-design-tokens.ts",
89
- "verify": "pnpm test && pnpm update:template && pnpm update:design-tokens"
88
+ "update:theme-digdir": "pnpm digdir:tokens-create && tsx ./src/scripts/update-design-tokens.ts",
89
+ "verify": "pnpm test && pnpm update:template && pnpm update:theme-digdir && pnpm build:tokens"
90
90
  }
91
91
  }