Skip to content

Commit

Permalink
chore: Update cli (#1851)
Browse files Browse the repository at this point in the history
  • Loading branch information
mimarz authored Apr 22, 2024
1 parent dced722 commit a69120c
Show file tree
Hide file tree
Showing 23 changed files with 917 additions and 828 deletions.
4 changes: 2 additions & 2 deletions apps/storefront/tokens/altinn.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4088,7 +4088,7 @@ export const borderRadius = [

export const spacing = [
{
value: "0rem",
value: "0",
type: "spacing",
filePath: "../../design-tokens/Base/Semantic.json",
isSource: false,
Expand Down Expand Up @@ -4411,7 +4411,7 @@ export const spacing = [

export const sizing = [
{
value: "0rem",
value: "0",
type: "sizing",
filePath: "../../design-tokens/Base/Semantic.json",
isSource: false,
Expand Down
4 changes: 2 additions & 2 deletions apps/storefront/tokens/brreg.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4136,7 +4136,7 @@ export const borderRadius = [

export const spacing = [
{
value: "0rem",
value: "0",
type: "spacing",
filePath: "../../design-tokens/Base/Semantic.json",
isSource: false,
Expand Down Expand Up @@ -4459,7 +4459,7 @@ export const spacing = [

export const sizing = [
{
value: "0rem",
value: "0",
type: "sizing",
filePath: "../../design-tokens/Base/Semantic.json",
isSource: false,
Expand Down
4 changes: 2 additions & 2 deletions apps/storefront/tokens/digdir.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4082,7 +4082,7 @@ export const borderRadius = [

export const spacing = [
{
value: "0rem",
value: "0",
type: "spacing",
filePath: "../../design-tokens/Base/Semantic.json",
isSource: false,
Expand Down Expand Up @@ -4405,7 +4405,7 @@ export const spacing = [

export const sizing = [
{
value: "0rem",
value: "0",
type: "sizing",
filePath: "../../design-tokens/Base/Semantic.json",
isSource: false,
Expand Down
4 changes: 2 additions & 2 deletions apps/storefront/tokens/tilsynet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4034,7 +4034,7 @@ export const borderRadius = [

export const spacing = [
{
value: "0rem",
value: "0",
type: "spacing",
filePath: "../../design-tokens/Base/Semantic.json",
isSource: false,
Expand Down Expand Up @@ -4357,7 +4357,7 @@ export const spacing = [

export const sizing = [
{
value: "0rem",
value: "0",
type: "sizing",
filePath: "../../design-tokens/Base/Semantic.json",
isSource: false,
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"devsite": "yarn workspace dev dev",
"build": "lerna run build",
"build:react": "yarn workspace @digdir/designsystemet-react build",
"build:tokens": "yarn workspace @digdir/designsystemet-cli build",
"build:tokens": "yarn workspace @digdir/designsystemet build",
"build:css": "yarn workspace @digdir/designsystemet-css build",
"build:storybook": "storybook build -o ./dist/storybook",
"build:storefront": "yarn workspace storefront building",
Expand Down
48 changes: 48 additions & 0 deletions packages/cli/bin/designsystemet.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#!/usr/bin/env node
import { Argument, program } from '@commander-js/extra-typings';

import migrations from './../src/codemods/migrations.js';
import { run } from './../src/tokens/build.js';

program
.name('Designsystemet')
.description('CLI for working with Designsystemet');

program
.command('tokens')
.description('run Designsystemet token builder')
.option(
'-t, --tokens <string>',
'Path to "design-tokens"',
'../../design-tokens',
)
.option(
'-b, --brands [brands...]',
'Brand files in "design-tokens" to include',
['Digdir'],
)
.option('-p, --preview')
.action((opts) => {
const brands = Array.isArray(opts.brands) ? opts.brands : [];
const tokens = typeof opts.tokens === 'string' ? opts.tokens : '';
return run({ brands, tokens });
});

program
.command('migrate')
.description('run a Designsystemet migration')
.addArgument(
new Argument('<migration>', 'Migration to run').choices(
Object.keys(migrations),
),
)
.action((migrationKey) => {
const migration = migrations[migrationKey as keyof typeof migrations];
if (!migration) {
console.error('Migration not found!');
throw 'Aborting';
}
migration?.();
});

await program.parseAsync(process.argv);
7 changes: 0 additions & 7 deletions packages/cli/declarations.d.ts

This file was deleted.

23 changes: 11 additions & 12 deletions packages/cli/package.json
Original file line number Diff line number Diff line change
@@ -1,43 +1,42 @@
{
"name": "@digdir/designsystemet-cli",
"name": "@digdir/designsystemet",
"version": "0.0.1",
"description": "CLI for Designsystemet",
"author": "Designsystemet team",
"repository": "https://github.com/digdir/designsystemet",
"homepage": "https://github.com/digdir/designsystemet/tree/main/scripts/cli",
"license": "MIT",
"type": "module",
"private": true,
"publishConfig": {
"access": "public"
},
"scripts": {
"start": "esno ./src/build.ts",
"build": "yarn clean && yarn start -t ../../design-tokens -b Digdir Tilsynet Altinn Brreg",
"designsystemet": "esno ./bin/designsystemet.ts",
"build": "yarn clean && yarn designsystemet tokens -t ../../design-tokens -b Digdir Tilsynet Altinn Brreg",
"prepublish": "tsc",
"clean": "yarn workspace @digdir/designsystemet-theme clean",
"css-light-dark-codemod": "esno ./src/codemods/migrations/light-dark.ts"
"css-light-dark-codemod": "esno ./bin/designsystemet.ts migrate tokens-rename-light-dark"
},
"files": [
"./dist/**"
],
"bin": {
"designsystemet": "./dist/build/build.js"
},
"bin": "./dist/build/bin/designsystemet.js",
"dependencies": {
"esno": "^4.7.0",
"fast-glob": "^3.3.2",
"postcss": "^8.4.38"
},
"devDependencies": {
"@tokens-studio/sd-transforms": "^0.9.3",
"@commander-js/extra-typings": "^12.0.1",
"@tokens-studio/sd-transforms": "^0.15.2",
"@types/glob": "^8.1.0",
"@types/node": "^20.12.7",
"@types/ramda": "^0.29.9",
"@types/yargs": "^17.0.32",
"commander": "^12.0.0",
"ramda": "^0.29.1",
"rimraf": "^5.0.5",
"style-dictionary": "^3.8.0",
"typescript": "^5.4.5",
"yargs": "^17.7.2"
"style-dictionary": "^4.0.0-prerelease.26",
"typescript": "^5.4.5"
}
}
Loading

0 comments on commit a69120c

Please sign in to comment.