create-next-pro-cli 0.1.18 → 0.1.20
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/README.md +18 -0
- package/create-next-pro-completion.sh +1 -1
- package/dist/bin.bun.js +176 -22
- package/dist/bin.node.js +191 -23
- package/dist/bin.node.js.map +1 -1
- package/package.json +1 -1
- package/templates/Api/route.ts +5 -0
- package/templates/Lib/index.ts +1 -0
- package/templates/Lib/item.ts +3 -0
- package/templates/Projects/default/src/app/api/hello/route.ts +5 -0
- package/templates/Projects/default/src/lib/sample/example.ts +3 -0
- package/templates/Projects/default/src/lib/sample/index.ts +3 -0
package/README.md
CHANGED
|
@@ -92,6 +92,24 @@ create-next-pro addcomponent MyComponent -P MyPage
|
|
|
92
92
|
create-next-pro addcomponent MyComponent -P ParentPage.ChildPage
|
|
93
93
|
```
|
|
94
94
|
|
|
95
|
+
### Create a library
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
create-next-pro addlib mylib
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
### Add a file to a library
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
create-next-pro addlib mylib.foo
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
### Create an API route
|
|
108
|
+
|
|
109
|
+
```bash
|
|
110
|
+
create-next-pro addapi hello
|
|
111
|
+
```
|
|
112
|
+
|
|
95
113
|
### Remove a page
|
|
96
114
|
|
|
97
115
|
```bash
|
|
@@ -4,7 +4,7 @@ _create_next_pro_complete() {
|
|
|
4
4
|
COMPREPLY=()
|
|
5
5
|
cur="${COMP_WORDS[COMP_CWORD]}"
|
|
6
6
|
prev="${COMP_WORDS[COMP_CWORD-1]}"
|
|
7
|
-
opts="addpage addcomponent rmpage"
|
|
7
|
+
opts="addpage addcomponent addlib addapi rmpage"
|
|
8
8
|
|
|
9
9
|
# Autocomplete commands
|
|
10
10
|
if [[ ${COMP_CWORD} == 1 ]]; then
|
package/dist/bin.bun.js
CHANGED
|
@@ -4937,7 +4937,7 @@ var require_prompts3 = __commonJS((exports, module) => {
|
|
|
4937
4937
|
});
|
|
4938
4938
|
|
|
4939
4939
|
// src/index.ts
|
|
4940
|
-
var
|
|
4940
|
+
var import_prompts7 = __toESM(require_prompts3(), 1);
|
|
4941
4941
|
import fs from "fs";
|
|
4942
4942
|
import os from "os";
|
|
4943
4943
|
import path from "path";
|
|
@@ -5305,18 +5305,161 @@ async function rmPage(args) {
|
|
|
5305
5305
|
console.log(`\u2705 Page "${pageName}" deleted.`);
|
|
5306
5306
|
}
|
|
5307
5307
|
|
|
5308
|
-
// src/
|
|
5309
|
-
|
|
5308
|
+
// src/lib/addLib.ts
|
|
5309
|
+
var import_prompts4 = __toESM(require_prompts3(), 1);
|
|
5310
5310
|
import { join as join5 } from "path";
|
|
5311
|
+
import { mkdir as mkdir3, readFile as readFile4, writeFile as writeFile4 } from "fs/promises";
|
|
5311
5312
|
import { existsSync as existsSync5 } from "fs";
|
|
5313
|
+
async function addLib(args) {
|
|
5314
|
+
let libArg = args[1];
|
|
5315
|
+
if (!libArg || libArg.startsWith("-")) {
|
|
5316
|
+
const response = await import_prompts4.default.prompt({
|
|
5317
|
+
type: "text",
|
|
5318
|
+
name: "libArg",
|
|
5319
|
+
message: "\uD83D\uDCE6 Lib name to add:",
|
|
5320
|
+
validate: (name) => name ? true : "Lib name is required"
|
|
5321
|
+
});
|
|
5322
|
+
libArg = response.libArg;
|
|
5323
|
+
}
|
|
5324
|
+
let libName = libArg;
|
|
5325
|
+
let fileName = null;
|
|
5326
|
+
if (libArg.includes(".")) {
|
|
5327
|
+
[libName, fileName] = libArg.split(".");
|
|
5328
|
+
}
|
|
5329
|
+
const config = await loadConfig();
|
|
5330
|
+
if (!config) {
|
|
5331
|
+
console.error("\u274C Configuration file cnp.config.json not found. Run this command from the project root.");
|
|
5332
|
+
return;
|
|
5333
|
+
}
|
|
5334
|
+
const libDir = join5(process.cwd(), "src", "lib", libName);
|
|
5335
|
+
if (!existsSync5(libDir)) {
|
|
5336
|
+
await mkdir3(libDir, { recursive: true });
|
|
5337
|
+
}
|
|
5338
|
+
const templateDir = join5(import.meta.dir, "..", "..", "templates", "Lib");
|
|
5339
|
+
const indexTemplate = join5(templateDir, "index.ts");
|
|
5340
|
+
const fileTemplate = join5(templateDir, "item.ts");
|
|
5341
|
+
const indexPath = join5(libDir, "index.ts");
|
|
5342
|
+
if (!existsSync5(indexPath)) {
|
|
5343
|
+
if (existsSync5(indexTemplate)) {
|
|
5344
|
+
const content = await readFile4(indexTemplate, "utf-8");
|
|
5345
|
+
await writeFile4(indexPath, content);
|
|
5346
|
+
} else {
|
|
5347
|
+
await writeFile4(indexPath, `export {}
|
|
5348
|
+
`);
|
|
5349
|
+
}
|
|
5350
|
+
console.log(`\uD83D\uDCC4 File created: ${indexPath}`);
|
|
5351
|
+
}
|
|
5352
|
+
if (fileName) {
|
|
5353
|
+
const filePath = join5(libDir, `${fileName}.ts`);
|
|
5354
|
+
if (!existsSync5(filePath)) {
|
|
5355
|
+
if (existsSync5(fileTemplate)) {
|
|
5356
|
+
let content = await readFile4(fileTemplate, "utf-8");
|
|
5357
|
+
content = content.replace(/template/g, fileName).replace(/Template/g, capitalize(fileName));
|
|
5358
|
+
await writeFile4(filePath, content);
|
|
5359
|
+
} else {
|
|
5360
|
+
await writeFile4(filePath, `export function ${fileName}() {
|
|
5361
|
+
// TODO: implement
|
|
5362
|
+
}
|
|
5363
|
+
`);
|
|
5364
|
+
}
|
|
5365
|
+
console.log(`\uD83D\uDCC4 File created: ${filePath}`);
|
|
5366
|
+
}
|
|
5367
|
+
let indexContent = await readFile4(indexPath, "utf-8");
|
|
5368
|
+
const importLine = `import { ${fileName} } from "./${fileName}";`;
|
|
5369
|
+
const importRegex = new RegExp(`import\\s*{\\s*${fileName}\\s*}\\s*from\\s*"\\./${fileName}";`);
|
|
5370
|
+
const exportRegex = /export\s*{([^}]*)}/m;
|
|
5371
|
+
const imports = [];
|
|
5372
|
+
const exportsSet = [];
|
|
5373
|
+
for (const line of indexContent.split(`
|
|
5374
|
+
`)) {
|
|
5375
|
+
if (line.startsWith("import")) {
|
|
5376
|
+
imports.push(line);
|
|
5377
|
+
} else if (line.startsWith("export")) {
|
|
5378
|
+
const match = line.match(exportRegex);
|
|
5379
|
+
if (match && match[1]) {
|
|
5380
|
+
exportsSet.push(...match[1].split(",").map((s) => s.trim()).filter(Boolean));
|
|
5381
|
+
}
|
|
5382
|
+
}
|
|
5383
|
+
}
|
|
5384
|
+
if (!imports.some((l) => importRegex.test(l))) {
|
|
5385
|
+
imports.push(importLine);
|
|
5386
|
+
}
|
|
5387
|
+
if (!exportsSet.includes(fileName)) {
|
|
5388
|
+
exportsSet.push(fileName);
|
|
5389
|
+
}
|
|
5390
|
+
indexContent = imports.join(`
|
|
5391
|
+
`) + `
|
|
5392
|
+
|
|
5393
|
+
export { ` + exportsSet.join(", ") + ` };
|
|
5394
|
+
`;
|
|
5395
|
+
await writeFile4(indexPath, indexContent);
|
|
5396
|
+
console.log(`\u270F\uFE0F Updated index: ${indexPath}`);
|
|
5397
|
+
}
|
|
5398
|
+
console.log(`\u2705 Lib "${libName}"${fileName ? ` with module ${fileName}` : ""} added.`);
|
|
5399
|
+
}
|
|
5400
|
+
|
|
5401
|
+
// src/lib/addApi.ts
|
|
5402
|
+
var import_prompts5 = __toESM(require_prompts3(), 1);
|
|
5403
|
+
import { join as join6 } from "path";
|
|
5404
|
+
import { mkdir as mkdir4, readFile as readFile5, writeFile as writeFile5 } from "fs/promises";
|
|
5405
|
+
import { existsSync as existsSync6 } from "fs";
|
|
5406
|
+
async function addApi(args) {
|
|
5407
|
+
let apiName = args[1];
|
|
5408
|
+
if (!apiName || apiName.startsWith("-")) {
|
|
5409
|
+
const response = await import_prompts5.default.prompt({
|
|
5410
|
+
type: "text",
|
|
5411
|
+
name: "apiName",
|
|
5412
|
+
message: "\uD83D\uDD0C API route name to add:",
|
|
5413
|
+
validate: (name) => name ? true : "API route name is required"
|
|
5414
|
+
});
|
|
5415
|
+
apiName = response.apiName;
|
|
5416
|
+
}
|
|
5417
|
+
const config = await loadConfig();
|
|
5418
|
+
if (!config) {
|
|
5419
|
+
console.error("\u274C Configuration file cnp.config.json not found. Run this command from the project root.");
|
|
5420
|
+
return;
|
|
5421
|
+
}
|
|
5422
|
+
const apiDir = join6(process.cwd(), "src", "app", "api", apiName);
|
|
5423
|
+
if (!existsSync6(apiDir)) {
|
|
5424
|
+
await mkdir4(apiDir, { recursive: true });
|
|
5425
|
+
}
|
|
5426
|
+
const templateDir = join6(import.meta.dir, "..", "..", "templates", "Api");
|
|
5427
|
+
const routeTemplate = join6(templateDir, "route.ts");
|
|
5428
|
+
const routePath = join6(apiDir, "route.ts");
|
|
5429
|
+
if (!existsSync6(routePath)) {
|
|
5430
|
+
if (existsSync6(routeTemplate)) {
|
|
5431
|
+
let content = await readFile5(routeTemplate, "utf-8");
|
|
5432
|
+
content = content.replace(/template/g, apiName);
|
|
5433
|
+
await writeFile5(routePath, content);
|
|
5434
|
+
} else {
|
|
5435
|
+
await writeFile5(routePath, `import { NextResponse } from "next/server";
|
|
5436
|
+
|
|
5437
|
+
export async function GET() {
|
|
5438
|
+
return NextResponse.json({ message: "Hello from ${apiName}" });
|
|
5439
|
+
}
|
|
5440
|
+
`);
|
|
5441
|
+
}
|
|
5442
|
+
console.log(`\uD83D\uDCC4 File created: ${routePath}`);
|
|
5443
|
+
} else {
|
|
5444
|
+
console.log(`\u2139\uFE0F File already exists: ${routePath}`);
|
|
5445
|
+
}
|
|
5446
|
+
console.log(`\u2705 API route "${apiName}" added.`);
|
|
5447
|
+
}
|
|
5448
|
+
|
|
5449
|
+
// src/scaffold.ts
|
|
5450
|
+
import { cp, mkdir as mkdir5, rm, writeFile as writeFile6, readFile as readFile6 } from "fs/promises";
|
|
5451
|
+
import { join as join7 } from "path";
|
|
5452
|
+
import { existsSync as existsSync7 } from "fs";
|
|
5312
5453
|
import { fileURLToPath } from "url";
|
|
5313
5454
|
var RED = "\x1B[31m";
|
|
5455
|
+
var GREEN = "\x1B[32m";
|
|
5456
|
+
var CYAN = "\x1B[36m";
|
|
5314
5457
|
var RESET = "\x1B[0m";
|
|
5315
5458
|
async function scaffoldProject(options) {
|
|
5316
|
-
const targetPath =
|
|
5459
|
+
const targetPath = join7(process.cwd(), options.projectName);
|
|
5317
5460
|
const __dirname2 = new URL(".", import.meta.url);
|
|
5318
|
-
const templatePath =
|
|
5319
|
-
if (
|
|
5461
|
+
const templatePath = join7(fileURLToPath(__dirname2), "..", "templates", "Projects", "default");
|
|
5462
|
+
if (existsSync7(targetPath)) {
|
|
5320
5463
|
if (options.force) {
|
|
5321
5464
|
console.warn("\u26A0\uFE0F Target directory already exists, removing...");
|
|
5322
5465
|
await rm(targetPath, { recursive: true, force: true });
|
|
@@ -5327,33 +5470,34 @@ async function scaffoldProject(options) {
|
|
|
5327
5470
|
}
|
|
5328
5471
|
try {
|
|
5329
5472
|
console.log("Creating project directory...");
|
|
5330
|
-
await
|
|
5473
|
+
await mkdir5(targetPath, { recursive: true });
|
|
5331
5474
|
console.log("Copying files from template...");
|
|
5332
5475
|
await cp(templatePath, targetPath, { recursive: true });
|
|
5333
|
-
const pkgPath =
|
|
5334
|
-
if (
|
|
5335
|
-
const pkg = JSON.parse(await
|
|
5476
|
+
const pkgPath = join7(targetPath, "package.json");
|
|
5477
|
+
if (existsSync7(pkgPath)) {
|
|
5478
|
+
const pkg = JSON.parse(await readFile6(pkgPath, "utf-8"));
|
|
5336
5479
|
pkg.dependencies = pkg.dependencies || {};
|
|
5337
5480
|
if (options.useI18n) {
|
|
5338
5481
|
pkg.dependencies["next-intl"] = pkg.dependencies["next-intl"] || "^4.3.5";
|
|
5339
5482
|
}
|
|
5340
|
-
await
|
|
5483
|
+
await writeFile6(pkgPath, JSON.stringify(pkg, null, 2));
|
|
5341
5484
|
}
|
|
5342
|
-
await
|
|
5343
|
-
console.log("Project setup complete
|
|
5485
|
+
await writeFile6(join7(targetPath, "cnp.config.json"), JSON.stringify(options, null, 2));
|
|
5486
|
+
console.log("Project setup complete!");
|
|
5344
5487
|
console.log("");
|
|
5345
5488
|
console.log("To get started:");
|
|
5346
|
-
console.log(`
|
|
5489
|
+
console.log(` ${GREEN}cd ${options.projectName}${RESET}`);
|
|
5347
5490
|
console.log("");
|
|
5348
5491
|
console.log("Then install dependencies and launch the dev server with your preferred tool:");
|
|
5349
|
-
console.log(
|
|
5350
|
-
console.log(
|
|
5351
|
-
console.log(
|
|
5492
|
+
console.log(` ${GREEN}bun install && bun dev${RESET}`);
|
|
5493
|
+
console.log(` ${GREEN}npm install && npm run dev${RESET}`);
|
|
5494
|
+
console.log(` ${GREEN}pnpm install && pnpm run dev${RESET}`);
|
|
5352
5495
|
console.log("");
|
|
5353
5496
|
console.log("Documentation and examples can be found at:");
|
|
5354
|
-
console.log(
|
|
5497
|
+
console.log(` ${CYAN}https://github.com/Rising-Corporation/create-next-pro-cli${RESET}`);
|
|
5498
|
+
console.log("_-`'-_-'`_`'-_-'`_`'-_-'`_`'-_-'`_`'-_-'`_`'-_-'`_`'-_-'`_`'-_-'`-_");
|
|
5355
5499
|
} catch (err) {
|
|
5356
|
-
console.error(
|
|
5500
|
+
console.error(` ${RED}[X] Error during project creation:${RESET}`, err);
|
|
5357
5501
|
process.exit(1);
|
|
5358
5502
|
}
|
|
5359
5503
|
}
|
|
@@ -5377,9 +5521,9 @@ async function createProject(nameArg, force) {
|
|
|
5377
5521
|
}
|
|
5378
5522
|
|
|
5379
5523
|
// src/lib/createProjectWithPrompt.ts
|
|
5380
|
-
var
|
|
5524
|
+
var import_prompts6 = __toESM(require_prompts3(), 1);
|
|
5381
5525
|
async function createProjectWithPrompt() {
|
|
5382
|
-
const response = await
|
|
5526
|
+
const response = await import_prompts6.default.prompt([
|
|
5383
5527
|
{
|
|
5384
5528
|
type: "text",
|
|
5385
5529
|
name: "projectName",
|
|
@@ -5497,7 +5641,7 @@ async function onboarding() {
|
|
|
5497
5641
|
const pkg = JSON.parse(packageJson);
|
|
5498
5642
|
console.log(`\uD83D\uDE80 Welcome to create-next-pro v${pkg.version}
|
|
5499
5643
|
`);
|
|
5500
|
-
const res = await
|
|
5644
|
+
const res = await import_prompts7.default([
|
|
5501
5645
|
{
|
|
5502
5646
|
type: "select",
|
|
5503
5647
|
name: "shell",
|
|
@@ -5541,6 +5685,8 @@ Usage:
|
|
|
5541
5685
|
create-next-pro <project-name> [--force]
|
|
5542
5686
|
create-next-pro addpage [options]
|
|
5543
5687
|
create-next-pro addcomponent [options]
|
|
5688
|
+
create-next-pro addlib [name]
|
|
5689
|
+
create-next-pro addapi [name]
|
|
5544
5690
|
create-next-pro rmpage [options]
|
|
5545
5691
|
|
|
5546
5692
|
Options:
|
|
@@ -5581,6 +5727,14 @@ async function main() {
|
|
|
5581
5727
|
addPage(args);
|
|
5582
5728
|
return;
|
|
5583
5729
|
}
|
|
5730
|
+
if (args[0] === "addlib") {
|
|
5731
|
+
addLib(args);
|
|
5732
|
+
return;
|
|
5733
|
+
}
|
|
5734
|
+
if (args[0] === "addapi") {
|
|
5735
|
+
addApi(args);
|
|
5736
|
+
return;
|
|
5737
|
+
}
|
|
5584
5738
|
if (args[0] === "rmpage") {
|
|
5585
5739
|
rmPage(args);
|
|
5586
5740
|
return;
|
package/dist/bin.node.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
import fs from "fs";
|
|
5
5
|
import os from "os";
|
|
6
6
|
import path from "path";
|
|
7
|
-
import
|
|
7
|
+
import prompts7 from "prompts";
|
|
8
8
|
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
9
9
|
import { dirname, resolve } from "path";
|
|
10
10
|
|
|
@@ -387,24 +387,177 @@ async function rmPage(args) {
|
|
|
387
387
|
console.log(`\u2705 Page "${pageName}" deleted.`);
|
|
388
388
|
}
|
|
389
389
|
|
|
390
|
-
// src/
|
|
391
|
-
import { cp, mkdir as mkdir3, rm, writeFile as writeFile4, readFile as readFile4 } from "fs/promises";
|
|
390
|
+
// src/lib/addLib.ts
|
|
392
391
|
import { join as join5 } from "path";
|
|
392
|
+
import { mkdir as mkdir3, readFile as readFile4, writeFile as writeFile4 } from "fs/promises";
|
|
393
|
+
import prompts4 from "prompts";
|
|
393
394
|
import { existsSync as existsSync5 } from "fs";
|
|
395
|
+
async function addLib(args) {
|
|
396
|
+
let libArg = args[1];
|
|
397
|
+
if (!libArg || libArg.startsWith("-")) {
|
|
398
|
+
const response = await prompts4.prompt({
|
|
399
|
+
type: "text",
|
|
400
|
+
name: "libArg",
|
|
401
|
+
message: "\u{1F4E6} Lib name to add:",
|
|
402
|
+
validate: (name) => name ? true : "Lib name is required"
|
|
403
|
+
});
|
|
404
|
+
libArg = response.libArg;
|
|
405
|
+
}
|
|
406
|
+
let libName = libArg;
|
|
407
|
+
let fileName = null;
|
|
408
|
+
if (libArg.includes(".")) {
|
|
409
|
+
[libName, fileName] = libArg.split(".");
|
|
410
|
+
}
|
|
411
|
+
const config = await loadConfig();
|
|
412
|
+
if (!config) {
|
|
413
|
+
console.error(
|
|
414
|
+
"\u274C Configuration file cnp.config.json not found. Run this command from the project root."
|
|
415
|
+
);
|
|
416
|
+
return;
|
|
417
|
+
}
|
|
418
|
+
const libDir = join5(process.cwd(), "src", "lib", libName);
|
|
419
|
+
if (!existsSync5(libDir)) {
|
|
420
|
+
await mkdir3(libDir, { recursive: true });
|
|
421
|
+
}
|
|
422
|
+
const templateDir = join5(import.meta.dir, "..", "..", "templates", "Lib");
|
|
423
|
+
const indexTemplate = join5(templateDir, "index.ts");
|
|
424
|
+
const fileTemplate = join5(templateDir, "item.ts");
|
|
425
|
+
const indexPath = join5(libDir, "index.ts");
|
|
426
|
+
if (!existsSync5(indexPath)) {
|
|
427
|
+
if (existsSync5(indexTemplate)) {
|
|
428
|
+
const content = await readFile4(indexTemplate, "utf-8");
|
|
429
|
+
await writeFile4(indexPath, content);
|
|
430
|
+
} else {
|
|
431
|
+
await writeFile4(indexPath, "export {}\n");
|
|
432
|
+
}
|
|
433
|
+
console.log(`\u{1F4C4} File created: ${indexPath}`);
|
|
434
|
+
}
|
|
435
|
+
if (fileName) {
|
|
436
|
+
const filePath = join5(libDir, `${fileName}.ts`);
|
|
437
|
+
if (!existsSync5(filePath)) {
|
|
438
|
+
if (existsSync5(fileTemplate)) {
|
|
439
|
+
let content = await readFile4(fileTemplate, "utf-8");
|
|
440
|
+
content = content.replace(/template/g, fileName).replace(/Template/g, capitalize(fileName));
|
|
441
|
+
await writeFile4(filePath, content);
|
|
442
|
+
} else {
|
|
443
|
+
await writeFile4(
|
|
444
|
+
filePath,
|
|
445
|
+
`export function ${fileName}() {
|
|
446
|
+
// TODO: implement
|
|
447
|
+
}
|
|
448
|
+
`
|
|
449
|
+
);
|
|
450
|
+
}
|
|
451
|
+
console.log(`\u{1F4C4} File created: ${filePath}`);
|
|
452
|
+
}
|
|
453
|
+
let indexContent = await readFile4(indexPath, "utf-8");
|
|
454
|
+
const importLine = `import { ${fileName} } from "./${fileName}";`;
|
|
455
|
+
const importRegex = new RegExp(
|
|
456
|
+
`import\\s*{\\s*${fileName}\\s*}\\s*from\\s*"\\./${fileName}";`
|
|
457
|
+
);
|
|
458
|
+
const exportRegex = /export\s*{([^}]*)}/m;
|
|
459
|
+
const imports = [];
|
|
460
|
+
const exportsSet = [];
|
|
461
|
+
for (const line of indexContent.split("\n")) {
|
|
462
|
+
if (line.startsWith("import")) {
|
|
463
|
+
imports.push(line);
|
|
464
|
+
} else if (line.startsWith("export")) {
|
|
465
|
+
const match = line.match(exportRegex);
|
|
466
|
+
if (match && match[1]) {
|
|
467
|
+
exportsSet.push(
|
|
468
|
+
...match[1].split(",").map((s) => s.trim()).filter(Boolean)
|
|
469
|
+
);
|
|
470
|
+
}
|
|
471
|
+
}
|
|
472
|
+
}
|
|
473
|
+
if (!imports.some((l) => importRegex.test(l))) {
|
|
474
|
+
imports.push(importLine);
|
|
475
|
+
}
|
|
476
|
+
if (!exportsSet.includes(fileName)) {
|
|
477
|
+
exportsSet.push(fileName);
|
|
478
|
+
}
|
|
479
|
+
indexContent = imports.join("\n") + "\n\nexport { " + exportsSet.join(", ") + " };\n";
|
|
480
|
+
await writeFile4(indexPath, indexContent);
|
|
481
|
+
console.log(`\u270F\uFE0F Updated index: ${indexPath}`);
|
|
482
|
+
}
|
|
483
|
+
console.log(
|
|
484
|
+
`\u2705 Lib "${libName}"${fileName ? ` with module ${fileName}` : ""} added.`
|
|
485
|
+
);
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
// src/lib/addApi.ts
|
|
489
|
+
import { join as join6 } from "path";
|
|
490
|
+
import { mkdir as mkdir4, readFile as readFile5, writeFile as writeFile5 } from "fs/promises";
|
|
491
|
+
import prompts5 from "prompts";
|
|
492
|
+
import { existsSync as existsSync6 } from "fs";
|
|
493
|
+
async function addApi(args) {
|
|
494
|
+
let apiName = args[1];
|
|
495
|
+
if (!apiName || apiName.startsWith("-")) {
|
|
496
|
+
const response = await prompts5.prompt({
|
|
497
|
+
type: "text",
|
|
498
|
+
name: "apiName",
|
|
499
|
+
message: "\u{1F50C} API route name to add:",
|
|
500
|
+
validate: (name) => name ? true : "API route name is required"
|
|
501
|
+
});
|
|
502
|
+
apiName = response.apiName;
|
|
503
|
+
}
|
|
504
|
+
const config = await loadConfig();
|
|
505
|
+
if (!config) {
|
|
506
|
+
console.error(
|
|
507
|
+
"\u274C Configuration file cnp.config.json not found. Run this command from the project root."
|
|
508
|
+
);
|
|
509
|
+
return;
|
|
510
|
+
}
|
|
511
|
+
const apiDir = join6(process.cwd(), "src", "app", "api", apiName);
|
|
512
|
+
if (!existsSync6(apiDir)) {
|
|
513
|
+
await mkdir4(apiDir, { recursive: true });
|
|
514
|
+
}
|
|
515
|
+
const templateDir = join6(import.meta.dir, "..", "..", "templates", "Api");
|
|
516
|
+
const routeTemplate = join6(templateDir, "route.ts");
|
|
517
|
+
const routePath = join6(apiDir, "route.ts");
|
|
518
|
+
if (!existsSync6(routePath)) {
|
|
519
|
+
if (existsSync6(routeTemplate)) {
|
|
520
|
+
let content = await readFile5(routeTemplate, "utf-8");
|
|
521
|
+
content = content.replace(/template/g, apiName);
|
|
522
|
+
await writeFile5(routePath, content);
|
|
523
|
+
} else {
|
|
524
|
+
await writeFile5(
|
|
525
|
+
routePath,
|
|
526
|
+
`import { NextResponse } from "next/server";
|
|
527
|
+
|
|
528
|
+
export async function GET() {
|
|
529
|
+
return NextResponse.json({ message: "Hello from ${apiName}" });
|
|
530
|
+
}
|
|
531
|
+
`
|
|
532
|
+
);
|
|
533
|
+
}
|
|
534
|
+
console.log(`\u{1F4C4} File created: ${routePath}`);
|
|
535
|
+
} else {
|
|
536
|
+
console.log(`\u2139\uFE0F File already exists: ${routePath}`);
|
|
537
|
+
}
|
|
538
|
+
console.log(`\u2705 API route "${apiName}" added.`);
|
|
539
|
+
}
|
|
540
|
+
|
|
541
|
+
// src/scaffold.ts
|
|
542
|
+
import { cp, mkdir as mkdir5, rm, writeFile as writeFile6, readFile as readFile6 } from "fs/promises";
|
|
543
|
+
import { join as join7 } from "path";
|
|
544
|
+
import { existsSync as existsSync7 } from "fs";
|
|
394
545
|
import { fileURLToPath } from "url";
|
|
395
546
|
var RED = "\x1B[31m";
|
|
547
|
+
var GREEN = "\x1B[32m";
|
|
548
|
+
var CYAN = "\x1B[36m";
|
|
396
549
|
var RESET = "\x1B[0m";
|
|
397
550
|
async function scaffoldProject(options) {
|
|
398
|
-
const targetPath =
|
|
551
|
+
const targetPath = join7(process.cwd(), options.projectName);
|
|
399
552
|
const __dirname2 = new URL(".", import.meta.url);
|
|
400
|
-
const templatePath =
|
|
553
|
+
const templatePath = join7(
|
|
401
554
|
fileURLToPath(__dirname2),
|
|
402
555
|
"..",
|
|
403
556
|
"templates",
|
|
404
557
|
"Projects",
|
|
405
558
|
"default"
|
|
406
559
|
);
|
|
407
|
-
if (
|
|
560
|
+
if (existsSync7(targetPath)) {
|
|
408
561
|
if (options.force) {
|
|
409
562
|
console.warn("\u26A0\uFE0F Target directory already exists, removing...");
|
|
410
563
|
await rm(targetPath, { recursive: true, force: true });
|
|
@@ -417,38 +570,43 @@ async function scaffoldProject(options) {
|
|
|
417
570
|
}
|
|
418
571
|
try {
|
|
419
572
|
console.log("Creating project directory...");
|
|
420
|
-
await
|
|
573
|
+
await mkdir5(targetPath, { recursive: true });
|
|
421
574
|
console.log("Copying files from template...");
|
|
422
575
|
await cp(templatePath, targetPath, { recursive: true });
|
|
423
|
-
const pkgPath =
|
|
424
|
-
if (
|
|
425
|
-
const pkg = JSON.parse(await
|
|
576
|
+
const pkgPath = join7(targetPath, "package.json");
|
|
577
|
+
if (existsSync7(pkgPath)) {
|
|
578
|
+
const pkg = JSON.parse(await readFile6(pkgPath, "utf-8"));
|
|
426
579
|
pkg.dependencies = pkg.dependencies || {};
|
|
427
580
|
if (options.useI18n) {
|
|
428
581
|
pkg.dependencies["next-intl"] = pkg.dependencies["next-intl"] || "^4.3.5";
|
|
429
582
|
}
|
|
430
|
-
await
|
|
583
|
+
await writeFile6(pkgPath, JSON.stringify(pkg, null, 2));
|
|
431
584
|
}
|
|
432
|
-
await
|
|
433
|
-
|
|
585
|
+
await writeFile6(
|
|
586
|
+
join7(targetPath, "cnp.config.json"),
|
|
434
587
|
JSON.stringify(options, null, 2)
|
|
435
588
|
);
|
|
436
|
-
console.log("Project setup complete
|
|
589
|
+
console.log("Project setup complete!");
|
|
437
590
|
console.log("");
|
|
438
591
|
console.log("To get started:");
|
|
439
|
-
console.log(`
|
|
592
|
+
console.log(` ${GREEN}cd ${options.projectName}${RESET}`);
|
|
440
593
|
console.log("");
|
|
441
594
|
console.log(
|
|
442
595
|
"Then install dependencies and launch the dev server with your preferred tool:"
|
|
443
596
|
);
|
|
444
|
-
console.log(
|
|
445
|
-
console.log(
|
|
446
|
-
console.log(
|
|
597
|
+
console.log(` ${GREEN}bun install && bun dev${RESET}`);
|
|
598
|
+
console.log(` ${GREEN}npm install && npm run dev${RESET}`);
|
|
599
|
+
console.log(` ${GREEN}pnpm install && pnpm run dev${RESET}`);
|
|
447
600
|
console.log("");
|
|
448
601
|
console.log("Documentation and examples can be found at:");
|
|
449
|
-
console.log(
|
|
602
|
+
console.log(
|
|
603
|
+
` ${CYAN}https://github.com/Rising-Corporation/create-next-pro-cli${RESET}`
|
|
604
|
+
);
|
|
605
|
+
console.log(
|
|
606
|
+
"_-`'-_-'`_`'-_-'`_`'-_-'`_`'-_-'`_`'-_-'`_`'-_-'`_`'-_-'`_`'-_-'`-_"
|
|
607
|
+
);
|
|
450
608
|
} catch (err) {
|
|
451
|
-
console.error(
|
|
609
|
+
console.error(` ${RED}[X] Error during project creation:${RESET}`, err);
|
|
452
610
|
process.exit(1);
|
|
453
611
|
}
|
|
454
612
|
}
|
|
@@ -472,9 +630,9 @@ async function createProject(nameArg, force) {
|
|
|
472
630
|
}
|
|
473
631
|
|
|
474
632
|
// src/lib/createProjectWithPrompt.ts
|
|
475
|
-
import
|
|
633
|
+
import prompts6 from "prompts";
|
|
476
634
|
async function createProjectWithPrompt() {
|
|
477
|
-
const response = await
|
|
635
|
+
const response = await prompts6.prompt([
|
|
478
636
|
{
|
|
479
637
|
type: "text",
|
|
480
638
|
name: "projectName",
|
|
@@ -594,7 +752,7 @@ async function onboarding() {
|
|
|
594
752
|
const pkg = JSON.parse(packageJson);
|
|
595
753
|
console.log(`\u{1F680} Welcome to create-next-pro v${pkg.version}
|
|
596
754
|
`);
|
|
597
|
-
const res = await
|
|
755
|
+
const res = await prompts7(
|
|
598
756
|
[
|
|
599
757
|
{
|
|
600
758
|
type: "select",
|
|
@@ -641,6 +799,8 @@ Usage:
|
|
|
641
799
|
create-next-pro <project-name> [--force]
|
|
642
800
|
create-next-pro addpage [options]
|
|
643
801
|
create-next-pro addcomponent [options]
|
|
802
|
+
create-next-pro addlib [name]
|
|
803
|
+
create-next-pro addapi [name]
|
|
644
804
|
create-next-pro rmpage [options]
|
|
645
805
|
|
|
646
806
|
Options:
|
|
@@ -679,6 +839,14 @@ async function main() {
|
|
|
679
839
|
addPage(args);
|
|
680
840
|
return;
|
|
681
841
|
}
|
|
842
|
+
if (args[0] === "addlib") {
|
|
843
|
+
addLib(args);
|
|
844
|
+
return;
|
|
845
|
+
}
|
|
846
|
+
if (args[0] === "addapi") {
|
|
847
|
+
addApi(args);
|
|
848
|
+
return;
|
|
849
|
+
}
|
|
682
850
|
if (args[0] === "rmpage") {
|
|
683
851
|
rmPage(args);
|
|
684
852
|
return;
|
package/dist/bin.node.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/lib/addComponent.ts","../src/lib/utils.ts","../src/lib/addPage.ts","../src/lib/rmPage.ts","../src/scaffold.ts","../src/lib/createProject.ts","../src/lib/createProjectWithPrompt.ts","../bin.node.ts"],"sourcesContent":["// src/index.ts\n\nimport fs from \"node:fs\";\nimport os from \"node:os\";\nimport path from \"node:path\";\nimport prompts from \"prompts\";\nimport { fileURLToPath } from \"node:url\";\nimport { dirname, resolve } from \"node:path\";\n\nimport { addComponent } from \"./lib/addComponent\";\nimport { addPage } from \"./lib/addPage\";\nimport { rmPage } from \"./lib/rmPage\";\nimport { createProject } from \"./lib/createProject\";\nimport { createProjectWithPrompt } from \"./lib/createProjectWithPrompt\";\n\ntype Cfg = {\n version: 1;\n shell: \"bash\" | \"zsh\";\n completionInstalled: boolean;\n createdAt: string;\n updatedAt: string;\n};\n\nconst CONFIG_DIR = process.env.XDG_CONFIG_HOME\n ? path.join(process.env.XDG_CONFIG_HOME, \"create-next-pro\")\n : path.join(os.homedir(), \".config\", \"create-next-pro\");\nconst CONFIG_FILE = path.join(CONFIG_DIR, \"config.json\");\n\nfunction readCfg(): Cfg | null {\n try {\n return JSON.parse(fs.readFileSync(CONFIG_FILE, \"utf8\")) as Cfg;\n } catch {\n return null;\n }\n}\nfunction writeCfg(cfg: Cfg) {\n fs.mkdirSync(CONFIG_DIR, { recursive: true });\n fs.writeFileSync(CONFIG_FILE, JSON.stringify(cfg, null, 2));\n}\nfunction rcFile(shell: \"bash\" | \"zsh\") {\n return path.join(os.homedir(), shell === \"zsh\" ? \".zshrc\" : \".bashrc\");\n}\nfunction ensureLineInRc(file: string, line: string) {\n try {\n const cur = fs.existsSync(file) ? fs.readFileSync(file, \"utf8\") : \"\";\n if (!cur.includes(line)) fs.appendFileSync(file, `\\n${line}\\n`);\n } catch {\n /* ignore */\n }\n}\nasync function installCompletion(shell: \"bash\" | \"zsh\") {\n // Lit le script d’auto-complétion depuis le package (racine du package)\n const __dirname = path.dirname(fileURLToPath(import.meta.url));\n const completionSrc = path.resolve(\n __dirname,\n \"../create-next-pro-completion.sh\",\n );\n const completionDst = path.join(CONFIG_DIR, \"completion.sh\");\n fs.mkdirSync(CONFIG_DIR, { recursive: true });\n fs.copyFileSync(completionSrc, completionDst);\n ensureLineInRc(rcFile(shell), `source \"${completionDst}\"`);\n}\n\nconst __filename = fileURLToPath(import.meta.url);\nconst __dirname = dirname(__filename);\nconst packageJsonPath = resolve(__dirname, \"../package.json\");\nconst packageJson = fs.readFileSync(packageJsonPath, \"utf8\");\n\nasync function onboarding(): Promise<Cfg> {\n const pkg = JSON.parse(packageJson);\n console.log(`🚀 Welcome to create-next-pro v${pkg.version}\\n`);\n const res = await prompts(\n [\n {\n type: \"select\",\n name: \"shell\",\n message: \"Which shell do you use?\",\n choices: [\n { title: \"zsh\", value: \"zsh\" },\n { title: \"bash\", value: \"bash\" },\n ],\n initial: (os.userInfo().shell || \"\").includes(\"zsh\") ? 0 : 1,\n },\n {\n type: \"toggle\",\n name: \"completion\",\n message: \"Install autocompletion?\",\n initial: true,\n active: \"Yes\",\n inactive: \"No\",\n },\n ],\n { onCancel: () => process.exit(1) },\n );\n\n const cfg: Cfg = {\n version: 1,\n shell: res.shell,\n completionInstalled: !!res.completion,\n createdAt: new Date().toISOString(),\n updatedAt: new Date().toISOString(),\n };\n if (cfg.completionInstalled) await installCompletion(cfg.shell);\n writeCfg(cfg);\n console.log(\"\\n✅ Configuration saved.\");\n console.log(\"you can now use the CLI ! ex : create-next-pro <project-name>\");\n console.log(\n \"For more information, visit: https://github.com/Rising-Corporation/create-next-pro-cli\",\n );\n console.log(\"Happy coding! 🎉\");\n return cfg;\n}\nfunction showHelp() {\n console.log(`create-next-pro\n\nUsage:\n create-next-pro <project-name> [--force]\n create-next-pro addpage [options]\n create-next-pro addcomponent [options]\n create-next-pro rmpage [options]\n\nOptions:\n --help Show this help message\n --reconfigure Run the configuration assistant again\n`);\n}\n\nfunction showVersion() {\n const pkg = JSON.parse(packageJson);\n console.log(`v${pkg.version}`);\n}\n\n/**\n * Main CLI entry point for create-next-pro.\n *\n * Note: For now, the project behaves as if --force is always enabled and no creation prompt is taken into account.\n * All actions are performed directly without confirmation.\n */\nexport async function main() {\n let args: string[];\n if (typeof Bun !== \"undefined\") {\n args = Bun.argv.slice(2);\n } else if (typeof process !== \"undefined\" && process.argv) {\n args = process.argv.slice(2);\n } else {\n args = [];\n }\n\n if (args.includes(\"--help\")) return showHelp();\n if (args.includes(\"--version\") || args.includes(\"-v\")) return showVersion();\n if (args.includes(\"--reconfigure\") || !readCfg()) {\n await onboarding();\n return;\n }\n\n const force = args.includes(\"--force\");\n // For now, --force is always considered enabled but do not overwrite existing projects\n // WARNING: if you enable --force it will overwrite existing projects. This is a temporary setting for development purposes.\n // const force = true;\n\n // If addpage is called without options, add default flags -LPl\n if (args[0] === \"addpage\" && args.length === 1) {\n args.push(\"-LPl\");\n }\n\n /**\n * Handle addcomponent command: create a component in the correct location and update translation JSON.\n */\n if (args[0] === \"addcomponent\") {\n addComponent(args);\n return;\n }\n\n /**\n * Handle addpage command: create a page (nested or not) and update translation JSON.\n */\n if (args[0] === \"addpage\") {\n addPage(args);\n return;\n }\n\n /**\n * Handle rmpage command: remove a page and all related files/folders.\n */\n if (args[0] === \"rmpage\") {\n rmPage(args);\n return;\n }\n\n /**\n * Handle direct project creation if a name argument is provided.\n */\n const nameArg = args.find((arg) => !arg.startsWith(\"--\"));\n\n if (nameArg) {\n createProject(nameArg, force);\n return;\n }\n\n /**\n * Interactive prompt for project creation (not currently used, see note above).\n */\n await createProjectWithPrompt();\n}\n","import { join } from \"node:path\";\nimport { mkdir, readFile, writeFile, readdir } from \"node:fs/promises\";\nimport prompts from \"prompts\";\n\nimport { capitalize, loadConfig } from \"./utils\";\n\nimport { existsSync, statSync } from \"node:fs\";\n\nexport async function addComponent(args: string[]) {\n let componentName = args[1];\n let pageScope = null;\n let pageIndex = args.findIndex((arg) => arg === \"-P\" || arg === \"--page\");\n if (pageIndex !== -1 && args[pageIndex + 1]) {\n pageScope = args[pageIndex + 1];\n }\n\n // Handle nested pageScope (e.g. ParentPage.ChildPage)\n let nestedPath = null;\n if (pageScope && pageScope.includes(\".\")) {\n nestedPath = join(...pageScope.split(\".\"));\n }\n\n if (!componentName || componentName.startsWith(\"-\")) {\n // Si le nom n'est pas fourni ou est une option, demander via prompt\n const response = await prompts.prompt({\n type: \"text\",\n name: \"componentName\",\n message: \"🧩 Component name to add:\",\n validate: (name: string) => (name ? true : \"Component name is required\"),\n });\n componentName = response.componentName;\n }\n\n const config = await loadConfig();\n if (!config) {\n console.error(\n \"❌ Configuration file cnp.config.json not found. Run this command from the project root.\"\n );\n return;\n }\n const useI18n = !!config.useI18n;\n\n const componentNameUpper = capitalize(componentName);\n const templatePath = join(\n import.meta.dir,\n \"..\",\n \"..\",\n \"templates\",\n \"Component\"\n );\n let messagesPath: string | null = null;\n if (useI18n) {\n messagesPath = join(process.cwd(), \"messages\");\n if (!existsSync(messagesPath)) {\n console.error(\"❌ Messages directory missing. Ensure i18n was configured.\");\n return;\n }\n }\n\n // Determine target path for the component\n let componentTargetPath;\n let translationKey;\n if (pageScope) {\n if (nestedPath) {\n componentTargetPath = join(process.cwd(), \"src\", \"ui\", nestedPath);\n translationKey = pageScope;\n } else {\n componentTargetPath = join(process.cwd(), \"src\", \"ui\", pageScope);\n translationKey = pageScope;\n }\n } else {\n componentTargetPath = join(process.cwd(), \"src\", \"ui\", \"_global\");\n translationKey = \"_global_ui\";\n }\n if (!existsSync(componentTargetPath)) {\n await mkdir(componentTargetPath, { recursive: true });\n }\n const componentFile = join(componentTargetPath, `${componentNameUpper}.tsx`);\n\n // Read and adapt the TSX template\n const templateComponentPath = join(templatePath, \"Component.tsx\");\n if (existsSync(templateComponentPath)) {\n let content = await readFile(templateComponentPath, \"utf-8\");\n // Remplacement du nom du component et de la clé de traduction\n content = content\n .replace(/Component/g, componentNameUpper)\n .replace(/componentPage/g, translationKey);\n await writeFile(componentFile, content);\n console.log(`📄 File created: ${componentFile}`);\n } else {\n console.error(\n \"❌ Template Component.tsx introuvable :\",\n templateComponentPath\n );\n }\n\n\n if (useI18n && messagesPath) {\n const entries = await readdir(messagesPath, { withFileTypes: true });\n const langDirs = entries.filter((e) => e.isDirectory()).map((e) => e.name);\n const jsonTemplate = join(templatePath, \"component.json\");\n if (!existsSync(jsonTemplate)) {\n console.error(\"❌ Template component.json not found:\", jsonTemplate);\n return;\n\n }\n const jsonContent = await readFile(jsonTemplate, \"utf-8\");\n const parsed = JSON.parse(jsonContent);\n\n for (const locale of langDirs) {\n // Only process if messages/<locale> is a directory\n const localeDir = join(messagesPath, locale);\n if (!existsSync(localeDir) || !statSync(localeDir).isDirectory())\n continue;\n let jsonTarget;\n if (pageScope) {\n jsonTarget = join(messagesPath, locale, `${pageScope}.json`);\n } else {\n jsonTarget = join(messagesPath, locale, `_global_ui.json`);\n }\n\n let current: Record<string, any> = {};\n if (existsSync(jsonTarget)) {\n const jsonFile = await readFile(jsonTarget, \"utf-8\");\n current = JSON.parse(jsonFile) as Record<string, any>;\n }\n current[componentNameUpper] = parsed;\n await writeFile(jsonTarget, JSON.stringify(current, null, 2));\n }\n } else {\n console.log(\"ℹ️ Skipping translation entries; next-intl not enabled.\");\n }\n\n console.log(\n `✅ Component \"${componentNameUpper}\" added ${\n pageScope ? `to page ${pageScope}` : \"globally\"\n }${useI18n ? \" with localized messages\" : \"\"}.`\n );\n}\n","import { readFile } from \"node:fs/promises\";\nimport { existsSync } from \"node:fs\";\nimport { join } from \"node:path\";\n\n/**\n * Capitalize the first letter of a string.\n */\nexport function capitalize(str: string): string {\n return str.charAt(0).toUpperCase() + str.slice(1);\n}\n\nexport interface CNPConfig {\n useI18n?: boolean;\n [key: string]: any;\n}\n\n/**\n * Load CLI configuration from the project root.\n * Returns null if the configuration file is missing or invalid.\n */\nexport async function loadConfig(): Promise<CNPConfig | null> {\n const configPath = join(process.cwd(), \"cnp.config.json\");\n if (!existsSync(configPath)) return null;\n try {\n const raw = await readFile(configPath, \"utf-8\");\n return JSON.parse(raw) as CNPConfig;\n } catch {\n return null;\n }\n}\n\n/**\n * Map a key to its corresponding file name for page/component templates.\n * @param key string\n * @returns file name string\n */\nexport function toFileName(key: string): string {\n switch (key) {\n case \"layout\":\n return \"layout.tsx\";\n case \"page\":\n return \"page.tsx\";\n case \"loading\":\n return \"loading.tsx\";\n case \"not-found\":\n return \"not-found.tsx\";\n case \"error\":\n return \"error.tsx\";\n case \"global-error\":\n return \"global-error.tsx\";\n case \"route\":\n return \"route.ts\";\n case \"template\":\n return \"template.tsx\";\n case \"default\":\n return \"default.tsx\";\n default:\n return `${key}.tsx`;\n }\n}\n","import { join } from \"node:path\";\nimport { mkdir, readFile, writeFile, readdir } from \"node:fs/promises\";\nimport prompts from \"prompts\";\n\nimport { capitalize, toFileName, loadConfig } from \"./utils\";\n\nimport { existsSync, statSync } from \"node:fs\";\n\nexport async function addPage(args: string[]) {\n let pageName = args[1];\n if (!pageName || pageName.startsWith(\"-\")) {\n const response = await prompts.prompt({\n type: \"text\",\n name: \"pageName\",\n message: \"📝 Page name to add:\",\n validate: (name: string) => (name ? true : \"Page name is required\"),\n });\n pageName = response.pageName;\n }\n\n // Handle nested pages\n let parentName = null;\n let childName = null;\n if (pageName.includes(\".\")) {\n [parentName, childName] = pageName.split(\".\");\n }\n\n let shortFlags = args.find((arg) => /^-[A-Za-z]+$/.test(arg));\n let longFlags = new Set(args.filter((a) => a.startsWith(\"--\")));\n const flags = new Set<string>();\n\n if (!shortFlags && Array.from(longFlags).length === 0) {\n shortFlags = \"-LPl\";\n }\n\n if (shortFlags) {\n for (const char of shortFlags.slice(1)) {\n switch (char) {\n case \"L\":\n flags.add(\"layout\");\n break;\n case \"P\":\n flags.add(\"page\");\n break;\n case \"l\":\n flags.add(\"loading\");\n break;\n case \"n\":\n flags.add(\"not-found\");\n break;\n case \"e\":\n flags.add(\"error\");\n break;\n case \"g\":\n flags.add(\"global-error\");\n break;\n case \"r\":\n flags.add(\"route\");\n break;\n case \"t\":\n flags.add(\"template\");\n break;\n case \"d\":\n flags.add(\"default\");\n break;\n }\n }\n }\n\n for (const flag of [\n \"layout\",\n \"page\",\n \"loading\",\n \"not-found\",\n \"error\",\n \"global-error\",\n \"route\",\n \"template\",\n \"default\",\n ]) {\n if (longFlags.has(\"--\" + flag)) flags.add(flag);\n }\n\n const config = await loadConfig();\n if (!config) {\n console.error(\"❌ Configuration file cnp.config.json not found. Run this command from the project root.\");\n return;\n }\n const useI18n = !!config.useI18n;\n\n const srcSegments = [\"src\", \"app\"];\n if (useI18n) srcSegments.push(\"[locale]\");\n const srcPath = join(process.cwd(), ...srcSegments);\n if (!existsSync(srcPath)) {\n console.error(`❌ Expected directory not found: ${srcPath}`);\n return;\n }\n\n let messagesPath: string | null = null;\n let locales: string[] = [];\n if (useI18n) {\n messagesPath = join(process.cwd(), \"messages\");\n if (!existsSync(messagesPath)) {\n console.error(\"❌ Messages directory missing. Ensure i18n was configured.\");\n return;\n }\n const entries = await readdir(messagesPath, { withFileTypes: true });\n locales = entries.filter((e) => e.isDirectory()).map((e) => e.name);\n }\n\n const templatePath = join(import.meta.dir, \"..\", \"..\", \"templates\", \"Page\");\n\n // Create folders/files for nested or simple page\n let uiPageDir, localePagePath, jsonFileName;\n if (parentName && childName) {\n uiPageDir = join(process.cwd(), \"src\", \"ui\", parentName, childName);\n localePagePath = join(srcPath, parentName, childName);\n jsonFileName = parentName;\n } else {\n uiPageDir = join(process.cwd(), \"src\", \"ui\", pageName);\n localePagePath = join(srcPath, pageName);\n jsonFileName = pageName;\n }\n if (!existsSync(uiPageDir)) {\n await mkdir(uiPageDir, { recursive: true });\n }\n const uiPageFile = join(uiPageDir, \"page-ui.tsx\");\n const uiPageTemplate = join(templatePath, \"page-ui.tsx\");\n if (existsSync(uiPageTemplate)) {\n let uiContent = await readFile(uiPageTemplate, \"utf-8\");\n uiContent = uiContent\n .replace(/template/g, childName || pageName)\n .replace(/Template/g, capitalize(childName || pageName));\n await writeFile(uiPageFile, uiContent);\n console.log(`📄 File created: ${uiPageFile}`);\n } else {\n console.warn(\"⚠️ Template page-ui.tsx manquant.\");\n }\n if (!existsSync(localePagePath)) {\n await mkdir(localePagePath, { recursive: true });\n }\n for (const flag of flags) {\n const filename = toFileName(flag);\n const src = join(templatePath, filename);\n const dst = join(localePagePath, filename);\n if (!existsSync(src)) {\n console.warn(`⚠️ Missing template file: ${filename}`);\n continue;\n }\n const content = await readFile(src, \"utf-8\");\n const replaced = content\n .replace(/template/g, childName || pageName)\n .replace(/Template/g, capitalize(childName || pageName));\n await writeFile(dst, replaced);\n console.log(`📄 File created: ${dst}`);\n }\n\n if (useI18n && messagesPath) {\n const jsonTemplate = join(templatePath, \"page.json\");\n if (!existsSync(jsonTemplate)) {\n console.warn(\"⚠️ Missing template page.json.\");\n\n } else {\n const content = await readFile(jsonTemplate, \"utf-8\");\n const replaced = content\n .replace(/template/g, childName || pageName)\n .replace(/Template/g, capitalize(childName || pageName));\n for (const locale of locales) {\n // Only process if messages/<locale> is a directory\n const localeDir = join(messagesPath, locale);\n if (!existsSync(localeDir) || !statSync(localeDir).isDirectory())\n continue;\n const jsonTarget = join(messagesPath, locale, `${jsonFileName}.json`);\n let current: Record<string, any> = {};\n if (existsSync(jsonTarget)) {\n const jsonFile = await readFile(jsonTarget, \"utf-8\");\n try {\n current = JSON.parse(jsonFile) as Record<string, any>;\n } catch {\n current = {};\n }\n }\n if (parentName && childName) {\n current[childName] = JSON.parse(replaced);\n } else {\n // fichier simple\n current = JSON.parse(replaced);\n }\n await writeFile(jsonTarget, JSON.stringify(current, null, 2));\n }\n }\n } else {\n console.log(\"ℹ️ Skipping translation templates; next-intl not enabled.\");\n }\n\n console.log(\n `✅ Page \"${pageName}\" with templates added${\n useI18n ? \" for each locale\" : \"\"\n }.`\n );\n}\n","import { join } from \"node:path\";\nimport { writeFile, readdir } from \"node:fs/promises\";\nimport prompts from \"prompts\";\nimport { existsSync } from \"node:fs\";\n\nexport async function rmPage(args: string[]) {\n let pageName = args[1];\n if (!pageName || pageName.startsWith(\"-\")) {\n const response = await prompts.prompt({\n type: \"text\",\n name: \"pageName\",\n message: \"🗑️ Page name to remove:\",\n validate: (name: string) => (name ? true : \"Page name is required\"),\n });\n pageName = response.pageName;\n }\n\n // Remove translation files messages/<lang>/<PageName>.json\n const messagesPath = join(process.cwd(), \"messages\");\n const entries = await readdir(messagesPath, { withFileTypes: true });\n const langDirs = entries.filter((e) => e.isDirectory()).map((e) => e.name);\n for (const locale of langDirs) {\n const jsonTarget = join(messagesPath, locale, `${pageName}.json`);\n if (existsSync(jsonTarget)) {\n await writeFile(jsonTarget, \"\");\n await import(\"node:child_process\").then((cp) =>\n cp.execSync(`rm -f '${jsonTarget}'`)\n );\n console.log(`🗑️ Deleted: ${jsonTarget}`);\n }\n }\n\n // Remove folder src/ui/<PageName>\n const uiPageDir = join(process.cwd(), \"src\", \"ui\", pageName);\n if (existsSync(uiPageDir)) {\n await import(\"node:child_process\").then((cp) =>\n cp.execSync(`rm -rf '${uiPageDir}'`)\n );\n console.log(`🗑️ Deleted: ${uiPageDir}`);\n }\n\n // Remove folder src/app/[locale]/<PageName>\n const appLocaleDir = join(process.cwd(), \"src\", \"app\", \"[locale]\", pageName);\n if (existsSync(appLocaleDir)) {\n await import(\"node:child_process\").then((cp) =>\n cp.execSync(`rm -rf '${appLocaleDir}'`)\n );\n console.log(`🗑️ Deleted: ${appLocaleDir}`);\n }\n\n console.log(`✅ Page \"${pageName}\" deleted.`);\n}\n","// src/scaffold.ts\n\nimport { cp, mkdir, rm, writeFile, readFile } from \"node:fs/promises\";\nimport { join } from \"node:path\";\nimport { existsSync } from \"node:fs\";\nimport { fileURLToPath } from \"node:url\";\n\nconst RED = \"\\x1b[31m\";\nconst RESET = \"\\x1b[0m\";\n\n/**\n * Options for scaffolding a Next.js project.\n */\ninterface ScaffoldOptions {\n projectName: string;\n useTypescript: boolean;\n useEslint: boolean;\n useTailwind: boolean;\n useSrcDir: boolean;\n useTurbopack: boolean;\n useI18n: boolean;\n customAlias: boolean;\n importAlias: string;\n force?: boolean;\n}\n\n/**\n * Scaffold a new Next.js project based on provided options.\n *\n * - Copies the default template to the target directory\n * - Removes the target directory if it exists and --force is set\n * - Optionally customizes the structure in future (e.g. remove unused files)\n *\n * @param options ScaffoldOptions for the project\n */\nexport async function scaffoldProject(options: ScaffoldOptions) {\n const targetPath = join(process.cwd(), options.projectName);\n\n const __dirname = new URL(\".\", import.meta.url); // or :\n // const __dirname = path.dirname(fileURLToPath(import.meta.url));\n const templatePath = join(\n fileURLToPath(__dirname),\n \"..\",\n \"templates\",\n \"Projects\",\n \"default\",\n );\n\n // Check if target directory exists\n if (existsSync(targetPath)) {\n if (options.force) {\n console.warn(\"⚠️ Target directory already exists, removing...\");\n await rm(targetPath, { recursive: true, force: true });\n } else {\n console.error(\n `${RED}[X] Target directory already exists. Use --force to overwrite.${RESET}`,\n );\n process.exit(1);\n }\n }\n\n try {\n console.log(\"Creating project directory...\");\n await mkdir(targetPath, { recursive: true });\n\n console.log(\"Copying files from template...\");\n await cp(templatePath, targetPath, { recursive: true });\n\n // Apply configuration: add dependencies or files based on prompt choices\n const pkgPath = join(targetPath, \"package.json\");\n if (existsSync(pkgPath)) {\n const pkg = JSON.parse(await readFile(pkgPath, \"utf-8\"));\n pkg.dependencies = pkg.dependencies || {};\n if (options.useI18n) {\n pkg.dependencies[\"next-intl\"] =\n pkg.dependencies[\"next-intl\"] || \"^4.3.5\";\n }\n await writeFile(pkgPath, JSON.stringify(pkg, null, 2));\n }\n\n // Write CLI configuration to project root\n await writeFile(\n join(targetPath, \"cnp.config.json\"),\n JSON.stringify(options, null, 2),\n );\n\n console.log(\"Project setup complete.\");\n console.log(\"\");\n console.log(\"To get started:\");\n console.log(` cd ${options.projectName}`);\n console.log(\"\");\n console.log(\n \"Then install dependencies and launch the dev server with your preferred tool:\",\n );\n\n console.log(\" bun install && bun dev\");\n console.log(\" npm install && npm run dev\");\n console.log(\" pnpm install && pnpm run dev\");\n console.log(\"\");\n console.log(\"Documentation and examples can be found at:\");\n console.log(\"https://github.com/Rising-Corporation/create-next-pro-cli\");\n } catch (err) {\n // Affiche une croix ASCII et le texte en rouge si le terminal le supporte\n\n console.error(`${RED}[X] Error during project creation:${RESET}`, err);\n process.exit(1);\n }\n}\n","import { scaffoldProject } from \"../scaffold\";\nexport async function createProject(nameArg: string, force: boolean) {\n const response = {\n projectName: nameArg,\n useTypescript: true,\n useEslint: true,\n useTailwind: true,\n useSrcDir: true,\n useTurbopack: true,\n useI18n: true,\n customAlias: true,\n importAlias: \"@/*\",\n force,\n };\n\n console.log(`Creating project \"${response.projectName}\"...`);\n await scaffoldProject(response);\n}\n","import { scaffoldProject } from \"../scaffold\";\nimport prompts from \"prompts\";\nexport async function createProjectWithPrompt() {\n const response = await prompts.prompt([\n {\n type: \"text\",\n name: \"projectName\",\n message: \"Project name:\",\n initial: \"my-next-app\",\n },\n {\n type: \"toggle\",\n name: \"useTypescript\",\n message: \"✔ Use TypeScript?\",\n initial: true,\n active: \"Yes\",\n inactive: \"No\",\n },\n {\n type: \"toggle\",\n name: \"useEslint\",\n message: \"✔ Use ESLint?\",\n initial: true,\n active: \"Yes\",\n inactive: \"No\",\n },\n {\n type: \"toggle\",\n name: \"useTailwind\",\n message: \"✔ Use Tailwind CSS?\",\n initial: true,\n active: \"Yes\",\n inactive: \"No\",\n },\n {\n type: \"toggle\",\n name: \"useSrcDir\",\n message: \"✔ Use `src/` directory?\",\n initial: true,\n active: \"Yes\",\n inactive: \"No\",\n },\n {\n type: \"toggle\",\n name: \"useTurbopack\",\n message: \"✔ Use Turbopack for `next dev`?\",\n initial: true,\n active: \"Yes\",\n inactive: \"No\",\n },\n {\n type: \"toggle\",\n name: \"useI18n\",\n message: \"✔ Use i18n with next-intl for translations?\",\n initial: true,\n active: \"Yes\",\n inactive: \"No\",\n },\n {\n type: \"toggle\",\n name: \"customAlias\",\n message: \"✔ Customize import alias (`@/*` by default)?\",\n initial: true,\n active: \"Yes\",\n inactive: \"No\",\n },\n {\n type: (prev: boolean) => (prev ? \"text\" : null),\n name: \"importAlias\",\n message: \"✔ What import alias would you like?\",\n initial: \"@core/*\",\n },\n ]);\n\n console.log(\"\\nYour choices:\");\n console.log(response);\n\n await scaffoldProject(response);\n}\n","#!/usr/bin/env node\nimport { main } from \"./src/index\";\nmain();\n"],"mappings":";;;AAEA,OAAO,QAAQ;AACf,OAAO,QAAQ;AACf,OAAO,UAAU;AACjB,OAAOA,cAAa;AACpB,SAAS,iBAAAC,sBAAqB;AAC9B,SAAS,SAAS,eAAe;;;ACPjC,SAAS,QAAAC,aAAY;AACrB,SAAS,OAAO,YAAAC,WAAU,WAAW,eAAe;AACpD,OAAO,aAAa;;;ACFpB,SAAS,gBAAgB;AACzB,SAAS,kBAAkB;AAC3B,SAAS,YAAY;AAKd,SAAS,WAAW,KAAqB;AAC9C,SAAO,IAAI,OAAO,CAAC,EAAE,YAAY,IAAI,IAAI,MAAM,CAAC;AAClD;AAWA,eAAsB,aAAwC;AAC5D,QAAM,aAAa,KAAK,QAAQ,IAAI,GAAG,iBAAiB;AACxD,MAAI,CAAC,WAAW,UAAU,EAAG,QAAO;AACpC,MAAI;AACF,UAAM,MAAM,MAAM,SAAS,YAAY,OAAO;AAC9C,WAAO,KAAK,MAAM,GAAG;AAAA,EACvB,QAAQ;AACN,WAAO;AAAA,EACT;AACF;AAOO,SAAS,WAAW,KAAqB;AAC9C,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AACjB;AAAA,EACF;AAKA,MAAI,KAAK,CAAC,MAAM,WAAW;AACzB,YAAQ,IAAI;AACZ;AAAA,EACF;AAKA,MAAI,KAAK,CAAC,MAAM,UAAU;AACxB,WAAO,IAAI;AACX;AAAA,EACF;AAKA,QAAM,UAAU,KAAK,KAAK,CAAC,QAAQ,CAAC,IAAI,WAAW,IAAI,CAAC;AAExD,MAAI,SAAS;AACX,kBAAc,SAAS,KAAK;AAC5B;AAAA,EACF;AAKA,QAAM,wBAAwB;AAChC;;;AQzMA,KAAK;","names":["prompts","fileURLToPath","join","readFile","existsSync","join","readFile","join","mkdir","readFile","writeFile","readdir","prompts","existsSync","statSync","prompts","join","readdir","mkdir","readFile","writeFile","join","writeFile","readdir","prompts","existsSync","cp","mkdir","writeFile","readFile","join","existsSync","__dirname","prompts","__dirname","fileURLToPath","prompts"]}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/lib/addComponent.ts","../src/lib/utils.ts","../src/lib/addPage.ts","../src/lib/rmPage.ts","../src/lib/addLib.ts","../src/lib/addApi.ts","../src/scaffold.ts","../src/lib/createProject.ts","../src/lib/createProjectWithPrompt.ts","../bin.node.ts"],"sourcesContent":["// src/index.ts\n\nimport fs from \"node:fs\";\nimport os from \"node:os\";\nimport path from \"node:path\";\nimport prompts from \"prompts\";\nimport { fileURLToPath } from \"node:url\";\nimport { dirname, resolve } from \"node:path\";\n\nimport { addComponent } from \"./lib/addComponent\";\nimport { addPage } from \"./lib/addPage\";\nimport { rmPage } from \"./lib/rmPage\";\nimport { addLib } from \"./lib/addLib\";\nimport { addApi } from \"./lib/addApi\";\nimport { createProject } from \"./lib/createProject\";\nimport { createProjectWithPrompt } from \"./lib/createProjectWithPrompt\";\n\ntype Cfg = {\n version: 1;\n shell: \"bash\" | \"zsh\";\n completionInstalled: boolean;\n createdAt: string;\n updatedAt: string;\n};\n\nconst CONFIG_DIR = process.env.XDG_CONFIG_HOME\n ? path.join(process.env.XDG_CONFIG_HOME, \"create-next-pro\")\n : path.join(os.homedir(), \".config\", \"create-next-pro\");\nconst CONFIG_FILE = path.join(CONFIG_DIR, \"config.json\");\n\nfunction readCfg(): Cfg | null {\n try {\n return JSON.parse(fs.readFileSync(CONFIG_FILE, \"utf8\")) as Cfg;\n } catch {\n return null;\n }\n}\nfunction writeCfg(cfg: Cfg) {\n fs.mkdirSync(CONFIG_DIR, { recursive: true });\n fs.writeFileSync(CONFIG_FILE, JSON.stringify(cfg, null, 2));\n}\nfunction rcFile(shell: \"bash\" | \"zsh\") {\n return path.join(os.homedir(), shell === \"zsh\" ? \".zshrc\" : \".bashrc\");\n}\nfunction ensureLineInRc(file: string, line: string) {\n try {\n const cur = fs.existsSync(file) ? fs.readFileSync(file, \"utf8\") : \"\";\n if (!cur.includes(line)) fs.appendFileSync(file, `\\n${line}\\n`);\n } catch {\n /* ignore */\n }\n}\nasync function installCompletion(shell: \"bash\" | \"zsh\") {\n // Lit le script d’auto-complétion depuis le package (racine du package)\n const __dirname = path.dirname(fileURLToPath(import.meta.url));\n const completionSrc = path.resolve(\n __dirname,\n \"../create-next-pro-completion.sh\",\n );\n const completionDst = path.join(CONFIG_DIR, \"completion.sh\");\n fs.mkdirSync(CONFIG_DIR, { recursive: true });\n fs.copyFileSync(completionSrc, completionDst);\n ensureLineInRc(rcFile(shell), `source \"${completionDst}\"`);\n}\n\nconst __filename = fileURLToPath(import.meta.url);\nconst __dirname = dirname(__filename);\nconst packageJsonPath = resolve(__dirname, \"../package.json\");\nconst packageJson = fs.readFileSync(packageJsonPath, \"utf8\");\n\nasync function onboarding(): Promise<Cfg> {\n const pkg = JSON.parse(packageJson);\n console.log(`🚀 Welcome to create-next-pro v${pkg.version}\\n`);\n const res = await prompts(\n [\n {\n type: \"select\",\n name: \"shell\",\n message: \"Which shell do you use?\",\n choices: [\n { title: \"zsh\", value: \"zsh\" },\n { title: \"bash\", value: \"bash\" },\n ],\n initial: (os.userInfo().shell || \"\").includes(\"zsh\") ? 0 : 1,\n },\n {\n type: \"toggle\",\n name: \"completion\",\n message: \"Install autocompletion?\",\n initial: true,\n active: \"Yes\",\n inactive: \"No\",\n },\n ],\n { onCancel: () => process.exit(1) },\n );\n\n const cfg: Cfg = {\n version: 1,\n shell: res.shell,\n completionInstalled: !!res.completion,\n createdAt: new Date().toISOString(),\n updatedAt: new Date().toISOString(),\n };\n if (cfg.completionInstalled) await installCompletion(cfg.shell);\n writeCfg(cfg);\n console.log(\"\\n✅ Configuration saved.\");\n console.log(\"you can now use the CLI ! ex : create-next-pro <project-name>\");\n console.log(\n \"For more information, visit: https://github.com/Rising-Corporation/create-next-pro-cli\",\n );\n console.log(\"Happy coding! 🎉\");\n return cfg;\n}\nfunction showHelp() {\n console.log(`create-next-pro\n\nUsage:\n create-next-pro <project-name> [--force]\n create-next-pro addpage [options]\n create-next-pro addcomponent [options]\n create-next-pro addlib [name]\n create-next-pro addapi [name]\n create-next-pro rmpage [options]\n\nOptions:\n --help Show this help message\n --reconfigure Run the configuration assistant again\n`);\n}\n\nfunction showVersion() {\n const pkg = JSON.parse(packageJson);\n console.log(`v${pkg.version}`);\n}\n\n/**\n * Main CLI entry point for create-next-pro.\n *\n * Note: For now, the project behaves as if --force is always enabled and no creation prompt is taken into account.\n * All actions are performed directly without confirmation.\n */\nexport async function main() {\n let args: string[];\n if (typeof Bun !== \"undefined\") {\n args = Bun.argv.slice(2);\n } else if (typeof process !== \"undefined\" && process.argv) {\n args = process.argv.slice(2);\n } else {\n args = [];\n }\n\n if (args.includes(\"--help\")) return showHelp();\n if (args.includes(\"--version\") || args.includes(\"-v\")) return showVersion();\n if (args.includes(\"--reconfigure\") || !readCfg()) {\n await onboarding();\n return;\n }\n\n const force = args.includes(\"--force\");\n // For now, --force is always considered enabled but do not overwrite existing projects\n // WARNING: if you enable --force it will overwrite existing projects. This is a temporary setting for development purposes.\n // const force = true;\n\n // If addpage is called without options, add default flags -LPl\n if (args[0] === \"addpage\" && args.length === 1) {\n args.push(\"-LPl\");\n }\n\n /**\n * Handle addcomponent command: create a component in the correct location and update translation JSON.\n */\n if (args[0] === \"addcomponent\") {\n addComponent(args);\n return;\n }\n\n /**\n * Handle addpage command: create a page (nested or not) and update translation JSON.\n */\n if (args[0] === \"addpage\") {\n addPage(args);\n return;\n }\n\n /**\n * Handle addlib command: scaffold a library folder and files.\n */\n if (args[0] === \"addlib\") {\n addLib(args);\n return;\n }\n\n /**\n * Handle addapi command: scaffold an API route.\n */\n if (args[0] === \"addapi\") {\n addApi(args);\n return;\n }\n\n /**\n * Handle rmpage command: remove a page and all related files/folders.\n */\n if (args[0] === \"rmpage\") {\n rmPage(args);\n return;\n }\n\n /**\n * Handle direct project creation if a name argument is provided.\n */\n const nameArg = args.find((arg) => !arg.startsWith(\"--\"));\n\n if (nameArg) {\n createProject(nameArg, force);\n return;\n }\n\n /**\n * Interactive prompt for project creation (not currently used, see note above).\n */\n await createProjectWithPrompt();\n}\n","import { join } from \"node:path\";\nimport { mkdir, readFile, writeFile, readdir } from \"node:fs/promises\";\nimport prompts from \"prompts\";\n\nimport { capitalize, loadConfig } from \"./utils\";\n\nimport { existsSync, statSync } from \"node:fs\";\n\nexport async function addComponent(args: string[]) {\n let componentName = args[1];\n let pageScope = null;\n let pageIndex = args.findIndex((arg) => arg === \"-P\" || arg === \"--page\");\n if (pageIndex !== -1 && args[pageIndex + 1]) {\n pageScope = args[pageIndex + 1];\n }\n\n // Handle nested pageScope (e.g. ParentPage.ChildPage)\n let nestedPath = null;\n if (pageScope && pageScope.includes(\".\")) {\n nestedPath = join(...pageScope.split(\".\"));\n }\n\n if (!componentName || componentName.startsWith(\"-\")) {\n // Si le nom n'est pas fourni ou est une option, demander via prompt\n const response = await prompts.prompt({\n type: \"text\",\n name: \"componentName\",\n message: \"🧩 Component name to add:\",\n validate: (name: string) => (name ? true : \"Component name is required\"),\n });\n componentName = response.componentName;\n }\n\n const config = await loadConfig();\n if (!config) {\n console.error(\n \"❌ Configuration file cnp.config.json not found. Run this command from the project root.\"\n );\n return;\n }\n const useI18n = !!config.useI18n;\n\n const componentNameUpper = capitalize(componentName);\n const templatePath = join(\n import.meta.dir,\n \"..\",\n \"..\",\n \"templates\",\n \"Component\"\n );\n let messagesPath: string | null = null;\n if (useI18n) {\n messagesPath = join(process.cwd(), \"messages\");\n if (!existsSync(messagesPath)) {\n console.error(\"❌ Messages directory missing. Ensure i18n was configured.\");\n return;\n }\n }\n\n // Determine target path for the component\n let componentTargetPath;\n let translationKey;\n if (pageScope) {\n if (nestedPath) {\n componentTargetPath = join(process.cwd(), \"src\", \"ui\", nestedPath);\n translationKey = pageScope;\n } else {\n componentTargetPath = join(process.cwd(), \"src\", \"ui\", pageScope);\n translationKey = pageScope;\n }\n } else {\n componentTargetPath = join(process.cwd(), \"src\", \"ui\", \"_global\");\n translationKey = \"_global_ui\";\n }\n if (!existsSync(componentTargetPath)) {\n await mkdir(componentTargetPath, { recursive: true });\n }\n const componentFile = join(componentTargetPath, `${componentNameUpper}.tsx`);\n\n // Read and adapt the TSX template\n const templateComponentPath = join(templatePath, \"Component.tsx\");\n if (existsSync(templateComponentPath)) {\n let content = await readFile(templateComponentPath, \"utf-8\");\n // Remplacement du nom du component et de la clé de traduction\n content = content\n .replace(/Component/g, componentNameUpper)\n .replace(/componentPage/g, translationKey);\n await writeFile(componentFile, content);\n console.log(`📄 File created: ${componentFile}`);\n } else {\n console.error(\n \"❌ Template Component.tsx introuvable :\",\n templateComponentPath\n );\n }\n\n\n if (useI18n && messagesPath) {\n const entries = await readdir(messagesPath, { withFileTypes: true });\n const langDirs = entries.filter((e) => e.isDirectory()).map((e) => e.name);\n const jsonTemplate = join(templatePath, \"component.json\");\n if (!existsSync(jsonTemplate)) {\n console.error(\"❌ Template component.json not found:\", jsonTemplate);\n return;\n\n }\n const jsonContent = await readFile(jsonTemplate, \"utf-8\");\n const parsed = JSON.parse(jsonContent);\n\n for (const locale of langDirs) {\n // Only process if messages/<locale> is a directory\n const localeDir = join(messagesPath, locale);\n if (!existsSync(localeDir) || !statSync(localeDir).isDirectory())\n continue;\n let jsonTarget;\n if (pageScope) {\n jsonTarget = join(messagesPath, locale, `${pageScope}.json`);\n } else {\n jsonTarget = join(messagesPath, locale, `_global_ui.json`);\n }\n\n let current: Record<string, any> = {};\n if (existsSync(jsonTarget)) {\n const jsonFile = await readFile(jsonTarget, \"utf-8\");\n current = JSON.parse(jsonFile) as Record<string, any>;\n }\n current[componentNameUpper] = parsed;\n await writeFile(jsonTarget, JSON.stringify(current, null, 2));\n }\n } else {\n console.log(\"ℹ️ Skipping translation entries; next-intl not enabled.\");\n }\n\n console.log(\n `✅ Component \"${componentNameUpper}\" added ${\n pageScope ? `to page ${pageScope}` : \"globally\"\n }${useI18n ? \" with localized messages\" : \"\"}.`\n );\n}\n","import { readFile } from \"node:fs/promises\";\nimport { existsSync } from \"node:fs\";\nimport { join } from \"node:path\";\n\n/**\n * Capitalize the first letter of a string.\n */\nexport function capitalize(str: string): string {\n return str.charAt(0).toUpperCase() + str.slice(1);\n}\n\nexport interface CNPConfig {\n useI18n?: boolean;\n [key: string]: any;\n}\n\n/**\n * Load CLI configuration from the project root.\n * Returns null if the configuration file is missing or invalid.\n */\nexport async function loadConfig(): Promise<CNPConfig | null> {\n const configPath = join(process.cwd(), \"cnp.config.json\");\n if (!existsSync(configPath)) return null;\n try {\n const raw = await readFile(configPath, \"utf-8\");\n return JSON.parse(raw) as CNPConfig;\n } catch {\n return null;\n }\n}\n\n/**\n * Map a key to its corresponding file name for page/component templates.\n * @param key string\n * @returns file name string\n */\nexport function toFileName(key: string): string {\n switch (key) {\n case \"layout\":\n return \"layout.tsx\";\n case \"page\":\n return \"page.tsx\";\n case \"loading\":\n return \"loading.tsx\";\n case \"not-found\":\n return \"not-found.tsx\";\n case \"error\":\n return \"error.tsx\";\n case \"global-error\":\n return \"global-error.tsx\";\n case \"route\":\n return \"route.ts\";\n case \"template\":\n return \"template.tsx\";\n case \"default\":\n return \"default.tsx\";\n default:\n return `${key}.tsx`;\n }\n}\n","import { join } from \"node:path\";\nimport { mkdir, readFile, writeFile, readdir } from \"node:fs/promises\";\nimport prompts from \"prompts\";\n\nimport { capitalize, toFileName, loadConfig } from \"./utils\";\n\nimport { existsSync, statSync } from \"node:fs\";\n\nexport async function addPage(args: string[]) {\n let pageName = args[1];\n if (!pageName || pageName.startsWith(\"-\")) {\n const response = await prompts.prompt({\n type: \"text\",\n name: \"pageName\",\n message: \"📝 Page name to add:\",\n validate: (name: string) => (name ? true : \"Page name is required\"),\n });\n pageName = response.pageName;\n }\n\n // Handle nested pages\n let parentName = null;\n let childName = null;\n if (pageName.includes(\".\")) {\n [parentName, childName] = pageName.split(\".\");\n }\n\n let shortFlags = args.find((arg) => /^-[A-Za-z]+$/.test(arg));\n let longFlags = new Set(args.filter((a) => a.startsWith(\"--\")));\n const flags = new Set<string>();\n\n if (!shortFlags && Array.from(longFlags).length === 0) {\n shortFlags = \"-LPl\";\n }\n\n if (shortFlags) {\n for (const char of shortFlags.slice(1)) {\n switch (char) {\n case \"L\":\n flags.add(\"layout\");\n break;\n case \"P\":\n flags.add(\"page\");\n break;\n case \"l\":\n flags.add(\"loading\");\n break;\n case \"n\":\n flags.add(\"not-found\");\n break;\n case \"e\":\n flags.add(\"error\");\n break;\n case \"g\":\n flags.add(\"global-error\");\n break;\n case \"r\":\n flags.add(\"route\");\n break;\n case \"t\":\n flags.add(\"template\");\n break;\n case \"d\":\n flags.add(\"default\");\n break;\n }\n }\n }\n\n for (const flag of [\n \"layout\",\n \"page\",\n \"loading\",\n \"not-found\",\n \"error\",\n \"global-error\",\n \"route\",\n \"template\",\n \"default\",\n ]) {\n if (longFlags.has(\"--\" + flag)) flags.add(flag);\n }\n\n const config = await loadConfig();\n if (!config) {\n console.error(\"❌ Configuration file cnp.config.json not found. Run this command from the project root.\");\n return;\n }\n const useI18n = !!config.useI18n;\n\n const srcSegments = [\"src\", \"app\"];\n if (useI18n) srcSegments.push(\"[locale]\");\n const srcPath = join(process.cwd(), ...srcSegments);\n if (!existsSync(srcPath)) {\n console.error(`❌ Expected directory not found: ${srcPath}`);\n return;\n }\n\n let messagesPath: string | null = null;\n let locales: string[] = [];\n if (useI18n) {\n messagesPath = join(process.cwd(), \"messages\");\n if (!existsSync(messagesPath)) {\n console.error(\"❌ Messages directory missing. Ensure i18n was configured.\");\n return;\n }\n const entries = await readdir(messagesPath, { withFileTypes: true });\n locales = entries.filter((e) => e.isDirectory()).map((e) => e.name);\n }\n\n const templatePath = join(import.meta.dir, \"..\", \"..\", \"templates\", \"Page\");\n\n // Create folders/files for nested or simple page\n let uiPageDir, localePagePath, jsonFileName;\n if (parentName && childName) {\n uiPageDir = join(process.cwd(), \"src\", \"ui\", parentName, childName);\n localePagePath = join(srcPath, parentName, childName);\n jsonFileName = parentName;\n } else {\n uiPageDir = join(process.cwd(), \"src\", \"ui\", pageName);\n localePagePath = join(srcPath, pageName);\n jsonFileName = pageName;\n }\n if (!existsSync(uiPageDir)) {\n await mkdir(uiPageDir, { recursive: true });\n }\n const uiPageFile = join(uiPageDir, \"page-ui.tsx\");\n const uiPageTemplate = join(templatePath, \"page-ui.tsx\");\n if (existsSync(uiPageTemplate)) {\n let uiContent = await readFile(uiPageTemplate, \"utf-8\");\n uiContent = uiContent\n .replace(/template/g, childName || pageName)\n .replace(/Template/g, capitalize(childName || pageName));\n await writeFile(uiPageFile, uiContent);\n console.log(`📄 File created: ${uiPageFile}`);\n } else {\n console.warn(\"⚠️ Template page-ui.tsx manquant.\");\n }\n if (!existsSync(localePagePath)) {\n await mkdir(localePagePath, { recursive: true });\n }\n for (const flag of flags) {\n const filename = toFileName(flag);\n const src = join(templatePath, filename);\n const dst = join(localePagePath, filename);\n if (!existsSync(src)) {\n console.warn(`⚠️ Missing template file: ${filename}`);\n continue;\n }\n const content = await readFile(src, \"utf-8\");\n const replaced = content\n .replace(/template/g, childName || pageName)\n .replace(/Template/g, capitalize(childName || pageName));\n await writeFile(dst, replaced);\n console.log(`📄 File created: ${dst}`);\n }\n\n if (useI18n && messagesPath) {\n const jsonTemplate = join(templatePath, \"page.json\");\n if (!existsSync(jsonTemplate)) {\n console.warn(\"⚠️ Missing template page.json.\");\n\n } else {\n const content = await readFile(jsonTemplate, \"utf-8\");\n const replaced = content\n .replace(/template/g, childName || pageName)\n .replace(/Template/g, capitalize(childName || pageName));\n for (const locale of locales) {\n // Only process if messages/<locale> is a directory\n const localeDir = join(messagesPath, locale);\n if (!existsSync(localeDir) || !statSync(localeDir).isDirectory())\n continue;\n const jsonTarget = join(messagesPath, locale, `${jsonFileName}.json`);\n let current: Record<string, any> = {};\n if (existsSync(jsonTarget)) {\n const jsonFile = await readFile(jsonTarget, \"utf-8\");\n try {\n current = JSON.parse(jsonFile) as Record<string, any>;\n } catch {\n current = {};\n }\n }\n if (parentName && childName) {\n current[childName] = JSON.parse(replaced);\n } else {\n // fichier simple\n current = JSON.parse(replaced);\n }\n await writeFile(jsonTarget, JSON.stringify(current, null, 2));\n }\n }\n } else {\n console.log(\"ℹ️ Skipping translation templates; next-intl not enabled.\");\n }\n\n console.log(\n `✅ Page \"${pageName}\" with templates added${\n useI18n ? \" for each locale\" : \"\"\n }.`\n );\n}\n","import { join } from \"node:path\";\nimport { writeFile, readdir } from \"node:fs/promises\";\nimport prompts from \"prompts\";\nimport { existsSync } from \"node:fs\";\n\nexport async function rmPage(args: string[]) {\n let pageName = args[1];\n if (!pageName || pageName.startsWith(\"-\")) {\n const response = await prompts.prompt({\n type: \"text\",\n name: \"pageName\",\n message: \"🗑️ Page name to remove:\",\n validate: (name: string) => (name ? true : \"Page name is required\"),\n });\n pageName = response.pageName;\n }\n\n // Remove translation files messages/<lang>/<PageName>.json\n const messagesPath = join(process.cwd(), \"messages\");\n const entries = await readdir(messagesPath, { withFileTypes: true });\n const langDirs = entries.filter((e) => e.isDirectory()).map((e) => e.name);\n for (const locale of langDirs) {\n const jsonTarget = join(messagesPath, locale, `${pageName}.json`);\n if (existsSync(jsonTarget)) {\n await writeFile(jsonTarget, \"\");\n await import(\"node:child_process\").then((cp) =>\n cp.execSync(`rm -f '${jsonTarget}'`)\n );\n console.log(`🗑️ Deleted: ${jsonTarget}`);\n }\n }\n\n // Remove folder src/ui/<PageName>\n const uiPageDir = join(process.cwd(), \"src\", \"ui\", pageName);\n if (existsSync(uiPageDir)) {\n await import(\"node:child_process\").then((cp) =>\n cp.execSync(`rm -rf '${uiPageDir}'`)\n );\n console.log(`🗑️ Deleted: ${uiPageDir}`);\n }\n\n // Remove folder src/app/[locale]/<PageName>\n const appLocaleDir = join(process.cwd(), \"src\", \"app\", \"[locale]\", pageName);\n if (existsSync(appLocaleDir)) {\n await import(\"node:child_process\").then((cp) =>\n cp.execSync(`rm -rf '${appLocaleDir}'`)\n );\n console.log(`🗑️ Deleted: ${appLocaleDir}`);\n }\n\n console.log(`✅ Page \"${pageName}\" deleted.`);\n}\n","import { join } from \"node:path\";\nimport { mkdir, readFile, writeFile } from \"node:fs/promises\";\nimport prompts from \"prompts\";\nimport { existsSync } from \"node:fs\";\n\nimport { loadConfig, capitalize } from \"./utils\";\n\nexport async function addLib(args: string[]) {\n let libArg = args[1];\n if (!libArg || libArg.startsWith(\"-\")) {\n const response = await prompts.prompt({\n type: \"text\",\n name: \"libArg\",\n message: \"📦 Lib name to add:\",\n validate: (name: string) => (name ? true : \"Lib name is required\"),\n });\n libArg = response.libArg;\n }\n\n let libName = libArg;\n let fileName: string | null = null;\n if (libArg.includes(\".\")) {\n [libName, fileName] = libArg.split(\".\");\n }\n\n const config = await loadConfig();\n if (!config) {\n console.error(\n \"❌ Configuration file cnp.config.json not found. Run this command from the project root.\",\n );\n return;\n }\n\n const libDir = join(process.cwd(), \"src\", \"lib\", libName);\n if (!existsSync(libDir)) {\n await mkdir(libDir, { recursive: true });\n }\n\n const templateDir = join(import.meta.dir, \"..\", \"..\", \"templates\", \"Lib\");\n const indexTemplate = join(templateDir, \"index.ts\");\n const fileTemplate = join(templateDir, \"item.ts\");\n\n const indexPath = join(libDir, \"index.ts\");\n if (!existsSync(indexPath)) {\n if (existsSync(indexTemplate)) {\n const content = await readFile(indexTemplate, \"utf-8\");\n await writeFile(indexPath, content);\n } else {\n await writeFile(indexPath, \"export {}\\n\");\n }\n console.log(`📄 File created: ${indexPath}`);\n }\n\n if (fileName) {\n const filePath = join(libDir, `${fileName}.ts`);\n if (!existsSync(filePath)) {\n if (existsSync(fileTemplate)) {\n let content = await readFile(fileTemplate, \"utf-8\");\n content = content\n .replace(/template/g, fileName)\n .replace(/Template/g, capitalize(fileName));\n await writeFile(filePath, content);\n } else {\n await writeFile(\n filePath,\n `export function ${fileName}() {\\n // TODO: implement\\n}\\n`,\n );\n }\n console.log(`📄 File created: ${filePath}`);\n }\n\n let indexContent = await readFile(indexPath, \"utf-8\");\n const importLine = `import { ${fileName} } from \"./${fileName}\";`;\n const importRegex = new RegExp(\n `import\\\\s*{\\\\s*${fileName}\\\\s*}\\\\s*from\\\\s*\"\\\\./${fileName}\";`,\n );\n const exportRegex = /export\\s*{([^}]*)}/m;\n\n const imports: string[] = [];\n const exportsSet: string[] = [];\n for (const line of indexContent.split(\"\\n\")) {\n if (line.startsWith(\"import\")) {\n imports.push(line);\n } else if (line.startsWith(\"export\")) {\n const match = line.match(exportRegex);\n if (match && match[1]) {\n exportsSet.push(\n ...match[1]\n .split(\",\")\n .map((s) => s.trim())\n .filter(Boolean),\n );\n }\n }\n }\n\n if (!imports.some((l) => importRegex.test(l))) {\n imports.push(importLine);\n }\n if (!exportsSet.includes(fileName)) {\n exportsSet.push(fileName);\n }\n\n indexContent =\n imports.join(\"\\n\") +\n \"\\n\\nexport { \" +\n exportsSet.join(\", \") +\n \" };\\n\";\n await writeFile(indexPath, indexContent);\n console.log(`✏️ Updated index: ${indexPath}`);\n }\n\n console.log(\n `✅ Lib \"${libName}\"${fileName ? ` with module ${fileName}` : \"\"} added.`,\n );\n}\n","import { join } from \"node:path\";\nimport { mkdir, readFile, writeFile } from \"node:fs/promises\";\nimport prompts from \"prompts\";\nimport { existsSync } from \"node:fs\";\n\nimport { loadConfig } from \"./utils\";\n\nexport async function addApi(args: string[]) {\n let apiName = args[1];\n if (!apiName || apiName.startsWith(\"-\")) {\n const response = await prompts.prompt({\n type: \"text\",\n name: \"apiName\",\n message: \"🔌 API route name to add:\",\n validate: (name: string) => (name ? true : \"API route name is required\"),\n });\n apiName = response.apiName;\n }\n\n const config = await loadConfig();\n if (!config) {\n console.error(\n \"❌ Configuration file cnp.config.json not found. Run this command from the project root.\",\n );\n return;\n }\n\n const apiDir = join(process.cwd(), \"src\", \"app\", \"api\", apiName);\n if (!existsSync(apiDir)) {\n await mkdir(apiDir, { recursive: true });\n }\n\n const templateDir = join(import.meta.dir, \"..\", \"..\", \"templates\", \"Api\");\n const routeTemplate = join(templateDir, \"route.ts\");\n const routePath = join(apiDir, \"route.ts\");\n\n if (!existsSync(routePath)) {\n if (existsSync(routeTemplate)) {\n let content = await readFile(routeTemplate, \"utf-8\");\n content = content.replace(/template/g, apiName);\n await writeFile(routePath, content);\n } else {\n await writeFile(\n routePath,\n `import { NextResponse } from \\\"next/server\\\";\\n\\nexport async function GET() {\\n return NextResponse.json({ message: \\\"Hello from ${apiName}\\\" });\\n}\\n`,\n );\n }\n console.log(`📄 File created: ${routePath}`);\n } else {\n console.log(`ℹ️ File already exists: ${routePath}`);\n }\n\n console.log(`✅ API route \"${apiName}\" added.`);\n}\n","// src/scaffold.ts\n\nimport { cp, mkdir, rm, writeFile, readFile } from \"node:fs/promises\";\nimport { join } from \"node:path\";\nimport { existsSync } from \"node:fs\";\nimport { fileURLToPath } from \"node:url\";\n\nconst RED = \"\\x1b[31m\";\nconst GREEN = \"\\x1b[32m\";\nconst YELLOW = \"\\x1b[33m\";\nconst BLUE = \"\\x1b[34m\";\nconst CYAN = \"\\x1b[36m\";\nconst RESET = \"\\x1b[0m\";\n\n/**\n * Options for scaffolding a Next.js project.\n */\ninterface ScaffoldOptions {\n projectName: string;\n useTypescript: boolean;\n useEslint: boolean;\n useTailwind: boolean;\n useSrcDir: boolean;\n useTurbopack: boolean;\n useI18n: boolean;\n customAlias: boolean;\n importAlias: string;\n force?: boolean;\n}\n\n/**\n * Scaffold a new Next.js project based on provided options.\n *\n * - Copies the default template to the target directory\n * - Removes the target directory if it exists and --force is set\n * - Optionally customizes the structure in future (e.g. remove unused files)\n *\n * @param options ScaffoldOptions for the project\n */\nexport async function scaffoldProject(options: ScaffoldOptions) {\n const targetPath = join(process.cwd(), options.projectName);\n\n const __dirname = new URL(\".\", import.meta.url); // or :\n // const __dirname = path.dirname(fileURLToPath(import.meta.url));\n const templatePath = join(\n fileURLToPath(__dirname),\n \"..\",\n \"templates\",\n \"Projects\",\n \"default\",\n );\n\n // Check if target directory exists\n if (existsSync(targetPath)) {\n if (options.force) {\n console.warn(\"⚠️ Target directory already exists, removing...\");\n await rm(targetPath, { recursive: true, force: true });\n } else {\n console.error(\n `${RED}[X] Target directory already exists. Use --force to overwrite.${RESET}`,\n );\n process.exit(1);\n }\n }\n\n try {\n console.log(\"Creating project directory...\");\n await mkdir(targetPath, { recursive: true });\n\n console.log(\"Copying files from template...\");\n await cp(templatePath, targetPath, { recursive: true });\n\n // Apply configuration: add dependencies or files based on prompt choices\n const pkgPath = join(targetPath, \"package.json\");\n if (existsSync(pkgPath)) {\n const pkg = JSON.parse(await readFile(pkgPath, \"utf-8\"));\n pkg.dependencies = pkg.dependencies || {};\n if (options.useI18n) {\n pkg.dependencies[\"next-intl\"] =\n pkg.dependencies[\"next-intl\"] || \"^4.3.5\";\n }\n await writeFile(pkgPath, JSON.stringify(pkg, null, 2));\n }\n\n // Write CLI configuration to project root\n await writeFile(\n join(targetPath, \"cnp.config.json\"),\n JSON.stringify(options, null, 2),\n );\n\n console.log(\"Project setup complete!\");\n console.log(\"\");\n console.log(\"To get started:\");\n console.log(` ${GREEN}cd ${options.projectName}${RESET}`);\n console.log(\"\");\n console.log(\n \"Then install dependencies and launch the dev server with your preferred tool:\",\n );\n\n console.log(` ${GREEN}bun install && bun dev${RESET}`);\n console.log(` ${GREEN}npm install && npm run dev${RESET}`);\n console.log(` ${GREEN}pnpm install && pnpm run dev${RESET}`);\n console.log(\"\");\n console.log(\"Documentation and examples can be found at:\");\n console.log(\n ` ${CYAN}https://github.com/Rising-Corporation/create-next-pro-cli${RESET}`,\n );\n console.log(\n \"_-`'-_-'`_`'-_-'`_`'-_-'`_`'-_-'`_`'-_-'`_`'-_-'`_`'-_-'`_`'-_-'`-_\",\n );\n } catch (err) {\n // Affiche une croix ASCII et le texte en rouge si le terminal le supporte\n\n console.error(` ${RED}[X] Error during project creation:${RESET}`, err);\n process.exit(1);\n }\n}\n","import { scaffoldProject } from \"../scaffold\";\nexport async function createProject(nameArg: string, force: boolean) {\n const response = {\n projectName: nameArg,\n useTypescript: true,\n useEslint: true,\n useTailwind: true,\n useSrcDir: true,\n useTurbopack: true,\n useI18n: true,\n customAlias: true,\n importAlias: \"@/*\",\n force,\n };\n\n console.log(`Creating project \"${response.projectName}\"...`);\n await scaffoldProject(response);\n}\n","import { scaffoldProject } from \"../scaffold\";\nimport prompts from \"prompts\";\nexport async function createProjectWithPrompt() {\n const response = await prompts.prompt([\n {\n type: \"text\",\n name: \"projectName\",\n message: \"Project name:\",\n initial: \"my-next-app\",\n },\n {\n type: \"toggle\",\n name: \"useTypescript\",\n message: \"✔ Use TypeScript?\",\n initial: true,\n active: \"Yes\",\n inactive: \"No\",\n },\n {\n type: \"toggle\",\n name: \"useEslint\",\n message: \"✔ Use ESLint?\",\n initial: true,\n active: \"Yes\",\n inactive: \"No\",\n },\n {\n type: \"toggle\",\n name: \"useTailwind\",\n message: \"✔ Use Tailwind CSS?\",\n initial: true,\n active: \"Yes\",\n inactive: \"No\",\n },\n {\n type: \"toggle\",\n name: \"useSrcDir\",\n message: \"✔ Use `src/` directory?\",\n initial: true,\n active: \"Yes\",\n inactive: \"No\",\n },\n {\n type: \"toggle\",\n name: \"useTurbopack\",\n message: \"✔ Use Turbopack for `next dev`?\",\n initial: true,\n active: \"Yes\",\n inactive: \"No\",\n },\n {\n type: \"toggle\",\n name: \"useI18n\",\n message: \"✔ Use i18n with next-intl for translations?\",\n initial: true,\n active: \"Yes\",\n inactive: \"No\",\n },\n {\n type: \"toggle\",\n name: \"customAlias\",\n message: \"✔ Customize import alias (`@/*` by default)?\",\n initial: true,\n active: \"Yes\",\n inactive: \"No\",\n },\n {\n type: (prev: boolean) => (prev ? \"text\" : null),\n name: \"importAlias\",\n message: \"✔ What import alias would you like?\",\n initial: \"@core/*\",\n },\n ]);\n\n console.log(\"\\nYour choices:\");\n console.log(response);\n\n await scaffoldProject(response);\n}\n","#!/usr/bin/env node\nimport { main } from \"./src/index\";\nmain();\n"],"mappings":";;;AAEA,OAAO,QAAQ;AACf,OAAO,QAAQ;AACf,OAAO,UAAU;AACjB,OAAOA,cAAa;AACpB,SAAS,iBAAAC,sBAAqB;AAC9B,SAAS,SAAS,eAAe;;;ACPjC,SAAS,QAAAC,aAAY;AACrB,SAAS,OAAO,YAAAC,WAAU,WAAW,eAAe;AACpD,OAAO,aAAa;;;ACFpB,SAAS,gBAAgB;AACzB,SAAS,kBAAkB;AAC3B,SAAS,YAAY;AAKd,SAAS,WAAW,KAAqB;AAC9C,SAAO,IAAI,OAAO,CAAC,EAAE,YAAY,IAAI,IAAI,MAAM,CAAC;AAClD;AAWA,eAAsB,aAAwC;AAC5D,QAAM,aAAa,KAAK,QAAQ,IAAI,GAAG,iBAAiB;AACxD,MAAI,CAAC,WAAW,UAAU,EAAG,QAAO;AACpC,MAAI;AACF,UAAM,MAAM,MAAM,SAAS,YAAY,OAAO;AAC9C,WAAO,KAAK,MAAM,GAAG;AAAA,EACvB,QAAQ;AACN,WAAO;AAAA,EACT;AACF;AAOO,SAAS,WAAW,KAAqB;AAC9C,UAAQ,KAAK;AAAA,IACX,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AACH,aAAO;AAAA,IACT,KAAK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CAAC;AAAA,EACV;AAEA,MAAI,KAAK,SAAS,QAAQ,EAAG,QAAO,SAAS;AAC7C,MAAI,KAAK,SAAS,WAAW,KAAK,KAAK,SAAS,IAAI,EAAG,QAAO,YAAY;AAC1E,MAAI,KAAK,SAAS,eAAe,KAAK,CAAC,QAAQ,GAAG;AAChD,UAAM,WAAW;AACjB;AAAA,EACF;AAEA,QAAM,QAAQ,KAAK,SAAS,SAAS;AAMrC,MAAI,KAAK,CAAC,MAAM,aAAa,KAAK,WAAW,GAAG;AAC9C,SAAK,KAAK,MAAM;AAAA,EAClB;AAKA,MAAI,KAAK,CAAC,MAAM,gBAAgB;AAC9B,iBAAa,IAAI;AACjB;AAAA,EACF;AAKA,MAAI,KAAK,CAAC,MAAM,WAAW;AACzB,YAAQ,IAAI;AACZ;AAAA,EACF;AAKA,MAAI,KAAK,CAAC,MAAM,UAAU;AACxB,WAAO,IAAI;AACX;AAAA,EACF;AAKA,MAAI,KAAK,CAAC,MAAM,UAAU;AACxB,WAAO,IAAI;AACX;AAAA,EACF;AAKA,MAAI,KAAK,CAAC,MAAM,UAAU;AACxB,WAAO,IAAI;AACX;AAAA,EACF;AAKA,QAAM,UAAU,KAAK,KAAK,CAAC,QAAQ,CAAC,IAAI,WAAW,IAAI,CAAC;AAExD,MAAI,SAAS;AACX,kBAAc,SAAS,KAAK;AAC5B;AAAA,EACF;AAKA,QAAM,wBAAwB;AAChC;;;AU7NA,KAAK;","names":["prompts","fileURLToPath","join","readFile","existsSync","join","readFile","join","mkdir","readFile","writeFile","readdir","prompts","existsSync","statSync","prompts","join","readdir","mkdir","readFile","writeFile","join","writeFile","readdir","prompts","existsSync","cp","join","mkdir","readFile","writeFile","prompts","existsSync","prompts","join","existsSync","mkdir","readFile","writeFile","join","mkdir","readFile","writeFile","prompts","existsSync","prompts","join","existsSync","mkdir","readFile","writeFile","mkdir","writeFile","readFile","join","existsSync","join","__dirname","existsSync","mkdir","readFile","writeFile","prompts","__dirname","fileURLToPath","prompts"]}
|
package/package.json
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|