From fd4d634c9df33aa085182020e50342ca30d43d1f Mon Sep 17 00:00:00 2001 From: Kshitij Sobti Date: Thu, 4 Jan 2024 14:01:45 +0530 Subject: [PATCH] fixup!: Review feedback add help etc --- bin/paragon-scripts.js | 12 +++++++++++- lib/build-tokens.js | 7 +++++-- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/bin/paragon-scripts.js b/bin/paragon-scripts.js index 75e08a9cd8..9c28f5be3e 100755 --- a/bin/paragon-scripts.js +++ b/bin/paragon-scripts.js @@ -75,9 +75,19 @@ const COMMANDS = { }, { name: '-t, --themes', - description: 'Specify themes to include in the token build.', + description: 'Specify themes to include in the token build. Eg. light,dark or "light dark"', defaultValue: 'light', }, + { + name: '--base-theme', + description: 'Specify the base theme to use in the token build. For example, to build the "high-contrast" theme on top of the ligth theme use "--theme high-contrast --base-theme light".', + defaultValue: 'Same as theme', + }, + { + name: '--all-themes', + description: 'Build tokens for all themes in the source directory.', + defaultValue: false, + }, ], }, 'replace-variables': { diff --git a/lib/build-tokens.js b/lib/build-tokens.js index 72ddb7e267..8378696656 100755 --- a/lib/build-tokens.js +++ b/lib/build-tokens.js @@ -40,12 +40,15 @@ async function buildTokensCommand(commandArgs) { let themesToProcess = null; if (allThemes) { + const tokensPath = tokensSource || path.resolve(__dirname, '../tokens/src'); themesToProcess = fs - .readdirSync(`${tokensSource}/themes/`, { withFileTypes: true }) + .readdirSync(`${tokensPath}/themes/`, { withFileTypes: true }) .filter(entry => entry.isDirectory()) .map(entry => entry.name); + } else if (Array.isArray(themes)) { + themesToProcess = themes; } else { - themesToProcess = themes.split(' '); + themesToProcess = themes.split(/[\s,]/); } const coreConfig = {