rapidkit 0.12.1 → 0.12.3
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 +10 -9
- package/dist/index.js +68 -58
- package/dist/package.json +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -19,7 +19,6 @@
|
|
|
19
19
|
```bash
|
|
20
20
|
npx rapidkit my-api --template fastapi
|
|
21
21
|
cd my-api
|
|
22
|
-
source .rapidkit/activate # Enable rapidkit commands
|
|
23
22
|
rapidkit init # Install dependencies
|
|
24
23
|
rapidkit dev # Start dev server at http://localhost:8000
|
|
25
24
|
```
|
|
@@ -29,7 +28,7 @@ rapidkit dev # Start dev server at http://localhost:8000
|
|
|
29
28
|
```bash
|
|
30
29
|
npx rapidkit my-api --template nestjs
|
|
31
30
|
cd my-api
|
|
32
|
-
|
|
31
|
+
rapidkit init # Install dependencies
|
|
33
32
|
rapidkit dev # Start dev server at http://localhost:8000
|
|
34
33
|
```
|
|
35
34
|
|
|
@@ -85,13 +84,11 @@ npx rapidkit [project-name] [options]
|
|
|
85
84
|
|
|
86
85
|
## Project Commands
|
|
87
86
|
|
|
88
|
-
After creating a project,
|
|
87
|
+
After creating a project, use these commands:
|
|
89
88
|
|
|
90
89
|
```bash
|
|
91
90
|
cd my-api
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
rapidkit init # Install dependencies
|
|
91
|
+
rapidkit init # Install dependencies (auto-activates environment)
|
|
95
92
|
rapidkit dev # Start dev server with hot reload (port 8000)
|
|
96
93
|
rapidkit start # Start production server
|
|
97
94
|
rapidkit build # Build for production
|
|
@@ -101,9 +98,11 @@ rapidkit format # Format code
|
|
|
101
98
|
rapidkit --help # Show all commands
|
|
102
99
|
```
|
|
103
100
|
|
|
104
|
-
|
|
101
|
+
> **Note:** The global `rapidkit` command automatically detects when you're inside a RapidKit project and delegates to the local CLI. No need for `./rapidkit` prefix or `source .rapidkit/activate`.
|
|
105
102
|
|
|
106
|
-
|
|
103
|
+
### Alternative: Direct Commands
|
|
104
|
+
|
|
105
|
+
You can also run commands directly:
|
|
107
106
|
|
|
108
107
|
```bash
|
|
109
108
|
./rapidkit dev # Using the wrapper script
|
|
@@ -196,4 +195,6 @@ MIT
|
|
|
196
195
|
|
|
197
196
|
---
|
|
198
197
|
|
|
199
|
-
**v0.12.
|
|
198
|
+
**v0.12.1** - Simplified CLI: `rapidkit init` now handles environment activation automatically
|
|
199
|
+
|
|
200
|
+
**v0.12.0** - Added NestJS template, workspace mode, and unified CLI
|
package/dist/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {Command}from'commander';import
|
|
3
|
-
[${t}/${i}]`),
|
|
4
|
-
\u26A0\uFE0F Update available: ${S} \u2192 ${t}`)),console.log(
|
|
5
|
-
`))):c.debug("You are using the latest version");}catch{c.debug("Could not check for updates");}}function w(){return S}var
|
|
2
|
+
import {Command}from'commander';import r from'chalk';import P from'inquirer';import d,{dirname,join}from'path';import {spawn}from'child_process';import {execa}from'execa';import {readFileSync,promises}from'fs';import {fileURLToPath}from'url';import ie from'os';import ae from'validate-npm-package-name';import*as u from'fs-extra';import N from'ora';var E=class{debugEnabled=false;setDebug(t){this.debugEnabled=t;}debug(t,...i){this.debugEnabled&&console.log(r.gray(`[DEBUG] ${t}`),...i);}info(t,...i){console.log(r.blue(t),...i);}success(t,...i){console.log(r.green(t),...i);}warn(t,...i){console.log(r.yellow(t),...i);}error(t,...i){console.error(r.red(t),...i);}step(t,i,a){console.log(r.cyan(`
|
|
3
|
+
[${t}/${i}]`),r.white(a));}},c=new E;var V="rapidkit",q=fileURLToPath(import.meta.url),X=dirname(q),Q=join(X,"..","package.json"),Z=JSON.parse(readFileSync(Q,"utf-8")),S=Z.version;async function U(){try{c.debug("Checking for updates...");let{stdout:e}=await execa("npm",["view",V,"version"],{timeout:3e3}),t=e.trim();t&&t!==S?(console.log(r.yellow(`
|
|
4
|
+
\u26A0\uFE0F Update available: ${S} \u2192 ${t}`)),console.log(r.cyan(`Run: npm install -g rapidkit@latest
|
|
5
|
+
`))):c.debug("You are using the latest version");}catch{c.debug("Could not check for updates");}}function w(){return S}var re=".rapidkitrc.json";async function O(){let e=d.join(ie.homedir(),re);try{let t=await promises.readFile(e,"utf-8"),i=JSON.parse(t);return c.debug(`Loaded config from ${e}`),i}catch{return c.debug("No user config found, using defaults"),{}}}var v=class extends Error{constructor(i,a,n){super(i);this.code=a;this.details=n;this.name="RapidKitError",Error.captureStackTrace(this,this.constructor);}};var h=class extends v{constructor(t,i){super(`Invalid project name: "${t}"`,"INVALID_PROJECT_NAME",i);}};function F(e){let t=ae(e);if(!t.validForNewPackages){let a=t.errors||[],n=t.warnings||[],s=[...a,...n];throw new h(e,`NPM validation failed: ${s.join(", ")}`)}if(!/^[a-z][a-z0-9_-]*$/.test(e))throw new h(e,"Must start with a lowercase letter and contain only lowercase letters, numbers, hyphens, and underscores");if(["test","tests","src","dist","build","lib","python","pip","poetry","node","npm","rapidkit","rapidkit"].includes(e.toLowerCase()))throw new h(e,`"${e}" is a reserved name. Please choose a different name.`);if(e.length<2)throw new h(e,"Name must be at least 2 characters long");if(e.length>214)throw new h(e,"Name must be less than 214 characters");return true}async function B(e,t){let i=N("Creating RapidKit workspace...").start();try{await promises.mkdir(e,{recursive:!0}),await promises.mkdir(d.join(e,".rapidkit"),{recursive:!0});let a={workspace_name:t.name,author:t.author,rapidkit_version:w(),created_at:new Date().toISOString(),type:"workspace"};await promises.writeFile(d.join(e,".rapidkit","config.json"),JSON.stringify(a,null,2));let n=oe();await promises.writeFile(d.join(e,"rapidkit"),n),await promises.chmod(d.join(e,"rapidkit"),493);let s=ne(t.name);if(await promises.writeFile(d.join(e,"README.md"),s),await promises.writeFile(d.join(e,".gitignore"),`# RapidKit workspace
|
|
6
6
|
.env
|
|
7
7
|
.env.*
|
|
8
8
|
!.env.example
|
|
@@ -17,10 +17,10 @@ Thumbs.db
|
|
|
17
17
|
|
|
18
18
|
# Logs
|
|
19
19
|
*.log
|
|
20
|
-
`),await
|
|
21
|
-
${
|
|
20
|
+
`),await se(e),i.succeed("Workspace created!"),!t.skipGit){let l=N("Initializing git repository...").start();try{await execa("git",["init"],{cwd:e}),await execa("git",["add","."],{cwd:e}),await execa("git",["commit","-m","Initial commit: RapidKit workspace"],{cwd:e}),l.succeed("Git repository initialized");}catch{l.warn("Could not initialize git repository");}}console.log(`
|
|
21
|
+
${r.green("\u2728 RapidKit workspace created successfully!")}
|
|
22
22
|
|
|
23
|
-
${
|
|
23
|
+
${r.bold("\u{1F4C2} Workspace structure:")}
|
|
24
24
|
${e}/
|
|
25
25
|
\u251C\u2500\u2500 rapidkit # Local CLI (add to PATH or use ./rapidkit)
|
|
26
26
|
\u251C\u2500\u2500 .rapidkit/ # Workspace configuration
|
|
@@ -28,25 +28,25 @@ ${e}/
|
|
|
28
28
|
\u2502 \u2514\u2500\u2500 templates/ # Project templates
|
|
29
29
|
\u2514\u2500\u2500 README.md
|
|
30
30
|
|
|
31
|
-
${
|
|
32
|
-
${
|
|
33
|
-
${
|
|
34
|
-
${
|
|
35
|
-
${
|
|
36
|
-
${
|
|
31
|
+
${r.bold("\u{1F680} Get started:")}
|
|
32
|
+
${r.cyan(`cd ${t.name}`)}
|
|
33
|
+
${r.cyan('export PATH="$PWD:$PATH"')} ${r.gray("# Add rapidkit to PATH")}
|
|
34
|
+
${r.cyan("rapidkit create my-api --template fastapi")}
|
|
35
|
+
${r.cyan("cd my-api")}
|
|
36
|
+
${r.cyan("rapidkit dev")}
|
|
37
37
|
|
|
38
|
-
${
|
|
38
|
+
${r.bold("\u{1F4E6} Available templates:")}
|
|
39
39
|
fastapi - FastAPI + Python (default)
|
|
40
40
|
nestjs - NestJS + TypeScript
|
|
41
41
|
|
|
42
|
-
${
|
|
42
|
+
${r.bold("\u{1F4DA} Commands:")}
|
|
43
43
|
rapidkit create <name> Create a new project
|
|
44
44
|
rapidkit create --help Show create options
|
|
45
45
|
rapidkit help Show all commands
|
|
46
46
|
|
|
47
|
-
${
|
|
48
|
-
${
|
|
49
|
-
`);}catch(
|
|
47
|
+
${r.gray("Tip: Add workspace to PATH for easier access:")}
|
|
48
|
+
${r.cyan(`echo 'export PATH="${e}:$PATH"' >> ~/.bashrc`)}
|
|
49
|
+
`);}catch(a){throw i.fail("Failed to create workspace"),a}}function oe(){return `#!/usr/bin/env bash
|
|
50
50
|
#
|
|
51
51
|
# RapidKit CLI - Local workspace commands
|
|
52
52
|
# This script provides rapidkit commands within the workspace
|
|
@@ -269,6 +269,12 @@ cmd_project() {
|
|
|
269
269
|
case "$cmd" in
|
|
270
270
|
init)
|
|
271
271
|
echo -e "\${BLUE}\u{1F4E6} Installing dependencies...\${NC}"
|
|
272
|
+
|
|
273
|
+
# Source activate script first to ensure Poetry is available
|
|
274
|
+
if [[ -f ".rapidkit/activate" ]]; then
|
|
275
|
+
source .rapidkit/activate
|
|
276
|
+
fi
|
|
277
|
+
|
|
272
278
|
poetry install
|
|
273
279
|
echo -e "\${GREEN}\u2705 Dependencies installed!\${NC}"
|
|
274
280
|
;;
|
|
@@ -314,6 +320,12 @@ cmd_project() {
|
|
|
314
320
|
case "$cmd" in
|
|
315
321
|
init)
|
|
316
322
|
echo -e "\${BLUE}\u{1F4E6} Installing dependencies...\${NC}"
|
|
323
|
+
|
|
324
|
+
# Source activate script first to ensure environment is ready
|
|
325
|
+
if [[ -f ".rapidkit/activate" ]]; then
|
|
326
|
+
source .rapidkit/activate
|
|
327
|
+
fi
|
|
328
|
+
|
|
317
329
|
$pm install
|
|
318
330
|
echo -e "\${GREEN}\u2705 Dependencies installed!\${NC}"
|
|
319
331
|
;;
|
|
@@ -382,7 +394,7 @@ main() {
|
|
|
382
394
|
}
|
|
383
395
|
|
|
384
396
|
main "$@"
|
|
385
|
-
`}function
|
|
397
|
+
`}function ne(e){return `# ${e}
|
|
386
398
|
|
|
387
399
|
RapidKit workspace for building API projects.
|
|
388
400
|
|
|
@@ -437,7 +449,7 @@ rapidkit dev # Start dev server
|
|
|
437
449
|
|
|
438
450
|
- [RapidKit Documentation](https://rapidkit.dev)
|
|
439
451
|
- [GitHub Repository](https://github.com/Baziar/rapidkit)
|
|
440
|
-
`}async function
|
|
452
|
+
`}async function se(e){let{fileURLToPath:t}=await import('url'),i=t(import.meta.url),a=d.dirname(i),n=d.resolve(a,".."),s=d.join(n,"templates","kits"),p=d.join(e,".rapidkit","templates"),{default:l}=await import('fs-extra');await l.copy(s,p);let g=d.join(n,"templates","generator.js"),j=d.join(e,".rapidkit","generator.js");await l.copy(g,j);}async function K(e,t){let i=t.template==="fastapi",a=i?"FastAPI":"NestJS",n=N(`Creating ${a} project...`).start();try{let{fileURLToPath:s}=await import('url'),p=s(import.meta.url),l=d.dirname(p),g=d.resolve(l,".."),j=i?"fastapi-standard":"nestjs-standard",C=d.join(g,"templates","kits",j);await promises.mkdir(e,{recursive:!0});let _={project_name:i?t.name.replace(/-/g,"_").toLowerCase():t.name.replace(/_/g,"-").toLowerCase(),author:t.author,description:t.description||`${a} application generated with RapidKit`,app_version:"0.1.0",license:"MIT",package_manager:t.package_manager||"npm",created_at:new Date().toISOString(),rapidkit_version:w()};await G(C,e,_);let W=i?`# Python
|
|
441
453
|
__pycache__/
|
|
442
454
|
*.py[cod]
|
|
443
455
|
*$py.class
|
|
@@ -505,10 +517,10 @@ Thumbs.db
|
|
|
505
517
|
|
|
506
518
|
# Coverage
|
|
507
519
|
coverage/
|
|
508
|
-
`;if(await promises.writeFile(
|
|
509
|
-
${
|
|
520
|
+
`;if(await promises.writeFile(d.join(e,".gitignore"),W),n.succeed(`${a} project created!`),!t.skipGit){let y=N("Initializing git repository...").start();try{await execa("git",["init"],{cwd:e}),await execa("git",["add","."],{cwd:e}),await execa("git",["commit","-m",`Initial commit: ${a} project via RapidKit`],{cwd:e}),y.succeed("Git repository initialized");}catch{y.warn("Could not initialize git repository");}}if(!t.skipInstall&&!i){let y=t.package_manager||"npm",L=N(`Installing dependencies with ${y}...`).start();try{await execa(y,["install"],{cwd:e}),L.succeed("Dependencies installed");}catch{L.warn(`Could not install dependencies. Run '${y} install' manually.`);}}let D=d.basename(e);console.log(i?`
|
|
521
|
+
${r.green("\u2728 FastAPI project created successfully!")}
|
|
510
522
|
|
|
511
|
-
${
|
|
523
|
+
${r.bold("\u{1F4C2} Project structure:")}
|
|
512
524
|
${e}/
|
|
513
525
|
\u251C\u2500\u2500 .rapidkit/ # RapidKit CLI module
|
|
514
526
|
\u251C\u2500\u2500 src/
|
|
@@ -520,13 +532,12 @@ ${e}/
|
|
|
520
532
|
\u251C\u2500\u2500 pyproject.toml # Poetry configuration
|
|
521
533
|
\u2514\u2500\u2500 README.md
|
|
522
534
|
|
|
523
|
-
${
|
|
524
|
-
${
|
|
525
|
-
${
|
|
526
|
-
${
|
|
527
|
-
${a.cyan("rapidkit dev")} ${a.gray("# Start dev server")}
|
|
535
|
+
${r.bold("\u{1F680} Get started:")}
|
|
536
|
+
${r.cyan(`cd ${D}`)}
|
|
537
|
+
${r.cyan("rapidkit init")} ${r.gray("# Install dependencies")}
|
|
538
|
+
${r.cyan("rapidkit dev")} ${r.gray("# Start dev server")}
|
|
528
539
|
|
|
529
|
-
${
|
|
540
|
+
${r.bold("\u{1F4DA} Available commands:")}
|
|
530
541
|
rapidkit init # Install dependencies (poetry install)
|
|
531
542
|
rapidkit dev # Start dev server with hot reload
|
|
532
543
|
rapidkit start # Start production server
|
|
@@ -534,11 +545,11 @@ ${a.bold("\u{1F4DA} Available commands:")}
|
|
|
534
545
|
rapidkit lint # Lint code
|
|
535
546
|
rapidkit format # Format code
|
|
536
547
|
|
|
537
|
-
${
|
|
548
|
+
${r.gray("Alternative: use make commands (make dev, make test, ...)")}
|
|
538
549
|
`:`
|
|
539
|
-
${
|
|
550
|
+
${r.green("\u2728 NestJS project created successfully!")}
|
|
540
551
|
|
|
541
|
-
${
|
|
552
|
+
${r.bold("\u{1F4C2} Project structure:")}
|
|
542
553
|
${e}/
|
|
543
554
|
\u251C\u2500\u2500 .rapidkit/ # RapidKit CLI module
|
|
544
555
|
\u251C\u2500\u2500 src/
|
|
@@ -550,14 +561,13 @@ ${e}/
|
|
|
550
561
|
\u251C\u2500\u2500 package.json # Dependencies
|
|
551
562
|
\u2514\u2500\u2500 README.md
|
|
552
563
|
|
|
553
|
-
${
|
|
554
|
-
${
|
|
555
|
-
${
|
|
556
|
-
${
|
|
557
|
-
|
|
558
|
-
${a.cyan("rapidkit dev")} ${a.gray("# Start dev server")}
|
|
564
|
+
${r.bold("\u{1F680} Get started:")}
|
|
565
|
+
${r.cyan(`cd ${D}`)}
|
|
566
|
+
${t.skipInstall?r.cyan("rapidkit init")+r.gray(" # npm install")+`
|
|
567
|
+
`:""}${r.cyan("cp .env.example .env")}
|
|
568
|
+
${r.cyan("rapidkit dev")} ${r.gray("# Start dev server")}
|
|
559
569
|
|
|
560
|
-
${
|
|
570
|
+
${r.bold("\u{1F4DA} Available commands:")}
|
|
561
571
|
rapidkit init # Install dependencies
|
|
562
572
|
rapidkit dev # Start dev server with hot reload
|
|
563
573
|
rapidkit start # Start production server
|
|
@@ -566,30 +576,30 @@ ${a.bold("\u{1F4DA} Available commands:")}
|
|
|
566
576
|
rapidkit lint # Lint code
|
|
567
577
|
rapidkit format # Format code
|
|
568
578
|
|
|
569
|
-
${
|
|
579
|
+
${r.bold("\u{1F310} API endpoints:")}
|
|
570
580
|
http://localhost:8000/health # Health check
|
|
571
581
|
http://localhost:8000/docs # Swagger docs
|
|
572
582
|
http://localhost:8000/examples/notes # Example API
|
|
573
|
-
`);}catch(s){throw n.fail(`Failed to create ${
|
|
583
|
+
`);}catch(s){throw n.fail(`Failed to create ${a} project`),s}}async function G(e,t,i){let a=await promises.readdir(e,{withFileTypes:true});for(let n of a){let s=d.join(e,n.name),p=n.name.replace(/\.j2$/,""),l=d.join(t,p);if(n.isDirectory())await promises.mkdir(l,{recursive:true}),await G(s,l,i);else {let g=await promises.readFile(s,"utf-8");n.name.endsWith(".j2")&&(g=ce(g,i)),await promises.writeFile(l,g),(p==="rapidkit"||p==="activate"||p.endsWith(".py")&&l.includes(".rapidkit"))&&await promises.chmod(l,493);}}}function ce(e,t){let i=e;for(let[a,n]of Object.entries(t)){let s=new RegExp(`\\{\\{\\s*${a}\\s*\\}\\}`,"g");i=i.replace(s,String(n));let p=new RegExp(`\\{\\{\\s*${a}\\s*\\|\\s*replace\\s*\\(\\s*['"]([^'"]+)['"]\\s*,\\s*['"]([^'"]*)['"]\\s*\\)\\s*\\}\\}`,"g");i=i.replace(p,(j,C,_)=>String(n).replace(new RegExp(C,"g"),_));let l=new RegExp(`\\{\\{\\s*${a}\\s*\\|\\s*lower\\s*\\}\\}`,"g");i=i.replace(l,String(n).toLowerCase());let g=new RegExp(`\\{\\{\\s*${a}\\s*\\|\\s*replace\\s*\\(\\s*['"]([^'"]+)['"]\\s*,\\s*['"]([^'"]*)['"]\\s*\\)\\s*\\|\\s*lower\\s*\\}\\}`,"g");i=i.replace(g,(j,C,_)=>String(n).replace(new RegExp(C,"g"),_).toLowerCase());}return i}var de=["init","dev","start","build","test","lint","format","help","--help","-h"];async function me(){let e=process.cwd(),t=d.join(e,"rapidkit"),i=d.join(e,".rapidkit"),[a,n]=await Promise.all([u.pathExists(t),u.pathExists(i)]);if(!a||!n)return false;let s=process.argv.slice(2),p=s[0];if(!p||!de.includes(p))return false;c.debug(`Delegating to local CLI: ./rapidkit ${s.join(" ")}`);let l=spawn(t,s,{stdio:"inherit",cwd:e});return l.on("close",g=>{process.exit(g??0);}),l.on("error",g=>{c.error(`Failed to run local rapidkit: ${g.message}`),process.exit(1);}),true}var f=null,x=false,A=new Command;A.name("rapidkit").description("Create RapidKit workspaces and projects").version(w());A.argument("[name]","Name of the workspace or project directory").option("-t, --template <template>","Create project with template (fastapi, nestjs) instead of workspace").option("-y, --yes","Skip prompts and use defaults").option("--skip-git","Skip git initialization").option("--skip-install","Skip installing dependencies").option("--debug","Enable debug logging").option("--dry-run","Show what would be created without creating it").option("--no-update-check","Skip checking for updates").action(async(e,t)=>{try{t.debug&&(c.setDebug(!0),c.debug("Debug mode enabled"));let i=await O();c.debug("User config loaded",i),t.updateCheck!==!1&&await U(),console.log(r.blue.bold(`
|
|
574
584
|
\u{1F680} Welcome to RapidKit!
|
|
575
|
-
`)),e||(
|
|
585
|
+
`)),e||(ge(),process.exit(0));try{F(e);}catch(p){throw p instanceof v&&(c.error(`
|
|
576
586
|
\u274C ${p.message}`),p.details&&c.warn(`\u{1F4A1} ${p.details}
|
|
577
|
-
`),process.exit(1)),p}let
|
|
578
|
-
\u274C Directory "${e}" already exists`),console.log(
|
|
587
|
+
`),process.exit(1)),p}let a=d.resolve(process.cwd(),e);f=a,await u.pathExists(a)&&(c.error(`
|
|
588
|
+
\u274C Directory "${e}" already exists`),console.log(r.cyan(`
|
|
579
589
|
\u{1F4A1} Choose a different name or delete the existing directory.
|
|
580
|
-
`)),process.exit(1));let n=!!t.template;if(n){let p=t.template.toLowerCase(),
|
|
581
|
-
\u274C Invalid template: ${t.template}`),console.log(
|
|
582
|
-
\u{1F4E6} Available templates: ${
|
|
583
|
-
`)),process.exit(1));}if(t.dryRun){console.log(
|
|
590
|
+
`)),process.exit(1));let n=!!t.template;if(n){let p=t.template.toLowerCase(),l=["fastapi","nestjs"];l.includes(p)||(c.error(`
|
|
591
|
+
\u274C Invalid template: ${t.template}`),console.log(r.cyan(`
|
|
592
|
+
\u{1F4E6} Available templates: ${l.join(", ")}
|
|
593
|
+
`)),process.exit(1));}if(t.dryRun){console.log(r.cyan(`
|
|
584
594
|
\u{1F50D} Dry-run mode - showing what would be created:
|
|
585
|
-
`)),console.log(
|
|
586
|
-
`))):n?t.template.toLowerCase()==="fastapi"?s=await P.prompt([{type:"input",name:"author",message:"Author name:",default:process.env.USER||"RapidKit User"},{type:"input",name:"description",message:"Project description:",default:"FastAPI service generated with RapidKit"}]):s=await P.prompt([{type:"input",name:"author",message:"Author name:",default:process.env.USER||"RapidKit User"},{type:"input",name:"description",message:"Project description:",default:"NestJS application generated with RapidKit"},{type:"list",name:"package_manager",message:"Package manager:",choices:["npm","yarn","pnpm"],default:"npm"}]):s=await P.prompt([{type:"input",name:"author",message:"Author name:",default:process.env.USER||"RapidKit User"}]),n?await
|
|
595
|
+
`)),console.log(r.white("\u{1F4C2} Path:"),a),console.log(r.white("\u{1F4E6} Type:"),n?`Project (${t.template})`:"Workspace"),console.log();return}let s;t.yes?(s={author:process.env.USER||"RapidKit User",description:n?`${t.template==="nestjs"?"NestJS":"FastAPI"} application generated with RapidKit`:void 0,package_manager:"npm"},console.log(r.gray(`Using default values (--yes flag)
|
|
596
|
+
`))):n?t.template.toLowerCase()==="fastapi"?s=await P.prompt([{type:"input",name:"author",message:"Author name:",default:process.env.USER||"RapidKit User"},{type:"input",name:"description",message:"Project description:",default:"FastAPI service generated with RapidKit"}]):s=await P.prompt([{type:"input",name:"author",message:"Author name:",default:process.env.USER||"RapidKit User"},{type:"input",name:"description",message:"Project description:",default:"NestJS application generated with RapidKit"},{type:"list",name:"package_manager",message:"Package manager:",choices:["npm","yarn","pnpm"],default:"npm"}]):s=await P.prompt([{type:"input",name:"author",message:"Author name:",default:process.env.USER||"RapidKit User"}]),n?await K(a,{name:e,template:t.template.toLowerCase(),author:s.author,description:s.description,package_manager:s.package_manager,skipGit:t.skipGit,skipInstall:t.skipInstall}):await B(a,{name:e,author:s.author,skipGit:t.skipGit});}catch(i){i instanceof v?(c.error(`
|
|
587
597
|
\u274C ${i.message}`),i.details&&c.warn(`\u{1F4A1} ${i.details}`),c.debug("Error code:",i.code)):(c.error(`
|
|
588
|
-
\u274C An unexpected error occurred:`),console.error(i)),process.exit(1);}finally{
|
|
589
|
-
`)),console.log(
|
|
590
|
-
`)),console.log(
|
|
591
|
-
`)),console.log(
|
|
592
|
-
`)),console.log(
|
|
593
|
-
`));}process.on("SIGINT",async()=>{if(!
|
|
594
|
-
|
|
595
|
-
\u26A0\uFE0F Interrupted by user`)),
|
|
598
|
+
\u274C An unexpected error occurred:`),console.error(i)),process.exit(1);}finally{f=null;}});function ge(){console.log(r.white(`Usage: npx rapidkit <name> [options]
|
|
599
|
+
`)),console.log(r.bold("Create a workspace (recommended):")),console.log(r.cyan(" npx rapidkit my-workspace")),console.log(r.cyan(" cd my-workspace")),console.log(r.cyan(" rapidkit create my-api --template fastapi")),console.log(r.cyan(" cd my-api")),console.log(r.cyan(` rapidkit dev
|
|
600
|
+
`)),console.log(r.bold("Or create a project directly:")),console.log(r.cyan(" npx rapidkit my-project --template fastapi")),console.log(r.cyan(` npx rapidkit my-project --template nestjs
|
|
601
|
+
`)),console.log(r.bold("Options:")),console.log(r.gray(" -t, --template <template> Create project with template (fastapi, nestjs)")),console.log(r.gray(" -y, --yes Skip prompts and use defaults")),console.log(r.gray(" --skip-git Skip git initialization")),console.log(r.gray(" --skip-install Skip installing dependencies")),console.log(r.gray(" --debug Enable debug logging")),console.log(r.gray(` --dry-run Show what would be created
|
|
602
|
+
`)),console.log(r.bold("Templates:")),console.log(r.gray(" fastapi FastAPI + Python")),console.log(r.gray(` nestjs NestJS + TypeScript
|
|
603
|
+
`));}process.on("SIGINT",async()=>{if(!x){if(x=true,console.log(r.yellow(`
|
|
604
|
+
|
|
605
|
+
\u26A0\uFE0F Interrupted by user`)),f&&await u.pathExists(f)){console.log(r.gray("Cleaning up partial installation..."));try{await u.remove(f),console.log(r.green("\u2713 Cleanup complete"));}catch(e){c.debug("Cleanup failed:",e);}}process.exit(130);}});process.on("SIGTERM",async()=>{if(!x){if(x=true,c.debug("Received SIGTERM"),f&&await u.pathExists(f))try{await u.remove(f);}catch(e){c.debug("Cleanup failed:",e);}process.exit(143);}});me().then(e=>{e||A.parse();});
|
package/dist/package.json
CHANGED