@nexub/tokens 6.8.0 → 7.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/nexub-migrate.mjs +15 -5
- package/package.json +1 -1
package/bin/nexub-migrate.mjs
CHANGED
|
@@ -6,7 +6,7 @@ import path from 'node:path';
|
|
|
6
6
|
import { fileURLToPath } from 'node:url';
|
|
7
7
|
import { parseArgs } from 'node:util';
|
|
8
8
|
|
|
9
|
-
export const RULES = ['legacy-tokens', 'logical-classes', 'tw-animate', 'opacity-modifier', 'deprecated-components', 'tailwind-3-preset', 'keep-5-defaults'];
|
|
9
|
+
export const RULES = ['legacy-tokens', 'logical-classes', 'tw-animate', 'opacity-modifier', 'deprecated-components', 'tailwind-3-preset', 'keep-5-defaults', 'removed-in-7'];
|
|
10
10
|
// Run only when asked for by --rules: they keep old behaviour instead of moving code forward.
|
|
11
11
|
const OPT_IN = new Set(['keep-5-defaults']);
|
|
12
12
|
export const DEFAULT_RULES = RULES.filter((r) => !OPT_IN.has(r));
|
|
@@ -380,7 +380,6 @@ function migrateComponents(src) {
|
|
|
380
380
|
// Adds the 5.x value as an explicit prop, so upgrading to 6.0 changes nothing.
|
|
381
381
|
const selection = (a) => (a.enableRowSelection && !a.selectionColumn ? ' selectionColumn={false}' : null);
|
|
382
382
|
const PINS = {
|
|
383
|
-
Autocomplete: (a) => (a.mode ? null : ' mode="inline"'),
|
|
384
383
|
DataTable: selection,
|
|
385
384
|
DataTableVirtual: selection,
|
|
386
385
|
};
|
|
@@ -450,6 +449,15 @@ export function migrateSource(src, { ext, rules = new Set(DEFAULT_RULES), fix =
|
|
|
450
449
|
for (const m of src.matchAll(/['"]@nexub\/tokens\/tailwind['"]/g))
|
|
451
450
|
items.push({ at: m.index, rule: 'tailwind-3-preset', message: '@nexub/tokens/tailwind (the Tailwind 3 preset) is removed in 4.0: move to Tailwind 4 and @import "@nexub/tokens/tailwind.css" in your CSS' });
|
|
452
451
|
}
|
|
452
|
+
if (rules.has('removed-in-7') && COMPONENT_EXTS.has(ext)) {
|
|
453
|
+
// Report only: both need a human choice (Stepper's import and props, or a Combobox layout).
|
|
454
|
+
if (/@nexub\/patterns['"]/.test(src))
|
|
455
|
+
for (const m of src.matchAll(/<StepIndicator\b/g))
|
|
456
|
+
items.push({ at: m.index, rule: 'removed-in-7', message: 'StepIndicator (@nexub/patterns) is removed in 7.0: use <Stepper orientation="vertical" current={…}> from @nexub/react (currentStep -> current)' });
|
|
457
|
+
if (/@nexub\/react['"/]/.test(src))
|
|
458
|
+
for (const m of src.matchAll(/<Autocomplete\b[^>]*\bmode=/g))
|
|
459
|
+
items.push({ at: m.index, rule: 'removed-in-7', message: 'Autocomplete `mode` is removed in 7.0 (the popover is the only layout): remove it; for an always-open list use the Combobox parts' });
|
|
460
|
+
}
|
|
453
461
|
// Rewrites never add or remove newlines, so offsets in src and text share line numbers.
|
|
454
462
|
const lineOf = (at) => src.slice(0, at).split('\n').length;
|
|
455
463
|
const manual = items.map(({ at, line, rule, message }) => ({ line: line ?? lineOf(at), rule, message })).sort((a, b) => a.line - b.line);
|
|
@@ -512,9 +520,11 @@ Rules:
|
|
|
512
520
|
(dot and non-JSX uses reported); *Props types renamed
|
|
513
521
|
tailwind-3-preset report the Tailwind 3 preset (@nexub/tokens/tailwind), removed in 4.0;
|
|
514
522
|
use Tailwind 4 with @import "@nexub/tokens/tailwind.css"
|
|
515
|
-
keep-5-defaults opt-in: keep 5.x behaviour
|
|
516
|
-
<
|
|
517
|
-
|
|
523
|
+
keep-5-defaults opt-in: keep 5.x behaviour by pinning the defaults 6.0 changed:
|
|
524
|
+
<DataTable enableRowSelection> gets selectionColumn={false}
|
|
525
|
+
(Autocomplete's inline layout is gone in 7.0, so it is not pinned)
|
|
526
|
+
removed-in-7 report what 7.0 removes: <StepIndicator> (use Stepper) and
|
|
527
|
+
Autocomplete's mode prop
|
|
518
528
|
|
|
519
529
|
Ignored: node_modules, dist, build, .next, out, coverage, files over 1 MB.
|
|
520
530
|
Exit codes: 0 ok, 1 --check found something, 2 usage error.`;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nexub/tokens",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "7.0.0",
|
|
4
4
|
"description": "Design tokens for Nexub Design System — colours, typography, spacing, radii, shadows, and motion as CSS variables, a Tailwind 4 theme, Figma variables and native (React Native, SwiftUI, Compose) tokens.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|