scss-variable-extractor 1.5.1 → 1.5.3

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/README.md CHANGED
@@ -342,7 +342,8 @@ npx scss-extract migrate-bootstrap ./src --custom-utilities ./src/utilities.scss
342
342
  - `[src]` - Source directory to scan (optional, auto-detected from angular.json)
343
343
 
344
344
  **Options:**
345
- - `--custom-utilities <path>` - Path for custom utilities file (default: `./src/utilities.scss`)
345
+ - `--custom-utilities <path>` - Path for custom utilities file (default: `./src/styles/utilities.scss`)
346
+ - `--no-custom-utilities` - Skip creating custom utility classes
346
347
  - `--dry-run` - Preview changes without modifying files
347
348
  - `--angular-json <path>` - Path to angular.json file
348
349
  - `--project <name>` - Specify which project to use
@@ -408,7 +409,13 @@ npx scss-extract migrate-bootstrap --dry-run
408
409
  # 3. Apply migration
409
410
  npx scss-extract migrate-bootstrap
410
411
 
411
- # 4. Review changes and test components
412
+ # 4. Apply migration with custom utilities path
413
+ npx scss-extract migrate-bootstrap --custom-utilities ./custom/utilities.scss
414
+
415
+ # 5. Skip utilities generation
416
+ npx scss-extract migrate-bootstrap --no-custom-utilities
417
+
418
+ # 6. Review changes and test components
412
419
  # Manual review of generated utilities.scss and component templates
413
420
  ```
414
421
 
@@ -701,6 +708,18 @@ MIT License - see [LICENSE](./LICENSE) file for details
701
708
 
702
709
  ## Changelog
703
710
 
711
+ ### 1.5.3 (2026-02-12)
712
+
713
+ - **Fixed:** `migrate-bootstrap` now actually detects Bootstrap classes and generates utilities
714
+ - **Fixed:** Invalid CSS ("Manual migration required") no longer added to utilities.scss
715
+ - **Enhanced:** Utility classes are now properly added to customUtilitiesSet during migration
716
+ - **Improved:** Component migrations are tracked and reported
717
+
718
+ ### 1.5.2 (2026-02-12)
719
+
720
+ - **Fixed:** `migrate-bootstrap` command option renamed from `--utilities` to `--custom-utilities` to work with `--no-custom-utilities`
721
+ - **Fixed:** Default utilities path corrected to `./src/styles/utilities.scss`
722
+
704
723
  ### 1.5.1 (2026-02-12)
705
724
 
706
725
  - **Enhanced:** HTML class detection now handles spaces around `=` (e.g., `class = "py-3"`)
package/bin/cli.js CHANGED
@@ -481,7 +481,7 @@ program
481
481
  .command('migrate-bootstrap')
482
482
  .description('Migrate Bootstrap classes to Angular Material MDC-based styles')
483
483
  .argument('[src]', 'Source directory to scan (optional if using angular.json)')
484
- .option('--utilities <path>', 'Path to custom utilities file', './src/styles/utilities.scss')
484
+ .option('--custom-utilities <path>', 'Path to custom utilities file', './src/styles/utilities.scss')
485
485
  .option('--no-custom-utilities', 'Skip creating custom utility classes')
486
486
  .option('--no-remove-imports', 'Keep Bootstrap imports')
487
487
  .option('--dry-run', 'Preview changes without modifying files')
@@ -512,7 +512,7 @@ program
512
512
  }
513
513
 
514
514
  console.log(chalk.gray(`Scanning: ${config.src}`));
515
- console.log(chalk.gray(`Utilities output: ${options.utilities}\n`));
515
+ console.log(chalk.gray(`Utilities output: ${options.customUtilities || './src/styles/utilities.scss'}\n`));
516
516
 
517
517
  // Scan files - look for SCSS, HTML, and TS files
518
518
  const allFiles = await scanTemplateFiles(config.src, config.ignore);
@@ -521,7 +521,7 @@ program
521
521
  // Migrate Bootstrap
522
522
  const results = migrateBootstrapToMaterial(allFiles, {
523
523
  createCustomUtilities: options.customUtilities !== false,
524
- customUtilitiesPath: options.utilities,
524
+ customUtilitiesPath: options.customUtilities || './src/styles/utilities.scss',
525
525
  removeBootstrapImports: options.removeImports !== false,
526
526
  dryRun: options.dryRun
527
527
  });
@@ -545,7 +545,7 @@ program
545
545
  }
546
546
 
547
547
  if (results.customUtilities.length > 0) {
548
- console.log(chalk.cyan(`✓ Generated ${results.customUtilities.length} custom utility class(es) in ${options.utilities}\n`));
548
+ console.log(chalk.cyan(`✓ Generated ${results.customUtilities.length} custom utility class(es) in ${options.customUtilities || './src/styles/utilities.scss'}\n`));
549
549
  }
550
550
 
551
551
  if (results.componentMigrations.length > 0) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "scss-variable-extractor",
3
- "version": "1.5.1",
3
+ "version": "1.5.3",
4
4
  "description": "Analyzes Angular SCSS files and extracts repeated hardcoded values into reusable variables",
5
5
  "bin": {
6
6
  "scss-extract": "./bin/cli.js"
@@ -418,6 +418,33 @@ function migrateFileBootstrap(content, filePath, options) {
418
418
  let modified = false;
419
419
  const { customUtilitiesSet, removeBootstrapImports } = options;
420
420
 
421
+ // Detect Bootstrap classes in this file first
422
+ const detected = detectBootstrapInFile(content, filePath);
423
+
424
+ // Add utility classes to the set for custom utilities generation
425
+ if (customUtilitiesSet && detected.classes.length > 0) {
426
+ detected.classes.forEach(classInfo => {
427
+ if (classInfo.type === 'utility' && classInfo.mapping.needsCustom) {
428
+ const className = classInfo.class;
429
+ const css = classInfo.mapping.custom;
430
+ // Only add valid CSS (not warnings like "Manual migration required")
431
+ if (css && !css.includes('Manual') && !css.includes('Use CSS Grid')) {
432
+ customUtilitiesSet.add(`.${className} { ${css} }`);
433
+ }
434
+ }
435
+
436
+ // Track component migrations
437
+ if (classInfo.type === 'component') {
438
+ componentMigrations.push({
439
+ class: classInfo.class,
440
+ material: classInfo.mapping.material,
441
+ line: classInfo.line,
442
+ file: filePath
443
+ });
444
+ }
445
+ });
446
+ }
447
+
421
448
  // Remove Bootstrap imports
422
449
  if (removeBootstrapImports) {
423
450
  const bootstrapImportRegex = /@import\s+['"].*bootstrap.*['"];?\s*\n?/gi;