create-nexusts 0.7.0
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/LICENSE +21 -0
- package/README.md +79 -0
- package/index.js +100 -0
- package/package.json +42 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 NexusJS Contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
# create-nexusts
|
|
2
|
+
|
|
3
|
+
> Scaffold a new [NexusTS](https://github.com/kabyeon/nexusts) project — Bun-native fullstack framework.
|
|
4
|
+
|
|
5
|
+
The official scaffolder for [NexusTS](https://github.com/kabyeon/nexusts). Creates a new project with the framework's MVC + DI + routing + validation stack pre-configured, plus your choice of view engine, ORM, and database.
|
|
6
|
+
|
|
7
|
+
## Quick start
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
# All three forms are equivalent:
|
|
11
|
+
npm create nexusts@latest my-app
|
|
12
|
+
npx create-nexusts@latest my-app
|
|
13
|
+
bunx create-nexusts@latest my-app
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
Then:
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
cd my-app
|
|
20
|
+
bun install
|
|
21
|
+
bun run dev
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Your app will be running at `http://localhost:3000`.
|
|
25
|
+
|
|
26
|
+
## Options
|
|
27
|
+
|
|
28
|
+
| Flag | Default | Description |
|
|
29
|
+
|------|---------|-------------|
|
|
30
|
+
| `--style` | `nest` | Routing style: `nest`, `adonis`, `functional` |
|
|
31
|
+
| `--view` | `rendu` | View engine: `rendu`, `edge`, `eta`, `inertia`, `none` |
|
|
32
|
+
| `--orm` | `drizzle` | ORM: `drizzle`, `prisma`, `kysely`, `none` |
|
|
33
|
+
| `--db` | `bun-sqlite` | Database: `bun-sqlite`, `postgres`, `mysql`, `none` |
|
|
34
|
+
|
|
35
|
+
### Examples
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
# Minimal: NestJS-style + Rendu + Drizzle + SQLite
|
|
39
|
+
npm create nexusts@latest my-app
|
|
40
|
+
|
|
41
|
+
# Inertia.js v2 + React SPA
|
|
42
|
+
npm create nexusts@latest my-app --view inertia
|
|
43
|
+
|
|
44
|
+
# No ORM (just an HTTP skeleton)
|
|
45
|
+
npm create nexusts@latest my-app --orm none --db none
|
|
46
|
+
|
|
47
|
+
# Functional handler style (Hono-style)
|
|
48
|
+
npm create nexusts@latest my-app --style functional
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## What you get
|
|
52
|
+
|
|
53
|
+
A complete project structure:
|
|
54
|
+
|
|
55
|
+
```
|
|
56
|
+
my-app/
|
|
57
|
+
├── app/
|
|
58
|
+
│ ├── app.module.ts # Root module
|
|
59
|
+
│ ├── app.controller.ts # Example controller
|
|
60
|
+
│ ├── app.service.ts # Example service
|
|
61
|
+
│ └── main.ts # Bootstrap (listens on PORT)
|
|
62
|
+
├── app.config.ts # Framework config (loaded at boot)
|
|
63
|
+
├── package.json # @nexusts/core + your chosen add-ons
|
|
64
|
+
├── tsconfig.json # Legacy decorators (Bun 1.3 compatible)
|
|
65
|
+
└── README.md # Project-specific README
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
Internally this runs `npx @nexusts/core init` in the new directory — you can use that command directly in an existing project to add NexusTS without losing files.
|
|
69
|
+
|
|
70
|
+
## Help
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
create-nexusts --help # Show usage
|
|
74
|
+
create-nexusts --version # Show version
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
## License
|
|
78
|
+
|
|
79
|
+
MIT — see the [LICENSE](./LICENSE) file in the main [NexusTS repo](https://github.com/kabyeon/nexusts).
|
package/index.js
ADDED
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* create-nexusts — scaffold a new NexusTS project.
|
|
4
|
+
*
|
|
5
|
+
* Usage (all three forms work identically):
|
|
6
|
+
* npm create nexusts@latest
|
|
7
|
+
* npx create-nexusts@latest
|
|
8
|
+
* bunx create-nexusts@latest
|
|
9
|
+
*
|
|
10
|
+
* Examples:
|
|
11
|
+
* npm create nexusts@latest my-app
|
|
12
|
+
* npm create nexusts@latest my-app --view rendu --orm drizzle --db bun-sqlite
|
|
13
|
+
*
|
|
14
|
+
* Internally calls `npx @nexusts/core init` in the new directory to
|
|
15
|
+
* do the heavy lifting.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
import { spawn } from "node:child_process";
|
|
19
|
+
import { existsSync, mkdirSync, writeFileSync } from "node:fs";
|
|
20
|
+
import { resolve, join } from "node:path";
|
|
21
|
+
|
|
22
|
+
const args = process.argv.slice(2);
|
|
23
|
+
const name = args[0];
|
|
24
|
+
|
|
25
|
+
// ── Help / version flags ────────────────────────────────────────────
|
|
26
|
+
if (!name || name === "-h" || name === "--help" || name === "-?") {
|
|
27
|
+
console.log(`
|
|
28
|
+
create-nexusts — scaffold a new NexusTS project
|
|
29
|
+
|
|
30
|
+
Usage:
|
|
31
|
+
npm create nexusts@latest [name] [options]
|
|
32
|
+
|
|
33
|
+
Examples:
|
|
34
|
+
npm create nexusts@latest my-app
|
|
35
|
+
npm create nexusts@latest my-app --view rendu --orm drizzle --db bun-sqlite
|
|
36
|
+
|
|
37
|
+
Options:
|
|
38
|
+
--style <nest|adonis|functional> Routing style (default: nest)
|
|
39
|
+
--view <rendu|edge|eta|inertia|none> View engine (default: rendu)
|
|
40
|
+
--orm <drizzle|prisma|kysely|none> ORM (default: drizzle)
|
|
41
|
+
--db <bun-sqlite|postgres|mysql|none> Database (default: bun-sqlite)
|
|
42
|
+
`);
|
|
43
|
+
process.exit(name ? 0 : 1);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
if (name === "-v" || name === "--version") {
|
|
47
|
+
const pkg = JSON.parse(
|
|
48
|
+
(await import("node:fs")).readFileSync(
|
|
49
|
+
new URL("./package.json", import.meta.url),
|
|
50
|
+
"utf8",
|
|
51
|
+
),
|
|
52
|
+
);
|
|
53
|
+
console.log(`create-nexusts v${pkg.version}`);
|
|
54
|
+
process.exit(0);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
const target = resolve(process.cwd(), name);
|
|
58
|
+
|
|
59
|
+
if (existsSync(target)) {
|
|
60
|
+
console.error(`\n ✖ Error: Directory "${name}" already exists.\n`);
|
|
61
|
+
process.exit(1);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
mkdirSync(target, { recursive: true });
|
|
65
|
+
|
|
66
|
+
// Create a minimal package.json so the init command can merge into it.
|
|
67
|
+
writeFileSync(
|
|
68
|
+
join(target, "package.json"),
|
|
69
|
+
JSON.stringify({ name, type: "module", private: true }, null, 2) + "\n",
|
|
70
|
+
);
|
|
71
|
+
|
|
72
|
+
console.log(`\n ✦ Scaffolding ${name}...\n`);
|
|
73
|
+
|
|
74
|
+
// Detect the runner we were invoked through.
|
|
75
|
+
const isBun = typeof Bun !== "undefined";
|
|
76
|
+
const runner = isBun ? "bunx" : "npx";
|
|
77
|
+
|
|
78
|
+
// Run @nexusts/core init in the target directory.
|
|
79
|
+
const initArgs = ["@nexusts/core", "init", "--no-interaction", ...args.slice(1)];
|
|
80
|
+
const child = spawn(runner, initArgs, {
|
|
81
|
+
cwd: target,
|
|
82
|
+
stdio: "inherit",
|
|
83
|
+
shell: process.platform === "win32",
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
child.on("exit", (code) => {
|
|
87
|
+
if (code === 0) {
|
|
88
|
+
console.log(`
|
|
89
|
+
✦ Done!
|
|
90
|
+
|
|
91
|
+
cd ${name}
|
|
92
|
+
bun install
|
|
93
|
+
bun run dev
|
|
94
|
+
|
|
95
|
+
Happy hacking with NexusTS!
|
|
96
|
+
`);
|
|
97
|
+
} else {
|
|
98
|
+
process.exit(code ?? 1);
|
|
99
|
+
}
|
|
100
|
+
});
|
package/package.json
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "create-nexusts",
|
|
3
|
+
"version": "0.7.0",
|
|
4
|
+
"description": "Scaffold a new NexusTS project — npm create nexusts@latest, bunx create-nexusts, or npx create-nexusts",
|
|
5
|
+
"bin": {
|
|
6
|
+
"create-nexusts": "index.js"
|
|
7
|
+
},
|
|
8
|
+
"type": "module",
|
|
9
|
+
"main": "index.js",
|
|
10
|
+
"files": [
|
|
11
|
+
"index.js",
|
|
12
|
+
"package.json",
|
|
13
|
+
"README.md",
|
|
14
|
+
"LICENSE"
|
|
15
|
+
],
|
|
16
|
+
"scripts": {
|
|
17
|
+
"test": "node index.js --help || true"
|
|
18
|
+
},
|
|
19
|
+
"license": "MIT",
|
|
20
|
+
"repository": {
|
|
21
|
+
"type": "git",
|
|
22
|
+
"url": "git+https://github.com/kabyeon/nexusts.git",
|
|
23
|
+
"directory": "packages/create-nexusts"
|
|
24
|
+
},
|
|
25
|
+
"homepage": "https://github.com/kabyeon/nexusts#readme",
|
|
26
|
+
"bugs": {
|
|
27
|
+
"url": "https://github.com/kabyeon/nexusts/issues"
|
|
28
|
+
},
|
|
29
|
+
"engines": {
|
|
30
|
+
"node": ">=18",
|
|
31
|
+
"bun": ">=1.0"
|
|
32
|
+
},
|
|
33
|
+
"keywords": [
|
|
34
|
+
"nexusts",
|
|
35
|
+
"create-nexusts",
|
|
36
|
+
"scaffold",
|
|
37
|
+
"framework",
|
|
38
|
+
"bun",
|
|
39
|
+
"fullstack",
|
|
40
|
+
"typescript"
|
|
41
|
+
]
|
|
42
|
+
}
|