Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/tame-geese-cover.md
Original file line number Diff line number Diff line change
@@ -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.
49 changes: 40 additions & 9 deletions packages/cli/bin/designsystemet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,26 +83,57 @@ function makeTokenCommands() {
tokenCmd
.command('create')
.description('Create Designsystemet tokens')
.option(`-m, --${cliOptions.theme.colors.main} <name:hex...>`, `Main colors`, parseColorValues)
.option(`-s, --${cliOptions.theme.colors.support} <name:hex...>`, `Support colors`, parseColorValues)
.option(`-n, --${cliOptions.theme.colors.neutral} <hex>`, `Neutral hex color`, convertToHex)
.option('--config <string>', `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} <name:hex...>`,
` Main colors (deprecated, use JSON config file instead)`,
Comment thread
mimarz marked this conversation as resolved.
Outdated
parseColorValues,
)
.option(
`-s, --${cliOptions.theme.colors.support} <name:hex...>`,
`Support colors (deprecated, use JSON config file instead)`,
parseColorValues,
)
.option(
`-n, --${cliOptions.theme.colors.neutral} <hex>`,
`Neutral hex color (deprecated, use JSON config file instead)`,
convertToHex,
)
.option(
`-o, --${cliOptions.outDir} <string>`,
`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} <string>`, `Font family (experimental)`, DEFAULT_FONT)
.option(
`-f, --${cliOptions.theme.typography.fontFamily} <string>`,
`Font family (experimental, deprecated, use JSON config file instead)`,
DEFAULT_FONT,
)
.option(
`-b, --${cliOptions.theme.borderRadius} <number>`,
`Unitless base border-radius in px`,
`Unitless base border-radius in px (deprecated, use JSON config file instead)`,
(radiusAsString) => Number(radiusAsString),
4,
)
.option('--theme <string>', 'Theme name (ignored when using JSON config file)', DEFAULT_THEME_NAME)
.option('--config <string>', `Path to config file (default: "${DEFAULT_CONFIG_FILEPATH}")`)
.option('--theme <string>', 'Theme name (deprecated, use JSON config file instead)', DEFAULT_THEME_NAME)
.action(async (opts, cmd) => {
if (
opts.mainColors ||
opts.supportColors ||
opts.neutralColor ||
opts.borderRadius ||
opts.theme ||
opts.fontFamily
) {
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.
\n ⚠️ Please use a JSON config file instead.`),
);
}

console.log(figletAscii);
if (opts.dry) {
console.log(`Performing dry run, no files will be written`);
Expand Down
Loading