create-moost 0.6.9 → 0.6.12
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/dist/index.cjs +44 -42
- package/dist/index.mjs +13 -17
- package/package.json +5 -5
- package/templates/cli/package.jsonc +1 -1
- package/templates/http/package.jsonc +1 -1
- package/templates/ssr/src/main.ts +2 -2
- package/templates/ws/package.jsonc +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
//#region \0rolldown/runtime.js
|
|
2
3
|
var __create = Object.create;
|
|
3
4
|
var __defProp = Object.defineProperty;
|
|
4
5
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -6,12 +7,16 @@ var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
|
6
7
|
var __getProtoOf = Object.getPrototypeOf;
|
|
7
8
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
9
|
var __copyProps = (to, from, except, desc) => {
|
|
9
|
-
if (from && typeof from === "object" || typeof from === "function")
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
12
|
+
key = keys[i];
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except) {
|
|
14
|
+
__defProp(to, key, {
|
|
15
|
+
get: ((k) => from[k]).bind(null, key),
|
|
16
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
}
|
|
15
20
|
}
|
|
16
21
|
return to;
|
|
17
22
|
};
|
|
@@ -21,12 +26,13 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
21
26
|
}) : target, mod));
|
|
22
27
|
|
|
23
28
|
//#endregion
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
29
|
+
let _moostjs_event_cli = require("@moostjs/event-cli");
|
|
30
|
+
let _wooksjs_event_cli = require("@wooksjs/event-cli");
|
|
31
|
+
let fs = require("fs");
|
|
32
|
+
let prompts = require("prompts");
|
|
33
|
+
prompts = __toESM(prompts);
|
|
34
|
+
let _prostojs_rewrite = require("@prostojs/rewrite");
|
|
35
|
+
let path = require("path");
|
|
30
36
|
|
|
31
37
|
//#region packages/create-moost/src/prompts.ts
|
|
32
38
|
const defaultProjectName = "moost-app";
|
|
@@ -49,8 +55,7 @@ async function getPrompts(inputs) {
|
|
|
49
55
|
name: "overwrite",
|
|
50
56
|
type: () => canSkipEmptying(predefined.targetDir) || inputs.force ? null : "confirm",
|
|
51
57
|
message: () => {
|
|
52
|
-
|
|
53
|
-
return `${dirForPrompt} is not empty. Remove existing files and continue?`;
|
|
58
|
+
return `${predefined.targetDir === "." ? "Current directory" : `Target directory "${predefined.targetDir}"`} is not empty. Remove existing files and continue?`;
|
|
54
59
|
}
|
|
55
60
|
},
|
|
56
61
|
{
|
|
@@ -63,13 +68,12 @@ async function getPrompts(inputs) {
|
|
|
63
68
|
{
|
|
64
69
|
name: "type",
|
|
65
70
|
type: () => {
|
|
66
|
-
const
|
|
71
|
+
const selected = [
|
|
67
72
|
"http",
|
|
68
73
|
"cli",
|
|
69
74
|
"ws",
|
|
70
75
|
"ssr"
|
|
71
|
-
];
|
|
72
|
-
const selected = typeFlags.filter((t) => inputs[t]);
|
|
76
|
+
].filter((t) => inputs[t]);
|
|
73
77
|
if (selected.length === 1) {
|
|
74
78
|
predefined.type = selected[0];
|
|
75
79
|
return null;
|
|
@@ -106,8 +110,7 @@ async function getPrompts(inputs) {
|
|
|
106
110
|
{
|
|
107
111
|
name: "ssr",
|
|
108
112
|
type: (prev, values) => {
|
|
109
|
-
|
|
110
|
-
if (type !== "ssr") return null;
|
|
113
|
+
if ((values.type || predefined.type) !== "ssr") return null;
|
|
111
114
|
return "toggle";
|
|
112
115
|
},
|
|
113
116
|
message: "Enable SSR (Server-Side Rendering)?",
|
|
@@ -118,8 +121,7 @@ async function getPrompts(inputs) {
|
|
|
118
121
|
{
|
|
119
122
|
name: "ws",
|
|
120
123
|
type: (prev, values) => {
|
|
121
|
-
|
|
122
|
-
if (type !== "http" || inputs.ws) return null;
|
|
124
|
+
if ((values.type || predefined.type) !== "http" || inputs.ws) return null;
|
|
123
125
|
return "toggle";
|
|
124
126
|
},
|
|
125
127
|
message: "Add WebSockets?",
|
|
@@ -176,7 +178,7 @@ function toValidPackageName(projectName) {
|
|
|
176
178
|
|
|
177
179
|
//#endregion
|
|
178
180
|
//#region packages/create-moost/src/scaffold.ts
|
|
179
|
-
const rw = new
|
|
181
|
+
const rw = new _prostojs_rewrite.ProstoRewrite({ textPattern: [
|
|
180
182
|
"*.{js,jsx,ts,tsx,txt,json,jsonc,yml,yaml,md,ini,css,html}",
|
|
181
183
|
"Dockerfile",
|
|
182
184
|
"*config",
|
|
@@ -260,7 +262,7 @@ function _ts_param(paramIndex, decorator) {
|
|
|
260
262
|
decorator(target, key, paramIndex);
|
|
261
263
|
};
|
|
262
264
|
}
|
|
263
|
-
let Commands = class Commands
|
|
265
|
+
let Commands = class Commands extends _moostjs_event_cli.CliApp {
|
|
264
266
|
root() {
|
|
265
267
|
return this.execute();
|
|
266
268
|
}
|
|
@@ -268,29 +270,29 @@ let Commands = class Commands$1 extends __moostjs_event_cli.CliApp {
|
|
|
268
270
|
return this.execute(name);
|
|
269
271
|
}
|
|
270
272
|
async execute(name) {
|
|
271
|
-
if ((0,
|
|
272
|
-
const prompts
|
|
273
|
+
if ((0, _wooksjs_event_cli.useAutoHelp)()) process.exit(0);
|
|
274
|
+
const prompts = await getPrompts({
|
|
273
275
|
name,
|
|
274
|
-
http: !!(0,
|
|
275
|
-
cli: !!(0,
|
|
276
|
-
ws: !!(0,
|
|
277
|
-
wf: !!(0,
|
|
278
|
-
ssr: !!(0,
|
|
279
|
-
oxc: !!(0,
|
|
280
|
-
force: !!(0,
|
|
276
|
+
http: !!(0, _wooksjs_event_cli.useCliOption)("http"),
|
|
277
|
+
cli: !!(0, _wooksjs_event_cli.useCliOption)("cli"),
|
|
278
|
+
ws: !!(0, _wooksjs_event_cli.useCliOption)("ws"),
|
|
279
|
+
wf: !!(0, _wooksjs_event_cli.useCliOption)("wf"),
|
|
280
|
+
ssr: !!(0, _wooksjs_event_cli.useCliOption)("ssr"),
|
|
281
|
+
oxc: !!(0, _wooksjs_event_cli.useCliOption)("oxc"),
|
|
282
|
+
force: !!(0, _wooksjs_event_cli.useCliOption)("force")
|
|
281
283
|
});
|
|
282
284
|
console.log("\nScaffolding a new project...");
|
|
283
|
-
await scaffold(prompts
|
|
284
|
-
const cli = prompts
|
|
285
|
-
const ws = prompts
|
|
286
|
-
const ssr = prompts
|
|
285
|
+
await scaffold(prompts);
|
|
286
|
+
const cli = prompts.type === "cli";
|
|
287
|
+
const ws = prompts.type === "ws";
|
|
288
|
+
const ssr = prompts.type === "ssr";
|
|
287
289
|
return `
|
|
288
|
-
[97m[1mSuccess! [22mYour new "${prompts
|
|
290
|
+
[97m[1mSuccess! [22mYour new "${prompts.projectName}" project has been created successfully. [39m
|
|
289
291
|
|
|
290
292
|
Follow these next steps to start your development server:
|
|
291
293
|
|
|
292
294
|
1. Navigate to your new project:
|
|
293
|
-
[36mcd ${prompts
|
|
295
|
+
[36mcd ${prompts.targetDir} [39m
|
|
294
296
|
|
|
295
297
|
2. Install the dependencies:
|
|
296
298
|
[36mnpm install [39m
|
|
@@ -310,14 +312,14 @@ API routes: http://localhost:3000/api/hello/World[39m
|
|
|
310
312
|
}
|
|
311
313
|
};
|
|
312
314
|
_ts_decorate([
|
|
313
|
-
(0,
|
|
315
|
+
(0, _moostjs_event_cli.Cli)(""),
|
|
314
316
|
_ts_metadata("design:type", Function),
|
|
315
317
|
_ts_metadata("design:paramtypes", []),
|
|
316
318
|
_ts_metadata("design:returntype", void 0)
|
|
317
319
|
], Commands.prototype, "root", null);
|
|
318
320
|
_ts_decorate([
|
|
319
|
-
(0,
|
|
320
|
-
_ts_param(0, (0,
|
|
321
|
+
(0, _moostjs_event_cli.Cli)(":name"),
|
|
322
|
+
_ts_param(0, (0, _moostjs_event_cli.Param)("name")),
|
|
321
323
|
_ts_metadata("design:type", Function),
|
|
322
324
|
_ts_metadata("design:paramtypes", [String]),
|
|
323
325
|
_ts_metadata("design:returntype", void 0)
|
package/dist/index.mjs
CHANGED
|
@@ -26,8 +26,7 @@ async function getPrompts(inputs) {
|
|
|
26
26
|
name: "overwrite",
|
|
27
27
|
type: () => canSkipEmptying(predefined.targetDir) || inputs.force ? null : "confirm",
|
|
28
28
|
message: () => {
|
|
29
|
-
|
|
30
|
-
return `${dirForPrompt} is not empty. Remove existing files and continue?`;
|
|
29
|
+
return `${predefined.targetDir === "." ? "Current directory" : `Target directory "${predefined.targetDir}"`} is not empty. Remove existing files and continue?`;
|
|
31
30
|
}
|
|
32
31
|
},
|
|
33
32
|
{
|
|
@@ -40,13 +39,12 @@ async function getPrompts(inputs) {
|
|
|
40
39
|
{
|
|
41
40
|
name: "type",
|
|
42
41
|
type: () => {
|
|
43
|
-
const
|
|
42
|
+
const selected = [
|
|
44
43
|
"http",
|
|
45
44
|
"cli",
|
|
46
45
|
"ws",
|
|
47
46
|
"ssr"
|
|
48
|
-
];
|
|
49
|
-
const selected = typeFlags.filter((t) => inputs[t]);
|
|
47
|
+
].filter((t) => inputs[t]);
|
|
50
48
|
if (selected.length === 1) {
|
|
51
49
|
predefined.type = selected[0];
|
|
52
50
|
return null;
|
|
@@ -83,8 +81,7 @@ async function getPrompts(inputs) {
|
|
|
83
81
|
{
|
|
84
82
|
name: "ssr",
|
|
85
83
|
type: (prev, values) => {
|
|
86
|
-
|
|
87
|
-
if (type !== "ssr") return null;
|
|
84
|
+
if ((values.type || predefined.type) !== "ssr") return null;
|
|
88
85
|
return "toggle";
|
|
89
86
|
},
|
|
90
87
|
message: "Enable SSR (Server-Side Rendering)?",
|
|
@@ -95,8 +92,7 @@ async function getPrompts(inputs) {
|
|
|
95
92
|
{
|
|
96
93
|
name: "ws",
|
|
97
94
|
type: (prev, values) => {
|
|
98
|
-
|
|
99
|
-
if (type !== "http" || inputs.ws) return null;
|
|
95
|
+
if ((values.type || predefined.type) !== "http" || inputs.ws) return null;
|
|
100
96
|
return "toggle";
|
|
101
97
|
},
|
|
102
98
|
message: "Add WebSockets?",
|
|
@@ -237,7 +233,7 @@ function _ts_param(paramIndex, decorator) {
|
|
|
237
233
|
decorator(target, key, paramIndex);
|
|
238
234
|
};
|
|
239
235
|
}
|
|
240
|
-
let Commands = class Commands
|
|
236
|
+
let Commands = class Commands extends CliApp {
|
|
241
237
|
root() {
|
|
242
238
|
return this.execute();
|
|
243
239
|
}
|
|
@@ -246,7 +242,7 @@ let Commands = class Commands$1 extends CliApp {
|
|
|
246
242
|
}
|
|
247
243
|
async execute(name) {
|
|
248
244
|
if (useAutoHelp()) process.exit(0);
|
|
249
|
-
const prompts
|
|
245
|
+
const prompts = await getPrompts({
|
|
250
246
|
name,
|
|
251
247
|
http: !!useCliOption("http"),
|
|
252
248
|
cli: !!useCliOption("cli"),
|
|
@@ -257,17 +253,17 @@ let Commands = class Commands$1 extends CliApp {
|
|
|
257
253
|
force: !!useCliOption("force")
|
|
258
254
|
});
|
|
259
255
|
console.log("\nScaffolding a new project...");
|
|
260
|
-
await scaffold(prompts
|
|
261
|
-
const cli = prompts
|
|
262
|
-
const ws = prompts
|
|
263
|
-
const ssr = prompts
|
|
256
|
+
await scaffold(prompts);
|
|
257
|
+
const cli = prompts.type === "cli";
|
|
258
|
+
const ws = prompts.type === "ws";
|
|
259
|
+
const ssr = prompts.type === "ssr";
|
|
264
260
|
return `
|
|
265
|
-
[97m[1mSuccess! [22mYour new "${prompts
|
|
261
|
+
[97m[1mSuccess! [22mYour new "${prompts.projectName}" project has been created successfully. [39m
|
|
266
262
|
|
|
267
263
|
Follow these next steps to start your development server:
|
|
268
264
|
|
|
269
265
|
1. Navigate to your new project:
|
|
270
|
-
[36mcd ${prompts
|
|
266
|
+
[36mcd ${prompts.targetDir} [39m
|
|
271
267
|
|
|
272
268
|
2. Install the dependencies:
|
|
273
269
|
[36mnpm install [39m
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-moost",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.12",
|
|
4
4
|
"description": "create-moost",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"composables",
|
|
@@ -44,16 +44,16 @@
|
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
46
|
"@prostojs/rewrite": "^0.2.3",
|
|
47
|
-
"@wooksjs/event-cli": "^0.7.
|
|
47
|
+
"@wooksjs/event-cli": "^0.7.12",
|
|
48
48
|
"prompts": "^2.4.2",
|
|
49
|
-
"@moostjs/event-cli": "^0.6.
|
|
50
|
-
"moost": "^0.6.
|
|
49
|
+
"@moostjs/event-cli": "^0.6.12",
|
|
50
|
+
"moost": "^0.6.12"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
53
|
"@types/prompts": "^2.4.9",
|
|
54
54
|
"vite": "^8.0.10",
|
|
55
55
|
"vitest": "3.2.4",
|
|
56
|
-
"@moostjs/vite": "^0.6.
|
|
56
|
+
"@moostjs/vite": "^0.6.12"
|
|
57
57
|
},
|
|
58
58
|
"scripts": {
|
|
59
59
|
"pub": "pnpm publish --access public",
|
|
@@ -3,6 +3,6 @@ import { MoostHttp } from '@moostjs/event-http'
|
|
|
3
3
|
import { ApiController } from './controllers/api.controller'
|
|
4
4
|
|
|
5
5
|
const app = new Moost()
|
|
6
|
-
app.adapter(new MoostHttp()).listen(3000)
|
|
7
6
|
app.registerControllers(ApiController)
|
|
8
|
-
app.
|
|
7
|
+
await app.adapter(new MoostHttp()).listen(3000)
|
|
8
|
+
await app.init()
|