boilercraft 1.0.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 +171 -0
- package/bin/boilercraft.js +110 -0
- package/cli/app.js +596 -0
- package/cli/ui.js +356 -0
- package/docs/STACK_ENGINE.md +93 -0
- package/docs/assets/cli-create.svg +52 -0
- package/docs/assets/cli-menu.svg +47 -0
- package/docs/stacks/dotnet-core.md +69 -0
- package/docs/stacks/laravel-vue.md +46 -0
- package/docs/stacks/nextjs.md +58 -0
- package/docs/stacks/node-express.md +58 -0
- package/docs/stacks/raw-php.md +130 -0
- package/main.js +82 -0
- package/package.json +86 -0
- package/public/index.html +721 -0
- package/public/logo.png +17 -0
- package/public/logo.svg +17 -0
- package/server.js +84 -0
- package/services/componentGenerator.js +195 -0
- package/services/engine/scaffoldEngine.js +517 -0
- package/services/engine/toolInstaller.js +232 -0
- package/services/engine/versionCatalog.js +115 -0
- package/services/generate.js +46 -0
- package/services/projectGenerator.js +686 -0
- package/services/readmeGenerator.js +221 -0
- package/services/themeGenerator.js +150 -0
- package/services/versionResolver.js +176 -0
- package/stacks/dotnet-core/overlays/api/Controllers/ProductsController.cs +33 -0
- package/stacks/dotnet-core/overlays/api/Program.cs +33 -0
- package/stacks/dotnet-core/overlays/api/wwwroot/index.html +38 -0
- package/stacks/dotnet-core/overlays/api-auth/Controllers/AuthController.cs +87 -0
- package/stacks/dotnet-core/overlays/common/Data/ApplicationDbContext.cs +25 -0
- package/stacks/dotnet-core/overlays/common/Models/Product.cs +19 -0
- package/stacks/dotnet-core/overlays/mvc/Controllers/ProductsController.cs +84 -0
- package/stacks/dotnet-core/overlays/mvc/Views/Home/Index.cshtml +23 -0
- package/stacks/dotnet-core/overlays/mvc/Views/Products/Create.cshtml +16 -0
- package/stacks/dotnet-core/overlays/mvc/Views/Products/Delete.cshtml +16 -0
- package/stacks/dotnet-core/overlays/mvc/Views/Products/Edit.cshtml +17 -0
- package/stacks/dotnet-core/overlays/mvc/Views/Products/Index.cshtml +46 -0
- package/stacks/dotnet-core/overlays/mvc/Views/Products/_Form.cshtml +19 -0
- package/stacks/dotnet-core/overlays/mvc-auth/Controllers/AccountController.cs +98 -0
- package/stacks/dotnet-core/overlays/mvc-auth/Models/AppUser.cs +48 -0
- package/stacks/dotnet-core/overlays/mvc-auth/Views/Account/Login.cshtml +35 -0
- package/stacks/dotnet-core/overlays/mvc-auth/Views/Account/Register.cshtml +41 -0
- package/stacks/dotnet-core/overlays/mvc-auth/Views/Shared/_AuthNav.cshtml +22 -0
- package/stacks/dotnet-core/snippets/packages-auth.xml +4 -0
- package/stacks/dotnet-core/snippets/packages-common.xml +5 -0
- package/stacks/dotnet-core/snippets/packages-ef.xml +4 -0
- package/stacks/dotnet-core/snippets/packages-mssql.xml +4 -0
- package/stacks/dotnet-core/snippets/packages-mysql.xml +4 -0
- package/stacks/dotnet-core/snippets/packages-swagger.xml +4 -0
- package/stacks/dotnet-core/stack.json +426 -0
- package/stacks/laravel/overlays/auth/app/Http/Controllers/Api/AuthController.php +67 -0
- package/stacks/laravel/overlays/common/app/Http/Controllers/BoilerCraftController.php +14 -0
- package/stacks/laravel/overlays/common/resources/views/boilercraft.blade.php +36 -0
- package/stacks/laravel/overlays/inertia-common/resources/views/app.blade.php +15 -0
- package/stacks/laravel/overlays/inertia-react/resources/js/Pages/Welcome.jsx +18 -0
- package/stacks/laravel/overlays/inertia-react/resources/js/app.jsx +13 -0
- package/stacks/laravel/overlays/inertia-vue/resources/js/Pages/Welcome.vue +23 -0
- package/stacks/laravel/overlays/inertia-vue/resources/js/app.js +13 -0
- package/stacks/laravel/snippets/api-routes.php +9 -0
- package/stacks/laravel/snippets/web-routes-inertia.php +7 -0
- package/stacks/laravel/snippets/web-routes.php +4 -0
- package/stacks/laravel/stack.json +477 -0
- package/stacks/nextjs/overlays/auth/src/lib/auth.js +36 -0
- package/stacks/nextjs/overlays/auth-app/src/app/api/auth/login/route.js +11 -0
- package/stacks/nextjs/overlays/auth-app/src/app/api/auth/register/route.js +14 -0
- package/stacks/nextjs/overlays/auth-pages/src/pages/api/auth/login.js +14 -0
- package/stacks/nextjs/overlays/auth-pages/src/pages/api/auth/register.js +17 -0
- package/stacks/nextjs/overlays/common/.env.example +3 -0
- package/stacks/nextjs/overlays/common/.env.local +3 -0
- package/stacks/nextjs/overlays/db/mongodb/src/lib/db.js +12 -0
- package/stacks/nextjs/overlays/db/mssql/src/lib/db.js +17 -0
- package/stacks/nextjs/overlays/db/mysql/src/lib/db.js +13 -0
- package/stacks/nextjs/overlays/router-app/src/app/api/health/route.js +10 -0
- package/stacks/nextjs/overlays/router-app/src/app/layout.js +16 -0
- package/stacks/nextjs/overlays/router-app/src/app/page.js +19 -0
- package/stacks/nextjs/overlays/router-pages/src/pages/_app.js +7 -0
- package/stacks/nextjs/overlays/router-pages/src/pages/_document.js +13 -0
- package/stacks/nextjs/overlays/router-pages/src/pages/api/health.js +8 -0
- package/stacks/nextjs/overlays/router-pages/src/pages/index.js +27 -0
- package/stacks/nextjs/stack.json +257 -0
- package/stacks/node-express/overlays/auth/src/controllers/authController.js +53 -0
- package/stacks/node-express/overlays/auth/src/middlewares/auth.js +36 -0
- package/stacks/node-express/overlays/auth/src/routes/authRoutes.js +16 -0
- package/stacks/node-express/overlays/common/.env.example +5 -0
- package/stacks/node-express/overlays/common/public/index.html +31 -0
- package/stacks/node-express/overlays/common/src/server.js +32 -0
- package/stacks/node-express/overlays/db/mongodb/src/db.js +13 -0
- package/stacks/node-express/overlays/db/mssql/src/db.js +22 -0
- package/stacks/node-express/overlays/db/mysql/src/db.js +22 -0
- package/stacks/node-express/stack.json +165 -0
- package/templates/dotnet-bootstrap-mssql/Controllers/AuthController.cs +74 -0
- package/templates/dotnet-bootstrap-mssql/Controllers/ProductsController.cs +33 -0
- package/templates/dotnet-bootstrap-mssql/Data/ApplicationDbContext.cs +24 -0
- package/templates/dotnet-bootstrap-mssql/Models/Product.cs +10 -0
- package/templates/dotnet-core/Controllers/AuthController.cs +74 -0
- package/templates/laravel-full/app/Http/Controllers/AuthController.php +79 -0
- package/templates/laravel-full/app/Http/Controllers/HomeController.php +22 -0
- package/templates/laravel-full/app/Models/User.php +49 -0
- package/templates/laravel-full/artisan +22 -0
- package/templates/laravel-full/bootstrap/app.php +21 -0
- package/templates/laravel-full/config/database.php +54 -0
- package/templates/laravel-full/database/migrations/2024_01_01_000001_create_users_table.php +27 -0
- package/templates/laravel-full/public/index.php +17 -0
- package/templates/laravel-full/resources/css/app.css +3 -0
- package/templates/laravel-full/resources/js/Pages/Home.vue +76 -0
- package/templates/laravel-full/resources/js/app.js +21 -0
- package/templates/laravel-full/resources/js/bootstrap.js +3 -0
- package/templates/laravel-full/resources/views/app.blade.php +15 -0
- package/templates/laravel-full/routes/api.php +8 -0
- package/templates/laravel-full/routes/console.php +7 -0
- package/templates/laravel-full/routes/web.php +24 -0
- package/templates/laravel-full/tailwind.config.js +12 -0
- package/templates/laravel-full/vite.config.js +20 -0
- package/templates/laravel-vue/app/Http/Controllers/Auth/AuthenticatedSessionController.php +43 -0
- package/templates/laravel-vue-mysql/app/Http/Controllers/HomeController.php +25 -0
- package/templates/laravel-vue-mysql/resources/js/Pages/Home.vue +70 -0
- package/templates/nextjs/src/app/api/auth/login/route.js +28 -0
- package/templates/nextjs-mongodb/src/app/api/health/route.js +17 -0
- package/templates/nextjs-mongodb/src/lib/mongodb.js +18 -0
- package/templates/nextjs-mssql/src/app/api/health/route.js +24 -0
- package/templates/nextjs-mssql/src/lib/mssql.js +38 -0
- package/templates/node-express/src/controllers/authController.js +53 -0
- package/templates/node-express/src/middlewares/auth.js +36 -0
- package/templates/node-express/src/routes/authRoutes.js +16 -0
- package/templates/node-mongodb/src/controllers/userController.js +30 -0
- package/templates/node-mongodb/src/middlewares/errorHandler.js +8 -0
- package/templates/node-mongodb/src/models/User.js +23 -0
- package/templates/node-mongodb/src/routes/api.js +9 -0
- package/templates/raw-php-mysql/app/Controllers/AuthController.php +73 -0
- package/templates/raw-php-mysql/app/Controllers/HomeController.php +65 -0
- package/templates/raw-php-mysql/app/Models/User.php +60 -0
- package/templates/raw-php-mysql/app/Views/404.php +15 -0
- package/templates/raw-php-mysql/app/Views/auth/login.php +66 -0
- package/templates/raw-php-mysql/app/Views/auth/register.php +71 -0
- package/templates/raw-php-mysql/app/Views/dashboard.php +50 -0
- package/templates/raw-php-mysql/app/Views/home.php +83 -0
- package/templates/raw-php-mysql/config/Auth.php +62 -0
- package/templates/raw-php-mysql/config/Database.php +100 -0
- package/templates/raw-php-mysql/config/Env.php +30 -0
- package/templates/raw-php-mysql/config/Middleware.php +53 -0
- package/templates/raw-php-mysql/config/QueryBuilder.php +109 -0
- package/templates/raw-php-mysql/config/Router.php +33 -0
- package/templates/raw-php-mysql/public/index.php +57 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 ARG RABBI (https://github.com/itrabbi24)
|
|
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,171 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
|
|
3
|
+
<img src="https://raw.githubusercontent.com/itrabbi24/BoilerCraft/main/assets/icon.png" alt="BoilerCraft" width="140" />
|
|
4
|
+
|
|
5
|
+
# BoilerCraft
|
|
6
|
+
|
|
7
|
+
**Production-ready projects in one command, built on each framework's official tooling.**
|
|
8
|
+
<br />
|
|
9
|
+
Any version · Authentication · Themes · Windows, macOS & Linux
|
|
10
|
+
|
|
11
|
+
[](https://www.npmjs.com/package/boilercraft)
|
|
12
|
+
[](https://nodejs.org)
|
|
13
|
+
[](#)
|
|
14
|
+
[](LICENSE)
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
npx boilercraft
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
<img src="https://raw.githubusercontent.com/itrabbi24/BoilerCraft/main/docs/assets/cli-menu.svg" alt="BoilerCraft main menu" width="760" />
|
|
21
|
+
|
|
22
|
+
</div>
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
## Why BoilerCraft
|
|
27
|
+
|
|
28
|
+
Most boilerplates are a frozen copy of someone's project. They go stale the day a new framework version ships. BoilerCraft works differently:
|
|
29
|
+
|
|
30
|
+
- **Always the real thing.** The base project is created by the framework's own creator (`composer create-project`, `create-next-app`, `dotnet new`, `npm`), so it matches the version you pick exactly.
|
|
31
|
+
- **Any version, including future ones.** Versions are fetched live from npm, Packagist and the .NET release index. A new release shows up in the menu without an update to BoilerCraft.
|
|
32
|
+
- **Ready to build on.** Auth, database wiring, a themed landing page and UI components are added on top, so you start with a working app instead of a blank one.
|
|
33
|
+
- **One command, zero setup.** Everything happens inside `npx boilercraft`. Missing PHP, Composer or the .NET SDK? It offers to install them for you.
|
|
34
|
+
|
|
35
|
+
## Quick start
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
npx boilercraft
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
Choose **Create a new project** and answer a few questions (↑/↓ to move, Enter to select):
|
|
42
|
+
|
|
43
|
+
<div align="center">
|
|
44
|
+
<img src="https://raw.githubusercontent.com/itrabbi24/BoilerCraft/main/docs/assets/cli-create.svg" alt="Creating a Laravel project" width="760" />
|
|
45
|
+
</div>
|
|
46
|
+
|
|
47
|
+
When it's done, pick **Start the dev server** or **Open in VS Code** from the same menu. You don't need to type `cd` or any other command.
|
|
48
|
+
|
|
49
|
+
## What you can create
|
|
50
|
+
|
|
51
|
+
| Framework | Versions | Choices | Databases | Auth |
|
|
52
|
+
|---|---|---|---|---|
|
|
53
|
+
| **Laravel** | 10 – 13 | Blade · Vue 3 (Inertia) · React (Inertia) | MySQL · SQL Server | Sanctum API tokens, or full Breeze UI (login, register, profile) for Vue/React |
|
|
54
|
+
| **Next.js** | 14 – 16 | App Router · Pages Router | MongoDB · MySQL · SQL Server | JWT register/login API routes |
|
|
55
|
+
| **.NET** | 8 – 10 | MVC (Model · View · Controller) · Web API | SQL Server · MySQL | MVC: cookie login/register pages · API: JWT + Swagger |
|
|
56
|
+
| **Node.js + Express** | 4 – 5 | — | MySQL · MongoDB · SQL Server | JWT middleware with roles |
|
|
57
|
+
| **Raw PHP (MVC)** | — | — | MySQL | Session auth |
|
|
58
|
+
|
|
59
|
+
Every project also gets:
|
|
60
|
+
- A **theme**: Slate Midnight, Cyber Emerald, Royal Indigo or Crimson Amber, in dark, light or both with a toggle.
|
|
61
|
+
- **Styling** with Tailwind CSS, Bootstrap 5 or plain CSS.
|
|
62
|
+
- Optional **UI components**: skeleton loaders, spinners, modals, off-canvas drawers.
|
|
63
|
+
|
|
64
|
+
The version list above is just what's verified today. Newer releases appear automatically and are marked *preview support* until verified.
|
|
65
|
+
|
|
66
|
+
## Missing a toolchain?
|
|
67
|
+
|
|
68
|
+
BoilerCraft checks what's installed and offers to set up the rest. You can also do it any time from **Check & install tools** in the menu.
|
|
69
|
+
|
|
70
|
+
| Tool | Needed for | How BoilerCraft installs it |
|
|
71
|
+
|---|---|---|
|
|
72
|
+
| .NET SDK | .NET | Microsoft's official `dotnet-install` script, exact version, user folder, **no admin rights** |
|
|
73
|
+
| Composer | Laravel | Official installer, signature-verified, user folder |
|
|
74
|
+
| PHP | Laravel, Raw PHP | `winget` (Windows) · Homebrew (macOS) · apt / dnf / pacman (Linux) |
|
|
75
|
+
| Node.js | Next.js, Express | Already there, since `npx` runs on it |
|
|
76
|
+
|
|
77
|
+
Tools installed into the user folder live in `~/.boilercraft/tools` and are added to your user PATH.
|
|
78
|
+
|
|
79
|
+
## Web studio
|
|
80
|
+
|
|
81
|
+
Prefer a browser? Choose **Open the web studio** in the menu. You get the same generator as a visual form at `http://localhost:4800`.
|
|
82
|
+
|
|
83
|
+
<details>
|
|
84
|
+
<summary><b>Automation (scripts and CI)</b></summary>
|
|
85
|
+
|
|
86
|
+
<br />
|
|
87
|
+
|
|
88
|
+
Every question has a flag. Anything you leave out is asked interactively, or takes its default with `-y`.
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
npx boilercraft new shop -s laravel -v 13 --frontend vue -t emerald -d mysql -y
|
|
92
|
+
npx boilercraft new web -s nextjs --router pages --no-auth -d mongodb -y
|
|
93
|
+
npx boilercraft new admin -s dotnet-core -v 10 --template mvc -y --install-tools
|
|
94
|
+
npx boilercraft --help
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
</details>
|
|
98
|
+
|
|
99
|
+
<details>
|
|
100
|
+
<summary><b>How new framework versions are handled</b></summary>
|
|
101
|
+
|
|
102
|
+
<br />
|
|
103
|
+
|
|
104
|
+
Each framework is described by a small manifest in [`stacks/<id>/stack.json`](stacks). It covers where versions come from, which official creator to run, and which BoilerCraft files to add, and each step can be limited to certain versions. In practice:
|
|
105
|
+
|
|
106
|
+
- **A new release usually needs nothing.** It appears in the menu automatically.
|
|
107
|
+
- **If a release changes something BoilerCraft relies on,** one version-scoped rule is added to the manifest. No code change is needed.
|
|
108
|
+
|
|
109
|
+
Full reference: [docs/STACK_ENGINE.md](docs/STACK_ENGINE.md).
|
|
110
|
+
|
|
111
|
+
</details>
|
|
112
|
+
|
|
113
|
+
<details>
|
|
114
|
+
<summary><b>Project structure</b></summary>
|
|
115
|
+
|
|
116
|
+
<br />
|
|
117
|
+
|
|
118
|
+
```text
|
|
119
|
+
BoilerCraft/
|
|
120
|
+
├── bin/boilercraft.js # CLI entry (npx boilercraft)
|
|
121
|
+
├── cli/ # Interactive menus, banner and prompts
|
|
122
|
+
├── stacks/<id>/ # One folder per framework
|
|
123
|
+
│ ├── stack.json # versions, official creator, version-scoped steps
|
|
124
|
+
│ └── overlays/ # files BoilerCraft adds on top
|
|
125
|
+
├── services/
|
|
126
|
+
│ ├── engine/ # Manifest runner, live version catalog, tool installer
|
|
127
|
+
│ ├── generate.js # Shared entry for the CLI and web studio
|
|
128
|
+
│ ├── themeGenerator.js # Theme palettes and dark/light CSS
|
|
129
|
+
│ └── componentGenerator.js # Skeleton, spinner, modal and drawer components
|
|
130
|
+
├── templates/ # Offline fallback templates (and Raw PHP)
|
|
131
|
+
├── public/index.html # Web studio
|
|
132
|
+
└── server.js # Web studio API
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
</details>
|
|
136
|
+
|
|
137
|
+
<details>
|
|
138
|
+
<summary><b>Working on BoilerCraft</b></summary>
|
|
139
|
+
|
|
140
|
+
<br />
|
|
141
|
+
|
|
142
|
+
```bash
|
|
143
|
+
git clone https://github.com/itrabbi24/BoilerCraft.git
|
|
144
|
+
cd BoilerCraft
|
|
145
|
+
npm install
|
|
146
|
+
node bin/boilercraft.js
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
To test exactly what npm users get: run `npm pack`, then `npx --package=./boilercraft-<version>.tgz boilercraft` in an empty folder.
|
|
150
|
+
|
|
151
|
+
**Releasing:** bump `version` in `package.json`, then run `npm publish`. Alternatively, push a `vX.Y.Z` tag: GitHub Actions smoke-tests on Windows, macOS and Linux and then publishes (requires the `NPM_TOKEN` repository secret).
|
|
152
|
+
|
|
153
|
+
</details>
|
|
154
|
+
|
|
155
|
+
## Contributing
|
|
156
|
+
|
|
157
|
+
Issues and pull requests are welcome. Please see the [issues page](https://github.com/itrabbi24/BoilerCraft/issues).
|
|
158
|
+
|
|
159
|
+
1. Fork the repository.
|
|
160
|
+
2. Create a branch: `git checkout -b feature/my-feature`.
|
|
161
|
+
3. Commit your changes and open a pull request.
|
|
162
|
+
|
|
163
|
+
## Author
|
|
164
|
+
|
|
165
|
+
**ARG RABBI** · [@itrabbi24](https://github.com/itrabbi24)
|
|
166
|
+
|
|
167
|
+
If BoilerCraft saves you time, a ⭐ on [GitHub](https://github.com/itrabbi24/BoilerCraft) is appreciated.
|
|
168
|
+
|
|
169
|
+
## License
|
|
170
|
+
|
|
171
|
+
[MIT](LICENSE) © 2026 ARG RABBI
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* BoilerCraft CLI — cross-platform (Windows / macOS / Linux).
|
|
4
|
+
*
|
|
5
|
+
* Everything is reachable from one command:
|
|
6
|
+
*
|
|
7
|
+
* npx boilercraft
|
|
8
|
+
*
|
|
9
|
+
* which opens an interactive menu (create project, install tools, browse
|
|
10
|
+
* versions, web studio). Flags exist only for scripts/CI, e.g.
|
|
11
|
+
* npx boilercraft new my-app -s laravel -v 12 -y
|
|
12
|
+
* See `npx boilercraft --help`.
|
|
13
|
+
*/
|
|
14
|
+
process.env.BOILERCRAFT_CLI = '1';
|
|
15
|
+
|
|
16
|
+
const [major, minor] = process.versions.node.split('.').map(Number);
|
|
17
|
+
if (major < 18 || (major === 18 && minor < 3)) {
|
|
18
|
+
console.error(`BoilerCraft needs Node.js 18.3 or newer (you have ${process.version}). Get it at https://nodejs.org`);
|
|
19
|
+
process.exit(1);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const { parseArgs } = require('util');
|
|
23
|
+
const ui = require('../cli/ui');
|
|
24
|
+
const app = require('../cli/app');
|
|
25
|
+
const pkg = require('../package.json');
|
|
26
|
+
|
|
27
|
+
const { c } = ui;
|
|
28
|
+
|
|
29
|
+
const HELP = `
|
|
30
|
+
${ui.gradient('BoilerCraft')} ${c.gray(`v${pkg.version}`)} ${c.gray('· by')} ${c.bold(app.AUTHOR)}
|
|
31
|
+
|
|
32
|
+
${c.bold('Usage')}
|
|
33
|
+
${c.cyan('npx boilercraft')} Opens the interactive menu. This is all you need.
|
|
34
|
+
|
|
35
|
+
${c.bold('Automation')} ${c.gray('(scripts / CI, no prompts)')}
|
|
36
|
+
npx boilercraft new <name> [flags]
|
|
37
|
+
|
|
38
|
+
-s, --stack <id> laravel | nextjs | node-express | dotnet-core | raw-php
|
|
39
|
+
-v, --version <major> Framework major version (default: recommended)
|
|
40
|
+
--auth / --no-auth Authentication module (default: on)
|
|
41
|
+
--router <type> app | pages (Next.js, default: app)
|
|
42
|
+
--frontend <name> blade | vue | react (Laravel, default: blade)
|
|
43
|
+
--template <type> mvc | api (.NET, default: mvc)
|
|
44
|
+
-t, --theme <name> midnight | emerald | royal | crimson
|
|
45
|
+
-m, --mode <mode> all | dark | light
|
|
46
|
+
-d, --db <name> mysql | mssql | mongodb
|
|
47
|
+
--styling <name> tailwind | bootstrap | vanilla
|
|
48
|
+
-o, --out <dir> Parent folder (default: current directory)
|
|
49
|
+
-y, --yes Defaults for anything not given
|
|
50
|
+
--install-tools Install missing PHP / Composer / .NET SDK automatically
|
|
51
|
+
--no-fallback Fail instead of using offline templates
|
|
52
|
+
-h, --help This help
|
|
53
|
+
`;
|
|
54
|
+
|
|
55
|
+
async function main() {
|
|
56
|
+
const { values, positionals } = parseArgs({
|
|
57
|
+
allowPositionals: true,
|
|
58
|
+
allowNegative: true,
|
|
59
|
+
options: {
|
|
60
|
+
stack: { type: 'string', short: 's' },
|
|
61
|
+
version: { type: 'string', short: 'v' },
|
|
62
|
+
auth: { type: 'boolean' },
|
|
63
|
+
theme: { type: 'string', short: 't' },
|
|
64
|
+
mode: { type: 'string', short: 'm' },
|
|
65
|
+
router: { type: 'string' },
|
|
66
|
+
frontend: { type: 'string' },
|
|
67
|
+
template: { type: 'string' },
|
|
68
|
+
db: { type: 'string', short: 'd' },
|
|
69
|
+
styling: { type: 'string' },
|
|
70
|
+
port: { type: 'string' },
|
|
71
|
+
title: { type: 'string' },
|
|
72
|
+
author: { type: 'string' },
|
|
73
|
+
out: { type: 'string', short: 'o' },
|
|
74
|
+
yes: { type: 'boolean', short: 'y' },
|
|
75
|
+
'install-tools': { type: 'boolean' },
|
|
76
|
+
fallback: { type: 'boolean' },
|
|
77
|
+
help: { type: 'boolean', short: 'h' }
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
if (values.help || positionals[0] === 'help') return console.log(HELP);
|
|
82
|
+
|
|
83
|
+
const [command, name] = positionals;
|
|
84
|
+
if (!command) return app.home();
|
|
85
|
+
|
|
86
|
+
// Non-interactive / scripted use.
|
|
87
|
+
if (command === 'new' || command === 'create') {
|
|
88
|
+
app.printBanner();
|
|
89
|
+
const given = { ...values, name, installTools: values['install-tools'], noFallback: values.fallback === false };
|
|
90
|
+
await app.createFlow(given);
|
|
91
|
+
return app.goodbye();
|
|
92
|
+
}
|
|
93
|
+
if (command === 'list') return app.browseFlow();
|
|
94
|
+
if (command === 'doctor' || command === 'tools') return app.toolsFlow();
|
|
95
|
+
|
|
96
|
+
// `npx boilercraft my-app` → menu-free create with the name filled in.
|
|
97
|
+
app.printBanner();
|
|
98
|
+
await app.createFlow({ ...values, name: command });
|
|
99
|
+
app.goodbye();
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
main().catch(err => {
|
|
103
|
+
if (err instanceof ui.CancelError) {
|
|
104
|
+
console.log(`\n ${c.gray('Cancelled.')}\n`);
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
ui.log.error(err.message);
|
|
108
|
+
console.log('');
|
|
109
|
+
process.exitCode = 1;
|
|
110
|
+
});
|