@igniter-js/cli 0.2.3 → 0.2.4

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/dist/index.mjs CHANGED
@@ -12491,11 +12491,12 @@ function showWelcome() {
12491
12491
  console.log(chalk2.dim("This process will configure your project with everything you need."));
12492
12492
  console.log();
12493
12493
  }
12494
- async function runSetupPrompts(targetDir, isExistingProject = false) {
12494
+ async function runSetupPrompts(targetDir, isExistingProject = false, cliOptions = {}) {
12495
12495
  showWelcome();
12496
12496
  const detectedFramework = detectFramework();
12497
12497
  const detectedPackageManager = detectPackageManager();
12498
12498
  const projectName = targetDir ? path3.basename(path3.resolve(targetDir)) : "my-igniter-app";
12499
+ const cliFeatures = cliOptions.features ? cliOptions.features.split(",").map((f) => f.trim()) : [];
12499
12500
  try {
12500
12501
  const answers = await prompts([
12501
12502
  {
@@ -12513,8 +12514,7 @@ async function runSetupPrompts(targetDir, isExistingProject = false) {
12513
12514
  format: (value) => value.trim().toLowerCase().replace(/\s+/g, "-")
12514
12515
  },
12515
12516
  {
12516
- type: !(isExistingProject && detectedFramework) ? "select" : null,
12517
- // Show if not existing project OR if existing but no framework detected
12517
+ type: cliOptions.template || isExistingProject && detectedFramework ? null : "select",
12518
12518
  name: "framework",
12519
12519
  message: "\u2022 Which starter would you like to use?",
12520
12520
  choices: [
@@ -12545,7 +12545,7 @@ async function runSetupPrompts(targetDir, isExistingProject = false) {
12545
12545
  ]
12546
12546
  },
12547
12547
  {
12548
- type: "multiselect",
12548
+ type: cliOptions.features ? null : "multiselect",
12549
12549
  name: "features",
12550
12550
  message: chalk2.bold("\u2022 Which Igniter.js features would you like to enable?"),
12551
12551
  choices: [
@@ -12582,7 +12582,7 @@ async function runSetupPrompts(targetDir, isExistingProject = false) {
12582
12582
  instructions: chalk2.dim("Use \u2191\u2193 to navigate, space to select, enter to confirm")
12583
12583
  },
12584
12584
  {
12585
- type: "select",
12585
+ type: cliOptions.database ? null : "select",
12586
12586
  name: "database",
12587
12587
  message: chalk2.bold("\u2022 Choose your database (optional):"),
12588
12588
  choices: [
@@ -12606,14 +12606,18 @@ async function runSetupPrompts(targetDir, isExistingProject = false) {
12606
12606
  initial: 0
12607
12607
  },
12608
12608
  {
12609
- type: (prev) => prev !== "none" ? "confirm" : null,
12609
+ type: (prev) => {
12610
+ if (cliOptions.docker === false) return null;
12611
+ const dbValue = cliOptions.database || prev;
12612
+ return dbValue !== "none" ? "confirm" : null;
12613
+ },
12610
12614
  name: "dockerCompose",
12611
12615
  message: chalk2.bold("\u2022 Setup Docker Compose for development?"),
12612
12616
  hint: chalk2.dim("Includes Redis and your selected database"),
12613
- initial: true
12617
+ initial: cliOptions.docker !== false
12614
12618
  },
12615
12619
  {
12616
- type: "select",
12620
+ type: cliOptions.packageManager ? null : "select",
12617
12621
  name: "packageManager",
12618
12622
  message: isExistingProject ? `We detected ${chalk2.cyan(detectedPackageManager)}. Please confirm or select another.` : chalk2.bold("\u2022 Which package manager?"),
12619
12623
  choices: [
@@ -12634,19 +12638,19 @@ async function runSetupPrompts(targetDir, isExistingProject = false) {
12634
12638
  value: "bun"
12635
12639
  }
12636
12640
  ],
12637
- initial: getPackageManagerChoiceIndex(detectedPackageManager)
12641
+ initial: getPackageManagerChoiceIndex(cliOptions.packageManager || detectedPackageManager)
12638
12642
  },
12639
12643
  {
12640
- type: isExistingProject ? null : "confirm",
12644
+ type: isExistingProject || cliOptions.git === false ? null : "confirm",
12641
12645
  name: "initGit",
12642
12646
  message: chalk2.bold("\u2022 Initialize Git repository?"),
12643
- initial: true
12647
+ initial: cliOptions.git !== false
12644
12648
  },
12645
12649
  {
12646
- type: "confirm",
12650
+ type: cliOptions.install === false ? null : "confirm",
12647
12651
  name: "installDependencies",
12648
12652
  message: chalk2.bold("\u2022 Install dependencies automatically?"),
12649
- initial: true
12653
+ initial: cliOptions.install !== false
12650
12654
  }
12651
12655
  ], {
12652
12656
  onCancel: () => {
@@ -12654,22 +12658,24 @@ async function runSetupPrompts(targetDir, isExistingProject = false) {
12654
12658
  process.exit(0);
12655
12659
  }
12656
12660
  });
12661
+ const selectedFeatures = cliOptions.features ? cliFeatures : answers.features || [];
12662
+ const hasExplicitFeatures = cliOptions.features || answers.features && answers.features.length > 0;
12657
12663
  const featuresObj = {
12658
- store: answers.features.includes("store"),
12659
- jobs: answers.features.includes("jobs"),
12660
- mcp: answers.features.includes("mcp"),
12661
- logging: answers.features.includes("logging"),
12662
- telemetry: answers.features.includes("telemetry")
12664
+ store: selectedFeatures.includes("store"),
12665
+ jobs: selectedFeatures.includes("jobs"),
12666
+ mcp: selectedFeatures.includes("mcp"),
12667
+ logging: selectedFeatures.includes("logging") || !hasExplicitFeatures,
12668
+ telemetry: selectedFeatures.includes("telemetry") || !hasExplicitFeatures
12663
12669
  };
12664
12670
  const config = {
12665
12671
  projectName: answers.projectName || projectName,
12666
- framework: answers.framework,
12672
+ framework: cliOptions.template || answers.framework,
12667
12673
  features: featuresObj,
12668
- database: { provider: answers.database },
12669
- packageManager: answers.packageManager,
12670
- initGit: answers.initGit === void 0 ? false : answers.initGit,
12671
- installDependencies: answers.installDependencies,
12672
- dockerCompose: answers.dockerCompose || false
12674
+ database: { provider: cliOptions.database || answers.database || "none" },
12675
+ packageManager: cliOptions.packageManager || answers.packageManager || detectedPackageManager,
12676
+ initGit: cliOptions.git !== false && (answers.initGit !== void 0 ? answers.initGit : !isExistingProject),
12677
+ installDependencies: cliOptions.install !== false && answers.installDependencies !== false,
12678
+ dockerCompose: cliOptions.docker !== false && (answers.dockerCompose || false)
12673
12679
  };
12674
12680
  showConfigSummary(config);
12675
12681
  return config;
@@ -14447,7 +14453,7 @@ async function handleGenerateProcedure(name, feature) {
14447
14453
  // src/index.ts
14448
14454
  var program = new Command();
14449
14455
  program.name("igniter").description("CLI for Igniter.js type-safe client generation").version("1.0.0");
14450
- program.command("init").description("Create a new Igniter.js project with interactive setup").argument("[project-name]", "Name of the project directory").option("--force", "Skip confirmation prompts and overwrite existing files").option("--pm, --package-manager <manager>", "Package manager to use (npm, yarn, pnpm, bun)").option("--template <template>", "Use a specific template (coming soon)").option("-f, --framework <framework>", "Target framework (nextjs, vite, etc.)").option("--no-git", "Skip git repository initialization").option("--no-install", "Skip automatic dependency installation").action(async (projectName, options) => {
14456
+ program.command("init").description("Create a new Igniter.js project with interactive setup").argument("[project-name]", "Name of the project directory").option("--force", "Skip confirmation prompts and overwrite existing files").option("--pm, --package-manager <manager>", "Package manager to use (npm, yarn, pnpm, bun)").option("--template <template>", "Use a specific template (e.g., starter-nextjs, starter-express-rest-api)").option("-f, --framework <framework>", "Target framework (nextjs, vite, etc.)").option("--features <features>", "Comma-separated list of features (store,jobs,mcp,logging,telemetry)").option("--database <database>", "Database provider (none, postgresql, mysql, sqlite)").option("--orm <orm>", "ORM provider (prisma, drizzle)").option("--no-git", "Skip git repository initialization").option("--no-install", "Skip automatic dependency installation").option("--no-docker", "Skip Docker Compose setup").action(async (projectName, options) => {
14451
14457
  const initLogger = createChildLogger({ component: "init-command" });
14452
14458
  try {
14453
14459
  if (!projectName) {
@@ -14484,7 +14490,7 @@ program.command("init").description("Create a new Igniter.js project with intera
14484
14490
  }
14485
14491
  }
14486
14492
  }
14487
- const config = await runSetupPrompts(targetDir, isExistingProject);
14493
+ const config = await runSetupPrompts(targetDir, isExistingProject, options);
14488
14494
  const validation = validateConfig(config);
14489
14495
  if (!validation.isValid) {
14490
14496
  console.error(`\u2717 ${validation.message}`);