Migration Guide
Upgrading from Design Tokens v1 to v2. Six breaking renames in the outcome tier, nine new tokens, and a codemod that handles ~90% of the work automatically.
Breaking Changes
--ds-color-success→--ds-color-outcome-positive--ds-color-warning→--ds-color-outcome-caution--ds-color-danger→--ds-color-outcome-negative--ds-color-success-subtle→--ds-color-outcome-positive-subtle--ds-color-warning-subtle→--ds-color-outcome-caution-subtle--ds-color-danger-subtle→--ds-color-outcome-negative-subtleCodemod Rules
The codemod applies these exact substitutions across *.ts, *.tsx, *.css, and *.scss files.
var(--ds-color-success)→var(--ds-color-outcome-positive)var(--ds-color-warning)→var(--ds-color-outcome-caution)var(--ds-color-danger)→var(--ds-color-outcome-negative)var(--ds-color-success-subtle)→var(--ds-color-outcome-positive-subtle)var(--ds-color-success-fg)→var(--ds-color-outcome-positive-fg)var(--ds-color-warning-subtle)→var(--ds-color-outcome-caution-subtle)var(--ds-color-warning-fg)→var(--ds-color-outcome-caution-fg)var(--ds-color-danger-subtle)→var(--ds-color-outcome-negative-subtle)var(--ds-color-danger-fg)→var(--ds-color-outcome-negative-fg)New Tokens in v2
These tokens did not exist in v1. No breaking change — use them to replace hardcoded values in your components.
--ds-color-action-primaryvar(--bh-black)--ds-color-action-primary-fgvar(--bh-white)--ds-border-focus#2B44D4--ds-text-disabled#B0B0B6--ds-surface-overlay#F0F0F2--ds-color-compare-a--ds-color-agency-subtle--ds-color-compare-b#FFF5F0--ds-color-compare-c#FFFFF0--ds-color-compare-d--ds-color-temporal-subtleStep-by-Step Upgrade
Run the codemod
The automated codemod handles all token renames in one pass. Run it from the project root:
# Dry run first to see what will change npx @nodus-ds/codemod tokens-v2 --dry-run ./src ./components ./app # Apply changes npx @nodus-ds/codemod tokens-v2 ./src ./components ./app # Check the diff git diff --stat
Update CSS/SCSS files
If you have custom CSS files using v1 tokens, the codemod covers .tsx/.ts/.css/.scss. Verify any template literals or dynamic token construction:
# Search for any missed v1 tokens
grep -r "ds-color-success\|ds-color-warning\|ds-color-danger" ./src --include="*.{ts,tsx,css,scss}"
# Also check for any hardcoded hex values that should be tokens
grep -r "#2E7D32\|#E65100\|#C62828" ./src --include="*.{ts,tsx}"Update Storybook stories
Stories referencing v1 token names need manual review — the codemod handles direct token usage but not documentation text within stories:
# Update stories grep -r "ds-color-success\|ds-color-warning\|ds-color-danger" ./stories # Review and update manually or re-run codemod on stories dir npx @nodus-ds/codemod tokens-v2 ./stories
Add new tokens to your overrides
If you use createTheme() for white-labeling, add the new outcome tier fields to your ThemeConfig. The defaults will apply if omitted:
import { createTheme } from "@nodus-ds/tokens";
// v1 theme config
const theme = createTheme({
colors: {
agency: "#0066CC",
temporal: "#7C3AED",
},
});
// v2 theme config — outcome tier defaults are sensible, override only if needed
const themeV2 = createTheme({
colors: {
agency: "#0066CC",
temporal: "#7C3AED",
// outcome tokens have defaults — only override if brand requires it
// outcomePositive: "#2E7D32",
// outcomeCaution: "#E65100",
// outcomeNegative: "#C62828",
},
});Validate compliance
Run the token compliance audit to confirm no v1 tokens remain and all components pass the threshold:
# Run the audit
npx ts-node scripts/audit-tokens.ts
# Check compliance registry output
cat compliance-registry.json | jq '.[] | select(.tokenScore < 90) | {componentName, tokenScore}'
# Confirm no v1 token references remain
npx ts-node scripts/check-token-compliance.ts --fail-on-v1Validation Checklist
See the token taxonomy spec for the full v2 token reference, or the white-labeling guide for enterprise theming. File issues in the GitHub repo.