wexts 3.0.1 → 4.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/README.md +49 -346
- package/bin/wexts.cjs +2 -0
- package/dist/chunk-2KAQYLVN.js +0 -0
- package/dist/chunk-2KAQYLVN.js.map +1 -1
- package/dist/{chunk-O42L6HOX.js → chunk-2LJVUMXW.js} +79 -93
- package/dist/chunk-2LJVUMXW.js.map +1 -0
- package/dist/chunk-7QKLIVRF.js +94 -0
- package/dist/chunk-7QKLIVRF.js.map +1 -0
- package/dist/{chunk-FCEZDH42.mjs → chunk-7WULUGLH.mjs} +5 -3
- package/dist/chunk-7WULUGLH.mjs.map +1 -0
- package/dist/{chunk-WF65EDRZ.js → chunk-BG56B4DE.js} +20 -2
- package/dist/chunk-BG56B4DE.js.map +1 -0
- package/dist/chunk-CLM5PNSG.mjs +496 -0
- package/dist/chunk-CLM5PNSG.mjs.map +1 -0
- package/dist/chunk-DNLGCKTT.js +31 -0
- package/dist/chunk-DNLGCKTT.js.map +1 -0
- package/dist/{chunk-VNNVLQLJ.mjs → chunk-JHOVXH3X.mjs} +2 -2
- package/dist/chunk-JHOVXH3X.mjs.map +1 -0
- package/dist/chunk-MXINIFPC.js +105 -0
- package/dist/chunk-MXINIFPC.js.map +1 -0
- package/dist/chunk-SE32ZPOZ.js +496 -0
- package/dist/chunk-SE32ZPOZ.js.map +1 -0
- package/dist/{chunk-STTOPUZ2.mjs → chunk-UAL54DVV.mjs} +21 -3
- package/dist/chunk-UAL54DVV.mjs.map +1 -0
- package/dist/{chunk-3OM7CHCA.js → chunk-WCKSKU3C.js} +1 -1
- package/dist/chunk-WCKSKU3C.js.map +1 -0
- package/dist/chunk-WU6FW77M.mjs +105 -0
- package/dist/chunk-WU6FW77M.mjs.map +1 -0
- package/dist/chunk-XE4OXN2W.js +0 -0
- package/dist/chunk-XE4OXN2W.js.map +1 -1
- package/dist/chunk-YBM3IJEA.mjs +94 -0
- package/dist/chunk-YBM3IJEA.mjs.map +1 -0
- package/dist/{chunk-KXYLEUSW.mjs → chunk-YN6WIWNQ.mjs} +69 -83
- package/dist/chunk-YN6WIWNQ.mjs.map +1 -0
- package/dist/chunk-YSLEF5C5.mjs +0 -0
- package/dist/chunk-YSLEF5C5.mjs.map +0 -0
- package/dist/chunk-ZX7QIN24.mjs +31 -0
- package/dist/chunk-ZX7QIN24.mjs.map +1 -0
- package/dist/cli/index.d.mts +10 -0
- package/dist/cli/index.d.ts +10 -0
- package/dist/cli/index.js +292 -292
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/index.mjs +294 -293
- package/dist/cli/index.mjs.map +1 -1
- package/dist/client/index.d.mts +10 -1
- package/dist/client/index.d.ts +10 -1
- package/dist/client/index.js +4 -2
- package/dist/client/index.js.map +1 -1
- package/dist/client/index.mjs +6 -4
- package/dist/client/index.mjs.map +0 -0
- package/dist/codegen/index.d.mts +2 -1
- package/dist/codegen/index.d.ts +2 -1
- package/dist/codegen/index.js +5 -3
- package/dist/codegen/index.js.map +1 -1
- package/dist/codegen/index.mjs +7 -5
- package/dist/codegen/index.mjs.map +0 -0
- package/dist/decorators-BT1FFqN0.d.mts +29 -0
- package/dist/decorators-DvS58PqC.d.ts +29 -0
- package/dist/dev-server/index.d.mts +1 -1
- package/dist/dev-server/index.d.ts +1 -1
- package/dist/dev-server/index.js +3 -3
- package/dist/dev-server/index.js.map +1 -1
- package/dist/dev-server/index.mjs +3 -3
- package/dist/dev-server/index.mjs.map +0 -0
- package/dist/{index-SjUaHgFr.d.ts → index-7QeQEf37.d.ts} +27 -10
- package/dist/{index-tFGPFVfQ.d.mts → index-7RvU-jGE.d.mts} +0 -1
- package/dist/{index-tFGPFVfQ.d.ts → index-7RvU-jGE.d.ts} +0 -1
- package/dist/{index-SjUaHgFr.d.mts → index-8nzxy0NN.d.mts} +27 -10
- package/dist/index-Co5ZsLqq.d.ts +58 -0
- package/dist/index-D94W1__r.d.mts +58 -0
- package/dist/index-DQmyVp6F.d.mts +27 -0
- package/dist/index-KL_1BrQb.d.ts +27 -0
- package/dist/index.d.mts +17 -6
- package/dist/index.d.ts +17 -6
- package/dist/index.js +57 -30
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +48 -21
- package/dist/index.mjs.map +1 -1
- package/dist/nest/index.d.mts +3 -1
- package/dist/nest/index.d.ts +3 -1
- package/dist/nest/index.js +20 -2
- package/dist/nest/index.js.map +1 -1
- package/dist/nest/index.mjs +21 -3
- package/dist/nest/index.mjs.map +0 -0
- package/dist/next/index.d.mts +7 -2
- package/dist/next/index.d.ts +7 -2
- package/dist/next/index.js +72 -5
- package/dist/next/index.js.map +1 -1
- package/dist/next/index.mjs +70 -4
- package/dist/next/index.mjs.map +1 -1
- package/dist/rpc/index.d.mts +2 -0
- package/dist/rpc/index.d.ts +2 -0
- package/dist/rpc/index.js +23 -0
- package/dist/rpc/index.js.map +1 -0
- package/dist/rpc/index.mjs +23 -0
- package/dist/{chunk-7NSRDJ5C.mjs.map → rpc/index.mjs.map} +0 -0
- package/dist/runtime/index.d.mts +55 -0
- package/dist/runtime/index.d.ts +55 -0
- package/dist/runtime/index.js +213 -0
- package/dist/runtime/index.js.map +1 -0
- package/dist/runtime/index.mjs +213 -0
- package/dist/runtime/index.mjs.map +1 -0
- package/dist/types/index.d.mts +0 -0
- package/dist/types/index.d.ts +0 -0
- package/dist/types/index.js +0 -0
- package/dist/types/index.js.map +1 -1
- package/dist/types/index.mjs +1 -1
- package/dist/types/index.mjs.map +0 -0
- package/dist/types-7d_fC-C3.d.mts +32 -0
- package/dist/types-7d_fC-C3.d.ts +32 -0
- package/dist/vercel-builder/index.d.mts +58 -0
- package/dist/vercel-builder/index.d.ts +58 -0
- package/dist/vercel-builder/index.js +330 -0
- package/dist/vercel-builder/index.js.map +1 -0
- package/dist/vercel-builder/index.mjs +330 -0
- package/dist/vercel-builder/index.mjs.map +1 -0
- package/package.json +37 -16
- package/templates/.dockerignore +43 -43
- package/templates/.env.example +0 -0
- package/templates/Dockerfile +60 -60
- package/templates/Procfile +1 -1
- package/templates/README.md +67 -58
- package/templates/api-sdk.ts +115 -115
- package/templates/docker-compose.yml +34 -34
- package/templates/nestjs-api/.env.example +0 -0
- package/templates/nestjs-api/README.md +87 -79
- package/templates/nestjs-api/nest-cli.json +6 -6
- package/templates/nestjs-api/package-lock.json +5623 -5623
- package/templates/nestjs-api/package.json +40 -40
- package/templates/nestjs-api/prisma/dev.db +0 -0
- package/templates/nestjs-api/prisma/migrations/20251123205437_init/migration.sql +0 -0
- package/templates/nestjs-api/prisma/migrations/migration_lock.toml +0 -0
- package/templates/nestjs-api/prisma/schema.prisma +29 -29
- package/templates/nestjs-api/src/app.module.ts +17 -17
- package/templates/nestjs-api/src/auth/auth.controller.ts +27 -27
- package/templates/nestjs-api/src/auth/auth.module.ts +37 -29
- package/templates/nestjs-api/src/auth/auth.service.ts +86 -86
- package/templates/nestjs-api/src/auth/dto/auth.dto.ts +22 -22
- package/templates/nestjs-api/src/auth/guards/jwt-auth.guard.ts +5 -5
- package/templates/nestjs-api/src/auth/strategies/jwt.strategy.ts +27 -19
- package/templates/nestjs-api/src/main.ts +32 -32
- package/templates/nestjs-api/src/prisma/prisma.module.ts +9 -9
- package/templates/nestjs-api/src/prisma/prisma.service.ts +14 -14
- package/templates/nestjs-api/src/todos/dto/todo.dto.ts +24 -24
- package/templates/nestjs-api/src/todos/todos.controller.ts +39 -39
- package/templates/nestjs-api/src/todos/todos.module.ts +11 -11
- package/templates/nestjs-api/src/todos/todos.service.ts +53 -53
- package/templates/nestjs-api/src/users/users.controller.ts +14 -14
- package/templates/nestjs-api/src/users/users.module.ts +12 -12
- package/templates/nestjs-api/src/users/users.service.ts +19 -19
- package/templates/nestjs-api/tsconfig.json +39 -39
- package/templates/nextjs-web/README.md +76 -68
- package/templates/nextjs-web/app/actions/auth.ts +108 -108
- package/templates/nextjs-web/app/dashboard/error.tsx +39 -39
- package/templates/nextjs-web/app/dashboard/loading.tsx +14 -14
- package/templates/nextjs-web/app/dashboard/page.tsx +5 -5
- package/templates/nextjs-web/app/globals.css +93 -93
- package/templates/nextjs-web/app/layout.tsx +29 -29
- package/templates/nextjs-web/app/login/page.tsx +5 -5
- package/templates/nextjs-web/app/page.tsx +28 -28
- package/templates/nextjs-web/app/register/page.tsx +5 -5
- package/templates/nextjs-web/components/ui/button.tsx +56 -56
- package/templates/nextjs-web/components/ui/card.tsx +79 -79
- package/templates/nextjs-web/components/ui/input.tsx +25 -25
- package/templates/nextjs-web/components/ui/label.tsx +24 -24
- package/templates/nextjs-web/features/auth/LoginForm.tsx +140 -140
- package/templates/nextjs-web/features/auth/RegisterForm.tsx +159 -159
- package/templates/nextjs-web/features/auth/api.ts +35 -35
- package/templates/nextjs-web/features/auth/index.ts +3 -3
- package/templates/nextjs-web/features/dashboard/DashboardView.tsx +204 -204
- package/templates/nextjs-web/features/dashboard/api.ts +9 -9
- package/templates/nextjs-web/features/dashboard/components.tsx +74 -74
- package/templates/nextjs-web/features/dashboard/index.ts +3 -3
- package/templates/nextjs-web/hooks/index.ts +4 -4
- package/templates/nextjs-web/lib/api-client.ts +89 -89
- package/templates/nextjs-web/lib/api.ts +115 -115
- package/templates/nextjs-web/lib/axios-global-config.ts +17 -17
- package/templates/nextjs-web/lib/utils.ts +6 -6
- package/templates/nextjs-web/lib/wexts-client.ts +4 -4
- package/templates/nextjs-web/next-env.d.ts +6 -6
- package/templates/nextjs-web/next.config.ts +20 -20
- package/templates/nextjs-web/package-lock.json +3254 -3254
- package/templates/nextjs-web/package.json +37 -37
- package/templates/nextjs-web/postcss.config.js +6 -6
- package/templates/nextjs-web/tailwind.config.ts +69 -69
- package/templates/nextjs-web/tsconfig.json +1 -1
- package/templates/nixpacks.toml +11 -11
- package/templates/root-package.json +31 -31
- package/templates/server.ts +66 -66
- package/templates/tsconfig.json +30 -30
- package/dist/chunk-2MCBBWEA.js +0 -1
- package/dist/chunk-2MCBBWEA.js.map +0 -1
- package/dist/chunk-3OM7CHCA.js.map +0 -1
- package/dist/chunk-63MTCWU2.mjs +0 -361
- package/dist/chunk-63MTCWU2.mjs.map +0 -1
- package/dist/chunk-667BQCEM.js +0 -375
- package/dist/chunk-667BQCEM.js.map +0 -1
- package/dist/chunk-67IJ6H4J.mjs +0 -44
- package/dist/chunk-67IJ6H4J.mjs.map +0 -1
- package/dist/chunk-6SVQEGEX.mjs +0 -44
- package/dist/chunk-6SVQEGEX.mjs.map +0 -1
- package/dist/chunk-7NSRDJ5C.mjs +0 -1
- package/dist/chunk-ASDXAK6G.js +0 -44
- package/dist/chunk-ASDXAK6G.js.map +0 -1
- package/dist/chunk-CKZ4VSCB.mjs +0 -18
- package/dist/chunk-CKZ4VSCB.mjs.map +0 -1
- package/dist/chunk-DW6GOKMF.js +0 -57
- package/dist/chunk-DW6GOKMF.js.map +0 -1
- package/dist/chunk-EFZPSZWO.mjs +0 -1
- package/dist/chunk-EFZPSZWO.mjs.map +0 -1
- package/dist/chunk-FCEZDH42.mjs.map +0 -1
- package/dist/chunk-FYGXL4V7.js +0 -361
- package/dist/chunk-FYGXL4V7.js.map +0 -1
- package/dist/chunk-GKVPGKAH.js +0 -66
- package/dist/chunk-GKVPGKAH.js.map +0 -1
- package/dist/chunk-GWP6PNSP.js +0 -225
- package/dist/chunk-GWP6PNSP.js.map +0 -1
- package/dist/chunk-HQKTXE7E.mjs +0 -225
- package/dist/chunk-HQKTXE7E.mjs.map +0 -1
- package/dist/chunk-HSFLZUJN.mjs +0 -57
- package/dist/chunk-HSFLZUJN.mjs.map +0 -1
- package/dist/chunk-HU63F22V.js +0 -361
- package/dist/chunk-HU63F22V.js.map +0 -1
- package/dist/chunk-J5LGTIGS.mjs +0 -10
- package/dist/chunk-J5LGTIGS.mjs.map +0 -1
- package/dist/chunk-JMBD6DOP.js +0 -225
- package/dist/chunk-JMBD6DOP.js.map +0 -1
- package/dist/chunk-K7EIJSYQ.js +0 -1
- package/dist/chunk-K7EIJSYQ.js.map +0 -1
- package/dist/chunk-KXYLEUSW.mjs.map +0 -1
- package/dist/chunk-MTHKZO55.js +0 -44
- package/dist/chunk-MTHKZO55.js.map +0 -1
- package/dist/chunk-NNQFLD7O.mjs +0 -361
- package/dist/chunk-NNQFLD7O.mjs.map +0 -1
- package/dist/chunk-NU2UB242.js +0 -82
- package/dist/chunk-NU2UB242.js.map +0 -1
- package/dist/chunk-NULGSZFE.mjs +0 -57
- package/dist/chunk-NULGSZFE.mjs.map +0 -1
- package/dist/chunk-O42L6HOX.js.map +0 -1
- package/dist/chunk-ONXNE2A6.mjs +0 -375
- package/dist/chunk-ONXNE2A6.mjs.map +0 -1
- package/dist/chunk-OTBYRUBE.mjs +0 -225
- package/dist/chunk-OTBYRUBE.mjs.map +0 -1
- package/dist/chunk-OTSAVKLY.mjs +0 -66
- package/dist/chunk-OTSAVKLY.mjs.map +0 -1
- package/dist/chunk-PZ5AY32C.js +0 -10
- package/dist/chunk-PZ5AY32C.js.map +0 -1
- package/dist/chunk-QP2TMRLG.js +0 -57
- package/dist/chunk-QP2TMRLG.js.map +0 -1
- package/dist/chunk-RS23R3ZQ.mjs +0 -82
- package/dist/chunk-RS23R3ZQ.mjs.map +0 -1
- package/dist/chunk-STTOPUZ2.mjs.map +0 -1
- package/dist/chunk-VMT3LALB.mjs +0 -51
- package/dist/chunk-VMT3LALB.mjs.map +0 -1
- package/dist/chunk-VNNVLQLJ.mjs.map +0 -1
- package/dist/chunk-W3YRVEFQ.js +0 -66
- package/dist/chunk-W3YRVEFQ.js.map +0 -1
- package/dist/chunk-WF65EDRZ.js.map +0 -1
- package/dist/chunk-WMHVXEYQ.mjs +0 -66
- package/dist/chunk-WMHVXEYQ.mjs.map +0 -1
- package/dist/chunk-XVKTIYHY.js +0 -51
- package/dist/chunk-XVKTIYHY.js.map +0 -1
- package/dist/codegen-MRZDLCYI.js +0 -13
- package/dist/codegen-MRZDLCYI.js.map +0 -1
- package/dist/codegen-UI5HTMXE.mjs +0 -13
- package/dist/codegen-UI5HTMXE.mjs.map +0 -1
- package/dist/dev-server-JKRVBWPY.mjs +0 -13
- package/dist/dev-server-JKRVBWPY.mjs.map +0 -1
- package/dist/dev-server-TLL7UQMR.js +0 -13
- package/dist/dev-server-TLL7UQMR.js.map +0 -1
- package/dist/index-BsNaOUtH.d.mts +0 -44
- package/dist/index-BsNaOUtH.d.ts +0 -44
- package/dist/index-CrbXnXsO.d.ts +0 -62
- package/dist/index-kEbGExWM.d.mts +0 -62
- package/templates/nestjs-api/.env +0 -4
- package/templates/nextjs-web/.env +0 -1
package/dist/cli/index.mjs
CHANGED
|
@@ -1,333 +1,334 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
logger
|
|
4
|
-
} from "../chunk-
|
|
4
|
+
} from "../chunk-JHOVXH3X.mjs";
|
|
5
5
|
import {
|
|
6
6
|
__dirname,
|
|
7
|
+
__filename,
|
|
7
8
|
__name
|
|
8
|
-
} from "../chunk-
|
|
9
|
+
} from "../chunk-7WULUGLH.mjs";
|
|
9
10
|
|
|
10
11
|
// src/cli/index.ts
|
|
11
12
|
import { Command } from "commander";
|
|
12
|
-
import * as pc from "picocolors";
|
|
13
|
-
import inquirer from "inquirer";
|
|
14
13
|
import * as fs from "fs";
|
|
15
14
|
import * as path from "path";
|
|
16
|
-
import {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
program
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
const { action } = await inquirer.prompt([
|
|
30
|
-
{
|
|
31
|
-
type: "list",
|
|
32
|
-
name: "action",
|
|
33
|
-
message: "What would you like to do?",
|
|
34
|
-
choices: [
|
|
35
|
-
{
|
|
36
|
-
name: "\u{1F4E6} Create a new project",
|
|
37
|
-
value: "create"
|
|
38
|
-
},
|
|
39
|
-
{
|
|
40
|
-
name: "\u{1F680} Start development server",
|
|
41
|
-
value: "dev"
|
|
42
|
-
},
|
|
43
|
-
{
|
|
44
|
-
name: "\u{1F528} Build for production",
|
|
45
|
-
value: "build"
|
|
46
|
-
},
|
|
47
|
-
{
|
|
48
|
-
name: "\u26A1 Generate code",
|
|
49
|
-
value: "generate"
|
|
50
|
-
},
|
|
51
|
-
{
|
|
52
|
-
name: "\u{1F916} Generate API client",
|
|
53
|
-
value: "codegen"
|
|
54
|
-
},
|
|
55
|
-
{
|
|
56
|
-
name: "\u274C Exit",
|
|
57
|
-
value: "exit"
|
|
58
|
-
}
|
|
59
|
-
]
|
|
60
|
-
}
|
|
61
|
-
]);
|
|
62
|
-
if (action === "exit") {
|
|
63
|
-
logger.info("Goodbye! \u{1F44B}");
|
|
64
|
-
process.exit(0);
|
|
65
|
-
}
|
|
66
|
-
if (action === "create") {
|
|
67
|
-
const { projectName, template } = await inquirer.prompt([
|
|
68
|
-
{
|
|
69
|
-
type: "input",
|
|
70
|
-
name: "projectName",
|
|
71
|
-
message: "Project name:",
|
|
72
|
-
default: "my-wexts-app"
|
|
73
|
-
},
|
|
74
|
-
{
|
|
75
|
-
type: "list",
|
|
76
|
-
name: "template",
|
|
77
|
-
message: "Select template:",
|
|
78
|
-
choices: [
|
|
79
|
-
{
|
|
80
|
-
name: "\u{1F4E6} Monorepo (Next.js + NestJS)",
|
|
81
|
-
value: "monorepo"
|
|
82
|
-
},
|
|
83
|
-
{
|
|
84
|
-
name: "\u{1F3AF} API only (NestJS)",
|
|
85
|
-
value: "api"
|
|
86
|
-
},
|
|
87
|
-
{
|
|
88
|
-
name: "\u{1F310} Web only (Next.js)",
|
|
89
|
-
value: "web"
|
|
90
|
-
}
|
|
91
|
-
]
|
|
92
|
-
}
|
|
93
|
-
]);
|
|
94
|
-
await createProject(projectName, template);
|
|
95
|
-
} else if (action === "dev") {
|
|
96
|
-
logger.info(pc.green("\u{1F680} Starting development servers...\n"));
|
|
97
|
-
logger.warn("Dev server not yet implemented");
|
|
98
|
-
} else if (action === "build") {
|
|
99
|
-
logger.info(pc.blue("\u{1F528} Building project...\n"));
|
|
100
|
-
logger.warn("Build not yet implemented");
|
|
101
|
-
} else if (action === "generate") {
|
|
102
|
-
const { type, name } = await inquirer.prompt([
|
|
103
|
-
{
|
|
104
|
-
type: "list",
|
|
105
|
-
name: "type",
|
|
106
|
-
message: "What to generate?",
|
|
107
|
-
choices: [
|
|
108
|
-
"controller",
|
|
109
|
-
"module",
|
|
110
|
-
"service",
|
|
111
|
-
"page"
|
|
112
|
-
]
|
|
113
|
-
},
|
|
114
|
-
{
|
|
115
|
-
type: "input",
|
|
116
|
-
name: "name",
|
|
117
|
-
message: "Name:"
|
|
118
|
-
}
|
|
119
|
-
]);
|
|
120
|
-
logger.info(pc.magenta(`
|
|
121
|
-
\u26A1 Generating ${type}: ${name}
|
|
122
|
-
`));
|
|
123
|
-
logger.warn("Code generation not yet implemented");
|
|
124
|
-
} else if (action === "codegen") {
|
|
125
|
-
logger.info(pc.cyan("\n\u{1F916} Generating API client...\n"));
|
|
126
|
-
logger.warn("Codegen not yet implemented");
|
|
127
|
-
}
|
|
128
|
-
});
|
|
129
|
-
program.command("create <project-name>").description("Create a new wexts project").option("-t, --template <template>", "Template to use (monorepo|api|web)", "monorepo").action(async (projectName, options) => {
|
|
130
|
-
await createProject(projectName, options.template);
|
|
131
|
-
});
|
|
132
|
-
program.command("dev").description("Start development servers").option("-a, --api <path>", "Path to API project", "./apps/api").option("-w, --web <path>", "Path to Web project", "./apps/web").option("-p, --port <port>", "Port for web server", "3000").option("--api-port <port>", "Port for API server", "5050").option("--no-proxy", "Disable proxy server").action(async (options) => {
|
|
133
|
-
logger.info(pc.green("\u{1F680} Starting Wexts development servers...\n"));
|
|
134
|
-
const { FusionDevServer } = await import("../dev-server/index.mjs");
|
|
135
|
-
const server = new FusionDevServer();
|
|
136
|
-
try {
|
|
15
|
+
import { spawnSync } from "child_process";
|
|
16
|
+
import { createRequire } from "module";
|
|
17
|
+
function createCliProgram() {
|
|
18
|
+
const program = new Command();
|
|
19
|
+
program.name("wexts").description("Wexts - production-focused single-runtime Next.js + NestJS toolkit").version("3.0.3");
|
|
20
|
+
program.command("create <project-name>").description("Create a compatibility project from bundled legacy templates").option("-t, --template <template>", "Legacy template to use (monorepo|api|web)", "monorepo").option("--skip-install", "Skip dependency installation", false).action(async (projectName, options) => {
|
|
21
|
+
await createProject(projectName, options.template, {
|
|
22
|
+
skipInstall: options.skipInstall
|
|
23
|
+
});
|
|
24
|
+
});
|
|
25
|
+
program.command("dev").description("Start local development processes").option("-a, --api <path>", "Path to API project", "./apps/api").option("-w, --web <path>", "Path to Web project", "./apps/web").option("-p, --port <port>", "Port for web server", "3000").option("--api-port <port>", "Port for API server", "5050").option("--proxy", "Enable development proxy on a separate proxy port", false).action(async (options) => {
|
|
26
|
+
const { FusionDevServer } = await import("../dev-server/index.mjs");
|
|
27
|
+
const server = new FusionDevServer();
|
|
137
28
|
await server.start({
|
|
138
29
|
apiPath: options.api,
|
|
139
30
|
webPath: options.web,
|
|
140
|
-
webPort:
|
|
141
|
-
apiPort:
|
|
31
|
+
webPort: Number(options.port),
|
|
32
|
+
apiPort: Number(options.apiPort),
|
|
142
33
|
useProxy: options.proxy
|
|
143
34
|
});
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
});
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
35
|
+
});
|
|
36
|
+
program.command("generate [type] [name]").alias("g").description("Generate RPC manifest/client, or scaffold a minimal RPC service").option("-p, --project <path>", "Path to NestJS project", "./apps/api").option("-o, --output <path>", "Output directory for generated RPC client", "./apps/web/lib/wexts").action(async (type, name, options) => {
|
|
37
|
+
if (!type || type === "rpc") {
|
|
38
|
+
const { generateRpcClient } = await import("../codegen/index.mjs");
|
|
39
|
+
const manifest = await generateRpcClient({
|
|
40
|
+
projectPath: path.resolve(options.project),
|
|
41
|
+
outputPath: path.resolve(options.output)
|
|
42
|
+
});
|
|
43
|
+
logger.success(`Generated Wexts RPC client for ${manifest.services.length} service(s).`);
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
if (type === "service") {
|
|
47
|
+
if (!name) throw new Error("Service name is required: wexts generate service hello");
|
|
48
|
+
await scaffoldRpcService(path.resolve(options.project), name);
|
|
49
|
+
logger.success(`Created RPC service ${name}. Run wexts generate to update the client.`);
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
throw new Error(`Unknown generator "${type}". Supported generators: rpc, service.`);
|
|
53
|
+
});
|
|
54
|
+
program.command("codegen").description("Alias for wexts generate rpc").option("-p, --project <path>", "Path to NestJS project", "./apps/api").option("-o, --output <path>", "Output directory for generated RPC client", "./apps/web/lib/wexts").action(async (options) => {
|
|
55
|
+
const { generateRpcClient } = await import("../codegen/index.mjs");
|
|
56
|
+
const manifest = await generateRpcClient({
|
|
57
|
+
projectPath: path.resolve(options.project),
|
|
58
|
+
outputPath: path.resolve(options.output)
|
|
165
59
|
});
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
60
|
+
logger.success(`Generated Wexts RPC client for ${manifest.services.length} service(s).`);
|
|
61
|
+
});
|
|
62
|
+
program.command("build").description("Build a Wexts project for production").option("--skip-generate", "Skip RPC generation before build", false).option("-p, --project <path>", "Path to NestJS project", "./apps/api").option("-o, --output <path>", "Output directory for generated RPC client", "./apps/web/lib/wexts").action(async (options) => {
|
|
63
|
+
if (!options.skipGenerate && fs.existsSync(options.project)) {
|
|
64
|
+
const { generateRpcClient } = await import("../codegen/index.mjs");
|
|
65
|
+
await generateRpcClient({
|
|
66
|
+
projectPath: path.resolve(options.project),
|
|
67
|
+
outputPath: path.resolve(options.output)
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
runScript("build", {
|
|
71
|
+
cwd: process.cwd()
|
|
72
|
+
});
|
|
73
|
+
});
|
|
74
|
+
program.command("start").description("Start the production Wexts runtime").option("-c, --config <path>", "Runtime config module path", "./wexts.runtime.js").option("-p, --port <port>", "Port to listen on", process.env.PORT ?? "3000").action(async (options) => {
|
|
75
|
+
const { startWextsRuntime } = await import("../runtime/index.mjs");
|
|
76
|
+
const configPath = path.resolve(options.config);
|
|
77
|
+
const runtimeConfig = fs.existsSync(configPath) ? await loadRuntimeConfig(configPath) : {};
|
|
78
|
+
await startWextsRuntime({
|
|
79
|
+
...runtimeConfig,
|
|
80
|
+
port: Number(options.port),
|
|
81
|
+
dev: false
|
|
174
82
|
});
|
|
83
|
+
});
|
|
84
|
+
program.command("vercel-build").description("Build for Vercel using Build Output API v3").option("-p, --project <path>", "Path to NestJS project", "./apps/api").option("-o, --output <path>", "Output dir for RPC client", "./apps/web/lib/wexts").option("-c, --config <path>", "Runtime config module path", "./wexts.runtime.js").option("--skip-codegen", "Skip RPC generation", false).option("--skip-build", "Skip project build step", false).option("--node-version <version>", "Node.js version for Vercel function", "20").option("--max-duration <seconds>", "Max duration for serverless function", "30").action(async (options) => {
|
|
85
|
+
const { buildVercelOutput } = await import("../vercel-builder/index.mjs");
|
|
86
|
+
const result = await buildVercelOutput({
|
|
87
|
+
rootDir: process.cwd(),
|
|
88
|
+
apiProjectPath: options.project,
|
|
89
|
+
rpcOutputPath: options.output,
|
|
90
|
+
runtimeConfigPath: options.config,
|
|
91
|
+
skipCodegen: options.skipCodegen,
|
|
92
|
+
skipBuild: options.skipBuild,
|
|
93
|
+
nodeVersion: options.nodeVersion,
|
|
94
|
+
maxDuration: Number(options.maxDuration)
|
|
95
|
+
});
|
|
96
|
+
if (result.warnings.length > 0) {
|
|
97
|
+
for (const warning of result.warnings) logger.warn(warning);
|
|
98
|
+
}
|
|
99
|
+
if (result.errors.length > 0) {
|
|
100
|
+
for (const error of result.errors) logger.error(error);
|
|
101
|
+
process.exit(1);
|
|
102
|
+
}
|
|
103
|
+
logger.success("Vercel build output ready at .vercel/output");
|
|
104
|
+
});
|
|
105
|
+
program.command("doctor").description("Validate Wexts project configuration").option("--security", "Run security-specific checks", false).action(async (options) => {
|
|
106
|
+
const result = runDoctor(process.cwd(), options.security);
|
|
107
|
+
for (const warning of result.warnings) logger.warn(warning);
|
|
108
|
+
for (const error of result.errors) logger.error(error);
|
|
109
|
+
if (result.errors.length > 0) process.exit(1);
|
|
110
|
+
logger.success(options.security ? "Security doctor passed." : "Doctor passed.");
|
|
111
|
+
});
|
|
112
|
+
return program;
|
|
113
|
+
}
|
|
114
|
+
__name(createCliProgram, "createCliProgram");
|
|
115
|
+
function runDoctor(cwd, security = false) {
|
|
116
|
+
const result = {
|
|
117
|
+
errors: [],
|
|
118
|
+
warnings: []
|
|
119
|
+
};
|
|
120
|
+
const pkgPath = path.join(cwd, "package.json");
|
|
121
|
+
if (!fs.existsSync(pkgPath)) {
|
|
122
|
+
result.errors.push("package.json not found.");
|
|
123
|
+
return result;
|
|
175
124
|
}
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
logger.info(`Template: ${template}`);
|
|
180
|
-
const projectPath = path.join(process.cwd(), projectName);
|
|
181
|
-
if (fs.existsSync(projectPath)) {
|
|
182
|
-
logger.error(`Directory ${projectName} already exists!`);
|
|
183
|
-
process.exit(1);
|
|
125
|
+
const pkg = JSON.parse(fs.readFileSync(pkgPath, "utf8"));
|
|
126
|
+
if (!pkg.packageManager?.startsWith("pnpm@")) {
|
|
127
|
+
result.warnings.push("packageManager should pin pnpm.");
|
|
184
128
|
}
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
// Absolute resolve
|
|
192
|
-
];
|
|
193
|
-
for (const p of possiblePaths) {
|
|
194
|
-
if (fs.existsSync(p)) {
|
|
195
|
-
return p;
|
|
196
|
-
}
|
|
129
|
+
for (const dir of [
|
|
130
|
+
"apps/api",
|
|
131
|
+
"apps/web"
|
|
132
|
+
]) {
|
|
133
|
+
if (!fs.existsSync(path.join(cwd, dir))) {
|
|
134
|
+
result.warnings.push(`${dir} not found; some Wexts commands may need explicit paths.`);
|
|
197
135
|
}
|
|
198
|
-
return "";
|
|
199
136
|
}
|
|
200
|
-
|
|
201
|
-
|
|
137
|
+
if (fs.existsSync(path.join(cwd, "apps/api")) && fs.existsSync(path.join(cwd, "apps/web"))) {
|
|
138
|
+
result.warnings.push("Development mode starts separate web/API processes. Single-port serving is the production `wexts start` runtime path.");
|
|
139
|
+
}
|
|
140
|
+
if (security) {
|
|
141
|
+
const source = readAllText(cwd, [
|
|
142
|
+
"apps/api/src",
|
|
143
|
+
"packages/templates/nestjs-api/src"
|
|
144
|
+
]);
|
|
145
|
+
if (source.includes("default-secret")) {
|
|
146
|
+
result.errors.push('JWT fallback "default-secret" found. Production apps must fail without a strong JWT_SECRET.');
|
|
147
|
+
}
|
|
148
|
+
if (/origin:\s*['"]\*['"]/.test(source)) {
|
|
149
|
+
result.errors.push("Wildcard CORS origin found. Use an explicit origin allowlist.");
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
return result;
|
|
153
|
+
}
|
|
154
|
+
__name(runDoctor, "runDoctor");
|
|
155
|
+
async function createProject(projectName, template, options) {
|
|
156
|
+
const projectPath = path.join(process.cwd(), projectName);
|
|
157
|
+
if (fs.existsSync(projectPath)) {
|
|
158
|
+
throw new Error(`Directory already exists: ${projectName}`);
|
|
159
|
+
}
|
|
160
|
+
const templatePath = findTemplatePath();
|
|
202
161
|
if (!templatePath) {
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
fs.mkdirSync(projectPath, {
|
|
210
|
-
recursive: true
|
|
211
|
-
});
|
|
162
|
+
throw new Error("Template directory not found in package.");
|
|
163
|
+
}
|
|
164
|
+
fs.mkdirSync(projectPath, {
|
|
165
|
+
recursive: true
|
|
166
|
+
});
|
|
167
|
+
if (template === "monorepo") {
|
|
212
168
|
fs.mkdirSync(path.join(projectPath, "apps"), {
|
|
213
169
|
recursive: true
|
|
214
170
|
});
|
|
215
|
-
fs.
|
|
171
|
+
fs.cpSync(path.join(templatePath, "nestjs-api"), path.join(projectPath, "apps/api"), {
|
|
216
172
|
recursive: true
|
|
217
173
|
});
|
|
218
|
-
|
|
219
|
-
logger.info(`\u{1F4E6} Copying templates from: ${templatePath}`);
|
|
220
|
-
fs.mkdirSync(projectPath, {
|
|
174
|
+
fs.cpSync(path.join(templatePath, "nextjs-web"), path.join(projectPath, "apps/web"), {
|
|
221
175
|
recursive: true
|
|
222
176
|
});
|
|
223
|
-
fs.
|
|
177
|
+
fs.writeFileSync(path.join(projectPath, "pnpm-workspace.yaml"), "packages:\n - 'apps/*'\n");
|
|
178
|
+
fs.writeFileSync(path.join(projectPath, "package.json"), JSON.stringify({
|
|
179
|
+
name: projectName,
|
|
180
|
+
private: true,
|
|
181
|
+
packageManager: "pnpm@10.22.0",
|
|
182
|
+
scripts: {
|
|
183
|
+
dev: "wexts dev",
|
|
184
|
+
generate: "wexts generate",
|
|
185
|
+
build: "wexts build",
|
|
186
|
+
start: "wexts start",
|
|
187
|
+
doctor: "wexts doctor"
|
|
188
|
+
},
|
|
189
|
+
devDependencies: {
|
|
190
|
+
wexts: "latest"
|
|
191
|
+
}
|
|
192
|
+
}, null, 2));
|
|
193
|
+
} else if (template === "api") {
|
|
194
|
+
fs.cpSync(path.join(templatePath, "nestjs-api"), projectPath, {
|
|
224
195
|
recursive: true
|
|
225
196
|
});
|
|
226
|
-
|
|
197
|
+
} else if (template === "web") {
|
|
198
|
+
fs.cpSync(path.join(templatePath, "nextjs-web"), projectPath, {
|
|
227
199
|
recursive: true
|
|
228
200
|
});
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
if (fs.existsSync(apiTemplatePath)) {
|
|
232
|
-
fs.cpSync(apiTemplatePath, apiDestPath, {
|
|
233
|
-
recursive: true
|
|
234
|
-
});
|
|
235
|
-
logger.success(" - Copied API template");
|
|
236
|
-
const envExamplePath = path.join(apiDestPath, ".env.example");
|
|
237
|
-
const envPath = path.join(apiDestPath, ".env");
|
|
238
|
-
if (fs.existsSync(envExamplePath) && !fs.existsSync(envPath)) {
|
|
239
|
-
fs.copyFileSync(envExamplePath, envPath);
|
|
240
|
-
logger.success(" - Created .env from .env.example");
|
|
241
|
-
}
|
|
242
|
-
} else {
|
|
243
|
-
logger.warn(` \u26A0\uFE0F API template not found at ${apiTemplatePath}`);
|
|
244
|
-
}
|
|
245
|
-
const webTemplatePath = path.join(templatePath, "nextjs-web");
|
|
246
|
-
const webDestPath = path.join(projectPath, "apps/web");
|
|
247
|
-
if (fs.existsSync(webTemplatePath)) {
|
|
248
|
-
fs.cpSync(webTemplatePath, webDestPath, {
|
|
249
|
-
recursive: true
|
|
250
|
-
});
|
|
251
|
-
logger.success(" - Copied Web template");
|
|
252
|
-
} else {
|
|
253
|
-
logger.warn(` \u26A0\uFE0F Web template not found at ${webTemplatePath}`);
|
|
254
|
-
}
|
|
201
|
+
} else {
|
|
202
|
+
throw new Error(`Unknown template "${template}".`);
|
|
255
203
|
}
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
204
|
+
if (!options.skipInstall) {
|
|
205
|
+
runCommand(detectPackageManager(projectPath), [
|
|
206
|
+
"install"
|
|
207
|
+
], projectPath);
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
__name(createProject, "createProject");
|
|
211
|
+
async function scaffoldRpcService(apiProjectPath, rawName) {
|
|
212
|
+
const serviceName = toKebabCase(rawName);
|
|
213
|
+
const className = `${toPascalCase(serviceName)}Service`;
|
|
214
|
+
const dir = path.join(apiProjectPath, "src", serviceName);
|
|
215
|
+
fs.mkdirSync(dir, {
|
|
216
|
+
recursive: true
|
|
217
|
+
});
|
|
218
|
+
fs.writeFileSync(path.join(dir, `${serviceName}.service.ts`), `import { Injectable } from '@nestjs/common';
|
|
219
|
+
import { RpcMethod, RpcService } from 'wexts/nest';
|
|
220
|
+
|
|
221
|
+
@Injectable()
|
|
222
|
+
@RpcService({ name: '${toCamelCase(serviceName)}', requireAuth: false })
|
|
223
|
+
export class ${className} {
|
|
224
|
+
@RpcMethod()
|
|
225
|
+
async sayHello(name: string): Promise<string> {
|
|
226
|
+
return \`Hello, \${name}!\`;
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
`);
|
|
230
|
+
}
|
|
231
|
+
__name(scaffoldRpcService, "scaffoldRpcService");
|
|
232
|
+
function runScript(script, options) {
|
|
233
|
+
const cwd = options.cwd ?? process.cwd();
|
|
234
|
+
const packageManager = detectPackageManager(cwd);
|
|
235
|
+
const args = packageManager === "npm" ? [
|
|
236
|
+
"run",
|
|
237
|
+
script
|
|
238
|
+
] : [
|
|
239
|
+
"run",
|
|
240
|
+
script
|
|
241
|
+
];
|
|
242
|
+
runCommand(packageManager, args, cwd);
|
|
243
|
+
}
|
|
244
|
+
__name(runScript, "runScript");
|
|
245
|
+
function runCommand(command, args, cwd) {
|
|
246
|
+
const result = spawnSync(command, args, {
|
|
247
|
+
cwd,
|
|
248
|
+
stdio: "inherit",
|
|
249
|
+
shell: process.platform === "win32"
|
|
250
|
+
});
|
|
251
|
+
if (result.status !== 0) {
|
|
252
|
+
throw new Error(`${command} ${args.join(" ")} failed with exit code ${result.status}`);
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
__name(runCommand, "runCommand");
|
|
256
|
+
function detectPackageManager(cwd) {
|
|
257
|
+
if (fs.existsSync(path.join(cwd, "pnpm-lock.yaml"))) return "pnpm";
|
|
258
|
+
return "npm";
|
|
259
|
+
}
|
|
260
|
+
__name(detectPackageManager, "detectPackageManager");
|
|
261
|
+
function findTemplatePath() {
|
|
262
|
+
const candidates = [
|
|
263
|
+
path.resolve(__dirname, "../../templates"),
|
|
264
|
+
path.resolve(__dirname, "../templates"),
|
|
265
|
+
path.resolve(process.cwd(), "packages/templates")
|
|
266
|
+
];
|
|
267
|
+
return candidates.find((candidate) => fs.existsSync(candidate));
|
|
268
|
+
}
|
|
269
|
+
__name(findTemplatePath, "findTemplatePath");
|
|
270
|
+
function readAllText(cwd, dirs) {
|
|
271
|
+
let text = "";
|
|
272
|
+
for (const dir of dirs) {
|
|
273
|
+
const absolute = path.join(cwd, dir);
|
|
274
|
+
if (!fs.existsSync(absolute)) continue;
|
|
275
|
+
for (const file of walk(absolute)) {
|
|
276
|
+
if (file.endsWith(".ts") || file.endsWith(".tsx") || file.endsWith(".js")) {
|
|
277
|
+
text += fs.readFileSync(file, "utf8");
|
|
292
278
|
}
|
|
293
279
|
}
|
|
294
|
-
};
|
|
295
|
-
fs.writeFileSync(path.join(projectPath, "turbo.json"), JSON.stringify(turboJson, null, 2));
|
|
296
|
-
const pnpmWorkspace = `packages:
|
|
297
|
-
- 'apps/*'
|
|
298
|
-
- 'packages/*'
|
|
299
|
-
`;
|
|
300
|
-
fs.writeFileSync(path.join(projectPath, "pnpm-workspace.yaml"), pnpmWorkspace);
|
|
301
|
-
logger.success("\u2705 Project structure created");
|
|
302
|
-
logger.info("\u{1F4E6} Installing dependencies...");
|
|
303
|
-
try {
|
|
304
|
-
try {
|
|
305
|
-
execSync("pnpm --version", {
|
|
306
|
-
stdio: "ignore"
|
|
307
|
-
});
|
|
308
|
-
} catch {
|
|
309
|
-
logger.info("Installing pnpm...");
|
|
310
|
-
execSync("npm install -g pnpm", {
|
|
311
|
-
stdio: "ignore"
|
|
312
|
-
});
|
|
313
|
-
}
|
|
314
|
-
execSync("pnpm install", {
|
|
315
|
-
cwd: projectPath,
|
|
316
|
-
stdio: "inherit"
|
|
317
|
-
});
|
|
318
|
-
logger.success("\u2705 Dependencies installed");
|
|
319
|
-
logger.info(pc.green(`
|
|
320
|
-
\u{1F389} Project ${projectName} created successfully!`));
|
|
321
|
-
logger.info(`
|
|
322
|
-
To get started:
|
|
323
|
-
`);
|
|
324
|
-
logger.info(pc.cyan(` cd ${projectName}`));
|
|
325
|
-
logger.info(pc.cyan(` pnpm dev
|
|
326
|
-
`));
|
|
327
|
-
} catch (error) {
|
|
328
|
-
logger.error("Failed to install dependencies");
|
|
329
280
|
}
|
|
281
|
+
return text;
|
|
330
282
|
}
|
|
331
|
-
__name(
|
|
332
|
-
|
|
283
|
+
__name(readAllText, "readAllText");
|
|
284
|
+
function walk(dir) {
|
|
285
|
+
return fs.readdirSync(dir, {
|
|
286
|
+
withFileTypes: true
|
|
287
|
+
}).flatMap((entry) => {
|
|
288
|
+
const absolute = path.join(dir, entry.name);
|
|
289
|
+
if (entry.isDirectory()) return walk(absolute);
|
|
290
|
+
return [
|
|
291
|
+
absolute
|
|
292
|
+
];
|
|
293
|
+
});
|
|
294
|
+
}
|
|
295
|
+
__name(walk, "walk");
|
|
296
|
+
function toKebabCase(value) {
|
|
297
|
+
return value.replace(/([a-z0-9])([A-Z])/g, "$1-$2").replace(/[_\s]+/g, "-").toLowerCase();
|
|
298
|
+
}
|
|
299
|
+
__name(toKebabCase, "toKebabCase");
|
|
300
|
+
function toPascalCase(value) {
|
|
301
|
+
return toKebabCase(value).split("-").map((part) => part.charAt(0).toUpperCase() + part.slice(1)).join("");
|
|
302
|
+
}
|
|
303
|
+
__name(toPascalCase, "toPascalCase");
|
|
304
|
+
function toCamelCase(value) {
|
|
305
|
+
const pascal = toPascalCase(value);
|
|
306
|
+
return pascal.charAt(0).toLowerCase() + pascal.slice(1);
|
|
307
|
+
}
|
|
308
|
+
__name(toCamelCase, "toCamelCase");
|
|
309
|
+
function pathToFileUrl(filePath) {
|
|
310
|
+
return `file://${filePath}`;
|
|
311
|
+
}
|
|
312
|
+
__name(pathToFileUrl, "pathToFileUrl");
|
|
313
|
+
async function loadRuntimeConfig(configPath) {
|
|
314
|
+
if (configPath.endsWith(".mjs")) {
|
|
315
|
+
const mod2 = await import(pathToFileUrl(configPath));
|
|
316
|
+
return mod2.default ?? mod2;
|
|
317
|
+
}
|
|
318
|
+
const require2 = createRequire(__filename);
|
|
319
|
+
const mod = require2(configPath);
|
|
320
|
+
return mod.default ?? mod;
|
|
321
|
+
}
|
|
322
|
+
__name(loadRuntimeConfig, "loadRuntimeConfig");
|
|
323
|
+
var invokedAsCli = process.argv[1] && (path.basename(process.argv[1]) === "wexts" || path.basename(process.argv[1]) === "wexts.cjs" || path.resolve(process.argv[1]).includes(`${path.sep}dist${path.sep}cli${path.sep}index`));
|
|
324
|
+
if (invokedAsCli && !process.env.VITEST) {
|
|
325
|
+
createCliProgram().parseAsync(process.argv).catch((error) => {
|
|
326
|
+
logger.error(error instanceof Error ? error.message : String(error));
|
|
327
|
+
process.exit(1);
|
|
328
|
+
});
|
|
329
|
+
}
|
|
330
|
+
export {
|
|
331
|
+
createCliProgram,
|
|
332
|
+
runDoctor
|
|
333
|
+
};
|
|
333
334
|
//# sourceMappingURL=index.mjs.map
|