@igniter-js/cli 0.2.2 → 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 +48 -58
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +48 -58
- 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,51 +12510,38 @@ async function runSetupPrompts(targetDir, isExistingProject = false) {
|
|
|
12509
12510
|
format: (value) => value.trim().toLowerCase().replace(/\s+/g, "-")
|
|
12510
12511
|
},
|
|
12511
12512
|
{
|
|
12512
|
-
type: "select",
|
|
12513
|
+
type: cliOptions.template || isExistingProject && detectedFramework ? null : "select",
|
|
12513
12514
|
name: "framework",
|
|
12514
|
-
message:
|
|
12515
|
+
message: "\u2022 Which starter would you like to use?",
|
|
12515
12516
|
choices: [
|
|
12516
12517
|
{
|
|
12517
|
-
title: `${import_chalk2.default.green("Next.js")} ${
|
|
12518
|
-
value: "nextjs"
|
|
12518
|
+
title: `${import_chalk2.default.green("Next.js")} ${import_chalk2.default.dim("(Fullstack)")}`,
|
|
12519
|
+
value: "starter-nextjs"
|
|
12519
12520
|
},
|
|
12520
12521
|
{
|
|
12521
|
-
title: `${import_chalk2.default.yellow("
|
|
12522
|
-
value: "
|
|
12522
|
+
title: `${import_chalk2.default.yellow("Express.js")} ${import_chalk2.default.dim("(REST API)")}`,
|
|
12523
|
+
value: "starter-express-rest-api"
|
|
12523
12524
|
},
|
|
12524
12525
|
{
|
|
12525
|
-
title: `${import_chalk2.default.cyan("
|
|
12526
|
-
value: "
|
|
12526
|
+
title: `${import_chalk2.default.cyan("Deno")} ${import_chalk2.default.dim("(REST API)")}`,
|
|
12527
|
+
value: "starter-deno-rest-api"
|
|
12527
12528
|
},
|
|
12528
12529
|
{
|
|
12529
|
-
title: `${import_chalk2.default.magenta("
|
|
12530
|
-
value: "
|
|
12530
|
+
title: `${import_chalk2.default.magenta("Bun")} ${import_chalk2.default.dim("(REST API)")}`,
|
|
12531
|
+
value: "starter-bun-rest-api"
|
|
12531
12532
|
},
|
|
12532
12533
|
{
|
|
12533
|
-
title: `${import_chalk2.default.red("
|
|
12534
|
-
value: "
|
|
12534
|
+
title: `${import_chalk2.default.red("Bun + React (Vite)")} ${import_chalk2.default.dim("(Fullstack)")}`,
|
|
12535
|
+
value: "starter-bun-react-app"
|
|
12535
12536
|
},
|
|
12536
12537
|
{
|
|
12537
|
-
title: `${import_chalk2.default.
|
|
12538
|
-
value: "
|
|
12539
|
-
},
|
|
12540
|
-
{
|
|
12541
|
-
title: `${import_chalk2.default.blue("Express")} ${detectedFramework === "express" ? import_chalk2.default.dim("(detected)") : ""}`,
|
|
12542
|
-
value: "express"
|
|
12543
|
-
},
|
|
12544
|
-
{
|
|
12545
|
-
title: `${import_chalk2.default.magenta("TanStack Start")} ${detectedFramework === "tanstack-start" ? import_chalk2.default.dim("(detected)") : ""}`,
|
|
12546
|
-
value: "tanstack-start"
|
|
12547
|
-
},
|
|
12548
|
-
{
|
|
12549
|
-
title: import_chalk2.default.gray("Generic/Other"),
|
|
12550
|
-
value: "generic"
|
|
12538
|
+
title: `${import_chalk2.default.magenta("TanStack Start")} ${import_chalk2.default.dim("(Fullstack)")}`,
|
|
12539
|
+
value: "starter-tanstack-start"
|
|
12551
12540
|
}
|
|
12552
|
-
]
|
|
12553
|
-
initial: getFrameworkChoiceIndex(detectedFramework)
|
|
12541
|
+
]
|
|
12554
12542
|
},
|
|
12555
12543
|
{
|
|
12556
|
-
type: "multiselect",
|
|
12544
|
+
type: cliOptions.features ? null : "multiselect",
|
|
12557
12545
|
name: "features",
|
|
12558
12546
|
message: import_chalk2.default.bold("\u2022 Which Igniter.js features would you like to enable?"),
|
|
12559
12547
|
choices: [
|
|
@@ -12590,7 +12578,7 @@ async function runSetupPrompts(targetDir, isExistingProject = false) {
|
|
|
12590
12578
|
instructions: import_chalk2.default.dim("Use \u2191\u2193 to navigate, space to select, enter to confirm")
|
|
12591
12579
|
},
|
|
12592
12580
|
{
|
|
12593
|
-
type: "select",
|
|
12581
|
+
type: cliOptions.database ? null : "select",
|
|
12594
12582
|
name: "database",
|
|
12595
12583
|
message: import_chalk2.default.bold("\u2022 Choose your database (optional):"),
|
|
12596
12584
|
choices: [
|
|
@@ -12614,14 +12602,18 @@ async function runSetupPrompts(targetDir, isExistingProject = false) {
|
|
|
12614
12602
|
initial: 0
|
|
12615
12603
|
},
|
|
12616
12604
|
{
|
|
12617
|
-
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
|
+
},
|
|
12618
12610
|
name: "dockerCompose",
|
|
12619
12611
|
message: import_chalk2.default.bold("\u2022 Setup Docker Compose for development?"),
|
|
12620
12612
|
hint: import_chalk2.default.dim("Includes Redis and your selected database"),
|
|
12621
|
-
initial:
|
|
12613
|
+
initial: cliOptions.docker !== false
|
|
12622
12614
|
},
|
|
12623
12615
|
{
|
|
12624
|
-
type: "select",
|
|
12616
|
+
type: cliOptions.packageManager ? null : "select",
|
|
12625
12617
|
name: "packageManager",
|
|
12626
12618
|
message: isExistingProject ? `We detected ${import_chalk2.default.cyan(detectedPackageManager)}. Please confirm or select another.` : import_chalk2.default.bold("\u2022 Which package manager?"),
|
|
12627
12619
|
choices: [
|
|
@@ -12642,19 +12634,19 @@ async function runSetupPrompts(targetDir, isExistingProject = false) {
|
|
|
12642
12634
|
value: "bun"
|
|
12643
12635
|
}
|
|
12644
12636
|
],
|
|
12645
|
-
initial: getPackageManagerChoiceIndex(detectedPackageManager)
|
|
12637
|
+
initial: getPackageManagerChoiceIndex(cliOptions.packageManager || detectedPackageManager)
|
|
12646
12638
|
},
|
|
12647
12639
|
{
|
|
12648
|
-
type: isExistingProject ? null : "confirm",
|
|
12640
|
+
type: isExistingProject || cliOptions.git === false ? null : "confirm",
|
|
12649
12641
|
name: "initGit",
|
|
12650
12642
|
message: import_chalk2.default.bold("\u2022 Initialize Git repository?"),
|
|
12651
|
-
initial:
|
|
12643
|
+
initial: cliOptions.git !== false
|
|
12652
12644
|
},
|
|
12653
12645
|
{
|
|
12654
|
-
type: "confirm",
|
|
12646
|
+
type: cliOptions.install === false ? null : "confirm",
|
|
12655
12647
|
name: "installDependencies",
|
|
12656
12648
|
message: import_chalk2.default.bold("\u2022 Install dependencies automatically?"),
|
|
12657
|
-
initial:
|
|
12649
|
+
initial: cliOptions.install !== false
|
|
12658
12650
|
}
|
|
12659
12651
|
], {
|
|
12660
12652
|
onCancel: () => {
|
|
@@ -12662,22 +12654,24 @@ async function runSetupPrompts(targetDir, isExistingProject = false) {
|
|
|
12662
12654
|
process.exit(0);
|
|
12663
12655
|
}
|
|
12664
12656
|
});
|
|
12657
|
+
const selectedFeatures = cliOptions.features ? cliFeatures : answers.features || [];
|
|
12658
|
+
const hasExplicitFeatures = cliOptions.features || answers.features && answers.features.length > 0;
|
|
12665
12659
|
const featuresObj = {
|
|
12666
|
-
store:
|
|
12667
|
-
jobs:
|
|
12668
|
-
mcp:
|
|
12669
|
-
logging:
|
|
12670
|
-
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
|
|
12671
12665
|
};
|
|
12672
12666
|
const config = {
|
|
12673
12667
|
projectName: answers.projectName || projectName,
|
|
12674
|
-
framework: answers.framework,
|
|
12668
|
+
framework: cliOptions.template || answers.framework,
|
|
12675
12669
|
features: featuresObj,
|
|
12676
|
-
database: { provider: answers.database },
|
|
12677
|
-
packageManager: answers.packageManager,
|
|
12678
|
-
initGit: answers.initGit
|
|
12679
|
-
installDependencies: answers.installDependencies,
|
|
12680
|
-
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)
|
|
12681
12675
|
};
|
|
12682
12676
|
showConfigSummary(config);
|
|
12683
12677
|
return config;
|
|
@@ -12710,10 +12704,6 @@ function showConfigSummary(config) {
|
|
|
12710
12704
|
}
|
|
12711
12705
|
console.log();
|
|
12712
12706
|
}
|
|
12713
|
-
function getFrameworkChoiceIndex(detected) {
|
|
12714
|
-
const frameworks = ["nextjs", "vite", "nuxt", "sveltekit", "remix", "astro", "express", "tanstack-start", "generic"];
|
|
12715
|
-
return Math.max(0, frameworks.indexOf(detected));
|
|
12716
|
-
}
|
|
12717
12707
|
function getPackageManagerChoiceIndex(detected) {
|
|
12718
12708
|
const managers = ["npm", "yarn", "pnpm", "bun"];
|
|
12719
12709
|
return Math.max(0, managers.indexOf(detected));
|
|
@@ -13596,9 +13586,9 @@ var ProjectGenerator = class {
|
|
|
13596
13586
|
async downloadTemplate() {
|
|
13597
13587
|
const { framework } = this.config;
|
|
13598
13588
|
const templateUrl = `https://github.com/felipebarcelospro/igniter-js.git`;
|
|
13599
|
-
const branch = "
|
|
13589
|
+
const branch = "main";
|
|
13600
13590
|
const tempDir = import_path2.default.join(this.targetDir, "__igniter_tmp__");
|
|
13601
|
-
const starterDir = import_path2.default.join(tempDir, "apps",
|
|
13591
|
+
const starterDir = import_path2.default.join(tempDir, "apps", framework);
|
|
13602
13592
|
const destDir = this.targetDir;
|
|
13603
13593
|
let isValidStarter = false;
|
|
13604
13594
|
this.spinner.start(`Baixando apenas o conte\xFAdo da pasta starter (${framework}) do branch ${branch}...`);
|
|
@@ -14459,7 +14449,7 @@ async function handleGenerateProcedure(name, feature) {
|
|
|
14459
14449
|
// src/index.ts
|
|
14460
14450
|
var program = new import_commander.Command();
|
|
14461
14451
|
program.name("igniter").description("CLI for Igniter.js type-safe client generation").version("1.0.0");
|
|
14462
|
-
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) => {
|
|
14463
14453
|
const initLogger = createChildLogger({ component: "init-command" });
|
|
14464
14454
|
try {
|
|
14465
14455
|
if (!projectName) {
|
|
@@ -14496,7 +14486,7 @@ program.command("init").description("Create a new Igniter.js project with intera
|
|
|
14496
14486
|
}
|
|
14497
14487
|
}
|
|
14498
14488
|
}
|
|
14499
|
-
const config = await runSetupPrompts(targetDir, isExistingProject);
|
|
14489
|
+
const config = await runSetupPrompts(targetDir, isExistingProject, options);
|
|
14500
14490
|
const validation = validateConfig(config);
|
|
14501
14491
|
if (!validation.isValid) {
|
|
14502
14492
|
console.error(`\u2717 ${validation.message}`);
|