create-warlock 4.0.171 → 4.1.1
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/cjs/index.cjs +780 -0
- package/cjs/index.cjs.map +1 -0
- package/cjs/paths-Bl9Wn7qV.cjs +247 -0
- package/cjs/paths-Bl9Wn7qV.cjs.map +1 -0
- package/cjs/project-builder-helpers-DGcgf60P.cjs +27 -0
- package/cjs/project-builder-helpers-DGcgf60P.cjs.map +1 -0
- package/esm/commands/create-new-app/get-app-path.mjs +17 -0
- package/esm/commands/create-new-app/get-app-path.mjs.map +1 -0
- package/esm/commands/create-new-app/index.mjs +152 -0
- package/esm/commands/create-new-app/index.mjs.map +1 -0
- package/esm/commands/create-new-app/types.d.mts +18 -0
- package/esm/commands/create-warlock-app/index.mjs +57 -0
- package/esm/commands/create-warlock-app/index.mjs.map +1 -0
- package/esm/features/database-drivers.mjs +47 -0
- package/esm/features/database-drivers.mjs.map +1 -0
- package/esm/features/features-map.mjs +157 -0
- package/esm/features/features-map.mjs.map +1 -0
- package/esm/helpers/app.mjs +157 -0
- package/esm/helpers/app.mjs.map +1 -0
- package/esm/helpers/exec.mjs +58 -0
- package/esm/helpers/exec.mjs.map +1 -0
- package/esm/helpers/package-manager.mjs +84 -0
- package/esm/helpers/package-manager.mjs.map +1 -0
- package/esm/helpers/paths.mjs +16 -0
- package/esm/helpers/paths.mjs.map +1 -0
- package/esm/helpers/project-builder-helpers.mjs +28 -0
- package/esm/helpers/project-builder-helpers.mjs.map +1 -0
- package/esm/index.d.mts +14 -0
- package/esm/index.mjs +83 -0
- package/esm/index.mjs.map +1 -0
- package/esm/ui/{banner.js → banner.mjs} +51 -67
- package/esm/ui/banner.mjs.map +1 -0
- package/esm/ui/spinners.mjs +23 -0
- package/esm/ui/spinners.mjs.map +1 -0
- package/llms-full.txt +121 -0
- package/llms.txt +9 -0
- package/package.json +36 -40
- package/skills/create-a-warlock-project/SKILL.md +111 -0
- package/templates/warlock/.prettierrc.json +10 -11
- package/templates/warlock/_.gitignore +0 -1
- package/templates/warlock/package.json +71 -66
- package/templates/warlock/src/app/auth/controllers/login.controller.ts +5 -6
- package/templates/warlock/src/app/auth/controllers/reset-password.controller.ts +5 -6
- package/templates/warlock/src/app/auth/models/otp/migrations/22-12-2025_10-30-20.otp-migration.ts +33 -43
- package/templates/warlock/src/app/auth/requests/guarded.request.ts +5 -1
- package/templates/warlock/src/app/posts/controllers/create-new-post.controller.ts +5 -6
- package/templates/warlock/src/app/posts/controllers/update-post.controller.ts +4 -5
- package/templates/warlock/src/app/posts/models/post/migrations/09-01-2026_02-07-51-post.migration.ts +21 -34
- package/templates/warlock/src/app/posts/models/post/post.model.ts +0 -2
- package/templates/warlock/src/app/posts/{validation → schema}/create-post.schema.ts +1 -1
- package/templates/warlock/src/app/posts/{validation → schema}/update-post.schema.ts +1 -1
- package/templates/warlock/src/app/shared/utils/locales.ts +34 -0
- package/templates/warlock/src/app/shared/utils/router.ts +1 -1
- package/templates/warlock/src/app/uploads/controllers/fetch-uploaded-file.controller.ts +1 -1
- package/templates/warlock/src/app/users/controllers/create-new-user.controller.ts +4 -4
- package/templates/warlock/src/app/users/controllers/list-users.controller.ts +3 -12
- package/templates/warlock/src/app/users/models/user/migrations/11-12-2025_23-58-03-user.migration.ts +13 -33
- package/templates/warlock/src/app/users/{validation → schema}/create-user.schema.ts +1 -1
- package/templates/warlock/storage/.gitignore +2 -0
- package/templates/warlock/yarn.lock +2332 -0
- package/cjs/commands/create-new-app/get-app-path.d.ts +0 -2
- package/cjs/commands/create-new-app/get-app-path.d.ts.map +0 -1
- package/cjs/commands/create-new-app/get-app-path.js +0 -8
- package/cjs/commands/create-new-app/get-app-path.js.map +0 -1
- package/cjs/commands/create-new-app/index.d.ts +0 -2
- package/cjs/commands/create-new-app/index.d.ts.map +0 -1
- package/cjs/commands/create-new-app/index.js +0 -96
- package/cjs/commands/create-new-app/index.js.map +0 -1
- package/cjs/commands/create-new-app/types.d.ts +0 -16
- package/cjs/commands/create-new-app/types.d.ts.map +0 -1
- package/cjs/commands/create-warlock-app/index.d.ts +0 -3
- package/cjs/commands/create-warlock-app/index.d.ts.map +0 -1
- package/cjs/commands/create-warlock-app/index.js +0 -55
- package/cjs/commands/create-warlock-app/index.js.map +0 -1
- package/cjs/features/database-drivers.d.ts +0 -31
- package/cjs/features/database-drivers.d.ts.map +0 -1
- package/cjs/features/database-drivers.js +0 -53
- package/cjs/features/database-drivers.js.map +0 -1
- package/cjs/features/features-map.d.ts +0 -35
- package/cjs/features/features-map.d.ts.map +0 -1
- package/cjs/features/features-map.js +0 -120
- package/cjs/features/features-map.js.map +0 -1
- package/cjs/helpers/app.d.ts +0 -71
- package/cjs/helpers/app.d.ts.map +0 -1
- package/cjs/helpers/app.js +0 -196
- package/cjs/helpers/app.js.map +0 -1
- package/cjs/helpers/exec.d.ts +0 -10
- package/cjs/helpers/exec.d.ts.map +0 -1
- package/cjs/helpers/exec.js +0 -69
- package/cjs/helpers/exec.js.map +0 -1
- package/cjs/helpers/package-manager.d.ts +0 -18
- package/cjs/helpers/package-manager.d.ts.map +0 -1
- package/cjs/helpers/package-manager.js +0 -104
- package/cjs/helpers/package-manager.js.map +0 -1
- package/cjs/helpers/paths.d.ts +0 -4
- package/cjs/helpers/paths.d.ts.map +0 -1
- package/cjs/helpers/paths.js +0 -8
- package/cjs/helpers/paths.js.map +0 -1
- package/cjs/helpers/project-builder-helpers.d.ts +0 -6
- package/cjs/helpers/project-builder-helpers.d.ts.map +0 -1
- package/cjs/helpers/project-builder-helpers.js +0 -11
- package/cjs/helpers/project-builder-helpers.js.map +0 -1
- package/cjs/index.d.ts +0 -2
- package/cjs/index.d.ts.map +0 -1
- package/cjs/index.js +0 -3
- package/cjs/index.js.map +0 -1
- package/cjs/ui/banner.d.ts +0 -29
- package/cjs/ui/banner.d.ts.map +0 -1
- package/cjs/ui/banner.js +0 -142
- package/cjs/ui/banner.js.map +0 -1
- package/cjs/ui/spinners.d.ts +0 -18
- package/cjs/ui/spinners.d.ts.map +0 -1
- package/cjs/ui/spinners.js +0 -17
- package/cjs/ui/spinners.js.map +0 -1
- package/create-app.js +0 -5
- package/esm/commands/create-new-app/get-app-path.d.ts +0 -2
- package/esm/commands/create-new-app/get-app-path.d.ts.map +0 -1
- package/esm/commands/create-new-app/get-app-path.js +0 -8
- package/esm/commands/create-new-app/get-app-path.js.map +0 -1
- package/esm/commands/create-new-app/index.d.ts +0 -2
- package/esm/commands/create-new-app/index.d.ts.map +0 -1
- package/esm/commands/create-new-app/index.js +0 -96
- package/esm/commands/create-new-app/index.js.map +0 -1
- package/esm/commands/create-new-app/types.d.ts +0 -16
- package/esm/commands/create-new-app/types.d.ts.map +0 -1
- package/esm/commands/create-warlock-app/index.d.ts +0 -3
- package/esm/commands/create-warlock-app/index.d.ts.map +0 -1
- package/esm/commands/create-warlock-app/index.js +0 -55
- package/esm/commands/create-warlock-app/index.js.map +0 -1
- package/esm/features/database-drivers.d.ts +0 -31
- package/esm/features/database-drivers.d.ts.map +0 -1
- package/esm/features/database-drivers.js +0 -53
- package/esm/features/database-drivers.js.map +0 -1
- package/esm/features/features-map.d.ts +0 -35
- package/esm/features/features-map.d.ts.map +0 -1
- package/esm/features/features-map.js +0 -120
- package/esm/features/features-map.js.map +0 -1
- package/esm/helpers/app.d.ts +0 -71
- package/esm/helpers/app.d.ts.map +0 -1
- package/esm/helpers/app.js +0 -196
- package/esm/helpers/app.js.map +0 -1
- package/esm/helpers/exec.d.ts +0 -10
- package/esm/helpers/exec.d.ts.map +0 -1
- package/esm/helpers/exec.js +0 -69
- package/esm/helpers/exec.js.map +0 -1
- package/esm/helpers/package-manager.d.ts +0 -18
- package/esm/helpers/package-manager.d.ts.map +0 -1
- package/esm/helpers/package-manager.js +0 -104
- package/esm/helpers/package-manager.js.map +0 -1
- package/esm/helpers/paths.d.ts +0 -4
- package/esm/helpers/paths.d.ts.map +0 -1
- package/esm/helpers/paths.js +0 -8
- package/esm/helpers/paths.js.map +0 -1
- package/esm/helpers/project-builder-helpers.d.ts +0 -6
- package/esm/helpers/project-builder-helpers.d.ts.map +0 -1
- package/esm/helpers/project-builder-helpers.js +0 -11
- package/esm/helpers/project-builder-helpers.js.map +0 -1
- package/esm/index.d.ts +0 -2
- package/esm/index.d.ts.map +0 -1
- package/esm/index.js +0 -3
- package/esm/index.js.map +0 -1
- package/esm/ui/banner.d.ts +0 -29
- package/esm/ui/banner.d.ts.map +0 -1
- package/esm/ui/banner.js.map +0 -1
- package/esm/ui/spinners.d.ts +0 -18
- package/esm/ui/spinners.d.ts.map +0 -1
- package/esm/ui/spinners.js +0 -17
- package/esm/ui/spinners.js.map +0 -1
- package/templates/warlock/src/app/auth/requests/login.request.ts +0 -4
- package/templates/warlock/src/app/auth/requests/reset-password.request.ts +0 -4
- package/templates/warlock/src/app/posts/requests/create-post.request.ts +0 -4
- package/templates/warlock/src/app/posts/requests/update-post.request.ts +0 -4
- package/templates/warlock/src/app/users/requests/create-user.request.ts +0 -4
package/cjs/index.cjs
ADDED
|
@@ -0,0 +1,780 @@
|
|
|
1
|
+
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
|
|
2
|
+
const require_paths = require('./paths-Bl9Wn7qV.cjs');
|
|
3
|
+
let _clack_prompts = require("@clack/prompts");
|
|
4
|
+
let _mongez_copper = require("@mongez/copper");
|
|
5
|
+
let _warlock_js_fs = require("@warlock.js/fs");
|
|
6
|
+
let path = require("path");
|
|
7
|
+
path = require_paths.__toESM(path, 1);
|
|
8
|
+
|
|
9
|
+
//#region ../../@warlock.js/create-warlock/src/features/database-drivers.ts
|
|
10
|
+
const databaseDrivers = [
|
|
11
|
+
{
|
|
12
|
+
value: "mongodb",
|
|
13
|
+
label: "MongoDB",
|
|
14
|
+
package: "mongodb",
|
|
15
|
+
packageVersion: "^7.0.0",
|
|
16
|
+
defaultPort: 27017
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
value: "postgres",
|
|
20
|
+
label: "PostgreSQL",
|
|
21
|
+
package: "pg",
|
|
22
|
+
packageVersion: "^8.11.0",
|
|
23
|
+
defaultPort: 5432
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
value: "mysql",
|
|
27
|
+
label: "MySQL (Coming Soon)",
|
|
28
|
+
package: "mysql2",
|
|
29
|
+
packageVersion: "^3.5.0",
|
|
30
|
+
defaultPort: 3306,
|
|
31
|
+
disabled: true,
|
|
32
|
+
hint: "MySQL support coming in a future release"
|
|
33
|
+
}
|
|
34
|
+
];
|
|
35
|
+
/**
|
|
36
|
+
* Get database driver options for the select prompt
|
|
37
|
+
*/
|
|
38
|
+
function getDatabaseDriverOptions() {
|
|
39
|
+
return databaseDrivers.map((driver) => ({
|
|
40
|
+
value: driver.value,
|
|
41
|
+
label: driver.label,
|
|
42
|
+
hint: driver.hint,
|
|
43
|
+
disabled: driver.disabled
|
|
44
|
+
}));
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Get database driver config by value
|
|
48
|
+
*/
|
|
49
|
+
function getDatabaseDriver(value) {
|
|
50
|
+
return databaseDrivers.find((driver) => driver.value === value);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
//#endregion
|
|
54
|
+
//#region ../../@warlock.js/create-warlock/src/features/features-map.ts
|
|
55
|
+
/**
|
|
56
|
+
* Optional features offered in the general multiselect step. The database
|
|
57
|
+
* driver (its own select) and AI providers (their own step) are intentionally
|
|
58
|
+
* NOT here — they have dedicated prompts.
|
|
59
|
+
*/
|
|
60
|
+
const features = [
|
|
61
|
+
{
|
|
62
|
+
key: "react",
|
|
63
|
+
label: "React (rendering & mails)",
|
|
64
|
+
hint: "React + ReactDOM for non-interactive rendering and HTML/email generation",
|
|
65
|
+
group: "Rendering & Mail",
|
|
66
|
+
defaultSelected: true
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
key: "react-email",
|
|
70
|
+
label: "React Email",
|
|
71
|
+
hint: "Build email templates with React + Tailwind (pulls react + mail)",
|
|
72
|
+
group: "Rendering & Mail"
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
key: "mail",
|
|
76
|
+
label: "Mail (Nodemailer)",
|
|
77
|
+
hint: "Send emails via SMTP",
|
|
78
|
+
group: "Rendering & Mail"
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
key: "ses",
|
|
82
|
+
label: "Amazon SES",
|
|
83
|
+
hint: "Send emails via the AWS SES API",
|
|
84
|
+
group: "Rendering & Mail"
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
key: "image",
|
|
88
|
+
label: "Image processing (Sharp)",
|
|
89
|
+
hint: "Resize, convert, and optimize images",
|
|
90
|
+
group: "Media"
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
key: "s3",
|
|
94
|
+
label: "S3 storage",
|
|
95
|
+
hint: "AWS S3 for cloud file storage",
|
|
96
|
+
group: "Storage & Cache"
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
key: "redis",
|
|
100
|
+
label: "Redis cache",
|
|
101
|
+
hint: "Redis driver for the cache layer",
|
|
102
|
+
group: "Storage & Cache"
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
key: "scheduler",
|
|
106
|
+
label: "Scheduler",
|
|
107
|
+
hint: "Background tasks and cron jobs",
|
|
108
|
+
group: "Jobs & Messaging"
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
key: "herald",
|
|
112
|
+
label: "Herald (RabbitMQ)",
|
|
113
|
+
hint: "Message broker for event-driven architecture",
|
|
114
|
+
group: "Jobs & Messaging"
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
key: "socket",
|
|
118
|
+
label: "Socket.IO",
|
|
119
|
+
hint: "Realtime websocket server",
|
|
120
|
+
group: "Realtime"
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
key: "swagger",
|
|
124
|
+
label: "Swagger",
|
|
125
|
+
hint: "OpenAPI documentation for your routes",
|
|
126
|
+
group: "API Docs"
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
key: "postman",
|
|
130
|
+
label: "Postman",
|
|
131
|
+
hint: "Generate a Postman collection for your API",
|
|
132
|
+
group: "API Docs"
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
key: "test",
|
|
136
|
+
label: "Testing (Vitest)",
|
|
137
|
+
hint: "Vitest + coverage + per-worker DB/cache test setup",
|
|
138
|
+
group: "Tooling"
|
|
139
|
+
}
|
|
140
|
+
];
|
|
141
|
+
/**
|
|
142
|
+
* AI providers offered in the dedicated AI step. Selecting any of these pulls
|
|
143
|
+
* the core `@warlock.js/ai` package automatically via the provider's `requires`
|
|
144
|
+
* in core's feature map — the scaffolder never lists `ai` as a standalone pick.
|
|
145
|
+
*/
|
|
146
|
+
const aiProviders = [
|
|
147
|
+
{
|
|
148
|
+
key: "openai",
|
|
149
|
+
label: "OpenAI",
|
|
150
|
+
hint: "GPT models via the OpenAI API"
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
key: "google",
|
|
154
|
+
label: "Google (Gemini)",
|
|
155
|
+
hint: "Gemini models via Google AI"
|
|
156
|
+
},
|
|
157
|
+
{
|
|
158
|
+
key: "anthropic",
|
|
159
|
+
label: "Anthropic (Claude)",
|
|
160
|
+
hint: "Claude models via the Anthropic API"
|
|
161
|
+
},
|
|
162
|
+
{
|
|
163
|
+
key: "bedrock",
|
|
164
|
+
label: "AWS Bedrock",
|
|
165
|
+
hint: "Foundation models via Amazon Bedrock"
|
|
166
|
+
},
|
|
167
|
+
{
|
|
168
|
+
key: "ollama",
|
|
169
|
+
label: "Ollama",
|
|
170
|
+
hint: "Local models via Ollama"
|
|
171
|
+
}
|
|
172
|
+
];
|
|
173
|
+
/**
|
|
174
|
+
* Feature options for the multiselect prompt, ordered by group with the group
|
|
175
|
+
* surfaced in the hint (keeps a flat list scannable without group widgets).
|
|
176
|
+
*/
|
|
177
|
+
function getFeatureOptions() {
|
|
178
|
+
return features.map((feature) => ({
|
|
179
|
+
value: feature.key,
|
|
180
|
+
label: feature.label,
|
|
181
|
+
hint: `${feature.group} — ${feature.hint}`
|
|
182
|
+
}));
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* Keys pre-checked in the feature multiselect.
|
|
186
|
+
*/
|
|
187
|
+
function getDefaultFeatureKeys() {
|
|
188
|
+
return features.filter((feature) => feature.defaultSelected).map((feature) => feature.key);
|
|
189
|
+
}
|
|
190
|
+
/**
|
|
191
|
+
* AI provider options for the dedicated AI multiselect step.
|
|
192
|
+
*/
|
|
193
|
+
function getAiProviderOptions() {
|
|
194
|
+
return aiProviders.map((provider) => ({
|
|
195
|
+
value: provider.key,
|
|
196
|
+
label: provider.label,
|
|
197
|
+
hint: provider.hint
|
|
198
|
+
}));
|
|
199
|
+
}
|
|
200
|
+
/**
|
|
201
|
+
* Every selectable key the scaffolder knows about (features + AI providers).
|
|
202
|
+
* Used to validate `--features` / `--ai` flags in non-interactive mode.
|
|
203
|
+
*/
|
|
204
|
+
function getAllFeatureKeys() {
|
|
205
|
+
return [...features.map((feature) => feature.key), ...aiProviders.map((provider) => provider.key)];
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
//#endregion
|
|
209
|
+
//#region ../../@warlock.js/create-warlock/src/helpers/app.ts
|
|
210
|
+
var App = class {
|
|
211
|
+
constructor(app) {
|
|
212
|
+
this.app = app;
|
|
213
|
+
this.files = {};
|
|
214
|
+
this.jsonFiles = {};
|
|
215
|
+
this.isInstalled = false;
|
|
216
|
+
}
|
|
217
|
+
get options() {
|
|
218
|
+
return this.app.options;
|
|
219
|
+
}
|
|
220
|
+
use(templateName) {
|
|
221
|
+
(0, _warlock_js_fs.copyDirectory)(require_paths.template(templateName), this.path);
|
|
222
|
+
if ((0, _warlock_js_fs.fileExists)(this.path + "/.env.example")) (0, _warlock_js_fs.copyFile)(this.path + "/.env.example", this.path + "/.env");
|
|
223
|
+
(0, _warlock_js_fs.renameFile)(this.path + "/_.gitignore", this.path + "/.gitignore");
|
|
224
|
+
return this;
|
|
225
|
+
}
|
|
226
|
+
init() {
|
|
227
|
+
return this;
|
|
228
|
+
}
|
|
229
|
+
terminate() {}
|
|
230
|
+
install() {
|
|
231
|
+
return require_paths.runCommand(require_paths.getPackageManager(), ["install"], this.path);
|
|
232
|
+
}
|
|
233
|
+
async exec(command) {
|
|
234
|
+
const [commandName, ...optionsList] = command.split(" ");
|
|
235
|
+
return await require_paths.executeCommand(commandName, optionsList, this.path);
|
|
236
|
+
}
|
|
237
|
+
async git() {
|
|
238
|
+
const { initializeGitRepository } = await Promise.resolve().then(() => require("./project-builder-helpers-DGcgf60P.cjs"));
|
|
239
|
+
return await initializeGitRepository(this.path);
|
|
240
|
+
}
|
|
241
|
+
updatePackageJson() {
|
|
242
|
+
this.package.replace("name", this.name.replaceAll("/", "-")).replaceAll("yarn", require_paths.getPackageManager()).save();
|
|
243
|
+
return this;
|
|
244
|
+
}
|
|
245
|
+
/**
|
|
246
|
+
* Wire DB_DRIVER and DB_PORT into .env.
|
|
247
|
+
*
|
|
248
|
+
* The driver's npm package is installed via `warlock add` (single source for
|
|
249
|
+
* versions), so this only touches environment configuration — not deps.
|
|
250
|
+
*/
|
|
251
|
+
configureDatabaseEnv(driverValue) {
|
|
252
|
+
const driver = getDatabaseDriver(driverValue);
|
|
253
|
+
if (!driver) return this;
|
|
254
|
+
let envContent = (0, _warlock_js_fs.getFile)(this.path + "/.env");
|
|
255
|
+
envContent = envContent.replace(/DB_PORT=\d+/, `DB_PORT=${driver.defaultPort}`);
|
|
256
|
+
if (envContent.includes("DB_DRIVER=")) envContent = envContent.replace(/DB_DRIVER=\w*/, `DB_DRIVER=${driver.value}`);
|
|
257
|
+
else envContent = envContent.replace(/DB_PORT=\d+/, `DB_PORT=${driver.defaultPort}\nDB_DRIVER=${driver.value}`);
|
|
258
|
+
(0, _warlock_js_fs.putFile)(this.path + "/.env", envContent);
|
|
259
|
+
return this;
|
|
260
|
+
}
|
|
261
|
+
/**
|
|
262
|
+
* Install the selected optional features by delegating to the project's own
|
|
263
|
+
* `warlock add`. `--no-install` records every dependency in package.json and
|
|
264
|
+
* ejects configs / scripts / setup hooks WITHOUT installing — the caller runs
|
|
265
|
+
* one batched install afterwards. Versions come from core's feature map, so
|
|
266
|
+
* the scaffolder never duplicates them.
|
|
267
|
+
*
|
|
268
|
+
* `--no-install` is passed LAST on purpose: the CLI parser treats the
|
|
269
|
+
* positional after a bare flag as that flag's value, so it must follow the
|
|
270
|
+
* feature list, not precede it.
|
|
271
|
+
*/
|
|
272
|
+
async installFeatures(features) {
|
|
273
|
+
if (features.length === 0) return true;
|
|
274
|
+
return this.exec(`npx warlock add ${features.join(" ")} --no-install`);
|
|
275
|
+
}
|
|
276
|
+
/**
|
|
277
|
+
* Get package json file
|
|
278
|
+
*/
|
|
279
|
+
get package() {
|
|
280
|
+
return this.json("package.json");
|
|
281
|
+
}
|
|
282
|
+
updateDotEnv() {
|
|
283
|
+
this.file(".env").replaceAll("appName", this.name).save();
|
|
284
|
+
return this;
|
|
285
|
+
}
|
|
286
|
+
/**
|
|
287
|
+
* Get env file to update
|
|
288
|
+
*/
|
|
289
|
+
get env() {
|
|
290
|
+
return this.file(".env");
|
|
291
|
+
}
|
|
292
|
+
get name() {
|
|
293
|
+
return this.app.appName;
|
|
294
|
+
}
|
|
295
|
+
get path() {
|
|
296
|
+
return this.app.appPath;
|
|
297
|
+
}
|
|
298
|
+
file(relativePath) {
|
|
299
|
+
const fullPath = path.default.resolve(this.path, relativePath);
|
|
300
|
+
if (!this.files[fullPath]) this.files[fullPath] = file(fullPath);
|
|
301
|
+
return this.files[fullPath];
|
|
302
|
+
}
|
|
303
|
+
json(relativePath) {
|
|
304
|
+
const fullPath = path.default.resolve(this.path, relativePath);
|
|
305
|
+
if (!this.jsonFiles[fullPath]) this.jsonFiles[fullPath] = jsonFile(fullPath);
|
|
306
|
+
return this.jsonFiles[fullPath];
|
|
307
|
+
}
|
|
308
|
+
};
|
|
309
|
+
var FileManager = class {
|
|
310
|
+
constructor(filePath) {
|
|
311
|
+
this.filePath = filePath;
|
|
312
|
+
this.parseContent();
|
|
313
|
+
}
|
|
314
|
+
parseContent() {
|
|
315
|
+
this.content = (0, _warlock_js_fs.getFile)(this.filePath);
|
|
316
|
+
}
|
|
317
|
+
replace(search, replace) {
|
|
318
|
+
this.content = this.content.replace(search, replace);
|
|
319
|
+
return this;
|
|
320
|
+
}
|
|
321
|
+
replaceAll(search, replace) {
|
|
322
|
+
this.content = this.content.replaceAll(search, replace);
|
|
323
|
+
return this;
|
|
324
|
+
}
|
|
325
|
+
save() {
|
|
326
|
+
(0, _warlock_js_fs.putFile)(this.filePath, this.content);
|
|
327
|
+
}
|
|
328
|
+
};
|
|
329
|
+
var JsonFileManager = class extends FileManager {
|
|
330
|
+
parseContent() {
|
|
331
|
+
this.content = (0, _warlock_js_fs.getJsonFile)(this.filePath);
|
|
332
|
+
}
|
|
333
|
+
save() {
|
|
334
|
+
(0, _warlock_js_fs.putJsonFile)(this.filePath, this.content);
|
|
335
|
+
}
|
|
336
|
+
has(key) {
|
|
337
|
+
return this.content[key] !== void 0;
|
|
338
|
+
}
|
|
339
|
+
replace(key, value) {
|
|
340
|
+
this.content[key] = value;
|
|
341
|
+
return this;
|
|
342
|
+
}
|
|
343
|
+
replaceAll(key, value) {
|
|
344
|
+
const contentAsString = JSON.stringify(this.content);
|
|
345
|
+
this.content = JSON.parse(contentAsString.replaceAll(key, value));
|
|
346
|
+
return this;
|
|
347
|
+
}
|
|
348
|
+
};
|
|
349
|
+
function file(path$2) {
|
|
350
|
+
return new FileManager(path$2);
|
|
351
|
+
}
|
|
352
|
+
function jsonFile(path$3) {
|
|
353
|
+
return new JsonFileManager(path$3);
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
//#endregion
|
|
357
|
+
//#region ../../@warlock.js/create-warlock/src/ui/banner.ts
|
|
358
|
+
const warlockTextAnsi = `
|
|
359
|
+
\x1b[49m
|
|
360
|
+
\x1b[49m \x1b[38;2;252;238;36m██╗ ██╗ █████╗ ██████╗ ██╗ ██████╗ ██████╗██╗ ██╗ \x1b[38;2;252;238;36m ██╗ ███████╗\x1b[m
|
|
361
|
+
\x1b[49m \x1b[38;2;250;235;34m██║ ██║██╔══██╗██╔══██╗██║ ██╔═══██╗██╔════╝██║ ██╔╝ \x1b[38;2;250;235;34m ██║ ██╔════╝\x1b[m
|
|
362
|
+
\x1b[49m \x1b[38;2;248;233;32m██║ █╗ ██║███████║██████╔╝██║ ██║ ██║██║ █████╔╝ \x1b[38;2;248;233;32m ██║ ███████╗\x1b[m
|
|
363
|
+
\x1b[49m \x1b[38;2;246;231;30m██║███╗██║██╔══██║██╔══██╗██║ ██║ ██║██║ ██╔═██╗ \x1b[38;2;246;231;30m██ ██║ ╚════██║\x1b[m
|
|
364
|
+
\x1b[49m \x1b[38;2;244;229;28m╚███╔███╔╝██║ ██║██║ ██║███████╗╚██████╔╝╚██████╗██║ ██╗ \x1b[38;2;244;229;28m╚█████╔╝ ███████║\x1b[m
|
|
365
|
+
\x1b[49m \x1b[38;2;242;227;26m ╚══╝╚══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝ ╚═════╝ ╚═════╝╚═╝ ╚═╝ \x1b[38;2;242;227;26m ╚════╝ ╚══════╝\x1b[m
|
|
366
|
+
\x1b[49m
|
|
367
|
+
`;
|
|
368
|
+
const warlockLogoAnsi = `\x1b[49m \x1b[38;2;247;232;77;49m▄\x1b[38;2;235;228;105;49m▄\x1b[49m \x1b[m
|
|
369
|
+
\x1b[49m \x1b[38;2;247;241;62;49m▄\x1b[38;2;251;243;29;48;2;245;240;69m▄\x1b[38;2;224;224;112;48;2;246;238;52m▄\x1b[49m \x1b[38;2;246;240;65;49m▄\x1b[38;2;252;238;32;48;2;250;237;68m▄\x1b[38;2;246;236;76;48;2;246;237;52m▄\x1b[49m \x1b[m
|
|
370
|
+
\x1b[49m \x1b[38;2;245;234;80;49m▄\x1b[38;2;246;238;58;49m▄\x1b[49m \x1b[49;38;2;240;232;72m▀\x1b[49;38;2;237;237;100m▀\x1b[49m \x1b[38;2;236;236;132;49m▄\x1b[38;2;253;244;30;48;2;255;235;78m▄\x1b[38;2;254;233;21;48;2;247;240;49m▄\x1b[38;2;249;206;52;48;2;253;234;25m▄\x1b[49;38;2;246;212;65m▀\x1b[49m \x1b[m
|
|
371
|
+
\x1b[49m \x1b[38;2;246;233;50;49m▄\x1b[38;2;250;235;26;48;2;237;228;118m▄\x1b[38;2;251;232;21;48;2;249;237;38m▄\x1b[38;2;249;231;20;48;2;251;234;21m▄\x1b[38;2;248;230;21;48;2;252;232;20m▄\x1b[38;2;248;230;21;48;2;248;233;25m▄\x1b[38;2;248;231;22;48;2;245;236;68m▄\x1b[38;2;247;233;32;49m▄\x1b[38;2;242;226;87;49m▄\x1b[49m \x1b[38;2;227;227;99;49m▄\x1b[38;2;250;235;43;49m▄\x1b[38;2;253;235;28;48;2;244;233;69m▄\x1b[38;2;254;226;25;48;2;252;237;25m▄\x1b[38;2;253;199;25;48;2;253;229;24m▄\x1b[38;2;247;205;73;48;2;253;201;27m▄\x1b[49;38;2;235;206;88m▀\x1b[49m \x1b[m
|
|
372
|
+
\x1b[49m \x1b[38;2;239;226;86;49m▄\x1b[38;2;250;235;34;49m▄\x1b[38;2;252;234;19;48;2;243;231;71m▄\x1b[38;2;251;233;19;48;2;251;234;28m▄\x1b[38;2;250;233;19;48;2;251;233;20m▄\x1b[38;2;251;233;20;48;2;250;232;20m▄\x1b[38;2;253;235;25;48;2;251;231;20m▄\x1b[38;2;245;232;53;48;2;251;232;20m▄\x1b[38;2;245;228;57;48;2;250;232;22m▄\x1b[38;2;247;229;39;48;2;248;231;22m▄\x1b[38;2;247;232;22;48;2;248;229;21m▄\x1b[38;2;247;231;21;48;2;248;229;20m▄\x1b[38;2;247;230;20;48;2;247;230;22m▄\x1b[38;2;248;230;20;48;2;246;234;38m▄\x1b[38;2;250;232;28;48;2;239;230;123m▄\x1b[38;2;250;231;49;49m▄\x1b[38;2;235;216;78;49m▄\x1b[49m \x1b[38;2;246;235;53;49m▄\x1b[38;2;251;236;23;48;2;244;232;75m▄\x1b[38;2;252;233;21;48;2;252;236;27m▄\x1b[38;2;253;227;26;48;2;253;233;23m▄\x1b[38;2;253;201;29;48;2;253;228;30m▄\x1b[38;2;253;199;27;48;2;253;201;26m▄\x1b[38;2;232;197;104;48;2;249;201;47m▄\x1b[49m \x1b[m
|
|
373
|
+
\x1b[49m \x1b[38;2;247;232;50;49m▄\x1b[38;2;250;233;28;48;2;245;226;98m▄\x1b[38;2;252;232;20;48;2;249;234;40m▄\x1b[38;2;251;231;20;48;2;253;236;23m▄\x1b[38;2;251;232;20;48;2;252;233;19m▄\x1b[38;2;252;234;22;48;2;250;233;19m▄\x1b[38;2;250;235;38;48;2;251;233;20m▄\x1b[38;2;241;231;68;48;2;252;235;24m▄\x1b[49;38;2;249;234;47m▀\x1b[49;38;2;242;229;78m▀\x1b[49m \x1b[49;38;2;247;229;54m▀\x1b[38;2;241;227;99;48;2;247;231;33m▄\x1b[38;2;248;233;50;48;2;247;232;22m▄\x1b[38;2;250;229;28;48;2;249;230;22m▄\x1b[38;2;254;226;26;48;2;253;224;23m▄\x1b[38;2;235;221;94;48;2;249;221;35m▄\x1b[49m \x1b[38;2;243;237;61;49m▄\x1b[38;2;251;237;28;48;2;243;236;87m▄\x1b[38;2;251;234;20;48;2;250;236;36m▄\x1b[38;2;252;232;21;48;2;252;234;21m▄\x1b[38;2;251;225;23;48;2;251;232;21m▄\x1b[38;2;250;198;26;48;2;251;225;24m▄\x1b[38;2;253;197;26;48;2;251;199;27m▄\x1b[38;2;252;200;38;48;2;255;199;28m▄\x1b[49;38;2;245;202;65m▀\x1b[49m \x1b[m
|
|
374
|
+
\x1b[49m \x1b[38;2;244;235;52;48;2;219;219;128m▄\x1b[38;2;247;234;53;49m▄\x1b[38;2;235;216;118;49m▄\x1b[49m \x1b[38;2;246;236;50;49m▄\x1b[38;2;253;238;21;48;2;249;234;58m▄\x1b[38;2;251;234;20;48;2;250;236;33m▄\x1b[38;2;251;233;19;48;2;252;234;21m▄\x1b[38;2;252;233;21;48;2;251;232;19m▄\x1b[38;2;252;233;26;48;2;251;231;20m▄\x1b[38;2;249;233;43;48;2;253;233;21m▄\x1b[49;38;2;252;236;30m▀\x1b[49;38;2;246;236;57m▀\x1b[49m \x1b[38;2;242;235;87;49m▄\x1b[49m \x1b[49;38;2;246;229;106m▀\x1b[49;38;2;247;227;62m▀\x1b[49m \x1b[49;38;2;248;237;47m▀\x1b[38;2;245;232;62;48;2;247;234;35m▄\x1b[38;2;253;231;26;48;2;252;234;23m▄\x1b[38;2;253;204;27;48;2;253;226;23m▄\x1b[38;2;252;199;34;48;2;252;200;26m▄\x1b[38;2;247;203;52;48;2;253;197;26m▄\x1b[49;38;2;251;199;35m▀\x1b[49;38;2;241;207;96m▀\x1b[49m \x1b[38;2;246;238;65;49m▄\x1b[38;2;250;226;39;49m▄\x1b[38;2;238;221;59;49m▄\x1b[49m \x1b[m
|
|
375
|
+
\x1b[49m \x1b[38;2;242;235;52;48;2;248;235;48m▄\x1b[38;2;251;234;24;48;2;251;234;23m▄\x1b[38;2;251;232;21;48;2;250;237;38m▄\x1b[38;2;248;233;20;48;2;244;236;69m▄\x1b[38;2;246;236;44;49m▄\x1b[38;2;243;238;64;49m▄\x1b[49m \x1b[49;38;2;235;228;87m▀\x1b[49;38;2;247;231;40m▀\x1b[38;2;242;230;96;48;2;248;234;24m▄\x1b[38;2;239;226;78;48;2;252;235;23m▄\x1b[49;38;2;250;234;35m▀\x1b[49;38;2;239;233;98m▀\x1b[49m \x1b[38;2;252;242;36;48;2;246;243;65m▄\x1b[38;2;252;240;31;48;2;251;245;46m▄\x1b[38;2;248;241;106;49m▄\x1b[49m \x1b[38;2;241;241;85;49m▄\x1b[38;2;250;238;34;48;2;244;234;69m▄\x1b[38;2;246;216;49;48;2;253;234;31m▄\x1b[38;2;228;215;121;48;2;252;210;33m▄\x1b[49;38;2;248;205;53m▀\x1b[49m \x1b[38;2;238;238;85;49m▄\x1b[38;2;243;233;63;49m▄\x1b[38;2;251;237;23;48;2;246;237;79m▄\x1b[38;2;253;234;22;48;2;247;234;52m▄\x1b[38;2;253;214;24;48;2;254;233;26m▄\x1b[38;2;249;210;44;48;2;252;212;31m▄\x1b[49m \x1b[m
|
|
376
|
+
\x1b[49m \x1b[49;38;2;228;228;67m▀\x1b[38;2;250;235;32;48;2;252;237;25m▄\x1b[38;2;252;223;25;48;2;250;227;23m▄\x1b[38;2;250;213;27;48;2;248;230;19m▄\x1b[38;2;247;224;25;48;2;247;230;19m▄\x1b[38;2;247;229;19;48;2;246;233;20m▄\x1b[38;2;248;231;22;48;2;243;234;51m▄\x1b[38;2;247;233;22;48;2;236;227;76m▄\x1b[38;2;243;233;67;49m▄\x1b[49m \x1b[38;2;250;238;38;48;2;240;235;82m▄\x1b[38;2;251;235;20;48;2;253;240;20m▄\x1b[38;2;252;232;22;48;2;253;235;23m▄\x1b[38;2;252;237;34;48;2;250;242;52m▄\x1b[49m \x1b[49;38;2;242;234;57m▀\x1b[49;38;2;233;233;78m▀\x1b[49m \x1b[38;2;244;233;98;49m▄\x1b[38;2;251;236;35;49m▄\x1b[38;2;252;236;22;48;2;243;232;72m▄\x1b[38;2;252;235;25;48;2;252;239;28m▄\x1b[38;2;251;233;21;48;2;250;234;20m▄\x1b[38;2;252;220;25;48;2;251;234;21m▄\x1b[38;2;251;203;25;48;2;253;229;23m▄\x1b[38;2;253;205;26;48;2;253;206;25m▄\x1b[38;2;248;209;53;48;2;250;211;51m▄\x1b[49m \x1b[m
|
|
377
|
+
\x1b[49m \x1b[49;38;2;242;230;81m▀\x1b[49;38;2;249;218;33m▀\x1b[38;2;242;212;73;48;2;250;214;26m▄\x1b[38;2;248;210;32;48;2;251;212;26m▄\x1b[38;2;248;213;26;48;2;249;210;26m▄\x1b[38;2;251;214;26;48;2;248;228;27m▄\x1b[38;2;250;214;27;48;2;250;231;20m▄\x1b[38;2;248;226;24;48;2;248;232;19m▄\x1b[38;2;247;231;19;48;2;245;234;26m▄\x1b[38;2;247;232;20;48;2;240;230;78m▄\x1b[38;2;245;236;35;49m▄\x1b[38;2;241;234;86;49m▄\x1b[49m \x1b[38;2;250;237;45;49m▄\x1b[38;2;251;234;20;48;2;251;237;25m▄\x1b[38;2;248;231;21;48;2;249;233;22m▄\x1b[38;2;247;230;20;48;2;248;231;21m▄\x1b[38;2;249;230;21;48;2;252;233;22m▄\x1b[38;2;252;238;35;48;2;249;239;60m▄\x1b[49m \x1b[38;2;223;207;143;49m▄\x1b[38;2;248;232;43;49m▄\x1b[38;2;250;233;21;48;2;237;219;109m▄\x1b[38;2;251;232;20;48;2;249;232;44m▄\x1b[38;2;252;232;21;48;2;251;233;22m▄\x1b[38;2;252;230;21;48;2;252;233;20m▄\x1b[38;2;253;215;26;48;2;253;233;20m▄\x1b[38;2;253;200;29;48;2;253;228;27m▄\x1b[38;2;254;203;28;48;2;252;203;26m▄\x1b[38;2;249;207;48;48;2;252;203;26m▄\x1b[38;2;242;215;74;48;2;253;204;27m▄\x1b[49;38;2;249;209;50m▀\x1b[49;38;2;241;213;99m▀\x1b[49m \x1b[m
|
|
378
|
+
\x1b[49m \x1b[49;38;2;243;213;61m▀\x1b[38;2;231;219;85;48;2;248;216;32m▄\x1b[38;2;245;214;58;48;2;250;215;26m▄\x1b[38;2;248;214;32;48;2;252;212;27m▄\x1b[38;2;250;215;26;48;2;249;217;27m▄\x1b[38;2;250;215;27;48;2;247;227;23m▄\x1b[38;2;247;220;28;48;2;246;231;20m▄\x1b[38;2;246;230;21;48;2;246;234;23m▄\x1b[38;2;251;235;24;48;2;247;237;45m▄\x1b[38;2;242;237;101;49m▄\x1b[49m \x1b[38;2;248;239;63;49m▄\x1b[38;2;252;235;20;48;2;252;237;26m▄\x1b[48;2;249;232;20m \x1b[38;2;250;231;22;48;2;247;230;20m▄\x1b[38;2;248;232;34;48;2;247;230;21m▄\x1b[38;2;248;232;22;48;2;248;231;21m▄\x1b[38;2;249;233;21;48;2;253;235;25m▄\x1b[38;2;251;240;38;48;2;246;241;79m▄\x1b[49m \x1b[38;2;252;237;26;48;2;244;236;59m▄\x1b[38;2;252;233;20;48;2;250;233;23m▄\x1b[48;2;251;232;20m \x1b[38;2;252;230;22;48;2;251;231;20m▄\x1b[38;2;253;214;24;48;2;251;231;20m▄\x1b[38;2;253;200;28;48;2;252;225;22m▄\x1b[38;2;250;203;41;48;2;252;203;26m▄\x1b[38;2;248;205;64;48;2;253;198;28m▄\x1b[49;38;2;249;202;46m▀\x1b[49;38;2;246;207;62m▀\x1b[49m \x1b[m
|
|
379
|
+
\x1b[49m \x1b[49;38;2;245;216;88m▀\x1b[49;38;2;246;216;52m▀\x1b[38;2;242;216;78;48;2;248;216;31m▄\x1b[38;2;249;217;38;48;2;250;215;27m▄\x1b[38;2;250;222;30;48;2;247;227;26m▄\x1b[48;2;248;232;23m \x1b[38;2;252;237;28;48;2;251;241;41m▄\x1b[38;2;238;238;119;49m▄\x1b[49m \x1b[38;2;243;235;85;49m▄\x1b[38;2;252;238;21;48;2;252;240;29m▄\x1b[38;2;252;234;23;48;2;251;234;22m▄\x1b[38;2;254;234;22;48;2;252;233;22m▄\x1b[38;2;248;227;59;48;2;251;232;38m▄\x1b[38;2;244;234;96;48;2;248;235;51m▄\x1b[38;2;251;238;32;48;2;249;235;24m▄\x1b[38;2;250;236;23;48;2;249;234;21m▄\x1b[38;2;252;234;22;48;2;253;236;25m▄\x1b[38;2;251;244;44;48;2;246;246;103m▄\x1b[49m \x1b[38;2;251;240;33;48;2;238;232;81m▄\x1b[38;2;249;233;21;48;2;251;236;19m▄\x1b[38;2;253;227;24;48;2;252;231;21m▄\x1b[38;2;254;204;26;48;2;252;224;23m▄\x1b[38;2;248;206;55;48;2;253;206;27m▄\x1b[49;38;2;250;204;40m▀\x1b[49;38;2;246;207;60m▀\x1b[49m \x1b[m
|
|
380
|
+
\x1b[49m \x1b[38;2;246;215;54;48;2;242;211;53m▄\x1b[38;2;253;217;20;48;2;248;216;35m▄\x1b[38;2;250;221;23;48;2;246;219;57m▄\x1b[38;2;245;232;39;49m▄\x1b[38;2;245;234;65;49m▄\x1b[49m \x1b[38;2;243;219;121;48;2;250;221;50m▄\x1b[38;2;252;221;33;48;2;251;222;30m▄\x1b[38;2;250;228;31;48;2;248;231;26m▄\x1b[38;2;249;232;23;48;2;251;234;23m▄\x1b[38;2;253;238;29;48;2;249;242;63m▄\x1b[49m \x1b[38;2;235;235;112;49m▄\x1b[38;2;251;236;21;48;2;251;240;34m▄\x1b[38;2;250;232;23;48;2;251;234;21m▄\x1b[38;2;253;230;24;48;2;252;233;23m▄\x1b[38;2;250;222;52;48;2;251;227;36m▄\x1b[49m \x1b[38;2;248;241;69;48;2;248;238;48m▄\x1b[38;2;251;239;28;48;2;250;238;25m▄\x1b[38;2;250;236;24;48;2;251;235;23m▄\x1b[38;2;252;234;23;48;2;252;238;26m▄\x1b[38;2;248;240;59;48;2;239;239;128m▄\x1b[49m \x1b[38;2;247;239;52;48;2;244;233;100m▄\x1b[38;2;249;234;20;48;2;252;238;23m▄\x1b[38;2;252;231;22;48;2;250;232;22m▄\x1b[38;2;253;207;25;48;2;253;216;26m▄\x1b[38;2;250;208;54;48;2;252;207;37m▄\x1b[49m \x1b[38;2;241;227;71;49m▄\x1b[38;2;247;213;44;49m▄\x1b[38;2;253;208;29;48;2;237;211;88m▄\x1b[38;2;254;205;28;48;2;248;213;47m▄\x1b[49m \x1b[m
|
|
381
|
+
\x1b[49m \x1b[38;2;245;230;60;48;2;242;224;49m▄\x1b[38;2;249;236;23;48;2;249;233;21m▄\x1b[38;2;252;235;26;48;2;250;231;20m▄\x1b[38;2;249;234;30;48;2;249;233;21m▄\x1b[38;2;254;236;27;48;2;252;236;25m▄\x1b[38;2;249;238;49;48;2;247;241;52m▄\x1b[49m \x1b[38;2;245;216;64;48;2;250;222;59m▄\x1b[38;2;252;220;31;48;2;252;223;33m▄\x1b[38;2;249;229;27;48;2;248;231;24m▄\x1b[38;2;248;230;21;48;2;251;233;22m▄\x1b[38;2;248;235;29;48;2;242;235;85m▄\x1b[38;2;251;235;24;48;2;250;242;49m▄\x1b[38;2;250;231;23;48;2;250;233;22m▄\x1b[38;2;253;225;23;48;2;252;230;24m▄\x1b[38;2;250;215;49;48;2;253;222;28m▄\x1b[49;38;2;244;222;89m▀\x1b[49m \x1b[38;2;247;234;63;48;2;248;238;46m▄\x1b[38;2;251;238;25;48;2;250;237;25m▄\x1b[38;2;250;233;22;48;2;250;234;21m▄\x1b[38;2;251;233;21;48;2;252;237;26m▄\x1b[38;2;244;232;62;49m▄\x1b[38;2;249;232;21;48;2;252;239;24m▄\x1b[38;2;250;231;22;48;2;249;231;22m▄\x1b[38;2;252;212;25;48;2;252;225;23m▄\x1b[38;2;251;209;55;48;2;253;204;27m▄\x1b[49;38;2;239;206;99m▀\x1b[49m \x1b[38;2;250;237;49;48;2;250;242;50m▄\x1b[38;2;251;234;22;48;2;252;231;25m▄\x1b[38;2;253;227;27;48;2;253;212;26m▄\x1b[38;2;254;206;26;48;2;254;204;25m▄\x1b[49m \x1b[m
|
|
382
|
+
\x1b[49m \x1b[38;2;253;239;29;48;2;238;230;84m▄\x1b[38;2;254;234;24;48;2;253;238;23m▄\x1b[38;2;253;209;29;48;2;254;233;26m▄\x1b[38;2;244;216;71;48;2;241;220;99m▄\x1b[49m \x1b[38;2;247;217;53;48;2;250;218;44m▄\x1b[38;2;251;217;31;48;2;250;222;31m▄\x1b[38;2;247;228;24;48;2;245;229;20m▄\x1b[48;2;245;229;19m \x1b[38;2;246;229;19;48;2;247;229;20m▄\x1b[38;2;253;224;24;48;2;251;229;23m▄\x1b[38;2;249;211;52;48;2;253;213;27m▄\x1b[49;38;2;244;210;68m▀\x1b[49m \x1b[38;2;249;234;57;48;2;249;237;39m▄\x1b[38;2;250;235;23;48;2;250;234;24m▄\x1b[38;2;247;231;19;48;2;247;230;19m▄\x1b[38;2;244;229;16;48;2;247;230;18m▄\x1b[38;2;246;229;18;48;2;246;230;19m▄\x1b[38;2;253;223;23;48;2;252;228;21m▄\x1b[38;2;253;206;37;48;2;253;208;26m▄\x1b[49;38;2;251;211;57m▀\x1b[49m \x1b[38;2;250;239;47;48;2;250;239;50m▄\x1b[38;2;250;236;23;48;2;249;235;22m▄\x1b[38;2;254;231;28;48;2;254;229;26m▄\x1b[38;2;255;209;26;48;2;254;209;27m▄\x1b[49m \x1b[m
|
|
383
|
+
\x1b[49m \x1b[38;2;245;239;70;49m▄\x1b[38;2;253;241;21;48;2;250;243;39m▄\x1b[38;2;251;208;32;48;2;254;237;23m▄\x1b[38;2;248;210;82;48;2;252;208;31m▄\x1b[49;38;2;245;213;78m▀\x1b[49m \x1b[38;2;246;218;70;48;2;252;217;33m▄\x1b[38;2;250;220;29;48;2;248;225;27m▄\x1b[38;2;248;229;24;48;2;245;229;20m▄\x1b[38;2;253;223;23;48;2;251;228;21m▄\x1b[38;2;252;209;33;48;2;253;211;26m▄\x1b[49;38;2;242;208;64m▀\x1b[49m \x1b[49;38;2;237;237;91m▀\x1b[38;2;246;235;64;48;2;251;237;29m▄\x1b[38;2;248;237;24;48;2;248;233;23m▄\x1b[38;2;247;233;21;48;2;245;231;18m▄\x1b[38;2;253;230;23;48;2;249;230;19m▄\x1b[38;2;253;206;30;48;2;253;209;24m▄\x1b[38;2;239;223;96;48;2;249;207;58m▄\x1b[49m \x1b[38;2;247;239;50;48;2;247;239;47m▄\x1b[38;2;249;236;23;48;2;250;236;23m▄\x1b[48;2;254;230;27m \x1b[38;2;254;209;27;48;2;254;209;26m▄\x1b[49m \x1b[m
|
|
384
|
+
\x1b[49m \x1b[38;2;235;235;78;49m▄\x1b[38;2;253;240;32;48;2;234;234;90m▄\x1b[38;2;249;224;34;48;2;253;242;25m▄\x1b[38;2;245;214;92;48;2;251;215;32m▄\x1b[49;38;2;240;209;85m▀\x1b[49m \x1b[38;2;245;235;64;49m▄\x1b[38;2;253;239;32;48;2;239;231;112m▄\x1b[38;2;246;239;82;49m▄\x1b[49m \x1b[49;38;2;246;219;73m▀\x1b[38;2;249;221;48;48;2;252;220;29m▄\x1b[38;2;254;222;27;48;2;253;228;27m▄\x1b[38;2;253;208;28;48;2;254;210;24m▄\x1b[38;2;237;219;73;48;2;244;208;63m▄\x1b[49m \x1b[38;2;249;236;42;49m▄\x1b[38;2;250;234;23;49m▄\x1b[38;2;249;231;24;49m▄\x1b[38;2;248;228;34;49m▄\x1b[38;2;243;226;99;49m▄\x1b[49m \x1b[49;38;2;242;242;67m▀\x1b[38;2;248;238;57;48;2;252;238;26m▄\x1b[38;2;253;236;26;48;2;251;235;23m▄\x1b[38;2;253;213;26;48;2;253;227;24m▄\x1b[38;2;247;209;62;48;2;247;209;61m▄\x1b[49m \x1b[38;2;247;239;49;48;2;247;239;47m▄\x1b[38;2;250;234;23;48;2;250;235;22m▄\x1b[38;2;254;228;28;48;2;254;230;28m▄\x1b[38;2;254;207;26;48;2;254;208;26m▄\x1b[49m \x1b[m
|
|
385
|
+
\x1b[49m \x1b[38;2;246;237;59;49m▄\x1b[38;2;249;236;35;48;2;249;240;43m▄\x1b[49;38;2;249;233;39m▀\x1b[49;38;2;237;219;109m▀\x1b[49m \x1b[38;2;239;234;80;49m▄\x1b[38;2;251;241;38;49m▄\x1b[38;2;252;239;32;48;2;252;242;48m▄\x1b[38;2;249;237;37;48;2;253;239;24m▄\x1b[38;2;245;233;57;48;2;254;236;21m▄\x1b[38;2;237;237;128;48;2;251;239;47m▄\x1b[49m \x1b[49;38;2;244;221;68m▀\x1b[38;2;252;216;33;48;2;254;216;24m▄\x1b[38;2;244;211;78;48;2;245;211;57m▄\x1b[49m \x1b[38;2;250;238;31;48;2;250;239;49m▄\x1b[38;2;249;233;20;48;2;251;235;20m▄\x1b[38;2;246;232;19;48;2;249;232;19m▄\x1b[38;2;246;231;19;48;2;248;231;19m▄\x1b[38;2;251;232;21;48;2;251;230;20m▄\x1b[38;2;253;217;25;48;2;250;222;34m▄\x1b[38;2;243;225;103;49m▄\x1b[49m \x1b[49;38;2;238;230;85m▀\x1b[38;2;251;237;40;48;2;253;238;27m▄\x1b[38;2;237;219;83;48;2;250;212;43m▄\x1b[49m \x1b[38;2;248;238;53;49m▄\x1b[38;2;252;234;34;48;2;250;237;49m▄\x1b[38;2;253;220;26;48;2;252;233;23m▄\x1b[38;2;252;202;28;48;2;253;225;29m▄\x1b[38;2;254;204;26;48;2;254;205;26m▄\x1b[49m \x1b[m
|
|
386
|
+
\x1b[49m \x1b[38;2;240;229;56;48;2;247;232;62m▄\x1b[49;38;2;249;238;37m▀\x1b[49m \x1b[49;38;2;231;231;110m▀\x1b[49;38;2;244;241;45m▀\x1b[49;38;2;239;239;63m▀\x1b[49m \x1b[49;38;2;241;217;88m▀\x1b[49m \x1b[38;2;249;236;52;48;2;249;237;33m▄\x1b[38;2;250;237;24;48;2;248;234;22m▄\x1b[38;2;250;234;21;48;2;246;233;19m▄\x1b[38;2;251;230;21;48;2;247;233;19m▄\x1b[38;2;253;210;26;48;2;252;230;22m▄\x1b[38;2;251;207;36;48;2;253;209;27m▄\x1b[49;38;2;243;219;95m▀\x1b[49m \x1b[49;38;2;241;223;96m▀\x1b[49m \x1b[38;2;242;233;67;49m▄\x1b[38;2;249;236;41;49m▄\x1b[38;2;253;237;23;48;2;245;232;63m▄\x1b[38;2;253;226;24;48;2;251;238;38m▄\x1b[38;2;251;201;26;48;2;252;234;23m▄\x1b[38;2;251;198;26;48;2;251;210;25m▄\x1b[38;2;253;202;29;48;2;251;199;25m▄\x1b[38;2;251;203;42;48;2;253;201;28m▄\x1b[38;2;229;211;123;48;2;253;203;32m▄\x1b[49m \x1b[m
|
|
387
|
+
\x1b[38;2;222;222;144;49m▄\x1b[38;2;229;220;123;48;2;234;225;98m▄\x1b[49;38;2;228;215;121m▀\x1b[49m \x1b[38;2;248;236;46;49m▄\x1b[38;2;252;236;21;48;2;243;230;66m▄\x1b[38;2;251;233;20;48;2;249;234;38m▄\x1b[38;2;251;231;20;48;2;248;234;33m▄\x1b[38;2;248;231;20;48;2;244;229;67m▄\x1b[38;2;244;233;47;49m▄\x1b[38;2;236;236;70;49m▄\x1b[49m \x1b[49;38;2;247;212;46m▀\x1b[49;38;2;250;209;30m▀\x1b[38;2;240;225;150;48;2;251;202;30m▄\x1b[49;38;2;252;203;36m▀\x1b[49;38;2;241;212;90m▀\x1b[49m \x1b[38;2;235;235;98;49m▄\x1b[38;2;243;235;63;49m▄\x1b[38;2;251;238;25;48;2;237;228;73m▄\x1b[38;2;253;236;20;48;2;247;234;52m▄\x1b[38;2;254;230;22;48;2;252;238;23m▄\x1b[38;2;252;206;26;48;2;253;233;21m▄\x1b[38;2;253;198;28;48;2;252;217;25m▄\x1b[38;2;252;201;36;48;2;252;196;26m▄\x1b[38;2;240;205;70;48;2;252;199;28m▄\x1b[49;38;2;250;202;38m▀\x1b[49;38;2;241;213;88m▀\x1b[49m \x1b[m
|
|
388
|
+
\x1b[49;38;2;207;207;191m▀\x1b[49m \x1b[38;2;236;232;82;49m▄\x1b[38;2;248;239;48;49m▄\x1b[49m \x1b[49;38;2;244;231;69m▀\x1b[49;38;2;249;233;29m▀\x1b[38;2;244;228;69;48;2;248;234;23m▄\x1b[38;2;249;233;28;48;2;247;231;21m▄\x1b[38;2;247;232;25;48;2;247;230;20m▄\x1b[38;2;248;231;23;48;2;248;231;19m▄\x1b[38;2;249;232;23;48;2;247;233;20m▄\x1b[38;2;249;233;24;48;2;246;237;59m▄\x1b[38;2;248;237;29;48;2;242;242;77m▄\x1b[38;2;244;240;76;49m▄\x1b[49m \x1b[38;2;241;234;99;49m▄\x1b[38;2;250;238;41;49m▄\x1b[38;2;253;237;26;48;2;242;232;79m▄\x1b[38;2;253;236;25;48;2;252;240;27m▄\x1b[38;2;254;233;24;48;2;254;236;20m▄\x1b[38;2;251;210;29;48;2;253;235;21m▄\x1b[38;2;251;197;28;48;2;253;225;23m▄\x1b[38;2;246;202;53;48;2;254;200;27m▄\x1b[49;38;2;253;199;32m▀\x1b[49;38;2;245;207;64m▀\x1b[49m \x1b[m
|
|
389
|
+
\x1b[49m \x1b[49;38;2;231;219;97m▀\x1b[49;38;2;243;229;58m▀\x1b[49m \x1b[49;38;2;237;237;91m▀\x1b[49;38;2;246;231;56m▀\x1b[38;2;246;238;68;48;2;246;233;22m▄\x1b[38;2;245;230;48;48;2;246;233;21m▄\x1b[38;2;247;235;23;48;2;247;232;19m▄\x1b[38;2;246;233;21;48;2;247;232;18m▄\x1b[38;2;247;232;20;48;2;248;232;18m▄\x1b[38;2;247;231;19;48;2;246;234;29m▄\x1b[38;2;247;232;20;48;2;240;230;80m▄\x1b[38;2;246;233;34;49m▄\x1b[38;2;245;231;52;49m▄\x1b[38;2;250;233;23;48;2;225;225;105m▄\x1b[38;2;252;233;19;48;2;248;234;46m▄\x1b[38;2;253;233;20;48;2;253;235;21m▄\x1b[38;2;254;232;21;48;2;253;234;20m▄\x1b[38;2;252;217;24;48;2;254;234;20m▄\x1b[38;2;253;202;35;48;2;254;230;23m▄\x1b[38;2;246;211;84;48;2;253;201;28m▄\x1b[49;38;2;250;203;46m▀\x1b[49;38;2;247;206;82m▀\x1b[49m \x1b[m
|
|
390
|
+
\x1b[49m \x1b[49;38;2;247;226;63m▀\x1b[49;38;2;247;232;36m▀\x1b[38;2;245;229;57;48;2;246;232;22m▄\x1b[38;2;247;230;31;48;2;248;232;21m▄\x1b[38;2;247;232;21;48;2;247;231;19m▄\x1b[38;2;247;233;19;48;2;246;231;18m▄\x1b[38;2;247;232;17;48;2;246;231;17m▄\x1b[38;2;251;232;19;48;2;249;232;17m▄\x1b[38;2;253;221;24;48;2;252;232;20m▄\x1b[38;2;249;207;48;48;2;253;229;22m▄\x1b[38;2;248;209;72;48;2;253;207;28m▄\x1b[49;38;2;245;202;59m▀\x1b[49;38;2;237;200;109m▀\x1b[49m \x1b[m
|
|
391
|
+
\x1b[49m \x1b[49;38;2;242;230;89m▀\x1b[49;38;2;247;232;50m▀\x1b[38;2;244;227;72;48;2;249;233;28m▄\x1b[38;2;244;218;55;48;2;252;231;23m▄\x1b[49;38;2;250;215;37m▀\x1b[49;38;2;244;206;65m▀\x1b[49m \x1b[m
|
|
392
|
+
`;
|
|
393
|
+
/**
|
|
394
|
+
* Get the intro banner with ASCII art
|
|
395
|
+
*/
|
|
396
|
+
function getIntroBanner(version) {
|
|
397
|
+
const versionLine = `v${version}`;
|
|
398
|
+
const padding = " ".repeat(35 - versionLine.length);
|
|
399
|
+
return `
|
|
400
|
+
${_mongez_copper.colors.magentaBright("╭──────────────────────────────────────╮")}
|
|
401
|
+
${_mongez_copper.colors.magentaBright("│")} ${_mongez_copper.colors.magentaBright("│")}
|
|
402
|
+
${_mongez_copper.colors.magentaBright("│")} 🧙 ${_mongez_copper.colors.bold(_mongez_copper.colors.yellowBright("WARLOCK.JS"))} ${_mongez_copper.colors.magentaBright("│")}
|
|
403
|
+
${_mongez_copper.colors.magentaBright("│")} ${_mongez_copper.colors.cyan("The Magical Node.js Framework")} ${_mongez_copper.colors.magentaBright("│")}
|
|
404
|
+
${_mongez_copper.colors.magentaBright("│")} ${_mongez_copper.colors.magentaBright("│")}
|
|
405
|
+
${_mongez_copper.colors.magentaBright("│")} ${_mongez_copper.colors.green(versionLine)}${padding}${_mongez_copper.colors.magentaBright("│")}
|
|
406
|
+
${_mongez_copper.colors.magentaBright("│")} ${_mongez_copper.colors.magentaBright("│")}
|
|
407
|
+
${_mongez_copper.colors.magentaBright("╰──────────────────────────────────────╯")}
|
|
408
|
+
`;
|
|
409
|
+
}
|
|
410
|
+
/**
|
|
411
|
+
* Display the intro banner
|
|
412
|
+
*/
|
|
413
|
+
function showIntroBanner(version) {
|
|
414
|
+
console.log(warlockLogoAnsi);
|
|
415
|
+
console.log(warlockTextAnsi);
|
|
416
|
+
console.log(getIntroBanner(version));
|
|
417
|
+
}
|
|
418
|
+
/**
|
|
419
|
+
* Get the success screen with project summary
|
|
420
|
+
*/
|
|
421
|
+
function getSuccessScreen(options) {
|
|
422
|
+
const { projectName, database, features, packageManager } = options;
|
|
423
|
+
let featuresText = features.join(", ");
|
|
424
|
+
if (features.length === 0) featuresText = "none";
|
|
425
|
+
const baseLabelLength = 10;
|
|
426
|
+
const padding = 6;
|
|
427
|
+
const projectLineLen = projectName.length + baseLabelLength;
|
|
428
|
+
const dbLineLen = database.length + baseLabelLength;
|
|
429
|
+
const featuresLineLen = featuresText.length + baseLabelLength;
|
|
430
|
+
const boxWidth = Math.max(projectLineLen, dbLineLen, featuresLineLen, 40) + padding + 2;
|
|
431
|
+
const createBorder = (start, end) => _mongez_copper.colors.magentaBright(start + "─".repeat(boxWidth - 2) + end);
|
|
432
|
+
const padLine = (label, value, isFeature = false) => {
|
|
433
|
+
const valueColor = (text) => {
|
|
434
|
+
if (isFeature && text === "none") return _mongez_copper.colors.dim(text);
|
|
435
|
+
return _mongez_copper.colors.white(text);
|
|
436
|
+
};
|
|
437
|
+
const labelPart = _mongez_copper.colors.dim(label.padEnd(10));
|
|
438
|
+
const valuePart = valueColor(value);
|
|
439
|
+
const contentVisibleLength = 13 + value.length;
|
|
440
|
+
const remaining = boxWidth - 2 - contentVisibleLength;
|
|
441
|
+
return _mongez_copper.colors.magentaBright("│") + " " + labelPart + valuePart + " ".repeat(remaining) + _mongez_copper.colors.magentaBright("│");
|
|
442
|
+
};
|
|
443
|
+
const emptyLine = _mongez_copper.colors.magentaBright("│") + " ".repeat(boxWidth - 2) + _mongez_copper.colors.magentaBright("│");
|
|
444
|
+
const headerText = "🎉 YOUR PROJECT IS READY! 🎉";
|
|
445
|
+
const headerPadding = Math.floor((boxWidth - 2 - 28) / 2);
|
|
446
|
+
const headerLine = _mongez_copper.colors.magentaBright("│") + " ".repeat(headerPadding) + _mongez_copper.colors.bold(_mongez_copper.colors.green(headerText)) + " ".repeat(boxWidth - 2 - headerPadding - 28) + _mongez_copper.colors.magentaBright("│");
|
|
447
|
+
const devCommand = packageManager === "npm" ? "npm run dev" : `${packageManager} dev`;
|
|
448
|
+
return `
|
|
449
|
+
${createBorder("╭", "╮")}
|
|
450
|
+
${emptyLine}
|
|
451
|
+
${headerLine}
|
|
452
|
+
${emptyLine}
|
|
453
|
+
${padLine("Project:", projectName)}
|
|
454
|
+
${padLine("Database:", database)}
|
|
455
|
+
${padLine("Features:", featuresText, true)}
|
|
456
|
+
${emptyLine}
|
|
457
|
+
${createBorder("╰", "╯")}
|
|
458
|
+
|
|
459
|
+
${_mongez_copper.colors.bold(_mongez_copper.colors.cyan("🚀 Next steps:"))}
|
|
460
|
+
|
|
461
|
+
${_mongez_copper.colors.cyan("cd")} ${projectName}
|
|
462
|
+
${_mongez_copper.colors.cyan(devCommand)}
|
|
463
|
+
|
|
464
|
+
${_mongez_copper.colors.dim("💡 Pro tip: Install the")} ${_mongez_copper.colors.yellow("Generator Z")} ${_mongez_copper.colors.dim("extension in VSCode")}
|
|
465
|
+
${_mongez_copper.colors.dim("for helpful code snippets and productivity boosters!")}
|
|
466
|
+
|
|
467
|
+
${_mongez_copper.colors.dim("📚 Docs:")} ${_mongez_copper.colors.cyan("https://warlock.js.org")}
|
|
468
|
+
${_mongez_copper.colors.dim("⭐ Star us:")} ${_mongez_copper.colors.cyan("https://github.com/warlockjs/framework")}
|
|
469
|
+
`;
|
|
470
|
+
}
|
|
471
|
+
/**
|
|
472
|
+
* Display the success screen
|
|
473
|
+
*/
|
|
474
|
+
function showSuccessScreen(options) {
|
|
475
|
+
console.log(getSuccessScreen(options));
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
//#endregion
|
|
479
|
+
//#region ../../@warlock.js/create-warlock/src/ui/spinners.ts
|
|
480
|
+
/**
|
|
481
|
+
* Themed spinner messages for the wizard
|
|
482
|
+
*/
|
|
483
|
+
const spinnerMessages = {
|
|
484
|
+
installingDeps: "📦 Summoning dependencies...",
|
|
485
|
+
depsInstalled: "📦 Dependencies materialized! ✅",
|
|
486
|
+
initializingGit: "📂 Initializing grimoire (git)...",
|
|
487
|
+
gitInitialized: "📂 Grimoire initialized! ✅",
|
|
488
|
+
generatingJwt: "🔐 Forging secret keys...",
|
|
489
|
+
jwtGenerated: "🔐 Secret keys forged! ✅",
|
|
490
|
+
warmingCache: "⚡ Charging magical circuits...",
|
|
491
|
+
cacheWarmed: "⚡ Circuits charged! ✅",
|
|
492
|
+
addingFeatures: "🪄 Weaving in your features...",
|
|
493
|
+
featuresAdded: "🪄 Features woven in! ✅",
|
|
494
|
+
featuresFailed: "⚠️ Some features could not be added — add them later with `warlock add`",
|
|
495
|
+
copyingTemplate: "📋 Preparing your spellbook...",
|
|
496
|
+
templateCopied: "📋 Spellbook ready! ✅"
|
|
497
|
+
};
|
|
498
|
+
|
|
499
|
+
//#endregion
|
|
500
|
+
//#region ../../@warlock.js/create-warlock/src/commands/create-warlock-app/index.ts
|
|
501
|
+
async function createWarlockApp(application) {
|
|
502
|
+
const { useGit, useJWT, features, aiProviders, databaseDriver } = application.options;
|
|
503
|
+
const templateSpinner = (0, _clack_prompts.spinner)();
|
|
504
|
+
templateSpinner.start(spinnerMessages.copyingTemplate);
|
|
505
|
+
application.init().use("warlock").updatePackageJson().updateDotEnv().configureDatabaseEnv(databaseDriver);
|
|
506
|
+
templateSpinner.stop(spinnerMessages.templateCopied);
|
|
507
|
+
const installSpinner = (0, _clack_prompts.spinner)();
|
|
508
|
+
installSpinner.start(spinnerMessages.installingDeps);
|
|
509
|
+
await application.install().install;
|
|
510
|
+
installSpinner.stop(spinnerMessages.depsInstalled);
|
|
511
|
+
const selectedFeatures = [
|
|
512
|
+
databaseDriver,
|
|
513
|
+
...features,
|
|
514
|
+
...aiProviders
|
|
515
|
+
];
|
|
516
|
+
if (selectedFeatures.length > 0) {
|
|
517
|
+
const featuresSpinner = (0, _clack_prompts.spinner)();
|
|
518
|
+
featuresSpinner.start(spinnerMessages.addingFeatures);
|
|
519
|
+
if (await application.installFeatures(selectedFeatures)) {
|
|
520
|
+
await application.install().install;
|
|
521
|
+
featuresSpinner.stop(spinnerMessages.featuresAdded);
|
|
522
|
+
} else featuresSpinner.stop(spinnerMessages.featuresFailed);
|
|
523
|
+
}
|
|
524
|
+
if (useGit) {
|
|
525
|
+
const gitSpinner = (0, _clack_prompts.spinner)();
|
|
526
|
+
gitSpinner.start(spinnerMessages.initializingGit);
|
|
527
|
+
await application.git();
|
|
528
|
+
gitSpinner.stop(spinnerMessages.gitInitialized);
|
|
529
|
+
}
|
|
530
|
+
if (useJWT) {
|
|
531
|
+
const jwtSpinner = (0, _clack_prompts.spinner)();
|
|
532
|
+
jwtSpinner.start(spinnerMessages.generatingJwt);
|
|
533
|
+
await application.exec(require_paths.runPackageManagerCommand("jwt"));
|
|
534
|
+
jwtSpinner.stop(spinnerMessages.jwtGenerated);
|
|
535
|
+
} else {
|
|
536
|
+
const warmSpinner = (0, _clack_prompts.spinner)();
|
|
537
|
+
warmSpinner.start(spinnerMessages.warmingCache);
|
|
538
|
+
await application.exec("npx warlock --warm-cache");
|
|
539
|
+
warmSpinner.stop(spinnerMessages.cacheWarmed);
|
|
540
|
+
}
|
|
541
|
+
showSuccessScreen({
|
|
542
|
+
projectName: application.name,
|
|
543
|
+
database: databaseDriver === "mongodb" ? "MongoDB" : "PostgreSQL",
|
|
544
|
+
features: [...features, ...aiProviders],
|
|
545
|
+
packageManager: require_paths.getPackageManager()
|
|
546
|
+
});
|
|
547
|
+
}
|
|
548
|
+
|
|
549
|
+
//#endregion
|
|
550
|
+
//#region ../../@warlock.js/create-warlock/src/commands/create-new-app/get-app-path.ts
|
|
551
|
+
function getAppPath(appName) {
|
|
552
|
+
const appPath = path.resolve(process.cwd(), appName);
|
|
553
|
+
if ((0, _warlock_js_fs.directoryExists)(appPath)) {
|
|
554
|
+
console.log(_mongez_copper.colors.redBright(`${process.cwd()} has an existing directory \`${_mongez_copper.colors.cyan(appName)}\`, please choose another app name or another directory to run the command from.`));
|
|
555
|
+
process.exit(1);
|
|
556
|
+
}
|
|
557
|
+
return appPath;
|
|
558
|
+
}
|
|
559
|
+
|
|
560
|
+
//#endregion
|
|
561
|
+
//#region ../../@warlock.js/create-warlock/src/commands/create-new-app/index.ts
|
|
562
|
+
async function createNewApp(cli = {}) {
|
|
563
|
+
const pmDetectionPromise = require_paths.detectPackageManagers();
|
|
564
|
+
const createWarlockVersion = (0, _warlock_js_fs.getJsonFile)(require_paths.packageRoot("package.json")).version;
|
|
565
|
+
showIntroBanner(createWarlockVersion);
|
|
566
|
+
console.log(_mongez_copper.colors.cyan("✨ Let's create something magical! ✨\n"));
|
|
567
|
+
const [major] = process.versions.node.split(".").map(Number);
|
|
568
|
+
if (major < 20) {
|
|
569
|
+
(0, _clack_prompts.cancel)("Node.js version must be at least 20.0.0");
|
|
570
|
+
process.exit(0);
|
|
571
|
+
}
|
|
572
|
+
if (cli.yes) {
|
|
573
|
+
await createNonInteractive(cli);
|
|
574
|
+
return;
|
|
575
|
+
}
|
|
576
|
+
const appName = await (0, _clack_prompts.text)({
|
|
577
|
+
message: "What shall we call your project?",
|
|
578
|
+
placeholder: "my-warlock-app"
|
|
579
|
+
});
|
|
580
|
+
if ((0, _clack_prompts.isCancel)(appName) || !appName.trim()) {
|
|
581
|
+
(0, _clack_prompts.cancel)("A project name is required to continue");
|
|
582
|
+
process.exit(0);
|
|
583
|
+
}
|
|
584
|
+
const appPath = getAppPath(appName);
|
|
585
|
+
if (!appPath) return;
|
|
586
|
+
await pmDetectionPromise;
|
|
587
|
+
const packageManager = await (0, _clack_prompts.select)({
|
|
588
|
+
message: "Which package manager do you want to use?",
|
|
589
|
+
options: require_paths.getSystemPackageManagers().map((pm) => ({
|
|
590
|
+
value: pm,
|
|
591
|
+
label: pm
|
|
592
|
+
})),
|
|
593
|
+
initialValue: require_paths.getPreferredPackageManager()
|
|
594
|
+
});
|
|
595
|
+
if ((0, _clack_prompts.isCancel)(packageManager)) {
|
|
596
|
+
(0, _clack_prompts.cancel)("Package manager selection cancelled");
|
|
597
|
+
process.exit(0);
|
|
598
|
+
}
|
|
599
|
+
require_paths.setPackageManager(packageManager);
|
|
600
|
+
const databaseDriver = await (0, _clack_prompts.select)({
|
|
601
|
+
message: "Choose your database driver 🗄ï¸",
|
|
602
|
+
options: getDatabaseDriverOptions()
|
|
603
|
+
});
|
|
604
|
+
if ((0, _clack_prompts.isCancel)(databaseDriver)) {
|
|
605
|
+
(0, _clack_prompts.cancel)("Database selection cancelled");
|
|
606
|
+
process.exit(0);
|
|
607
|
+
}
|
|
608
|
+
const selectedDriver = getDatabaseDriver(databaseDriver);
|
|
609
|
+
const selectedFeatures = await (0, _clack_prompts.multiselect)({
|
|
610
|
+
message: "Select optional features to include ✨",
|
|
611
|
+
options: getFeatureOptions(),
|
|
612
|
+
initialValues: getDefaultFeatureKeys(),
|
|
613
|
+
required: false
|
|
614
|
+
});
|
|
615
|
+
if ((0, _clack_prompts.isCancel)(selectedFeatures)) {
|
|
616
|
+
(0, _clack_prompts.cancel)("Feature selection cancelled");
|
|
617
|
+
process.exit(0);
|
|
618
|
+
}
|
|
619
|
+
const selectedAiProviders = await (0, _clack_prompts.multiselect)({
|
|
620
|
+
message: "Add AI providers? The core AI package is included automatically 🤖",
|
|
621
|
+
options: getAiProviderOptions(),
|
|
622
|
+
required: false
|
|
623
|
+
});
|
|
624
|
+
if ((0, _clack_prompts.isCancel)(selectedAiProviders)) {
|
|
625
|
+
(0, _clack_prompts.cancel)("AI provider selection cancelled");
|
|
626
|
+
process.exit(0);
|
|
627
|
+
}
|
|
628
|
+
const useGit = await (0, _clack_prompts.confirm)({ message: "Initialize a Git repository? 📂" }) === true;
|
|
629
|
+
if ((0, _clack_prompts.isCancel)(useGit)) {
|
|
630
|
+
(0, _clack_prompts.cancel)("Setup cancelled");
|
|
631
|
+
process.exit(0);
|
|
632
|
+
}
|
|
633
|
+
const useJWT = await (0, _clack_prompts.confirm)({ message: "Generate JWT secret keys? ðŸ”" }) === true;
|
|
634
|
+
if ((0, _clack_prompts.isCancel)(useJWT)) {
|
|
635
|
+
(0, _clack_prompts.cancel)("Setup cancelled");
|
|
636
|
+
process.exit(0);
|
|
637
|
+
}
|
|
638
|
+
await createWarlockApp(new App({
|
|
639
|
+
appName,
|
|
640
|
+
appType: "warlock",
|
|
641
|
+
appPath,
|
|
642
|
+
pkgManager: require_paths.getPackageManager(),
|
|
643
|
+
options: {
|
|
644
|
+
databaseDriver,
|
|
645
|
+
databasePort: selectedDriver?.defaultPort || 27017,
|
|
646
|
+
features: selectedFeatures,
|
|
647
|
+
aiProviders: selectedAiProviders,
|
|
648
|
+
useGit,
|
|
649
|
+
useJWT
|
|
650
|
+
}
|
|
651
|
+
}));
|
|
652
|
+
}
|
|
653
|
+
/**
|
|
654
|
+
* Non-interactive scaffold path for `--yes`. Builds the app from flags with
|
|
655
|
+
* sensible defaults and skips every prompt. Validates the database driver and
|
|
656
|
+
* feature/provider keys up front so a typo fails fast instead of mid-install.
|
|
657
|
+
*/
|
|
658
|
+
async function createNonInteractive(cli) {
|
|
659
|
+
const appName = (cli.name ?? "").trim();
|
|
660
|
+
if (!appName) {
|
|
661
|
+
(0, _clack_prompts.cancel)("--yes requires a project name (first argument or --name=<name>)");
|
|
662
|
+
process.exit(1);
|
|
663
|
+
}
|
|
664
|
+
const appPath = getAppPath(appName);
|
|
665
|
+
if (!appPath) return;
|
|
666
|
+
await require_paths.detectPackageManagers();
|
|
667
|
+
require_paths.setPackageManager(cli.pm ?? require_paths.getPreferredPackageManager());
|
|
668
|
+
const databaseDriver = cli.db ?? "mongodb";
|
|
669
|
+
const driver = getDatabaseDriver(databaseDriver);
|
|
670
|
+
if (!driver) {
|
|
671
|
+
(0, _clack_prompts.cancel)(`Unknown database driver "${databaseDriver}"`);
|
|
672
|
+
process.exit(1);
|
|
673
|
+
}
|
|
674
|
+
const features = cli.features ?? [];
|
|
675
|
+
const aiProviders = cli.ai ?? [];
|
|
676
|
+
const allowedKeys = getAllFeatureKeys();
|
|
677
|
+
const invalidKeys = [...features, ...aiProviders].filter((key) => !allowedKeys.includes(key));
|
|
678
|
+
if (invalidKeys.length > 0) {
|
|
679
|
+
(0, _clack_prompts.cancel)(`Unknown feature(s): ${invalidKeys.join(", ")}`);
|
|
680
|
+
process.exit(1);
|
|
681
|
+
}
|
|
682
|
+
await createWarlockApp(new App({
|
|
683
|
+
appName,
|
|
684
|
+
appType: "warlock",
|
|
685
|
+
appPath,
|
|
686
|
+
pkgManager: require_paths.getPackageManager(),
|
|
687
|
+
options: {
|
|
688
|
+
databaseDriver,
|
|
689
|
+
databasePort: driver.defaultPort,
|
|
690
|
+
features,
|
|
691
|
+
aiProviders,
|
|
692
|
+
useGit: cli.git ?? false,
|
|
693
|
+
useJWT: cli.jwt ?? false
|
|
694
|
+
}
|
|
695
|
+
}));
|
|
696
|
+
}
|
|
697
|
+
|
|
698
|
+
//#endregion
|
|
699
|
+
//#region ../../@warlock.js/create-warlock/src/index.ts
|
|
700
|
+
const valueFlags = [
|
|
701
|
+
"name",
|
|
702
|
+
"db",
|
|
703
|
+
"pm",
|
|
704
|
+
"features",
|
|
705
|
+
"ai"
|
|
706
|
+
];
|
|
707
|
+
/**
|
|
708
|
+
* Parse the scaffolder's own CLI flags for non-interactive mode.
|
|
709
|
+
*
|
|
710
|
+
* @example
|
|
711
|
+
* create-warlock my-app --db=postgres --features=test,herald --ai=openai,anthropic --yes
|
|
712
|
+
*/
|
|
713
|
+
function parseFlags(argv) {
|
|
714
|
+
const flags = {};
|
|
715
|
+
const positionals = [];
|
|
716
|
+
for (let i = 0; i < argv.length; i++) {
|
|
717
|
+
const arg = argv[i];
|
|
718
|
+
if (!arg.startsWith("-")) {
|
|
719
|
+
positionals.push(arg);
|
|
720
|
+
continue;
|
|
721
|
+
}
|
|
722
|
+
const equalIndex = arg.indexOf("=");
|
|
723
|
+
const key = (equalIndex === -1 ? arg : arg.slice(0, equalIndex)).replace(/^-+/, "");
|
|
724
|
+
let value = equalIndex === -1 ? void 0 : arg.slice(equalIndex + 1);
|
|
725
|
+
if (valueFlags.includes(key) && value === void 0) {
|
|
726
|
+
const next = argv[i + 1];
|
|
727
|
+
if (next && !next.startsWith("-")) {
|
|
728
|
+
value = next;
|
|
729
|
+
i++;
|
|
730
|
+
}
|
|
731
|
+
}
|
|
732
|
+
switch (key) {
|
|
733
|
+
case "yes":
|
|
734
|
+
case "y":
|
|
735
|
+
flags.yes = true;
|
|
736
|
+
break;
|
|
737
|
+
case "git":
|
|
738
|
+
flags.git = true;
|
|
739
|
+
break;
|
|
740
|
+
case "no-git":
|
|
741
|
+
flags.git = false;
|
|
742
|
+
break;
|
|
743
|
+
case "jwt":
|
|
744
|
+
flags.jwt = true;
|
|
745
|
+
break;
|
|
746
|
+
case "no-jwt":
|
|
747
|
+
flags.jwt = false;
|
|
748
|
+
break;
|
|
749
|
+
case "name":
|
|
750
|
+
flags.name = value;
|
|
751
|
+
break;
|
|
752
|
+
case "db":
|
|
753
|
+
flags.db = value;
|
|
754
|
+
break;
|
|
755
|
+
case "pm":
|
|
756
|
+
flags.pm = value;
|
|
757
|
+
break;
|
|
758
|
+
case "features":
|
|
759
|
+
flags.features = splitList(value);
|
|
760
|
+
break;
|
|
761
|
+
case "ai":
|
|
762
|
+
flags.ai = splitList(value);
|
|
763
|
+
break;
|
|
764
|
+
}
|
|
765
|
+
}
|
|
766
|
+
if (!flags.name && positionals.length > 0) flags.name = positionals[0];
|
|
767
|
+
return flags;
|
|
768
|
+
}
|
|
769
|
+
function splitList(value) {
|
|
770
|
+
if (!value) return [];
|
|
771
|
+
return value.split(",").map((item) => item.trim()).filter(Boolean);
|
|
772
|
+
}
|
|
773
|
+
function createApp() {
|
|
774
|
+
createNewApp(parseFlags(process.argv.slice(2)));
|
|
775
|
+
}
|
|
776
|
+
|
|
777
|
+
//#endregion
|
|
778
|
+
exports.default = createApp;
|
|
779
|
+
exports.parseFlags = parseFlags;
|
|
780
|
+
//# sourceMappingURL=index.cjs.map
|