@dialpad/dialtone-css 8.80.0-next.9 → 8.81.0-next.1

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.
@@ -0,0 +1 @@
1
+ import './dialtone-fonts.css';
@@ -28,7 +28,7 @@
28
28
  * npx dialtone-migrate --only color-stops,hsl-to-oklch
29
29
  */
30
30
 
31
- import { spawn } from 'node:child_process';
31
+ import { spawn, execFileSync } from 'node:child_process';
32
32
  import fs from 'fs/promises';
33
33
  import path from 'path';
34
34
  import readline from 'readline';
@@ -302,11 +302,12 @@ const MIGRATIONS = [
302
302
  {
303
303
  id: 'vue3-to-vue-imports',
304
304
  name: 'Vue 3 Import Paths',
305
- description: '@dialpad/dialtone-icons/vue3 and @dialpad/dialtone-vue/vue3 import paths renamed to /vue.',
305
+ description: '@dialpad/dialtone/vue3, @dialpad/dialtone-icons/vue3, and @dialpad/dialtone-vue/vue3 import paths renamed to /vue.',
306
306
  category: 'required',
307
307
  type: 'config',
308
308
  configName: 'vue3-to-vue-imports',
309
309
  detectPatterns: [
310
+ /@dialpad\/dialtone\/vue3/,
310
311
  /@dialpad\/dialtone-icons\/vue3/,
311
312
  /@dialpad\/dialtone-vue\/vue3/,
312
313
  ],
@@ -314,6 +315,43 @@ const MIGRATIONS = [
314
315
  },
315
316
  ];
316
317
 
318
+ // ---------------------------------------------------------------------------
319
+ // Migration markers
320
+ // ---------------------------------------------------------------------------
321
+
322
+ const MARKER_DIR = '.dialtone-migrations';
323
+
324
+ function getRepoRoot (cwd) {
325
+ try {
326
+ return execFileSync('git', ['rev-parse', '--show-toplevel'], {
327
+ cwd,
328
+ encoding: 'utf8',
329
+ stdio: ['ignore', 'pipe', 'ignore'],
330
+ }).trim();
331
+ } catch {
332
+ return cwd;
333
+ }
334
+ }
335
+
336
+ function markerPath (cwd, id) {
337
+ return path.join(getRepoRoot(cwd), MARKER_DIR, id);
338
+ }
339
+
340
+ async function checkMigrationMarker (cwd, id) {
341
+ try {
342
+ await fs.access(markerPath(cwd, id));
343
+ return true;
344
+ } catch {
345
+ return false;
346
+ }
347
+ }
348
+
349
+ async function writeMigrationMarker (cwd, id) {
350
+ const p = markerPath(cwd, id);
351
+ await fs.mkdir(path.dirname(p), { recursive: true });
352
+ await fs.writeFile(p, '', 'utf8');
353
+ }
354
+
317
355
  // ---------------------------------------------------------------------------
318
356
  // CLI parsing
319
357
  // ---------------------------------------------------------------------------
@@ -370,7 +408,7 @@ Examples:
370
408
  // File walker (shared utility)
371
409
  // ---------------------------------------------------------------------------
372
410
 
373
- const DEFAULT_IGNORE = ['node_modules', 'dist', '.git', '.vuepress/public', '.vuepress/.temp', '.vuepress/.cache', 'storybook-static'];
411
+ const DEFAULT_IGNORE = ['node_modules', 'dist', '.git', '.vuepress/public', '.vuepress/.temp', '.vuepress/.cache', 'storybook-static', 'compiled'];
374
412
 
375
413
  function isIgnoredPath (fullPath) {
376
414
  const segments = fullPath.split(path.sep);
@@ -386,6 +424,31 @@ function isIgnoredPath (fullPath) {
386
424
  });
387
425
  }
388
426
 
427
+ /**
428
+ * Filter out files that are ignored by .gitignore using git check-ignore.
429
+ * Falls back gracefully if git is not available.
430
+ */
431
+ function filterGitIgnored (files, cwd) {
432
+ if (files.length === 0) return files;
433
+ try {
434
+ const input = files.join('\n');
435
+ const output = execFileSync('git', ['check-ignore', '--stdin'], {
436
+ input,
437
+ cwd,
438
+ encoding: 'utf8',
439
+ stdio: ['pipe', 'pipe', 'ignore'],
440
+ });
441
+ const ignored = new Set(output.trim().split('\n').filter(Boolean));
442
+ return files.filter(f => !ignored.has(f));
443
+ } catch (err) {
444
+ // status 1 → no paths ignored; status 128 → not a git repo; ENOENT → git missing
445
+ if (err.status === 1 || err.status === 128 || err.code === 'ENOENT') {
446
+ return files;
447
+ }
448
+ throw err;
449
+ }
450
+ }
451
+
389
452
  async function findFiles (dir, extensions) {
390
453
  const results = [];
391
454
  async function walk (currentDir) {
@@ -404,7 +467,7 @@ async function findFiles (dir, extensions) {
404
467
  }
405
468
  }
406
469
  await walk(dir);
407
- return results;
470
+ return filterGitIgnored(results, dir);
408
471
  }
