@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.js +32 -26
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +32 -26
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -12487,11 +12487,12 @@ function showWelcome() {
|
|
|
12487
12487
|
console.log(import_chalk2.default.dim("This process will configure your project with everything you need."));
|
|
12488
12488
|
console.log();
|
|
12489
12489
|
}
|
|
12490
|
-
async function runSetupPrompts(targetDir, isExistingProject = false) {
|
|
12490
|
+
async function runSetupPrompts(targetDir, isExistingProject = false, cliOptions = {}) {
|
|
12491
12491
|
showWelcome();
|
|
12492
12492
|
const detectedFramework = detectFramework();
|
|
12493
12493
|
const detectedPackageManager = detectPackageManager();
|
|
12494
12494
|
const projectName = targetDir ? import_path.default.basename(import_path.default.resolve(targetDir)) : "my-igniter-app";
|
|
12495
|
+
const cliFeatures = cliOptions.features ? cliOptions.features.split(",").map((f) => f.trim()) : [];
|
|
12495
12496
|
try {
|
|
12496
12497
|
const answers = await (0, import_prompts.default)([
|
|
12497
12498
|
{
|
|
@@ -12509,8 +12510,7 @@ async function runSetupPrompts(targetDir, isExistingProject = false) {
|
|
|
12509
12510
|
format: (value) => value.trim().toLowerCase().replace(/\s+/g, "-")
|
|
12510
12511
|
},
|
|
12511
12512
|
{
|
|
12512
|
-
type:
|
|
12513
|
-
// Show if not existing project OR if existing but no framework detected
|
|
12513
|
+
type: cliOptions.template || isExistingProject && detectedFramework ? null : "select",
|
|
12514
12514
|
name: "framework",
|
|
12515
12515
|
message: "\u2022 Which starter would you like to use?",
|
|
12516
12516
|
choices: [
|
|
@@ -12541,7 +12541,7 @@ async function runSetupPrompts(targetDir, isExistingProject = false) {
|
|
|
12541
12541
|
]
|
|
12542
12542
|
},
|
|
12543
12543
|
{
|
|
12544
|
-
type: "multiselect",
|
|
12544
|
+
type: cliOptions.features ? null : "multiselect",
|
|
12545
12545
|
name: "features",
|
|
12546
12546
|
message: import_chalk2.default.bold("\u2022 Which Igniter.js features would you like to enable?"),
|
|
12547
12547
|
choices: [
|
|
@@ -12578,7 +12578,7 @@ async function runSetupPrompts(targetDir, isExistingProject = false) {
|
|
|
12578
12578
|
instructions: import_chalk2.default.dim("Use \u2191\u2193 to navigate, space to select, enter to confirm")
|
|
12579
12579
|
},
|
|
12580
12580
|
{
|
|
12581
|
-
type: "select",
|
|
12581
|
+
type: cliOptions.database ? null : "select",
|
|
12582
12582
|
name: "database",
|
|
12583
12583
|
message: import_chalk2.default.bold("\u2022 Choose your database (optional):"),
|
|
12584
12584
|
choices: [
|
|
@@ -12602,14 +12602,18 @@ async function runSetupPrompts(targetDir, isExistingProject = false) {
|
|
|
12602
12602
|
initial: 0
|
|
12603
12603
|
},
|
|
12604
12604
|
{
|
|
12605
|
-
type: (prev) =>
|
|
12605
|
+
type: (prev) => {
|
|
12606
|
+
if (cliOptions.docker === false) return null;
|
|
12607
|
+
const dbValue = cliOptions.database || prev;
|
|
12608
|
+
return dbValue !== "none" ? "confirm" : null;
|
|
12609
|
+
},
|
|
12606
12610
|
name: "dockerCompose",
|
|
12607
12611
|
message: import_chalk2.default.bold("\u2022 Setup Docker Compose for development?"),
|
|
12608
12612
|
hint: import_chalk2.default.dim("Includes Redis and your selected database"),
|
|
12609
|
-
initial:
|
|
12613
|
+
initial: cliOptions.docker !== false
|
|
12610
12614
|
},
|
|
12611
12615
|
{
|
|
12612
|
-
type: "select",
|
|
12616
|
+
type: cliOptions.packageManager ? null : "select",
|
|
12613
12617
|
name: "packageManager",
|
|
12614
12618
|
message: isExistingProject ? `We detected ${import_chalk2.default.cyan(detectedPackageManager)}. Please confirm or select another.` : import_chalk2.default.bold("\u2022 Which package manager?"),
|
|
12615
12619
|
choices: [
|
|
@@ -12630,19 +12634,19 @@ async function runSetupPrompts(targetDir, isExistingProject = false) {
|
|
|
12630
12634
|
value: "bun"
|
|
12631
12635
|
}
|
|
12632
12636
|
],
|
|
12633
|
-
initial: getPackageManagerChoiceIndex(detectedPackageManager)
|
|
12637
|
+
initial: getPackageManagerChoiceIndex(cliOptions.packageManager || detectedPackageManager)
|
|
12634
12638
|
},
|
|
12635
12639
|
{
|
|
12636
|
-
type: isExistingProject ? null : "confirm",
|
|
12640
|
+
type: isExistingProject || cliOptions.git === false ? null : "confirm",
|
|
12637
12641
|
name: "initGit",
|
|
12638
12642
|
message: import_chalk2.default.bold("\u2022 Initialize Git repository?"),
|
|
12639
|
-
initial:
|
|
12643
|
+
initial: cliOptions.git !== false
|
|
12640
12644
|
},
|
|
12641
12645
|
{
|
|
12642
|
-
type: "confirm",
|
|
12646
|
+
type: cliOptions.install === false ? null : "confirm",
|
|
12643
12647
|
name: "installDependencies",
|
|
12644
12648
|
message: import_chalk2.default.bold("\u2022 Install dependencies automatically?"),
|
|
12645
|
-
initial:
|
|
12649
|
+
initial: cliOptions.install !== false
|
|
12646
12650
|
}
|
|
12647
12651
|
], {
|
|
12648
12652
|
onCancel: () => {
|
|
@@ -12650,22 +12654,24 @@ async function runSetupPrompts(targetDir, isExistingProject = false) {
|
|
|
12650
12654
|
process.exit(0);
|
|
12651
12655
|
}
|
|
12652
12656
|
});
|
|
12657
|
+
const selectedFeatures = cliOptions.features ? cliFeatures : answers.features || [];
|
|
12658
|
+
const hasExplicitFeatures = cliOptions.features || answers.features && answers.features.length > 0;
|
|
12653
12659
|
const featuresObj = {
|
|
12654
|
-
store:
|
|
12655
|
-
jobs:
|
|
12656
|
-
mcp:
|
|
12657
|
-
logging:
|
|
12658
|
-
telemetry:
|
|
12660
|
+
store: selectedFeatures.includes("store"),
|
|
12661
|
+
jobs: selectedFeatures.includes("jobs"),
|
|
12662
|
+
mcp: selectedFeatures.includes("mcp"),
|
|
12663
|
+
logging: selectedFeatures.includes("logging") || !hasExplicitFeatures,
|
|
12664
|
+
telemetry: selectedFeatures.includes("telemetry") || !hasExplicitFeatures
|
|
12659
12665
|
};
|
|
12660
12666
|
const config = {
|
|
12661
12667
|
projectName: answers.projectName || projectName,
|
|
12662
|
-
framework: answers.framework,
|
|
12668
|
+
framework: cliOptions.template || answers.framework,
|
|
12663
12669
|
features: featuresObj,
|
|
12664
|
-
database: { provider: answers.database },
|
|
12665
|
-
packageManager: answers.packageManager,
|
|
12666
|
-
initGit: answers.initGit
|
|
12667
|
-
installDependencies: answers.installDependencies,
|
|
12668
|
-
dockerCompose: answers.dockerCompose || false
|
|
12670
|
+
database: { provider: cliOptions.database || answers.database || "none" },
|
|
12671
|
+
packageManager: cliOptions.packageManager || answers.packageManager || detectedPackageManager,
|
|
12672
|
+
initGit: cliOptions.git !== false && (answers.initGit !== void 0 ? answers.initGit : !isExistingProject),
|
|
12673
|
+
installDependencies: cliOptions.install !== false && answers.installDependencies !== false,
|
|
12674
|
+
dockerCompose: cliOptions.docker !== false && (answers.dockerCompose || false)
|
|
12669
12675
|
};
|
|
12670
12676
|
showConfigSummary(config);
|
|
12671
12677
|
return config;
|
|
@@ -14443,7 +14449,7 @@ async function handleGenerateProcedure(name, feature) {
|
|
|
14443
14449
|
// src/index.ts
|
|
14444
14450
|
var program = new import_commander.Command();
|
|
14445
14451
|
program.name("igniter").description("CLI for Igniter.js type-safe client generation").version("1.0.0");
|
|
14446
|
-
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 (
|
|
14452
|
+
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) => {
|
|
14447
14453
|
const initLogger = createChildLogger({ component: "init-command" });
|
|
14448
14454
|
try {
|
|
14449
14455
|
if (!projectName) {
|
|
@@ -14480,7 +14486,7 @@ program.command("init").description("Create a new Igniter.js project with intera
|
|
|
14480
14486
|
}
|
|
14481
14487
|
}
|
|
14482
14488
|
}
|
|
14483
|
-
const config = await runSetupPrompts(targetDir, isExistingProject);
|
|
14489
|
+
const config = await runSetupPrompts(targetDir, isExistingProject, options);
|
|
14484
14490
|
const validation = validateConfig(config);
|
|
14485
14491
|
if (!validation.isValid) {
|
|
14486
14492
|
console.error(`\u2717 ${validation.message}`);
|