wexts 3.0.2 → 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.js
CHANGED
|
@@ -1,332 +1,332 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
"use strict"; function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function
|
|
2
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var _chunkWCKSKU3Cjs = require('../chunk-WCKSKU3C.js');
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
var _chunkXE4OXN2Wjs = require('../chunk-XE4OXN2W.js');
|
|
8
8
|
|
|
9
9
|
// src/cli/index.ts
|
|
10
10
|
var _commander = require('commander');
|
|
11
|
-
var _picocolors = require('picocolors'); var pc = _interopRequireWildcard(_picocolors);
|
|
12
|
-
var _inquirer = require('inquirer'); var _inquirer2 = _interopRequireDefault(_inquirer);
|
|
13
11
|
var _fs = require('fs'); var fs = _interopRequireWildcard(_fs);
|
|
14
12
|
var _path = require('path'); var path = _interopRequireWildcard(_path);
|
|
15
13
|
var _child_process = require('child_process');
|
|
16
|
-
var
|
|
17
|
-
|
|
18
|
-
program
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
const { action } = await _inquirer2.default.prompt([
|
|
29
|
-
{
|
|
30
|
-
type: "list",
|
|
31
|
-
name: "action",
|
|
32
|
-
message: "What would you like to do?",
|
|
33
|
-
choices: [
|
|
34
|
-
{
|
|
35
|
-
name: "\u{1F4E6} Create a new project",
|
|
36
|
-
value: "create"
|
|
37
|
-
},
|
|
38
|
-
{
|
|
39
|
-
name: "\u{1F680} Start development server",
|
|
40
|
-
value: "dev"
|
|
41
|
-
},
|
|
42
|
-
{
|
|
43
|
-
name: "\u{1F528} Build for production",
|
|
44
|
-
value: "build"
|
|
45
|
-
},
|
|
46
|
-
{
|
|
47
|
-
name: "\u26A1 Generate code",
|
|
48
|
-
value: "generate"
|
|
49
|
-
},
|
|
50
|
-
{
|
|
51
|
-
name: "\u{1F916} Generate API client",
|
|
52
|
-
value: "codegen"
|
|
53
|
-
},
|
|
54
|
-
{
|
|
55
|
-
name: "\u274C Exit",
|
|
56
|
-
value: "exit"
|
|
57
|
-
}
|
|
58
|
-
]
|
|
59
|
-
}
|
|
60
|
-
]);
|
|
61
|
-
if (action === "exit") {
|
|
62
|
-
_chunk3OM7CHCAjs.logger.info("Goodbye! \u{1F44B}");
|
|
63
|
-
process.exit(0);
|
|
64
|
-
}
|
|
65
|
-
if (action === "create") {
|
|
66
|
-
const { projectName, template } = await _inquirer2.default.prompt([
|
|
67
|
-
{
|
|
68
|
-
type: "input",
|
|
69
|
-
name: "projectName",
|
|
70
|
-
message: "Project name:",
|
|
71
|
-
default: "my-wexts-app"
|
|
72
|
-
},
|
|
73
|
-
{
|
|
74
|
-
type: "list",
|
|
75
|
-
name: "template",
|
|
76
|
-
message: "Select template:",
|
|
77
|
-
choices: [
|
|
78
|
-
{
|
|
79
|
-
name: "\u{1F4E6} Monorepo (Next.js + NestJS)",
|
|
80
|
-
value: "monorepo"
|
|
81
|
-
},
|
|
82
|
-
{
|
|
83
|
-
name: "\u{1F3AF} API only (NestJS)",
|
|
84
|
-
value: "api"
|
|
85
|
-
},
|
|
86
|
-
{
|
|
87
|
-
name: "\u{1F310} Web only (Next.js)",
|
|
88
|
-
value: "web"
|
|
89
|
-
}
|
|
90
|
-
]
|
|
91
|
-
}
|
|
92
|
-
]);
|
|
93
|
-
await createProject(projectName, template);
|
|
94
|
-
} else if (action === "dev") {
|
|
95
|
-
_chunk3OM7CHCAjs.logger.info(pc.green("\u{1F680} Starting development servers...\n"));
|
|
96
|
-
_chunk3OM7CHCAjs.logger.warn("Dev server not yet implemented");
|
|
97
|
-
} else if (action === "build") {
|
|
98
|
-
_chunk3OM7CHCAjs.logger.info(pc.blue("\u{1F528} Building project...\n"));
|
|
99
|
-
_chunk3OM7CHCAjs.logger.warn("Build not yet implemented");
|
|
100
|
-
} else if (action === "generate") {
|
|
101
|
-
const { type, name } = await _inquirer2.default.prompt([
|
|
102
|
-
{
|
|
103
|
-
type: "list",
|
|
104
|
-
name: "type",
|
|
105
|
-
message: "What to generate?",
|
|
106
|
-
choices: [
|
|
107
|
-
"controller",
|
|
108
|
-
"module",
|
|
109
|
-
"service",
|
|
110
|
-
"page"
|
|
111
|
-
]
|
|
112
|
-
},
|
|
113
|
-
{
|
|
114
|
-
type: "input",
|
|
115
|
-
name: "name",
|
|
116
|
-
message: "Name:"
|
|
117
|
-
}
|
|
118
|
-
]);
|
|
119
|
-
_chunk3OM7CHCAjs.logger.info(pc.magenta(`
|
|
120
|
-
\u26A1 Generating ${type}: ${name}
|
|
121
|
-
`));
|
|
122
|
-
_chunk3OM7CHCAjs.logger.warn("Code generation not yet implemented");
|
|
123
|
-
} else if (action === "codegen") {
|
|
124
|
-
_chunk3OM7CHCAjs.logger.info(pc.cyan("\n\u{1F916} Generating API client...\n"));
|
|
125
|
-
_chunk3OM7CHCAjs.logger.warn("Codegen not yet implemented");
|
|
126
|
-
}
|
|
127
|
-
});
|
|
128
|
-
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) => {
|
|
129
|
-
await createProject(projectName, options.template);
|
|
130
|
-
});
|
|
131
|
-
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) => {
|
|
132
|
-
_chunk3OM7CHCAjs.logger.info(pc.green("\u{1F680} Starting Wexts development servers...\n"));
|
|
133
|
-
const { FusionDevServer } = await Promise.resolve().then(() => _interopRequireWildcard(require("../dev-server/index.js")));
|
|
134
|
-
const server = new FusionDevServer();
|
|
135
|
-
try {
|
|
14
|
+
var _module = require('module');
|
|
15
|
+
function createCliProgram() {
|
|
16
|
+
const program = new (0, _commander.Command)();
|
|
17
|
+
program.name("wexts").description("Wexts - production-focused single-runtime Next.js + NestJS toolkit").version("3.0.3");
|
|
18
|
+
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) => {
|
|
19
|
+
await createProject(projectName, options.template, {
|
|
20
|
+
skipInstall: options.skipInstall
|
|
21
|
+
});
|
|
22
|
+
});
|
|
23
|
+
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) => {
|
|
24
|
+
const { FusionDevServer } = await Promise.resolve().then(() => _interopRequireWildcard(require("../dev-server/index.js")));
|
|
25
|
+
const server = new FusionDevServer();
|
|
136
26
|
await server.start({
|
|
137
27
|
apiPath: options.api,
|
|
138
28
|
webPath: options.web,
|
|
139
|
-
webPort:
|
|
140
|
-
apiPort:
|
|
29
|
+
webPort: Number(options.port),
|
|
30
|
+
apiPort: Number(options.apiPort),
|
|
141
31
|
useProxy: options.proxy
|
|
142
32
|
});
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
});
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
33
|
+
});
|
|
34
|
+
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) => {
|
|
35
|
+
if (!type || type === "rpc") {
|
|
36
|
+
const { generateRpcClient } = await Promise.resolve().then(() => _interopRequireWildcard(require("../codegen/index.js")));
|
|
37
|
+
const manifest = await generateRpcClient({
|
|
38
|
+
projectPath: path.resolve(options.project),
|
|
39
|
+
outputPath: path.resolve(options.output)
|
|
40
|
+
});
|
|
41
|
+
_chunkWCKSKU3Cjs.logger.success(`Generated Wexts RPC client for ${manifest.services.length} service(s).`);
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
if (type === "service") {
|
|
45
|
+
if (!name) throw new Error("Service name is required: wexts generate service hello");
|
|
46
|
+
await scaffoldRpcService(path.resolve(options.project), name);
|
|
47
|
+
_chunkWCKSKU3Cjs.logger.success(`Created RPC service ${name}. Run wexts generate to update the client.`);
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
throw new Error(`Unknown generator "${type}". Supported generators: rpc, service.`);
|
|
51
|
+
});
|
|
52
|
+
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) => {
|
|
53
|
+
const { generateRpcClient } = await Promise.resolve().then(() => _interopRequireWildcard(require("../codegen/index.js")));
|
|
54
|
+
const manifest = await generateRpcClient({
|
|
55
|
+
projectPath: path.resolve(options.project),
|
|
56
|
+
outputPath: path.resolve(options.output)
|
|
164
57
|
});
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
58
|
+
_chunkWCKSKU3Cjs.logger.success(`Generated Wexts RPC client for ${manifest.services.length} service(s).`);
|
|
59
|
+
});
|
|
60
|
+
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) => {
|
|
61
|
+
if (!options.skipGenerate && fs.existsSync(options.project)) {
|
|
62
|
+
const { generateRpcClient } = await Promise.resolve().then(() => _interopRequireWildcard(require("../codegen/index.js")));
|
|
63
|
+
await generateRpcClient({
|
|
64
|
+
projectPath: path.resolve(options.project),
|
|
65
|
+
outputPath: path.resolve(options.output)
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
runScript("build", {
|
|
69
|
+
cwd: process.cwd()
|
|
70
|
+
});
|
|
71
|
+
});
|
|
72
|
+
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", _nullishCoalesce(process.env.PORT, () => ( "3000"))).action(async (options) => {
|
|
73
|
+
const { startWextsRuntime } = await Promise.resolve().then(() => _interopRequireWildcard(require("../runtime/index.js")));
|
|
74
|
+
const configPath = path.resolve(options.config);
|
|
75
|
+
const runtimeConfig = fs.existsSync(configPath) ? await loadRuntimeConfig(configPath) : {};
|
|
76
|
+
await startWextsRuntime({
|
|
77
|
+
...runtimeConfig,
|
|
78
|
+
port: Number(options.port),
|
|
79
|
+
dev: false
|
|
80
|
+
});
|
|
81
|
+
});
|
|
82
|
+
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) => {
|
|
83
|
+
const { buildVercelOutput } = await Promise.resolve().then(() => _interopRequireWildcard(require("../vercel-builder/index.js")));
|
|
84
|
+
const result = await buildVercelOutput({
|
|
85
|
+
rootDir: process.cwd(),
|
|
86
|
+
apiProjectPath: options.project,
|
|
87
|
+
rpcOutputPath: options.output,
|
|
88
|
+
runtimeConfigPath: options.config,
|
|
89
|
+
skipCodegen: options.skipCodegen,
|
|
90
|
+
skipBuild: options.skipBuild,
|
|
91
|
+
nodeVersion: options.nodeVersion,
|
|
92
|
+
maxDuration: Number(options.maxDuration)
|
|
173
93
|
});
|
|
94
|
+
if (result.warnings.length > 0) {
|
|
95
|
+
for (const warning of result.warnings) _chunkWCKSKU3Cjs.logger.warn(warning);
|
|
96
|
+
}
|
|
97
|
+
if (result.errors.length > 0) {
|
|
98
|
+
for (const error of result.errors) _chunkWCKSKU3Cjs.logger.error(error);
|
|
99
|
+
process.exit(1);
|
|
100
|
+
}
|
|
101
|
+
_chunkWCKSKU3Cjs.logger.success("Vercel build output ready at .vercel/output");
|
|
102
|
+
});
|
|
103
|
+
program.command("doctor").description("Validate Wexts project configuration").option("--security", "Run security-specific checks", false).action(async (options) => {
|
|
104
|
+
const result = runDoctor(process.cwd(), options.security);
|
|
105
|
+
for (const warning of result.warnings) _chunkWCKSKU3Cjs.logger.warn(warning);
|
|
106
|
+
for (const error of result.errors) _chunkWCKSKU3Cjs.logger.error(error);
|
|
107
|
+
if (result.errors.length > 0) process.exit(1);
|
|
108
|
+
_chunkWCKSKU3Cjs.logger.success(options.security ? "Security doctor passed." : "Doctor passed.");
|
|
109
|
+
});
|
|
110
|
+
return program;
|
|
111
|
+
}
|
|
112
|
+
_chunkXE4OXN2Wjs.__name.call(void 0, createCliProgram, "createCliProgram");
|
|
113
|
+
function runDoctor(cwd, security = false) {
|
|
114
|
+
const result = {
|
|
115
|
+
errors: [],
|
|
116
|
+
warnings: []
|
|
117
|
+
};
|
|
118
|
+
const pkgPath = path.join(cwd, "package.json");
|
|
119
|
+
if (!fs.existsSync(pkgPath)) {
|
|
120
|
+
result.errors.push("package.json not found.");
|
|
121
|
+
return result;
|
|
174
122
|
}
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
_chunk3OM7CHCAjs.logger.info(`Template: ${template}`);
|
|
179
|
-
const projectPath = path.join(process.cwd(), projectName);
|
|
180
|
-
if (fs.existsSync(projectPath)) {
|
|
181
|
-
_chunk3OM7CHCAjs.logger.error(`Directory ${projectName} already exists!`);
|
|
182
|
-
process.exit(1);
|
|
123
|
+
const pkg = JSON.parse(fs.readFileSync(pkgPath, "utf8"));
|
|
124
|
+
if (!_optionalChain([pkg, 'access', _ => _.packageManager, 'optionalAccess', _2 => _2.startsWith, 'call', _3 => _3("pnpm@")])) {
|
|
125
|
+
result.warnings.push("packageManager should pin pnpm.");
|
|
183
126
|
}
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
// Absolute resolve
|
|
191
|
-
];
|
|
192
|
-
for (const p of possiblePaths) {
|
|
193
|
-
if (fs.existsSync(p)) {
|
|
194
|
-
return p;
|
|
195
|
-
}
|
|
127
|
+
for (const dir of [
|
|
128
|
+
"apps/api",
|
|
129
|
+
"apps/web"
|
|
130
|
+
]) {
|
|
131
|
+
if (!fs.existsSync(path.join(cwd, dir))) {
|
|
132
|
+
result.warnings.push(`${dir} not found; some Wexts commands may need explicit paths.`);
|
|
196
133
|
}
|
|
197
|
-
return "";
|
|
198
134
|
}
|
|
199
|
-
|
|
200
|
-
|
|
135
|
+
if (fs.existsSync(path.join(cwd, "apps/api")) && fs.existsSync(path.join(cwd, "apps/web"))) {
|
|
136
|
+
result.warnings.push("Development mode starts separate web/API processes. Single-port serving is the production `wexts start` runtime path.");
|
|
137
|
+
}
|
|
138
|
+
if (security) {
|
|
139
|
+
const source = readAllText(cwd, [
|
|
140
|
+
"apps/api/src",
|
|
141
|
+
"packages/templates/nestjs-api/src"
|
|
142
|
+
]);
|
|
143
|
+
if (source.includes("default-secret")) {
|
|
144
|
+
result.errors.push('JWT fallback "default-secret" found. Production apps must fail without a strong JWT_SECRET.');
|
|
145
|
+
}
|
|
146
|
+
if (/origin:\s*['"]\*['"]/.test(source)) {
|
|
147
|
+
result.errors.push("Wildcard CORS origin found. Use an explicit origin allowlist.");
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
return result;
|
|
151
|
+
}
|
|
152
|
+
_chunkXE4OXN2Wjs.__name.call(void 0, runDoctor, "runDoctor");
|
|
153
|
+
async function createProject(projectName, template, options) {
|
|
154
|
+
const projectPath = path.join(process.cwd(), projectName);
|
|
155
|
+
if (fs.existsSync(projectPath)) {
|
|
156
|
+
throw new Error(`Directory already exists: ${projectName}`);
|
|
157
|
+
}
|
|
158
|
+
const templatePath = findTemplatePath();
|
|
201
159
|
if (!templatePath) {
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
fs.mkdirSync(projectPath, {
|
|
209
|
-
recursive: true
|
|
210
|
-
});
|
|
160
|
+
throw new Error("Template directory not found in package.");
|
|
161
|
+
}
|
|
162
|
+
fs.mkdirSync(projectPath, {
|
|
163
|
+
recursive: true
|
|
164
|
+
});
|
|
165
|
+
if (template === "monorepo") {
|
|
211
166
|
fs.mkdirSync(path.join(projectPath, "apps"), {
|
|
212
167
|
recursive: true
|
|
213
168
|
});
|
|
214
|
-
fs.
|
|
169
|
+
fs.cpSync(path.join(templatePath, "nestjs-api"), path.join(projectPath, "apps/api"), {
|
|
215
170
|
recursive: true
|
|
216
171
|
});
|
|
217
|
-
|
|
218
|
-
_chunk3OM7CHCAjs.logger.info(`\u{1F4E6} Copying templates from: ${templatePath}`);
|
|
219
|
-
fs.mkdirSync(projectPath, {
|
|
172
|
+
fs.cpSync(path.join(templatePath, "nextjs-web"), path.join(projectPath, "apps/web"), {
|
|
220
173
|
recursive: true
|
|
221
174
|
});
|
|
222
|
-
fs.
|
|
175
|
+
fs.writeFileSync(path.join(projectPath, "pnpm-workspace.yaml"), "packages:\n - 'apps/*'\n");
|
|
176
|
+
fs.writeFileSync(path.join(projectPath, "package.json"), JSON.stringify({
|
|
177
|
+
name: projectName,
|
|
178
|
+
private: true,
|
|
179
|
+
packageManager: "pnpm@10.22.0",
|
|
180
|
+
scripts: {
|
|
181
|
+
dev: "wexts dev",
|
|
182
|
+
generate: "wexts generate",
|
|
183
|
+
build: "wexts build",
|
|
184
|
+
start: "wexts start",
|
|
185
|
+
doctor: "wexts doctor"
|
|
186
|
+
},
|
|
187
|
+
devDependencies: {
|
|
188
|
+
wexts: "latest"
|
|
189
|
+
}
|
|
190
|
+
}, null, 2));
|
|
191
|
+
} else if (template === "api") {
|
|
192
|
+
fs.cpSync(path.join(templatePath, "nestjs-api"), projectPath, {
|
|
223
193
|
recursive: true
|
|
224
194
|
});
|
|
225
|
-
|
|
195
|
+
} else if (template === "web") {
|
|
196
|
+
fs.cpSync(path.join(templatePath, "nextjs-web"), projectPath, {
|
|
226
197
|
recursive: true
|
|
227
198
|
});
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
if (fs.existsSync(apiTemplatePath)) {
|
|
231
|
-
fs.cpSync(apiTemplatePath, apiDestPath, {
|
|
232
|
-
recursive: true
|
|
233
|
-
});
|
|
234
|
-
_chunk3OM7CHCAjs.logger.success(" - Copied API template");
|
|
235
|
-
const envExamplePath = path.join(apiDestPath, ".env.example");
|
|
236
|
-
const envPath = path.join(apiDestPath, ".env");
|
|
237
|
-
if (fs.existsSync(envExamplePath) && !fs.existsSync(envPath)) {
|
|
238
|
-
fs.copyFileSync(envExamplePath, envPath);
|
|
239
|
-
_chunk3OM7CHCAjs.logger.success(" - Created .env from .env.example");
|
|
240
|
-
}
|
|
241
|
-
} else {
|
|
242
|
-
_chunk3OM7CHCAjs.logger.warn(` \u26A0\uFE0F API template not found at ${apiTemplatePath}`);
|
|
243
|
-
}
|
|
244
|
-
const webTemplatePath = path.join(templatePath, "nextjs-web");
|
|
245
|
-
const webDestPath = path.join(projectPath, "apps/web");
|
|
246
|
-
if (fs.existsSync(webTemplatePath)) {
|
|
247
|
-
fs.cpSync(webTemplatePath, webDestPath, {
|
|
248
|
-
recursive: true
|
|
249
|
-
});
|
|
250
|
-
_chunk3OM7CHCAjs.logger.success(" - Copied Web template");
|
|
251
|
-
} else {
|
|
252
|
-
_chunk3OM7CHCAjs.logger.warn(` \u26A0\uFE0F Web template not found at ${webTemplatePath}`);
|
|
253
|
-
}
|
|
199
|
+
} else {
|
|
200
|
+
throw new Error(`Unknown template "${template}".`);
|
|
254
201
|
}
|
|
255
|
-
|
|
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
|
-
|
|
202
|
+
if (!options.skipInstall) {
|
|
203
|
+
runCommand(detectPackageManager(projectPath), [
|
|
204
|
+
"install"
|
|
205
|
+
], projectPath);
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
_chunkXE4OXN2Wjs.__name.call(void 0, createProject, "createProject");
|
|
209
|
+
async function scaffoldRpcService(apiProjectPath, rawName) {
|
|
210
|
+
const serviceName = toKebabCase(rawName);
|
|
211
|
+
const className = `${toPascalCase(serviceName)}Service`;
|
|
212
|
+
const dir = path.join(apiProjectPath, "src", serviceName);
|
|
213
|
+
fs.mkdirSync(dir, {
|
|
214
|
+
recursive: true
|
|
215
|
+
});
|
|
216
|
+
fs.writeFileSync(path.join(dir, `${serviceName}.service.ts`), `import { Injectable } from '@nestjs/common';
|
|
217
|
+
import { RpcMethod, RpcService } from 'wexts/nest';
|
|
218
|
+
|
|
219
|
+
@Injectable()
|
|
220
|
+
@RpcService({ name: '${toCamelCase(serviceName)}', requireAuth: false })
|
|
221
|
+
export class ${className} {
|
|
222
|
+
@RpcMethod()
|
|
223
|
+
async sayHello(name: string): Promise<string> {
|
|
224
|
+
return \`Hello, \${name}!\`;
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
`);
|
|
228
|
+
}
|
|
229
|
+
_chunkXE4OXN2Wjs.__name.call(void 0, scaffoldRpcService, "scaffoldRpcService");
|
|
230
|
+
function runScript(script, options) {
|
|
231
|
+
const cwd = _nullishCoalesce(options.cwd, () => ( process.cwd()));
|
|
232
|
+
const packageManager = detectPackageManager(cwd);
|
|
233
|
+
const args = packageManager === "npm" ? [
|
|
234
|
+
"run",
|
|
235
|
+
script
|
|
236
|
+
] : [
|
|
237
|
+
"run",
|
|
238
|
+
script
|
|
239
|
+
];
|
|
240
|
+
runCommand(packageManager, args, cwd);
|
|
241
|
+
}
|
|
242
|
+
_chunkXE4OXN2Wjs.__name.call(void 0, runScript, "runScript");
|
|
243
|
+
function runCommand(command, args, cwd) {
|
|
244
|
+
const result = _child_process.spawnSync.call(void 0, command, args, {
|
|
245
|
+
cwd,
|
|
246
|
+
stdio: "inherit",
|
|
247
|
+
shell: process.platform === "win32"
|
|
248
|
+
});
|
|
249
|
+
if (result.status !== 0) {
|
|
250
|
+
throw new Error(`${command} ${args.join(" ")} failed with exit code ${result.status}`);
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
_chunkXE4OXN2Wjs.__name.call(void 0, runCommand, "runCommand");
|
|
254
|
+
function detectPackageManager(cwd) {
|
|
255
|
+
if (fs.existsSync(path.join(cwd, "pnpm-lock.yaml"))) return "pnpm";
|
|
256
|
+
return "npm";
|
|
257
|
+
}
|
|
258
|
+
_chunkXE4OXN2Wjs.__name.call(void 0, detectPackageManager, "detectPackageManager");
|
|
259
|
+
function findTemplatePath() {
|
|
260
|
+
const candidates = [
|
|
261
|
+
path.resolve(__dirname, "../../templates"),
|
|
262
|
+
path.resolve(__dirname, "../templates"),
|
|
263
|
+
path.resolve(process.cwd(), "packages/templates")
|
|
264
|
+
];
|
|
265
|
+
return candidates.find((candidate) => fs.existsSync(candidate));
|
|
266
|
+
}
|
|
267
|
+
_chunkXE4OXN2Wjs.__name.call(void 0, findTemplatePath, "findTemplatePath");
|
|
268
|
+
function readAllText(cwd, dirs) {
|
|
269
|
+
let text = "";
|
|
270
|
+
for (const dir of dirs) {
|
|
271
|
+
const absolute = path.join(cwd, dir);
|
|
272
|
+
if (!fs.existsSync(absolute)) continue;
|
|
273
|
+
for (const file of walk(absolute)) {
|
|
274
|
+
if (file.endsWith(".ts") || file.endsWith(".tsx") || file.endsWith(".js")) {
|
|
275
|
+
text += fs.readFileSync(file, "utf8");
|
|
291
276
|
}
|
|
292
277
|
}
|
|
293
|
-
};
|
|
294
|
-
fs.writeFileSync(path.join(projectPath, "turbo.json"), JSON.stringify(turboJson, null, 2));
|
|
295
|
-
const pnpmWorkspace = `packages:
|
|
296
|
-
- 'apps/*'
|
|
297
|
-
- 'packages/*'
|
|
298
|
-
`;
|
|
299
|
-
fs.writeFileSync(path.join(projectPath, "pnpm-workspace.yaml"), pnpmWorkspace);
|
|
300
|
-
_chunk3OM7CHCAjs.logger.success("\u2705 Project structure created");
|
|
301
|
-
_chunk3OM7CHCAjs.logger.info("\u{1F4E6} Installing dependencies...");
|
|
302
|
-
try {
|
|
303
|
-
try {
|
|
304
|
-
_child_process.execSync.call(void 0, "pnpm --version", {
|
|
305
|
-
stdio: "ignore"
|
|
306
|
-
});
|
|
307
|
-
} catch (e) {
|
|
308
|
-
_chunk3OM7CHCAjs.logger.info("Installing pnpm...");
|
|
309
|
-
_child_process.execSync.call(void 0, "npm install -g pnpm", {
|
|
310
|
-
stdio: "ignore"
|
|
311
|
-
});
|
|
312
|
-
}
|
|
313
|
-
_child_process.execSync.call(void 0, "pnpm install", {
|
|
314
|
-
cwd: projectPath,
|
|
315
|
-
stdio: "inherit"
|
|
316
|
-
});
|
|
317
|
-
_chunk3OM7CHCAjs.logger.success("\u2705 Dependencies installed");
|
|
318
|
-
_chunk3OM7CHCAjs.logger.info(pc.green(`
|
|
319
|
-
\u{1F389} Project ${projectName} created successfully!`));
|
|
320
|
-
_chunk3OM7CHCAjs.logger.info(`
|
|
321
|
-
To get started:
|
|
322
|
-
`);
|
|
323
|
-
_chunk3OM7CHCAjs.logger.info(pc.cyan(` cd ${projectName}`));
|
|
324
|
-
_chunk3OM7CHCAjs.logger.info(pc.cyan(` pnpm dev
|
|
325
|
-
`));
|
|
326
|
-
} catch (error) {
|
|
327
|
-
_chunk3OM7CHCAjs.logger.error("Failed to install dependencies");
|
|
328
278
|
}
|
|
279
|
+
return text;
|
|
329
280
|
}
|
|
330
|
-
_chunkXE4OXN2Wjs.__name.call(void 0,
|
|
331
|
-
|
|
281
|
+
_chunkXE4OXN2Wjs.__name.call(void 0, readAllText, "readAllText");
|
|
282
|
+
function walk(dir) {
|
|
283
|
+
return fs.readdirSync(dir, {
|
|
284
|
+
withFileTypes: true
|
|
285
|
+
}).flatMap((entry) => {
|
|
286
|
+
const absolute = path.join(dir, entry.name);
|
|
287
|
+
if (entry.isDirectory()) return walk(absolute);
|
|
288
|
+
return [
|
|
289
|
+
absolute
|
|
290
|
+
];
|
|
291
|
+
});
|
|
292
|
+
}
|
|
293
|
+
_chunkXE4OXN2Wjs.__name.call(void 0, walk, "walk");
|
|
294
|
+
function toKebabCase(value) {
|
|
295
|
+
return value.replace(/([a-z0-9])([A-Z])/g, "$1-$2").replace(/[_\s]+/g, "-").toLowerCase();
|
|
296
|
+
}
|
|
297
|
+
_chunkXE4OXN2Wjs.__name.call(void 0, toKebabCase, "toKebabCase");
|
|
298
|
+
function toPascalCase(value) {
|
|
299
|
+
return toKebabCase(value).split("-").map((part) => part.charAt(0).toUpperCase() + part.slice(1)).join("");
|
|
300
|
+
}
|
|
301
|
+
_chunkXE4OXN2Wjs.__name.call(void 0, toPascalCase, "toPascalCase");
|
|
302
|
+
function toCamelCase(value) {
|
|
303
|
+
const pascal = toPascalCase(value);
|
|
304
|
+
return pascal.charAt(0).toLowerCase() + pascal.slice(1);
|
|
305
|
+
}
|
|
306
|
+
_chunkXE4OXN2Wjs.__name.call(void 0, toCamelCase, "toCamelCase");
|
|
307
|
+
function pathToFileUrl(filePath) {
|
|
308
|
+
return `file://${filePath}`;
|
|
309
|
+
}
|
|
310
|
+
_chunkXE4OXN2Wjs.__name.call(void 0, pathToFileUrl, "pathToFileUrl");
|
|
311
|
+
async function loadRuntimeConfig(configPath) {
|
|
312
|
+
if (configPath.endsWith(".mjs")) {
|
|
313
|
+
const mod2 = await Promise.resolve().then(() => _interopRequireWildcard(require(pathToFileUrl(configPath))));
|
|
314
|
+
return _nullishCoalesce(mod2.default, () => ( mod2));
|
|
315
|
+
}
|
|
316
|
+
const require2 = _module.createRequire.call(void 0, __filename);
|
|
317
|
+
const mod = require2(configPath);
|
|
318
|
+
return _nullishCoalesce(mod.default, () => ( mod));
|
|
319
|
+
}
|
|
320
|
+
_chunkXE4OXN2Wjs.__name.call(void 0, loadRuntimeConfig, "loadRuntimeConfig");
|
|
321
|
+
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`));
|
|
322
|
+
if (invokedAsCli && !process.env.VITEST) {
|
|
323
|
+
createCliProgram().parseAsync(process.argv).catch((error) => {
|
|
324
|
+
_chunkWCKSKU3Cjs.logger.error(error instanceof Error ? error.message : String(error));
|
|
325
|
+
process.exit(1);
|
|
326
|
+
});
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
|
|
330
|
+
|
|
331
|
+
exports.createCliProgram = createCliProgram; exports.runDoctor = runDoctor;
|
|
332
332
|
//# sourceMappingURL=index.js.map
|