409
472
 
410
473
  // ---------------------------------------------------------------------------
@@ -723,8 +786,11 @@ async function runStandaloneMigration (migration, opts) {
723
786
  });
724
787
 
725
788
  child.on('close', code => {
726
- // Exit code 0 means success (or nothing to do)
727
- resolve({ exitCode: code });
789
+ if (code !== 0) {
790
+ reject(new Error(`child process exited with code ${code}`));
791
+ } else {
792
+ resolve({ exitCode: code });
793
+ }
728
794
  });
729
795
 
730
796
  child.on('error', reject);
@@ -732,8 +798,21 @@ async function runStandaloneMigration (migration, opts) {
732
798
  }
733
799
 
734
800
  async function runMigration (migration, opts) {
801
+ if (migration.id === 'color-stops' && !opts.dryRun) {
802
+ if (await checkMigrationMarker(opts.cwd, migration.id)) {
803
+ console.log(` ✓ Already applied on this branch (${path.join(getRepoRoot(opts.cwd), MARKER_DIR, migration.id)} exists). Skipping.\n`);
804
+ console.log(` Remove that file to re-run.\n`);
805
+ return { skipped: true };
806
+ }
807
+ }
808
+
735
809
  if (migration.type === 'config') {
736
- return runConfigMigration(migration, opts);
810
+ const result = await runConfigMigration(migration, opts);
811
+ if (migration.id === 'color-stops' && result.applied) {
812
+ await writeMigrationMarker(opts.cwd, migration.id);
813
+ console.log(` Marker written to ${path.join(getRepoRoot(opts.cwd), MARKER_DIR, migration.id)} — commit this file with your changes.\n`);
814
+ }
815
+ return result;
737
816
  }
738
817
 
739
818
  if (migration.type === 'standalone') {
File without changes
File without changes
@@ -5,10 +5,13 @@
5
5
 
6
6
  export default {
7
7
  description:
8
- 'Renames /vue3 import subpaths to /vue for @dialpad/dialtone-icons and\n' +
9
- '@dialpad/dialtone-vue. After Vue 2 removal, /vue is the canonical path.',
8
+ 'Renames /vue3 import subpaths to /vue for @dialpad/dialtone,\n' +
9
+ '@dialpad/dialtone-icons, and @dialpad/dialtone-vue.\n' +
10
+ 'After Vue 2 removal, /vue is the canonical path.',
10
11
  patterns: ['**/*.{vue,js,ts,jsx,tsx,mjs,mts}'],
11
12
  expressions: [
13
+ // @dialpad/dialtone/vue3 → @dialpad/dialtone/vue
14
+ { from: /@dialpad\/dialtone\/vue3/g, to: '@dialpad/dialtone/vue' },
12
15
  // @dialpad/dialtone-icons/vue3 → @dialpad/dialtone-icons/vue
13
16
  { from: /@dialpad\/dialtone-icons\/vue3/g, to: '@dialpad/dialtone-icons/vue' },
14
17
  // @dialpad/dialtone-vue/vue3 → @dialpad/dialtone-vue (or /vue if used)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dialpad/dialtone-css",
3
- "version": "8.80.0-next.9",
3
+ "version": "8.81.0-next.1",
4
4
  "description": "Dialpad's design system",
5
5
  "keywords": [
6
6
  "Dialpad",
@@ -49,17 +49,10 @@
49
49
  "lib"
50
50
  ],
51
51
  "bin": {
52
- "dialtone-migrate": "./lib/dist/js/dialtone_migrate/index.mjs",
53
52
  "dialtone-health-check": "./lib/dist/js/dialtone_health_check/index.cjs",
53
+ "dialtone-migrate": "./lib/dist/js/dialtone_migrate/index.mjs",
54
54
  "dialtone-migration-helper": "./lib/dist/js/dialtone_migration_helper/index.mjs",
55
- "dialtone-migrate-flex-to-stack": "./lib/dist/js/dialtone_migrate_flex_to_stack/index.mjs",
56
- "dialtone-migrate-link-rendering": "./lib/dist/js/dialtone_migrate_link_rendering/index.mjs",
57
- "dialtone-migrate-tshirt-to-numeric": "./lib/dist/js/dialtone_migrate_tshirt_to_numeric/index.mjs",
58
- "dialtone-migrate-props": "./lib/dist/js/dialtone_migrate_props/index.mjs",
59
- "dialtone-migrate-chip-interactive": "./lib/dist/js/dialtone_migrate_chip_interactive/index.mjs",
60
- "dialtone-migrate-scrollbar-always": "./lib/dist/js/dialtone_migrate_scrollbar_always/index.mjs",
61
- "dialtone-migrate-typography": "./lib/dist/js/dialtone_migrate_typography/index.mjs",
62
- "dialtone-migrate-border-radius": "./lib/dist/js/dialtone_migrate_border_radius/index.mjs"
55
+ "dialtone-migrate-flex-to-stack": "./lib/dist/js/dialtone_migrate_flex_to_stack/index.mjs"
63
56
  },
64
57
  "type": "module",
65
58
  "unpkg": "./lib/dist/dialtone.min.css",