@luxkit/cli 1.0.7 → 1.0.8

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.
Files changed (2) hide show
  1. package/dist/index.js +20 -5
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -781,6 +781,19 @@ async function installDevDeps(packages, cwd, pm) {
781
781
  }
782
782
 
783
783
  // src/commands/fmt.ts
784
+ function filterStylelintScripts(scripts) {
785
+ const filtered = {};
786
+ for (const [key, value] of Object.entries(scripts)) {
787
+ if (key.startsWith("stylelint")) continue;
788
+ filtered[key] = value.replace(/\s*&&\s*<pm>\s+stylelint\S*/g, "");
789
+ }
790
+ return filtered;
791
+ }
792
+ function isNotStylelintDep(dep) {
793
+ if (dep.includes("stylelint")) return false;
794
+ if (dep === "postcss-html" || dep === "postcss-scss") return false;
795
+ return true;
796
+ }
784
797
  function registerFmtCommand(program2) {
785
798
  const fmt = program2.command("fmt").description("Initialize formatting config with preset");
786
799
  fmt.argument("<preset>").option("-F, --force", "Force overwrite existing files").option("--no-install", "Skip dependency installation").option("--dry-run", "Preview without writing files").option("--no-stylelint", "Skip Stylelint config generation").action(
@@ -807,21 +820,23 @@ function registerFmtCommand(program2) {
807
820
  warnMissingPackageJson(preset, options.install !== false);
808
821
  return;
809
822
  }
810
- if (preset.scripts) {
811
- await injectScripts(preset.scripts, opts, pm);
823
+ const scripts = opts.noStylelint && preset.scripts ? filterStylelintScripts(preset.scripts) : preset.scripts;
824
+ if (scripts) {
825
+ await injectScripts(scripts, opts, pm);
812
826
  }
813
827
  if (!preset.dependencies?.dev) return;
828
+ const devDeps = opts.noStylelint ? preset.dependencies.dev.filter(isNotStylelintDep) : preset.dependencies.dev;
814
829
  if (options.install === false) {
815
- logger.log(`Dependencies: ${preset.dependencies.dev.join(", ")}`);
830
+ logger.log(`Dependencies: ${devDeps.join(", ")}`);
816
831
  return;
817
832
  }
818
833
  if (opts.dryRun) {
819
- logger.log(`[dry-run] Would install: ${preset.dependencies.dev.join(", ")}`);
834
+ logger.log(`[dry-run] Would install: ${devDeps.join(", ")}`);
820
835
  return;
821
836
  }
822
837
  try {
823
838
  logger.log(`Installing dependencies with ${pm}...`);
824
- await installDevDeps(preset.dependencies.dev, cwd, pm);
839
+ await installDevDeps(devDeps, cwd, pm);
825
840
  logger.success("Dependencies installed successfully");
826
841
  } catch {
827
842
  logger.warn("Dependency installation failed. You can install manually.");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@luxkit/cli",
3
- "version": "1.0.7",
3
+ "version": "1.0.8",
4
4
  "description": "One-click project formatting & VSCode config CLI",
5
5
  "type": "module",
6
6
  "bin": {