-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
23 changed files
with
917 additions
and
828 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" | ||
} | ||
} |
Oops, something went wrong.