From 9582d9eee28611c25f035b1edf791df7ca3f5d24 Mon Sep 17 00:00:00 2001 From: Michael Marszalek Date: Wed, 20 May 2026 14:02:20 +0200 Subject: [PATCH 1/7] chore: add deprecation warning in cli for theme options --- packages/cli/bin/designsystemet.ts | 37 ++++++++++++++++++++++++++---- 1 file changed, 32 insertions(+), 5 deletions(-) diff --git a/packages/cli/bin/designsystemet.ts b/packages/cli/bin/designsystemet.ts index fbc6b3cc0d..dc6c85a457 100644 --- a/packages/cli/bin/designsystemet.ts +++ b/packages/cli/bin/designsystemet.ts @@ -83,9 +83,21 @@ function makeTokenCommands() { tokenCmd .command('create') .description('Create Designsystemet tokens') - .option(`-m, --${cliOptions.theme.colors.main} `, `Main colors`, parseColorValues) - .option(`-s, --${cliOptions.theme.colors.support} `, `Support colors`, parseColorValues) - .option(`-n, --${cliOptions.theme.colors.neutral} `, `Neutral hex color`, convertToHex) + .option( + `-m, --${cliOptions.theme.colors.main} `, + ` Main colors (deprecated, use JSON config file instead)`, + parseColorValues, + ) + .option( + `-s, --${cliOptions.theme.colors.support} `, + `Support colors (deprecated, use JSON config file instead)`, + parseColorValues, + ) + .option( + `-n, --${cliOptions.theme.colors.neutral} `, + `Neutral hex color (deprecated, use JSON config file instead)`, + convertToHex, + ) .option( `-o, --${cliOptions.outDir} `, `Output directory for created ${pc.blue('design-tokens')}`, @@ -96,13 +108,28 @@ function makeTokenCommands() { .option(`-f, --${cliOptions.theme.typography.fontFamily} `, `Font family (experimental)`, DEFAULT_FONT) .option( `-b, --${cliOptions.theme.borderRadius} `, - `Unitless base border-radius in px`, + `Unitless base border-radius in px (deprecated, use JSON config file instead)`, (radiusAsString) => Number(radiusAsString), 4, ) - .option('--theme ', 'Theme name (ignored when using JSON config file)', DEFAULT_THEME_NAME) + .option('--theme ', 'Theme name (deprecated, use JSON config file instead)', DEFAULT_THEME_NAME) .option('--config ', `Path to config file (default: "${DEFAULT_CONFIG_FILEPATH}")`) .action(async (opts, cmd) => { + if ( + opts.mainColors || + opts.supportColors || + opts.neutralColor || + opts.borderRadius || + opts.theme || + opts.fontFamily + ) { + console.warn( + pc.yellow( + 'Warning: Using CLI options for colors is deprecated and will be removed in a future release. Please use a JSON config file instead.', + ), + ); + } + console.log(figletAscii); if (opts.dry) { console.log(`Performing dry run, no files will be written`); From 38f31afac6a8e2e6b95a9298fee712368bac64da Mon Sep 17 00:00:00 2001 From: Michael Marszalek Date: Wed, 20 May 2026 14:06:44 +0200 Subject: [PATCH 2/7] changeset --- .changeset/tame-geese-cover.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/tame-geese-cover.md diff --git a/.changeset/tame-geese-cover.md b/.changeset/tame-geese-cover.md new file mode 100644 index 0000000000..c4097bc974 --- /dev/null +++ b/.changeset/tame-geese-cover.md @@ -0,0 +1,5 @@ +--- +"@digdir/designsystemet": patch +--- + +Add deprecation warning for cli options `--main-colors`, `--support-colors`, `--neutral-color`, `--font-family`, `--border-radius` and `--theme`. Use JSON config file instead. From 391d09f3ec9440b06f03a535c1ddb36df609fde6 Mon Sep 17 00:00:00 2001 From: Michael Marszalek Date: Wed, 20 May 2026 14:07:17 +0200 Subject: [PATCH 3/7] reorder for readability --- packages/cli/bin/designsystemet.ts | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/packages/cli/bin/designsystemet.ts b/packages/cli/bin/designsystemet.ts index dc6c85a457..5faf1d6617 100644 --- a/packages/cli/bin/designsystemet.ts +++ b/packages/cli/bin/designsystemet.ts @@ -83,6 +83,10 @@ function makeTokenCommands() { tokenCmd .command('create') .description('Create Designsystemet tokens') + .option('--config ', `Path to config file (default: "${DEFAULT_CONFIG_FILEPATH}")`) + .option(`--${cliOptions.clean} [boolean]`, 'Clean output directory before creating tokens', parseBoolean, false) + .option('--dry [boolean]', `Dry run for created ${pc.blue('design-tokens')}`, parseBoolean, false) + /** Deprecated options */ .option( `-m, --${cliOptions.theme.colors.main} `, ` Main colors (deprecated, use JSON config file instead)`, @@ -103,9 +107,11 @@ function makeTokenCommands() { `Output directory for created ${pc.blue('design-tokens')}`, DEFAULT_TOKENS_CREATE_DIR, ) - .option(`--${cliOptions.clean} [boolean]`, 'Clean output directory before creating tokens', parseBoolean, false) - .option('--dry [boolean]', `Dry run for created ${pc.blue('design-tokens')}`, parseBoolean, false) - .option(`-f, --${cliOptions.theme.typography.fontFamily} `, `Font family (experimental)`, DEFAULT_FONT) + .option( + `-f, --${cliOptions.theme.typography.fontFamily} `, + `Font family (experimental, deprecated, use JSON config file instead)`, + DEFAULT_FONT, + ) .option( `-b, --${cliOptions.theme.borderRadius} `, `Unitless base border-radius in px (deprecated, use JSON config file instead)`, @@ -113,7 +119,6 @@ function makeTokenCommands() { 4, ) .option('--theme ', 'Theme name (deprecated, use JSON config file instead)', DEFAULT_THEME_NAME) - .option('--config ', `Path to config file (default: "${DEFAULT_CONFIG_FILEPATH}")`) .action(async (opts, cmd) => { if ( opts.mainColors || @@ -125,7 +130,7 @@ function makeTokenCommands() { ) { console.warn( pc.yellow( - 'Warning: Using CLI options for colors is deprecated and will be removed in a future release. Please use a JSON config file instead.', + 'Warning: Using CLI options for colors, border radius, theme, or font family is deprecated and will be removed in a future release. Please use a JSON config file instead.', ), ); } From bfc6ee2b6337c8b5e1d8d94f4bca94d5d6bd616f Mon Sep 17 00:00:00 2001 From: Michael Marszalek Date: Wed, 20 May 2026 14:15:17 +0200 Subject: [PATCH 4/7] updat warning formatting --- packages/cli/bin/designsystemet.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/packages/cli/bin/designsystemet.ts b/packages/cli/bin/designsystemet.ts index 5faf1d6617..7556d84eb2 100644 --- a/packages/cli/bin/designsystemet.ts +++ b/packages/cli/bin/designsystemet.ts @@ -129,9 +129,8 @@ function makeTokenCommands() { opts.fontFamily ) { console.warn( - pc.yellow( - 'Warning: Using CLI options for colors, border radius, theme, or font family is deprecated and will be removed in a future release. Please use a JSON config file instead.', - ), + pc.yellow(`\n ⚠️ Using CLI options for ${pc.bold(`colors, border radius, theme, or font family is deprecated`)} and will be removed in a future release. + \n ⚠️ Please use a JSON config file instead.`), ); } From f7540fd7ff824e94eb3598e44ada63bebf139b21 Mon Sep 17 00:00:00 2001 From: Michael Marszalek Date: Tue, 26 May 2026 11:38:30 +0200 Subject: [PATCH 5/7] Update packages/cli/bin/designsystemet.ts Co-authored-by: Tobias Barsnes --- packages/cli/bin/designsystemet.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/cli/bin/designsystemet.ts b/packages/cli/bin/designsystemet.ts index 7556d84eb2..ce65530e27 100644 --- a/packages/cli/bin/designsystemet.ts +++ b/packages/cli/bin/designsystemet.ts @@ -89,7 +89,7 @@ function makeTokenCommands() { /** Deprecated options */ .option( `-m, --${cliOptions.theme.colors.main} `, - ` Main colors (deprecated, use JSON config file instead)`, + `Main colors (deprecated, use JSON config file instead)`, parseColorValues, ) .option( From 7e58e5671ecab542fcb3f375986201df9c12633e Mon Sep 17 00:00:00 2001 From: Michael Marszalek Date: Tue, 26 May 2026 16:07:06 +0200 Subject: [PATCH 6/7] avoid false positives with defaults --- packages/cli/tests/config/design-tokens/$designsystemet.jsonc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/cli/tests/config/design-tokens/$designsystemet.jsonc b/packages/cli/tests/config/design-tokens/$designsystemet.jsonc index 2bc470b385..b982a9f27f 100644 --- a/packages/cli/tests/config/design-tokens/$designsystemet.jsonc +++ b/packages/cli/tests/config/design-tokens/$designsystemet.jsonc @@ -1,4 +1,4 @@ { "name": "@digdir/designsystemet", - "version": "1.13.2" + "version": "1.14.0" } \ No newline at end of file From 26f98c899a9e088ef7280750fda62b57f9ccb826 Mon Sep 17 00:00:00 2001 From: Michael Marszalek Date: Tue, 26 May 2026 16:07:07 +0200 Subject: [PATCH 7/7] avoid false positives with defaults --- packages/cli/bin/designsystemet.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/cli/bin/designsystemet.ts b/packages/cli/bin/designsystemet.ts index ce65530e27..5d5f3a6361 100644 --- a/packages/cli/bin/designsystemet.ts +++ b/packages/cli/bin/designsystemet.ts @@ -124,9 +124,9 @@ function makeTokenCommands() { opts.mainColors || opts.supportColors || opts.neutralColor || - opts.borderRadius || - opts.theme || - opts.fontFamily + (opts.borderRadius && opts.borderRadius !== 4) || + (opts.theme && opts.theme !== DEFAULT_THEME_NAME) || + (opts.fontFamily && opts.fontFamily !== DEFAULT_FONT) ) { console.warn( pc.yellow(`\n ⚠️ Using CLI options for ${pc.bold(`colors, border radius, theme, or font family is deprecated`)} and will be removed in a future release.