js-style-kit 0.4.2 → 0.5.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.
@@ -1,17 +1,12 @@
1
1
  #!/usr/bin/env node
2
+ "use strict";
2
3
  var __create = Object.create;
3
4
  var __defProp = Object.defineProperty;
4
5
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
6
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
7
  var __getProtoOf = Object.getPrototypeOf;
7
8
  var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
9
- get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
10
- }) : x)(function(x) {
11
- if (typeof require !== "undefined") return require.apply(this, arguments);
12
- throw Error('Dynamic require of "' + x + '" is not supported');
13
- });
14
- var __commonJS = (cb, mod) => function __require2() {
9
+ var __commonJS = (cb, mod) => function __require() {
15
10
  return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
16
11
  };
17
12
  var __copyProps = (to, from, except, desc) => {
@@ -33,7 +28,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
33
28
 
34
29
  // ../../node_modules/commander/lib/error.js
35
30
  var require_error = __commonJS({
36
- "../../node_modules/commander/lib/error.js"(exports) {
31
+ "../../node_modules/commander/lib/error.js"(exports2) {
37
32
  "use strict";
38
33
  var CommanderError2 = class extends Error {
39
34
  /**
@@ -62,14 +57,14 @@ var require_error = __commonJS({
62
57
  this.name = this.constructor.name;
63
58
  }
64
59
  };
65
- exports.CommanderError = CommanderError2;
66
- exports.InvalidArgumentError = InvalidArgumentError2;
60
+ exports2.CommanderError = CommanderError2;
61
+ exports2.InvalidArgumentError = InvalidArgumentError2;
67
62
  }
68
63
  });
69
64
 
70
65
  // ../../node_modules/commander/lib/argument.js
71
66
  var require_argument = __commonJS({
72
- "../../node_modules/commander/lib/argument.js"(exports) {
67
+ "../../node_modules/commander/lib/argument.js"(exports2) {
73
68
  "use strict";
74
69
  var { InvalidArgumentError: InvalidArgumentError2 } = require_error();
75
70
  var Argument2 = class {
@@ -190,14 +185,14 @@ var require_argument = __commonJS({
190
185
  const nameOutput = arg.name() + (arg.variadic === true ? "..." : "");
191
186
  return arg.required ? "<" + nameOutput + ">" : "[" + nameOutput + "]";
192
187
  }
193
- exports.Argument = Argument2;
194
- exports.humanReadableArgName = humanReadableArgName;
188
+ exports2.Argument = Argument2;
189
+ exports2.humanReadableArgName = humanReadableArgName;
195
190
  }
196
191
  });
197
192
 
198
193
  // ../../node_modules/commander/lib/help.js
199
194
  var require_help = __commonJS({
200
- "../../node_modules/commander/lib/help.js"(exports) {
195
+ "../../node_modules/commander/lib/help.js"(exports2) {
201
196
  "use strict";
202
197
  var { humanReadableArgName } = require_argument();
203
198
  var Help2 = class {
@@ -793,14 +788,14 @@ ${itemIndentStr}`);
793
788
  const sgrPattern = /\x1b\[\d*(;\d*)*m/g;
794
789
  return str.replace(sgrPattern, "");
795
790
  }
796
- exports.Help = Help2;
797
- exports.stripColor = stripColor;
791
+ exports2.Help = Help2;
792
+ exports2.stripColor = stripColor;
798
793
  }
799
794
  });
800
795
 
801
796
  // ../../node_modules/commander/lib/option.js
802
797
  var require_option = __commonJS({
803
- "../../node_modules/commander/lib/option.js"(exports) {
798
+ "../../node_modules/commander/lib/option.js"(exports2) {
804
799
  "use strict";
805
800
  var { InvalidArgumentError: InvalidArgumentError2 } = require_error();
806
801
  var Option2 = class {
@@ -1106,14 +1101,14 @@ var require_option = __commonJS({
1106
1101
  );
1107
1102
  return { shortFlag, longFlag };
1108
1103
  }
1109
- exports.Option = Option2;
1110
- exports.DualOptions = DualOptions;
1104
+ exports2.Option = Option2;
1105
+ exports2.DualOptions = DualOptions;
1111
1106
  }
1112
1107
  });
1113
1108
 
1114
1109
  // ../../node_modules/commander/lib/suggestSimilar.js
1115
1110
  var require_suggestSimilar = __commonJS({
1116
- "../../node_modules/commander/lib/suggestSimilar.js"(exports) {
1111
+ "../../node_modules/commander/lib/suggestSimilar.js"(exports2) {
1117
1112
  "use strict";
1118
1113
  var maxDistance = 3;
1119
1114
  function editDistance(a, b) {
@@ -1188,19 +1183,19 @@ var require_suggestSimilar = __commonJS({
1188
1183
  }
1189
1184
  return "";
1190
1185
  }
1191
- exports.suggestSimilar = suggestSimilar;
1186
+ exports2.suggestSimilar = suggestSimilar;
1192
1187
  }
1193
1188
  });
1194
1189
 
1195
1190
  // ../../node_modules/commander/lib/command.js
1196
1191
  var require_command = __commonJS({
1197
- "../../node_modules/commander/lib/command.js"(exports) {
1192
+ "../../node_modules/commander/lib/command.js"(exports2) {
1198
1193
  "use strict";
1199
- var EventEmitter = __require("events").EventEmitter;
1200
- var childProcess = __require("child_process");
1201
- var path2 = __require("path");
1202
- var fs2 = __require("fs");
1203
- var process2 = __require("process");
1194
+ var EventEmitter = require("events").EventEmitter;
1195
+ var childProcess = require("child_process");
1196
+ var path3 = require("path");
1197
+ var fs8 = require("fs");
1198
+ var process2 = require("process");
1204
1199
  var { Argument: Argument2, humanReadableArgName } = require_argument();
1205
1200
  var { CommanderError: CommanderError2 } = require_error();
1206
1201
  var { Help: Help2, stripColor } = require_help();
@@ -2194,7 +2189,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
2194
2189
  * @param {string} subcommandName
2195
2190
  */
2196
2191
  _checkForMissingExecutable(executableFile, executableDir, subcommandName) {
2197
- if (fs2.existsSync(executableFile)) return;
2192
+ if (fs8.existsSync(executableFile)) return;
2198
2193
  const executableDirMessage = executableDir ? `searched for local subcommand relative to directory '${executableDir}'` : "no directory for search for local subcommand, use .executableDir() to supply a custom directory";
2199
2194
  const executableMissing = `'${executableFile}' does not exist
2200
2195
  - if '${subcommandName}' is not meant to be an executable command, remove description parameter from '.command()' and use '.description()' instead
@@ -2212,11 +2207,11 @@ Expecting one of '${allowedValues.join("', '")}'`);
2212
2207
  let launchWithNode = false;
2213
2208
  const sourceExt = [".js", ".ts", ".tsx", ".mjs", ".cjs"];
2214
2209
  function findFile(baseDir, baseName) {
2215
- const localBin = path2.resolve(baseDir, baseName);
2216
- if (fs2.existsSync(localBin)) return localBin;
2217
- if (sourceExt.includes(path2.extname(baseName))) return void 0;
2210
+ const localBin = path3.resolve(baseDir, baseName);
2211
+ if (fs8.existsSync(localBin)) return localBin;
2212
+ if (sourceExt.includes(path3.extname(baseName))) return void 0;
2218
2213
  const foundExt = sourceExt.find(
2219
- (ext) => fs2.existsSync(`${localBin}${ext}`)
2214
+ (ext) => fs8.existsSync(`${localBin}${ext}`)
2220
2215
  );
2221
2216
  if (foundExt) return `${localBin}${foundExt}`;
2222
2217
  return void 0;
@@ -2228,21 +2223,21 @@ Expecting one of '${allowedValues.join("', '")}'`);
2228
2223
  if (this._scriptPath) {
2229
2224
  let resolvedScriptPath;
2230
2225
  try {
2231
- resolvedScriptPath = fs2.realpathSync(this._scriptPath);
2226
+ resolvedScriptPath = fs8.realpathSync(this._scriptPath);
2232
2227
  } catch {
2233
2228
  resolvedScriptPath = this._scriptPath;
2234
2229
  }
2235
- executableDir = path2.resolve(
2236
- path2.dirname(resolvedScriptPath),
2230
+ executableDir = path3.resolve(
2231
+ path3.dirname(resolvedScriptPath),
2237
2232
  executableDir
2238
2233
  );
2239
2234
  }
2240
2235
  if (executableDir) {
2241
2236
  let localFile = findFile(executableDir, executableFile);
2242
2237
  if (!localFile && !subcommand._executableFile && this._scriptPath) {
2243
- const legacyName = path2.basename(
2238
+ const legacyName = path3.basename(
2244
2239
  this._scriptPath,
2245
- path2.extname(this._scriptPath)
2240
+ path3.extname(this._scriptPath)
2246
2241
  );
2247
2242
  if (legacyName !== this._name) {
2248
2243
  localFile = findFile(
@@ -2253,7 +2248,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
2253
2248
  }
2254
2249
  executableFile = localFile || executableFile;
2255
2250
  }
2256
- launchWithNode = sourceExt.includes(path2.extname(executableFile));
2251
+ launchWithNode = sourceExt.includes(path3.extname(executableFile));
2257
2252
  let proc;
2258
2253
  if (process2.platform !== "win32") {
2259
2254
  if (launchWithNode) {
@@ -3169,7 +3164,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
3169
3164
  * @return {Command}
3170
3165
  */
3171
3166
  nameFromFilename(filename) {
3172
- this._name = path2.basename(filename, path2.extname(filename));
3167
+ this._name = path3.basename(filename, path3.extname(filename));
3173
3168
  return this;
3174
3169
  }
3175
3170
  /**
@@ -3183,9 +3178,9 @@ Expecting one of '${allowedValues.join("', '")}'`);
3183
3178
  * @param {string} [path]
3184
3179
  * @return {(string|null|Command)}
3185
3180
  */
3186
- executableDir(path3) {
3187
- if (path3 === void 0) return this._executableDir;
3188
- this._executableDir = path3;
3181
+ executableDir(path4) {
3182
+ if (path4 === void 0) return this._executableDir;
3183
+ this._executableDir = path4;
3189
3184
  return this;
3190
3185
  }
3191
3186
  /**
@@ -3436,31 +3431,31 @@ Expecting one of '${allowedValues.join("', '")}'`);
3436
3431
  return true;
3437
3432
  return void 0;
3438
3433
  }
3439
- exports.Command = Command2;
3440
- exports.useColor = useColor;
3434
+ exports2.Command = Command2;
3435
+ exports2.useColor = useColor;
3441
3436
  }
3442
3437
  });
3443
3438
 
3444
3439
  // ../../node_modules/commander/index.js
3445
3440
  var require_commander = __commonJS({
3446
- "../../node_modules/commander/index.js"(exports) {
3441
+ "../../node_modules/commander/index.js"(exports2) {
3447
3442
  "use strict";
3448
3443
  var { Argument: Argument2 } = require_argument();
3449
3444
  var { Command: Command2 } = require_command();
3450
3445
  var { CommanderError: CommanderError2, InvalidArgumentError: InvalidArgumentError2 } = require_error();
3451
3446
  var { Help: Help2 } = require_help();
3452
3447
  var { Option: Option2 } = require_option();
3453
- exports.program = new Command2();
3454
- exports.createCommand = (name) => new Command2(name);
3455
- exports.createOption = (flags, description) => new Option2(flags, description);
3456
- exports.createArgument = (name, description) => new Argument2(name, description);
3457
- exports.Command = Command2;
3458
- exports.Option = Option2;
3459
- exports.Argument = Argument2;
3460
- exports.Help = Help2;
3461
- exports.CommanderError = CommanderError2;
3462
- exports.InvalidArgumentError = InvalidArgumentError2;
3463
- exports.InvalidOptionArgumentError = InvalidArgumentError2;
3448
+ exports2.program = new Command2();
3449
+ exports2.createCommand = (name) => new Command2(name);
3450
+ exports2.createOption = (flags, description) => new Option2(flags, description);
3451
+ exports2.createArgument = (name, description) => new Argument2(name, description);
3452
+ exports2.Command = Command2;
3453
+ exports2.Option = Option2;
3454
+ exports2.Argument = Argument2;
3455
+ exports2.Help = Help2;
3456
+ exports2.CommanderError = CommanderError2;
3457
+ exports2.InvalidArgumentError = InvalidArgumentError2;
3458
+ exports2.InvalidOptionArgumentError = InvalidArgumentError2;
3464
3459
  }
3465
3460
  });
3466
3461
 
@@ -3482,44 +3477,147 @@ var {
3482
3477
  } = import_index.default;
3483
3478
 
3484
3479
  // bin/index.ts
3485
- import { execSync } from "child_process";
3486
- import fs from "fs";
3487
- import path from "path";
3488
- var program2 = new Command();
3489
- program2.name("js-style-kit").description(
3490
- "Initialize JavaScript/TypeScript project with style configurations"
3491
- ).version("1.0.0");
3480
+ var import_node_fs7 = __toESM(require("fs"), 1);
3481
+
3482
+ // bin/lib/detect-package-manager.ts
3483
+ var import_node_fs = __toESM(require("fs"), 1);
3492
3484
  var detectPackageManager = () => {
3493
- if (fs.existsSync("bun.lock") || fs.existsSync("bun.lockb")) {
3494
- return "bun";
3485
+ try {
3486
+ if (import_node_fs.default.existsSync("bun.lock") || import_node_fs.default.existsSync("bun.lockb")) {
3487
+ return "bun";
3488
+ }
3489
+ if (import_node_fs.default.existsSync("pnpm-lock.yaml")) {
3490
+ return "pnpm";
3491
+ }
3492
+ if (import_node_fs.default.existsSync("yarn.lock")) {
3493
+ return "yarn";
3494
+ }
3495
+ } catch {
3495
3496
  }
3496
- if (fs.existsSync("pnpm-lock.yaml")) {
3497
- return "pnpm";
3497
+ return "npm";
3498
+ };
3499
+
3500
+ // bin/lib/setup-config-files.ts
3501
+ var import_node_fs2 = __toESM(require("fs"), 1);
3502
+ var setupConfigFiles = () => {
3503
+ console.info("Creating configuration files...");
3504
+ let extension = ".js";
3505
+ try {
3506
+ const packageJson = JSON.parse(import_node_fs2.default.readFileSync("package.json", "utf8"));
3507
+ const isEsm = packageJson.type === "module";
3508
+ extension = isEsm ? ".js" : ".mjs";
3509
+ const prettierConfigContent = `//@ts-check
3510
+ import { prettierConfig } from "js-style-kit";
3511
+
3512
+ export default prettierConfig({});
3513
+ `;
3514
+ const eslintConfigContent = `//@ts-check
3515
+ import { eslintConfig } from "js-style-kit";
3516
+
3517
+ export default eslintConfig({});
3518
+ `;
3519
+ import_node_fs2.default.writeFileSync(`prettier.config${extension}`, prettierConfigContent);
3520
+ import_node_fs2.default.writeFileSync(`eslint.config${extension}`, eslintConfigContent);
3521
+ console.info(`Created configuration files with ${extension} extension`);
3522
+ } catch (error) {
3523
+ console.error("Failed to create configuration files:", error);
3524
+ process.exit(1);
3498
3525
  }
3499
- if (fs.existsSync("yarn.lock")) {
3500
- return "yarn";
3526
+ return extension;
3527
+ };
3528
+
3529
+ // bin/lib/setup-dependencies.ts
3530
+ var import_node_child_process = require("child_process");
3531
+ var import_node_fs4 = __toESM(require("fs"), 1);
3532
+
3533
+ // bin/lib/get-dependencies.ts
3534
+ var import_node_fs3 = __toESM(require("fs"), 1);
3535
+ var import_node_path = __toESM(require("path"), 1);
3536
+ var getDependencies = () => {
3537
+ const nodeModulesPath = import_node_path.default.join(
3538
+ process.cwd(),
3539
+ "node_modules",
3540
+ "js-style-kit",
3541
+ "package.json"
3542
+ );
3543
+ try {
3544
+ if (import_node_fs3.default.existsSync(nodeModulesPath)) {
3545
+ const jsStyleKitPackageJson = JSON.parse(
3546
+ import_node_fs3.default.readFileSync(nodeModulesPath, "utf8")
3547
+ );
3548
+ const dependencies = Object.keys(
3549
+ jsStyleKitPackageJson.dependencies || {}
3550
+ );
3551
+ console.info(
3552
+ `Found ${dependencies.length} dependencies in js-style-kit to remove`
3553
+ );
3554
+ return dependencies;
3555
+ }
3556
+ } catch {
3557
+ console.warn(
3558
+ "Could not read js-style-kit package.json from node_modules, using fallback list"
3559
+ );
3501
3560
  }
3502
- return "npm";
3561
+ return [
3562
+ "eslint",
3563
+ "prettier",
3564
+ "@prettier/plugin-oxc",
3565
+ "@typescript-eslint/parser",
3566
+ "eslint-import-resolver-typescript",
3567
+ "eslint-plugin-import-x",
3568
+ "eslint-plugin-jest",
3569
+ "eslint-plugin-jsdoc",
3570
+ "eslint-plugin-nextjs",
3571
+ "eslint-plugin-perfectionist",
3572
+ "eslint-plugin-prefer-arrow-functions",
3573
+ "eslint-plugin-react",
3574
+ "eslint-plugin-react-hooks",
3575
+ "eslint-plugin-react-refresh",
3576
+ "eslint-plugin-storybook",
3577
+ "eslint-plugin-turbo",
3578
+ "eslint-plugin-unicorn",
3579
+ "eslint-plugin-vitest",
3580
+ "globals",
3581
+ "prettier-plugin-css-order",
3582
+ "prettier-plugin-curly",
3583
+ "prettier-plugin-packagejson",
3584
+ "prettier-plugin-sort-json",
3585
+ "prettier-plugin-tailwindcss",
3586
+ "typescript-eslint"
3587
+ ];
3503
3588
  };
3504
- var setupDependencies = (packageManager) => {
3589
+
3590
+ // bin/lib/setup-dependencies.ts
3591
+ var setupDependencies = (packageManager, dryRun = false) => {
3505
3592
  console.info(`Using package manager: ${packageManager}`);
3506
- console.info("Installing js-style-kit...");
3507
- const installCommands = {
3508
- bun: "bun add --dev js-style-kit",
3509
- npm: "npm install --save-dev js-style-kit",
3510
- pnpm: "pnpm add --save-dev js-style-kit",
3511
- yarn: "yarn add --dev js-style-kit"
3512
- };
3513
- const installCmd = installCommands[packageManager];
3514
- execSync(installCmd, { stdio: "inherit" });
3593
+ if (dryRun) {
3594
+ console.info("Would install js-style-kit (dry run)");
3595
+ } else {
3596
+ console.info("Installing js-style-kit...");
3597
+ const installCommands = {
3598
+ bun: "bun add --dev js-style-kit",
3599
+ npm: "npm install --save-dev js-style-kit",
3600
+ pnpm: "pnpm add --save-dev js-style-kit",
3601
+ yarn: "yarn add --dev js-style-kit"
3602
+ };
3603
+ const installCmd = installCommands[packageManager];
3604
+ (0, import_node_child_process.execSync)(installCmd, { stdio: "inherit" });
3605
+ }
3515
3606
  try {
3516
- const overlappingDeps = ["eslint", "prettier"];
3607
+ const overlappingDeps = getDependencies();
3517
3608
  console.info("Removing overlapping dependencies...");
3518
- const packageJson = JSON.parse(fs.readFileSync("package.json", "utf8"));
3609
+ const packageJson = JSON.parse(import_node_fs4.default.readFileSync("package.json", "utf8"));
3610
+ packageJson.dependencies = packageJson.dependencies ?? {};
3519
3611
  packageJson.devDependencies = packageJson.devDependencies ?? {};
3612
+ const newDeps = { ...packageJson.dependencies };
3520
3613
  const newDevDeps = { ...packageJson.devDependencies };
3521
3614
  let hasChanges = false;
3522
3615
  overlappingDeps.forEach((dep) => {
3616
+ if (Object.prototype.hasOwnProperty.call(newDeps, dep)) {
3617
+ delete newDeps[dep];
3618
+ hasChanges = true;
3619
+ console.info(`Removed ${dep} from dependencies`);
3620
+ }
3523
3621
  if (Object.prototype.hasOwnProperty.call(newDevDeps, dep)) {
3524
3622
  delete newDevDeps[dep];
3525
3623
  hasChanges = true;
@@ -3527,8 +3625,9 @@ var setupDependencies = (packageManager) => {
3527
3625
  }
3528
3626
  });
3529
3627
  if (hasChanges) {
3628
+ packageJson.dependencies = newDeps;
3530
3629
  packageJson.devDependencies = newDevDeps;
3531
- fs.writeFileSync(
3630
+ import_node_fs4.default.writeFileSync(
3532
3631
  "package.json",
3533
3632
  JSON.stringify(packageJson, null, 2).concat("\n")
3534
3633
  );
@@ -3538,18 +3637,21 @@ var setupDependencies = (packageManager) => {
3538
3637
  process.exit(1);
3539
3638
  }
3540
3639
  };
3640
+
3641
+ // bin/lib/setup-scripts.ts
3642
+ var import_node_fs5 = __toESM(require("fs"), 1);
3541
3643
  var setupScripts = () => {
3542
3644
  console.info("Setting up package.json scripts...");
3543
3645
  try {
3544
- const packageJson = JSON.parse(fs.readFileSync("package.json", "utf8"));
3646
+ const packageJson = JSON.parse(import_node_fs5.default.readFileSync("package.json", "utf8"));
3545
3647
  packageJson.scripts = {
3546
3648
  ...packageJson.scripts,
3547
- format: "prettier format",
3548
- "format:check": "prettier format --check",
3549
- lint: "eslint lint",
3550
- "lint:fix": "eslint lint --fix"
3649
+ format: "prettier . --write --cache",
3650
+ "format:check": "prettier . --check --cache",
3651
+ lint: "eslint .",
3652
+ "lint:fix": "eslint . --fix"
3551
3653
  };
3552
- fs.writeFileSync(
3654
+ import_node_fs5.default.writeFileSync(
3553
3655
  "package.json",
3554
3656
  JSON.stringify(packageJson, null, 2).concat("\n")
3555
3657
  );
@@ -3559,47 +3661,26 @@ var setupScripts = () => {
3559
3661
  process.exit(1);
3560
3662
  }
3561
3663
  };
3562
- var setupConfigFiles = () => {
3563
- console.info("Creating configuration files...");
3564
- let extension = ".js";
3565
- try {
3566
- const packageJson = JSON.parse(fs.readFileSync("package.json", "utf8"));
3567
- const isEsm = packageJson.type === "module";
3568
- extension = isEsm ? ".js" : ".mjs";
3569
- const prettierConfigContent = `
3570
- import { prettierConfig } from "js-style-kit";
3571
-
3572
- export default prettierConfig({});
3573
- `;
3574
- const eslintConfigContent = `
3575
- import { eslintConfig } from "js-style-kit";
3576
3664
 
3577
- export default eslintConfig({});
3578
- `;
3579
- fs.writeFileSync(`prettier.config${extension}`, prettierConfigContent);
3580
- fs.writeFileSync(`eslint.config${extension}`, eslintConfigContent);
3581
- console.info(`Created configuration files with ${extension} extension`);
3582
- } catch (error) {
3583
- console.error("Failed to create configuration files:", error);
3584
- process.exit(1);
3585
- }
3586
- return extension;
3587
- };
3665
+ // bin/lib/setup-vscode-settings.ts
3666
+ var import_node_fs6 = __toESM(require("fs"), 1);
3667
+ var import_node_path2 = __toESM(require("path"), 1);
3588
3668
  var setupVSCodeSettings = () => {
3589
3669
  console.info("Setting up VS Code settings...");
3590
3670
  try {
3591
- const vscodeDir = path.join(process.cwd(), ".vscode");
3592
- const settingsPath = path.join(vscodeDir, "settings.json");
3593
- if (!fs.existsSync(vscodeDir)) {
3594
- fs.mkdirSync(vscodeDir);
3671
+ const vscodeDir = import_node_path2.default.join(process.cwd(), ".vscode");
3672
+ const settingsPath = import_node_path2.default.join(vscodeDir, "settings.json");
3673
+ if (!import_node_fs6.default.existsSync(vscodeDir)) {
3674
+ import_node_fs6.default.mkdirSync(vscodeDir);
3595
3675
  }
3596
3676
  let settings = {};
3597
- if (fs.existsSync(settingsPath)) {
3598
- settings = JSON.parse(fs.readFileSync(settingsPath, "utf8"));
3677
+ if (import_node_fs6.default.existsSync(settingsPath)) {
3678
+ settings = JSON.parse(import_node_fs6.default.readFileSync(settingsPath, "utf8"));
3599
3679
  }
3600
3680
  settings = {
3601
3681
  ...settings,
3602
3682
  "editor.codeActionsOnSave": {
3683
+ ...settings["editor.codeActionsOnSave"] || {},
3603
3684
  "source.fixAll.eslint": "explicit"
3604
3685
  },
3605
3686
  "editor.defaultFormatter": "esbenp.prettier-vscode",
@@ -3607,7 +3688,7 @@ var setupVSCodeSettings = () => {
3607
3688
  "eslint.runtime": "node",
3608
3689
  "tailwindCSS.classFunctions": ["cn", "cva", "clsx"]
3609
3690
  };
3610
- fs.writeFileSync(
3691
+ import_node_fs6.default.writeFileSync(
3611
3692
  settingsPath,
3612
3693
  JSON.stringify(settings, null, 2).concat("\n")
3613
3694
  );
@@ -3617,17 +3698,31 @@ var setupVSCodeSettings = () => {
3617
3698
  process.exit(1);
3618
3699
  }
3619
3700
  };
3620
- program2.command("init").description("Initialize project with js-style-kit configurations").action(() => {
3621
- console.info("Initializing js-style-kit...");
3701
+
3702
+ // bin/index.ts
3703
+ var program2 = new Command();
3704
+ program2.name("js-style-kit").description(
3705
+ "Initialize JavaScript/TypeScript project with style configurations"
3706
+ ).version("1.0.0");
3707
+ program2.command("init").description("Initialize project with js-style-kit configurations").option(
3708
+ "--dry-run",
3709
+ "Create configuration files but skip dependency installation"
3710
+ ).action((options) => {
3711
+ const dryRun = options.dryRun ?? false;
3712
+ if (dryRun) {
3713
+ console.info("Initializing js-style-kit (dry run mode)...");
3714
+ } else {
3715
+ console.info("Initializing js-style-kit...");
3716
+ }
3622
3717
  try {
3623
3718
  const packageManager = detectPackageManager();
3624
- if (!fs.existsSync("package.json")) {
3719
+ if (!import_node_fs7.default.existsSync("package.json")) {
3625
3720
  console.error(
3626
3721
  "package.json not found. Please initialize your project first."
3627
3722
  );
3628
3723
  process.exit(1);
3629
3724
  }
3630
- setupDependencies(packageManager);
3725
+ setupDependencies(packageManager, dryRun);
3631
3726
  setupScripts();
3632
3727
  setupConfigFiles();
3633
3728
  setupVSCodeSettings();
@@ -3637,20 +3732,27 @@ program2.command("init").description("Initialize project with js-style-kit confi
3637
3732
  pnpm: "pnpm run",
3638
3733
  yarn: "yarn"
3639
3734
  };
3640
- console.info("\n\u2705 js-style-kit initialized successfully!");
3641
- console.info("\nYou can now use the following npm scripts:");
3642
- console.info(
3643
- ` - ${runCmd[packageManager]} lint: Check code for linting issues`
3644
- );
3645
- console.info(
3646
- ` - ${runCmd[packageManager]} lint:fix: Automatically fix linting issues`
3647
- );
3648
- console.info(
3649
- ` - ${runCmd[packageManager]} format: Format code with Prettier`
3650
- );
3651
- console.info(
3652
- ` - ${runCmd[packageManager]} format:check: Check if code is properly formatted`
3653
- );
3735
+ if (dryRun) {
3736
+ console.info("\n\u2705 js-style-kit dry run completed successfully!");
3737
+ console.info(
3738
+ "Configuration files created, but dependencies were not installed."
3739
+ );
3740
+ } else {
3741
+ console.info("\n\u2705 js-style-kit initialized successfully!");
3742
+ console.info("\nYou can now use the following npm scripts:");
3743
+ console.info(
3744
+ ` - ${runCmd[packageManager]} lint - Check code for linting issues`
3745
+ );
3746
+ console.info(
3747
+ ` - ${runCmd[packageManager]} lint:fix - Automatically fix linting issues`
3748
+ );
3749
+ console.info(
3750
+ ` - ${runCmd[packageManager]} format - Format code with Prettier`
3751
+ );
3752
+ console.info(
3753
+ ` - ${runCmd[packageManager]} format:check - Check if code is properly formatted`
3754
+ );
3755
+ }
3654
3756
  } catch (error) {
3655
3757
  console.error("Failed to initialize js-style-kit:", { cause: error });
3656
3758
  process.exit(1);
@@ -3660,4 +3762,4 @@ program2.parse();
3660
3762
  if (!process.argv.slice(2).length) {
3661
3763
  program2.outputHelp();
3662
3764
  }
3663
- //# sourceMappingURL=index.js.map
3765
+ //# sourceMappingURL=index.cjs.map