express-file-cluster 0.1.6 → 0.2.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/dist/auth/index.cjs +13 -96
- package/dist/auth/index.cjs.map +1 -1
- package/dist/auth/index.d.cts +3 -3
- package/dist/auth/index.d.ts +3 -3
- package/dist/auth/index.js +7 -51
- package/dist/auth/index.js.map +1 -1
- package/dist/chunk-DQGWFWBV.js +63 -0
- package/dist/chunk-DQGWFWBV.js.map +1 -0
- package/dist/chunk-MQNVNOH5.cjs +48 -0
- package/dist/chunk-MQNVNOH5.cjs.map +1 -0
- package/dist/chunk-MZPG5HXL.js +48 -0
- package/dist/chunk-MZPG5HXL.js.map +1 -0
- package/dist/chunk-QB3X6LKZ.cjs +63 -0
- package/dist/chunk-QB3X6LKZ.cjs.map +1 -0
- package/dist/chunk-UDE6S53C.cjs +42 -0
- package/dist/chunk-UDE6S53C.cjs.map +1 -0
- package/dist/chunk-Z5YNIVQG.js +42 -0
- package/dist/chunk-Z5YNIVQG.js.map +1 -0
- package/dist/cli/index.cjs +101 -167
- package/dist/cli/index.cjs.map +1 -1
- package/dist/cli/index.js +53 -96
- package/dist/cli/index.js.map +1 -1
- package/dist/index.cjs +90 -188
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +20 -74
- package/dist/index.js.map +1 -1
- package/dist/tasks/index.cjs +13 -68
- package/dist/tasks/index.cjs.map +1 -1
- package/dist/tasks/index.d.cts +1 -1
- package/dist/tasks/index.d.ts +1 -1
- package/dist/tasks/index.js +7 -33
- package/dist/tasks/index.js.map +1 -1
- package/dist/{types-CkpRAA3y.d.cts → types-Dj9-sLOK.d.cts} +1 -1
- package/dist/{types-CkpRAA3y.d.ts → types-Dj9-sLOK.d.ts} +1 -1
- package/package.json +3 -5
package/dist/cli/index.cjs
CHANGED
|
@@ -1,56 +1,36 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
"use strict";
|
|
3
|
-
|
|
4
|
-
var
|
|
5
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
8
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
-
var __copyProps = (to, from, except, desc) => {
|
|
10
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
-
for (let key of __getOwnPropNames(from))
|
|
12
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
-
}
|
|
15
|
-
return to;
|
|
16
|
-
};
|
|
17
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
18
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
19
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
20
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
21
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
22
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
23
|
-
mod
|
|
24
|
-
));
|
|
2
|
+
"use strict"; function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }
|
|
3
|
+
|
|
4
|
+
var _chunkMQNVNOH5cjs = require('../chunk-MQNVNOH5.cjs');
|
|
25
5
|
|
|
26
6
|
// src/cli/index.ts
|
|
27
|
-
var
|
|
7
|
+
var _commander = require('commander');
|
|
28
8
|
|
|
29
9
|
// src/cli/commands/start.ts
|
|
30
|
-
|
|
31
|
-
var
|
|
32
|
-
var
|
|
33
|
-
var
|
|
34
|
-
var
|
|
10
|
+
|
|
11
|
+
var _child_process = require('child_process');
|
|
12
|
+
var _path = require('path'); var _path2 = _interopRequireDefault(_path);
|
|
13
|
+
var _fs = require('fs'); var _fs2 = _interopRequireDefault(_fs);
|
|
14
|
+
var _picocolors = require('picocolors'); var _picocolors2 = _interopRequireDefault(_picocolors);
|
|
35
15
|
function startCommand() {
|
|
36
|
-
const cmd = new
|
|
16
|
+
const cmd = new (0, _commander.Command)("start");
|
|
37
17
|
cmd.argument("<mode>", "dev | prod").description("Start the EFC server").action((mode) => {
|
|
38
18
|
if (mode === "dev") {
|
|
39
19
|
startDev();
|
|
40
20
|
} else if (mode === "prod") {
|
|
41
21
|
startProd();
|
|
42
22
|
} else {
|
|
43
|
-
console.error(
|
|
23
|
+
console.error(_picocolors2.default.red(`Unknown mode: ${mode}. Use 'dev' or 'prod'.`));
|
|
44
24
|
process.exit(1);
|
|
45
25
|
}
|
|
46
26
|
});
|
|
47
27
|
return cmd;
|
|
48
28
|
}
|
|
49
29
|
function parseDotenv(cwd) {
|
|
50
|
-
const envFile =
|
|
51
|
-
if (!
|
|
30
|
+
const envFile = _path2.default.join(cwd, ".env");
|
|
31
|
+
if (!_fs2.default.existsSync(envFile)) return {};
|
|
52
32
|
const vars = {};
|
|
53
|
-
for (const line of
|
|
33
|
+
for (const line of _fs2.default.readFileSync(envFile, "utf8").split("\n")) {
|
|
54
34
|
const trimmed = line.trim();
|
|
55
35
|
if (!trimmed || trimmed.startsWith("#")) continue;
|
|
56
36
|
const eq = trimmed.indexOf("=");
|
|
@@ -64,52 +44,52 @@ function parseDotenv(cwd) {
|
|
|
64
44
|
function startDev() {
|
|
65
45
|
const entry = resolveEntry();
|
|
66
46
|
if (!entry) {
|
|
67
|
-
console.error(
|
|
47
|
+
console.error(_picocolors2.default.red("[EFC] Could not find entry point. Expected src/index.ts or index.ts"));
|
|
68
48
|
process.exit(1);
|
|
69
49
|
}
|
|
70
|
-
console.log(
|
|
71
|
-
console.log(
|
|
50
|
+
console.log(_picocolors2.default.cyan("[EFC] Starting development server\u2026"));
|
|
51
|
+
console.log(_picocolors2.default.dim(` Entry: ${entry}`));
|
|
72
52
|
const cwd = process.cwd();
|
|
73
|
-
const localTsx =
|
|
74
|
-
const tsx =
|
|
53
|
+
const localTsx = _path2.default.join(cwd, "node_modules", ".bin", "tsx");
|
|
54
|
+
const tsx = _fs2.default.existsSync(localTsx) ? localTsx : "tsx";
|
|
75
55
|
const env = { ...parseDotenv(cwd), ...process.env, NODE_ENV: "development" };
|
|
76
|
-
const child = (0,
|
|
77
|
-
child.on("exit", (code) => process.exit(code
|
|
56
|
+
const child = _child_process.spawn.call(void 0, tsx, ["watch", "--include", "src", entry], { stdio: "inherit", env });
|
|
57
|
+
child.on("exit", (code) => process.exit(_nullishCoalesce(code, () => ( 0))));
|
|
78
58
|
}
|
|
79
59
|
function startProd() {
|
|
80
60
|
const cwd = process.cwd();
|
|
81
|
-
const distEntry =
|
|
82
|
-
if (!
|
|
83
|
-
console.error(
|
|
61
|
+
const distEntry = _path2.default.join(cwd, "dist", "index.js");
|
|
62
|
+
if (!_fs2.default.existsSync(distEntry)) {
|
|
63
|
+
console.error(_picocolors2.default.red("[EFC] dist/index.js not found. Run `efc build prod` first."));
|
|
84
64
|
process.exit(1);
|
|
85
65
|
}
|
|
86
|
-
console.log(
|
|
87
|
-
const child = (0,
|
|
66
|
+
console.log(_picocolors2.default.cyan("[EFC] Starting production server\u2026"));
|
|
67
|
+
const child = _child_process.spawn.call(void 0, "node", [distEntry], {
|
|
88
68
|
stdio: "inherit",
|
|
89
69
|
env: { ...process.env, NODE_ENV: "production" }
|
|
90
70
|
});
|
|
91
|
-
child.on("exit", (code) => process.exit(code
|
|
71
|
+
child.on("exit", (code) => process.exit(_nullishCoalesce(code, () => ( 0))));
|
|
92
72
|
}
|
|
93
73
|
function resolveEntry() {
|
|
94
74
|
const cwd = process.cwd();
|
|
95
75
|
const candidates = [
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
76
|
+
_path2.default.join(cwd, "src", "index.ts"),
|
|
77
|
+
_path2.default.join(cwd, "index.ts"),
|
|
78
|
+
_path2.default.join(cwd, "src", "index.js"),
|
|
79
|
+
_path2.default.join(cwd, "index.js")
|
|
100
80
|
];
|
|
101
|
-
return candidates.find((f) =>
|
|
81
|
+
return _nullishCoalesce(candidates.find((f) => _fs2.default.existsSync(f)), () => ( null));
|
|
102
82
|
}
|
|
103
83
|
|
|
104
84
|
// src/cli/commands/build.ts
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
|
|
108
88
|
function buildCommand() {
|
|
109
|
-
const cmd = new
|
|
89
|
+
const cmd = new (0, _commander.Command)("build");
|
|
110
90
|
cmd.argument("<mode>", "prod").description("Build the application for production").action((mode) => {
|
|
111
91
|
if (mode !== "prod") {
|
|
112
|
-
console.error(
|
|
92
|
+
console.error(_picocolors2.default.red(`Unknown build mode: ${mode}. Use 'prod'.`));
|
|
113
93
|
process.exit(1);
|
|
114
94
|
}
|
|
115
95
|
buildProd();
|
|
@@ -117,71 +97,71 @@ function buildCommand() {
|
|
|
117
97
|
return cmd;
|
|
118
98
|
}
|
|
119
99
|
function buildProd() {
|
|
120
|
-
console.log(
|
|
121
|
-
const tsc = (0,
|
|
100
|
+
console.log(_picocolors2.default.cyan("[EFC] Building for production\u2026"));
|
|
101
|
+
const tsc = _child_process.spawn.call(void 0, "npx", ["tsc", "--noEmit"], { stdio: "inherit" });
|
|
122
102
|
tsc.on("exit", (code) => {
|
|
123
103
|
if (code !== 0) {
|
|
124
|
-
console.error(
|
|
104
|
+
console.error(_picocolors2.default.red("[EFC] TypeScript errors found. Fix them before building."));
|
|
125
105
|
process.exit(1);
|
|
126
106
|
}
|
|
127
|
-
const tsup = (0,
|
|
107
|
+
const tsup = _child_process.spawn.call(void 0, "npx", ["tsup"], { stdio: "inherit" });
|
|
128
108
|
tsup.on("exit", (tsupCode) => {
|
|
129
109
|
if (tsupCode === 0) {
|
|
130
|
-
console.log(
|
|
110
|
+
console.log(_picocolors2.default.green("[EFC] Build complete \u2192 dist/"));
|
|
131
111
|
} else {
|
|
132
|
-
process.exit(tsupCode
|
|
112
|
+
process.exit(_nullishCoalesce(tsupCode, () => ( 1)));
|
|
133
113
|
}
|
|
134
114
|
});
|
|
135
115
|
});
|
|
136
116
|
}
|
|
137
117
|
|
|
138
118
|
// src/cli/commands/run.ts
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
|
|
142
122
|
function runCommand() {
|
|
143
|
-
const cmd = new
|
|
123
|
+
const cmd = new (0, _commander.Command)("run");
|
|
144
124
|
cmd.argument("<runner>", "tests").description("Run EFC sub-commands (tests)").allowUnknownOption().action((runner) => {
|
|
145
125
|
if (runner === "tests") {
|
|
146
126
|
runTests(cmd.args.slice(1));
|
|
147
127
|
} else {
|
|
148
|
-
console.error(
|
|
128
|
+
console.error(_picocolors2.default.red(`Unknown runner: ${runner}. Use 'tests'.`));
|
|
149
129
|
process.exit(1);
|
|
150
130
|
}
|
|
151
131
|
});
|
|
152
132
|
return cmd;
|
|
153
133
|
}
|
|
154
134
|
function runTests(extraArgs) {
|
|
155
|
-
console.log(
|
|
156
|
-
const child = (0,
|
|
157
|
-
child.on("exit", (code) => process.exit(code
|
|
135
|
+
console.log(_picocolors2.default.cyan("[EFC] Running tests via Vitest\u2026"));
|
|
136
|
+
const child = _child_process.spawn.call(void 0, "npx", ["vitest", "run", ...extraArgs], { stdio: "inherit" });
|
|
137
|
+
child.on("exit", (code) => process.exit(_nullishCoalesce(code, () => ( 0))));
|
|
158
138
|
}
|
|
159
139
|
|
|
160
140
|
// src/cli/commands/generate.ts
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
|
|
165
145
|
function generateCommand() {
|
|
166
|
-
const cmd = new
|
|
146
|
+
const cmd = new (0, _commander.Command)("generate").alias("g").description("Scaffold EFC modules");
|
|
167
147
|
cmd.command("route <routePath>").description("Scaffold a route module, e.g. users/[id]").action((routePath) => generateRoute(routePath));
|
|
168
148
|
cmd.command("task <name>").description("Scaffold a background task module").action((name) => generateTask(name));
|
|
169
149
|
cmd.command("middleware <name>").description("Scaffold a middleware module").action((name) => generateMiddleware(name));
|
|
170
150
|
return cmd;
|
|
171
151
|
}
|
|
172
152
|
function writeFile(filePath, content) {
|
|
173
|
-
const dir =
|
|
174
|
-
|
|
175
|
-
if (
|
|
176
|
-
console.error(
|
|
153
|
+
const dir = _path2.default.dirname(filePath);
|
|
154
|
+
_fs2.default.mkdirSync(dir, { recursive: true });
|
|
155
|
+
if (_fs2.default.existsSync(filePath)) {
|
|
156
|
+
console.error(_picocolors2.default.red(`File already exists: ${filePath}`));
|
|
177
157
|
process.exit(1);
|
|
178
158
|
}
|
|
179
|
-
|
|
180
|
-
console.log(
|
|
159
|
+
_fs2.default.writeFileSync(filePath, content, "utf8");
|
|
160
|
+
console.log(_picocolors2.default.green(` created ${_path2.default.relative(process.cwd(), filePath)}`));
|
|
181
161
|
}
|
|
182
162
|
function generateRoute(routePath) {
|
|
183
163
|
const cwd = process.cwd();
|
|
184
|
-
const filePath =
|
|
164
|
+
const filePath = _path2.default.join(cwd, "src", "api", `${routePath}.ts`);
|
|
185
165
|
const content = `import type { Request, Response } from 'express';
|
|
186
166
|
|
|
187
167
|
export const GET = async (req: Request, res: Response) => {
|
|
@@ -193,11 +173,11 @@ export const POST = async (req: Request, res: Response) => {
|
|
|
193
173
|
};
|
|
194
174
|
`;
|
|
195
175
|
writeFile(filePath, content);
|
|
196
|
-
console.log(
|
|
176
|
+
console.log(_picocolors2.default.cyan(`[EFC] Route scaffolded`));
|
|
197
177
|
}
|
|
198
178
|
function generateTask(name) {
|
|
199
179
|
const cwd = process.cwd();
|
|
200
|
-
const filePath =
|
|
180
|
+
const filePath = _path2.default.join(cwd, "src", "tasks", `${name}.ts`);
|
|
201
181
|
const content = `import { defineTask } from 'express-file-cluster/tasks';
|
|
202
182
|
|
|
203
183
|
interface ${name}Payload {
|
|
@@ -210,11 +190,11 @@ export default defineTask<${name}Payload>(async (payload) => {
|
|
|
210
190
|
});
|
|
211
191
|
`;
|
|
212
192
|
writeFile(filePath, content);
|
|
213
|
-
console.log(
|
|
193
|
+
console.log(_picocolors2.default.cyan(`[EFC] Task scaffolded`));
|
|
214
194
|
}
|
|
215
195
|
function generateMiddleware(name) {
|
|
216
196
|
const cwd = process.cwd();
|
|
217
|
-
const filePath =
|
|
197
|
+
const filePath = _path2.default.join(cwd, "src", "middlewares", `${name}.ts`);
|
|
218
198
|
const content = `import type { Request, Response, NextFunction } from 'express';
|
|
219
199
|
|
|
220
200
|
export function ${name}(req: Request, res: Response, next: NextFunction): void {
|
|
@@ -223,122 +203,76 @@ export function ${name}(req: Request, res: Response, next: NextFunction): void {
|
|
|
223
203
|
}
|
|
224
204
|
`;
|
|
225
205
|
writeFile(filePath, content);
|
|
226
|
-
console.log(
|
|
206
|
+
console.log(_picocolors2.default.cyan(`[EFC] Middleware scaffolded`));
|
|
227
207
|
}
|
|
228
208
|
|
|
229
209
|
// src/cli/commands/diagnostics.ts
|
|
230
|
-
var import_commander5 = require("commander");
|
|
231
210
|
|
|
232
|
-
// src/router/scan.ts
|
|
233
|
-
var import_node_fs3 = __toESM(require("fs"), 1);
|
|
234
|
-
var import_node_path3 = __toESM(require("path"), 1);
|
|
235
|
-
var ROUTE_FILE_RE = /\.(ts|js|mts|mjs|cts|cjs)$/;
|
|
236
|
-
var DYNAMIC_SEGMENT_RE = /\[([^\]]+)\]/g;
|
|
237
|
-
function filePathToUrlPath(relativePath) {
|
|
238
|
-
let p = relativePath.replace(ROUTE_FILE_RE, "");
|
|
239
|
-
p = p.replace(/\/index$/, "");
|
|
240
|
-
p = p.replace(DYNAMIC_SEGMENT_RE, ":$1");
|
|
241
|
-
return p === "" ? "/" : p.startsWith("/") ? p : `/${p}`;
|
|
242
|
-
}
|
|
243
|
-
function extractParams(relativePath) {
|
|
244
|
-
const params = [];
|
|
245
|
-
let match;
|
|
246
|
-
const re = new RegExp(DYNAMIC_SEGMENT_RE.source, "g");
|
|
247
|
-
while ((match = re.exec(relativePath)) !== null) {
|
|
248
|
-
if (match[1]) params.push(match[1]);
|
|
249
|
-
}
|
|
250
|
-
return params;
|
|
251
|
-
}
|
|
252
|
-
function scanDir(dir, base = dir) {
|
|
253
|
-
if (!import_node_fs3.default.existsSync(dir)) return [];
|
|
254
|
-
const entries = [];
|
|
255
|
-
const items = import_node_fs3.default.readdirSync(dir, { withFileTypes: true });
|
|
256
|
-
for (const item of items) {
|
|
257
|
-
const fullPath = import_node_path3.default.join(dir, item.name);
|
|
258
|
-
if (item.isDirectory()) {
|
|
259
|
-
entries.push(...scanDir(fullPath, base));
|
|
260
|
-
} else if (ROUTE_FILE_RE.test(item.name)) {
|
|
261
|
-
const relative = "/" + import_node_path3.default.relative(base, fullPath).replace(/\\/g, "/");
|
|
262
|
-
entries.push({
|
|
263
|
-
urlPath: filePathToUrlPath(relative),
|
|
264
|
-
filePath: fullPath,
|
|
265
|
-
params: extractParams(relative)
|
|
266
|
-
});
|
|
267
|
-
}
|
|
268
|
-
}
|
|
269
|
-
return entries.sort((a, b) => {
|
|
270
|
-
const aDynamic = a.urlPath.includes(":") ? 1 : 0;
|
|
271
|
-
const bDynamic = b.urlPath.includes(":") ? 1 : 0;
|
|
272
|
-
return aDynamic - bDynamic || a.urlPath.localeCompare(b.urlPath);
|
|
273
|
-
});
|
|
274
|
-
}
|
|
275
211
|
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
var import_node_fs4 = __toESM(require("fs"), 1);
|
|
279
|
-
var import_chalk5 = __toESM(require("chalk"), 1);
|
|
212
|
+
|
|
213
|
+
|
|
280
214
|
function diagnosticsCommands() {
|
|
281
215
|
return [routesCommand(), tasksCommand(), doctorCommand()];
|
|
282
216
|
}
|
|
283
217
|
function routesCommand() {
|
|
284
|
-
return new
|
|
218
|
+
return new (0, _commander.Command)("routes").description("Print the resolved route table").action(() => {
|
|
285
219
|
const apiDir = resolveApiDir();
|
|
286
220
|
if (!apiDir) {
|
|
287
|
-
console.error(
|
|
221
|
+
console.error(_picocolors2.default.red("[EFC] Could not find apiDir (expected src/api)"));
|
|
288
222
|
process.exit(1);
|
|
289
223
|
}
|
|
290
|
-
const routes = scanDir(apiDir);
|
|
224
|
+
const routes = _chunkMQNVNOH5cjs.scanDir.call(void 0, apiDir);
|
|
291
225
|
if (routes.length === 0) {
|
|
292
|
-
console.log(
|
|
226
|
+
console.log(_picocolors2.default.yellow("No routes found."));
|
|
293
227
|
return;
|
|
294
228
|
}
|
|
295
|
-
console.log(
|
|
296
|
-
console.log(
|
|
229
|
+
console.log(_picocolors2.default.bold("\n Route Table\n"));
|
|
230
|
+
console.log(_picocolors2.default.dim(" " + "\u2500".repeat(60)));
|
|
297
231
|
for (const route of routes) {
|
|
298
|
-
const rel =
|
|
299
|
-
console.log(` ${
|
|
232
|
+
const rel = _path2.default.relative(process.cwd(), route.filePath);
|
|
233
|
+
console.log(` ${_picocolors2.default.cyan(route.urlPath.padEnd(35))} ${_picocolors2.default.dim(rel)}`);
|
|
300
234
|
}
|
|
301
|
-
console.log(
|
|
302
|
-
console.log(
|
|
235
|
+
console.log(_picocolors2.default.dim(" " + "\u2500".repeat(60)));
|
|
236
|
+
console.log(_picocolors2.default.dim(`
|
|
303
237
|
${routes.length} route(s) found
|
|
304
238
|
`));
|
|
305
239
|
});
|
|
306
240
|
}
|
|
307
241
|
function tasksCommand() {
|
|
308
|
-
return new
|
|
242
|
+
return new (0, _commander.Command)("tasks").description("List registered background tasks").action(() => {
|
|
309
243
|
const tasksDir = resolveTasksDir();
|
|
310
|
-
if (!tasksDir || !
|
|
311
|
-
console.log(
|
|
244
|
+
if (!tasksDir || !_fs2.default.existsSync(tasksDir)) {
|
|
245
|
+
console.log(_picocolors2.default.yellow("No tasks directory found."));
|
|
312
246
|
return;
|
|
313
247
|
}
|
|
314
|
-
const files =
|
|
248
|
+
const files = _fs2.default.readdirSync(tasksDir).filter((f) => /\.(ts|js)$/.test(f));
|
|
315
249
|
if (files.length === 0) {
|
|
316
|
-
console.log(
|
|
250
|
+
console.log(_picocolors2.default.yellow("No tasks found."));
|
|
317
251
|
return;
|
|
318
252
|
}
|
|
319
|
-
console.log(
|
|
253
|
+
console.log(_picocolors2.default.bold("\n Background Tasks\n"));
|
|
320
254
|
for (const file of files) {
|
|
321
|
-
console.log(` ${
|
|
255
|
+
console.log(` ${_picocolors2.default.cyan(_path2.default.basename(file, _path2.default.extname(file)))}`);
|
|
322
256
|
}
|
|
323
257
|
console.log();
|
|
324
258
|
});
|
|
325
259
|
}
|
|
326
260
|
function doctorCommand() {
|
|
327
|
-
return new
|
|
261
|
+
return new (0, _commander.Command)("doctor").description("Validate config, env vars, and project setup").action(() => {
|
|
328
262
|
const cwd = process.cwd();
|
|
329
263
|
const checks = [
|
|
330
264
|
{
|
|
331
265
|
label: "package.json exists",
|
|
332
|
-
ok:
|
|
266
|
+
ok: _fs2.default.existsSync(_path2.default.join(cwd, "package.json"))
|
|
333
267
|
},
|
|
334
268
|
{
|
|
335
269
|
label: "tsconfig.json exists",
|
|
336
|
-
ok:
|
|
270
|
+
ok: _fs2.default.existsSync(_path2.default.join(cwd, "tsconfig.json")),
|
|
337
271
|
hint: "Run `tsc --init` to create one"
|
|
338
272
|
},
|
|
339
273
|
{
|
|
340
274
|
label: "src/api directory exists",
|
|
341
|
-
ok:
|
|
275
|
+
ok: _fs2.default.existsSync(_path2.default.join(cwd, "src", "api")),
|
|
342
276
|
hint: "Create src/api/ and add route files"
|
|
343
277
|
},
|
|
344
278
|
{
|
|
@@ -352,38 +286,38 @@ function doctorCommand() {
|
|
|
352
286
|
hint: "Add JWT_SECRET to .env (generate: openssl rand -hex 64)"
|
|
353
287
|
}
|
|
354
288
|
];
|
|
355
|
-
console.log(
|
|
289
|
+
console.log(_picocolors2.default.bold("\n EFC Doctor\n"));
|
|
356
290
|
let allOk = true;
|
|
357
291
|
for (const check of checks) {
|
|
358
|
-
const icon = check.ok ?
|
|
292
|
+
const icon = check.ok ? _picocolors2.default.green("\u2713") : _picocolors2.default.red("\u2717");
|
|
359
293
|
console.log(` ${icon} ${check.label}`);
|
|
360
294
|
if (!check.ok) {
|
|
361
295
|
allOk = false;
|
|
362
|
-
if (check.hint) console.log(
|
|
296
|
+
if (check.hint) console.log(_picocolors2.default.dim(` \u2192 ${check.hint}`));
|
|
363
297
|
}
|
|
364
298
|
}
|
|
365
299
|
console.log();
|
|
366
300
|
if (allOk) {
|
|
367
|
-
console.log(
|
|
301
|
+
console.log(_picocolors2.default.green(" All checks passed!\n"));
|
|
368
302
|
} else {
|
|
369
|
-
console.log(
|
|
303
|
+
console.log(_picocolors2.default.yellow(" Some checks failed. Fix the issues above.\n"));
|
|
370
304
|
process.exit(1);
|
|
371
305
|
}
|
|
372
306
|
});
|
|
373
307
|
}
|
|
374
308
|
function resolveApiDir() {
|
|
375
309
|
const cwd = process.cwd();
|
|
376
|
-
const candidates = [
|
|
377
|
-
return candidates.find((d) =>
|
|
310
|
+
const candidates = [_path2.default.join(cwd, "src", "api"), _path2.default.join(cwd, "api")];
|
|
311
|
+
return _nullishCoalesce(candidates.find((d) => _fs2.default.existsSync(d)), () => ( null));
|
|
378
312
|
}
|
|
379
313
|
function resolveTasksDir() {
|
|
380
314
|
const cwd = process.cwd();
|
|
381
|
-
const candidates = [
|
|
382
|
-
return candidates.find((d) =>
|
|
315
|
+
const candidates = [_path2.default.join(cwd, "src", "tasks"), _path2.default.join(cwd, "tasks")];
|
|
316
|
+
return _nullishCoalesce(candidates.find((d) => _fs2.default.existsSync(d)), () => ( null));
|
|
383
317
|
}
|
|
384
318
|
|
|
385
319
|
// src/cli/index.ts
|
|
386
|
-
var program = new
|
|
320
|
+
var program = new (0, _commander.Command)("efc").description("Express File Cluster CLI").version("0.1.0");
|
|
387
321
|
program.addCommand(startCommand());
|
|
388
322
|
program.addCommand(buildCommand());
|
|
389
323
|
program.addCommand(runCommand());
|
package/dist/cli/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/cli/index.ts","../../src/cli/commands/start.ts","../../src/cli/commands/build.ts","../../src/cli/commands/run.ts","../../src/cli/commands/generate.ts","../../src/cli/commands/diagnostics.ts","../../src/router/scan.ts"],"sourcesContent":["#!/usr/bin/env node\nimport { Command } from 'commander';\nimport { startCommand } from './commands/start.js';\nimport { buildCommand } from './commands/build.js';\nimport { runCommand } from './commands/run.js';\nimport { generateCommand } from './commands/generate.js';\nimport { diagnosticsCommands } from './commands/diagnostics.js';\n\nconst program = new Command('efc')\n .description('Express File Cluster CLI')\n .version('0.1.0');\n\nprogram.addCommand(startCommand());\nprogram.addCommand(buildCommand());\nprogram.addCommand(runCommand());\nprogram.addCommand(generateCommand());\n\nfor (const cmd of diagnosticsCommands()) {\n program.addCommand(cmd);\n}\n\nprogram.parse(process.argv);\n","import { Command } from 'commander';\nimport { spawn } from 'node:child_process';\nimport path from 'node:path';\nimport fs from 'node:fs';\nimport chalk from 'chalk';\n\nexport function startCommand(): Command {\n const cmd = new Command('start');\n\n cmd\n .argument('<mode>', 'dev | prod')\n .description('Start the EFC server')\n .action((mode: string) => {\n if (mode === 'dev') {\n startDev();\n } else if (mode === 'prod') {\n startProd();\n } else {\n console.error(chalk.red(`Unknown mode: ${mode}. Use 'dev' or 'prod'.`));\n process.exit(1);\n }\n });\n\n return cmd;\n}\n\nfunction parseDotenv(cwd: string): Record<string, string> {\n const envFile = path.join(cwd, '.env');\n if (!fs.existsSync(envFile)) return {};\n const vars: Record<string, string> = {};\n for (const line of fs.readFileSync(envFile, 'utf8').split('\\n')) {\n const trimmed = line.trim();\n if (!trimmed || trimmed.startsWith('#')) continue;\n const eq = trimmed.indexOf('=');\n if (eq === -1) continue;\n const key = trimmed.slice(0, eq).trim();\n const raw = trimmed.slice(eq + 1).trim();\n vars[key] = raw.replace(/^(['\"])(.*)\\1$/, '$2');\n }\n return vars;\n}\n\nfunction startDev(): void {\n const entry = resolveEntry();\n if (!entry) {\n console.error(chalk.red('[EFC] Could not find entry point. Expected src/index.ts or index.ts'));\n process.exit(1);\n }\n\n console.log(chalk.cyan('[EFC] Starting development server…'));\n console.log(chalk.dim(` Entry: ${entry}`));\n\n const cwd = process.cwd();\n const localTsx = path.join(cwd, 'node_modules', '.bin', 'tsx');\n const tsx = fs.existsSync(localTsx) ? localTsx : 'tsx';\n\n // .env values are base; existing process.env takes precedence (same as dotenv default)\n const env: NodeJS.ProcessEnv = { ...parseDotenv(cwd), ...process.env, NODE_ENV: 'development' };\n\n const child = spawn(tsx, ['watch', entry], { stdio: 'inherit', env });\n child.on('exit', (code) => process.exit(code ?? 0));\n}\n\nfunction startProd(): void {\n const cwd = process.cwd();\n const distEntry = path.join(cwd, 'dist', 'index.js');\n\n if (!fs.existsSync(distEntry)) {\n console.error(chalk.red('[EFC] dist/index.js not found. Run `efc build prod` first.'));\n process.exit(1);\n }\n\n console.log(chalk.cyan('[EFC] Starting production server…'));\n\n // Production env comes exclusively from process.env — no .env file loading.\n // Platforms (Docker, Kubernetes, Railway, Heroku, etc.) inject vars directly.\n const child = spawn('node', [distEntry], {\n stdio: 'inherit',\n env: { ...process.env, NODE_ENV: 'production' },\n });\n child.on('exit', (code) => process.exit(code ?? 0));\n}\n\nfunction resolveEntry(): string | null {\n const cwd = process.cwd();\n const candidates = [\n path.join(cwd, 'src', 'index.ts'),\n path.join(cwd, 'index.ts'),\n path.join(cwd, 'src', 'index.js'),\n path.join(cwd, 'index.js'),\n ];\n return candidates.find((f) => fs.existsSync(f)) ?? null;\n}\n","import { Command } from 'commander';\nimport { spawn } from 'node:child_process';\nimport chalk from 'chalk';\n\nexport function buildCommand(): Command {\n const cmd = new Command('build');\n\n cmd\n .argument('<mode>', 'prod')\n .description('Build the application for production')\n .action((mode: string) => {\n if (mode !== 'prod') {\n console.error(chalk.red(`Unknown build mode: ${mode}. Use 'prod'.`));\n process.exit(1);\n }\n buildProd();\n });\n\n return cmd;\n}\n\nfunction buildProd(): void {\n console.log(chalk.cyan('[EFC] Building for production…'));\n\n // Type-check first\n const tsc = spawn('npx', ['tsc', '--noEmit'], { stdio: 'inherit' });\n\n tsc.on('exit', (code) => {\n if (code !== 0) {\n console.error(chalk.red('[EFC] TypeScript errors found. Fix them before building.'));\n process.exit(1);\n }\n\n const tsup = spawn('npx', ['tsup'], { stdio: 'inherit' });\n tsup.on('exit', (tsupCode) => {\n if (tsupCode === 0) {\n console.log(chalk.green('[EFC] Build complete → dist/'));\n } else {\n process.exit(tsupCode ?? 1);\n }\n });\n });\n}\n","import { Command } from 'commander';\nimport { spawn } from 'node:child_process';\nimport chalk from 'chalk';\n\nexport function runCommand(): Command {\n const cmd = new Command('run');\n\n cmd\n .argument('<runner>', 'tests')\n .description('Run EFC sub-commands (tests)')\n .allowUnknownOption()\n .action((runner: string) => {\n if (runner === 'tests') {\n runTests(cmd.args.slice(1));\n } else {\n console.error(chalk.red(`Unknown runner: ${runner}. Use 'tests'.`));\n process.exit(1);\n }\n });\n\n return cmd;\n}\n\nfunction runTests(extraArgs: string[]): void {\n console.log(chalk.cyan('[EFC] Running tests via Vitest…'));\n const child = spawn('npx', ['vitest', 'run', ...extraArgs], { stdio: 'inherit' });\n child.on('exit', (code) => process.exit(code ?? 0));\n}\n","import { Command } from 'commander';\nimport fs from 'node:fs';\nimport path from 'node:path';\nimport chalk from 'chalk';\n\nexport function generateCommand(): Command {\n const cmd = new Command('generate').alias('g').description('Scaffold EFC modules');\n\n cmd\n .command('route <routePath>')\n .description('Scaffold a route module, e.g. users/[id]')\n .action((routePath: string) => generateRoute(routePath));\n\n cmd\n .command('task <name>')\n .description('Scaffold a background task module')\n .action((name: string) => generateTask(name));\n\n cmd\n .command('middleware <name>')\n .description('Scaffold a middleware module')\n .action((name: string) => generateMiddleware(name));\n\n return cmd;\n}\n\nfunction writeFile(filePath: string, content: string): void {\n const dir = path.dirname(filePath);\n fs.mkdirSync(dir, { recursive: true });\n if (fs.existsSync(filePath)) {\n console.error(chalk.red(`File already exists: ${filePath}`));\n process.exit(1);\n }\n fs.writeFileSync(filePath, content, 'utf8');\n console.log(chalk.green(` created ${path.relative(process.cwd(), filePath)}`));\n}\n\nfunction generateRoute(routePath: string): void {\n const cwd = process.cwd();\n const filePath = path.join(cwd, 'src', 'api', `${routePath}.ts`);\n\n const content = `import type { Request, Response } from 'express';\n\nexport const GET = async (req: Request, res: Response) => {\n res.json({ message: 'OK' });\n};\n\nexport const POST = async (req: Request, res: Response) => {\n res.status(201).json({ message: 'Created' });\n};\n`;\n\n writeFile(filePath, content);\n console.log(chalk.cyan(`[EFC] Route scaffolded`));\n}\n\nfunction generateTask(name: string): void {\n const cwd = process.cwd();\n const filePath = path.join(cwd, 'src', 'tasks', `${name}.ts`);\n\n const content = `import { defineTask } from 'express-file-cluster/tasks';\n\ninterface ${name}Payload {\n // TODO: define payload fields\n}\n\nexport default defineTask<${name}Payload>(async (payload) => {\n // TODO: implement task logic\n console.log('[Task:${name}]', payload);\n});\n`;\n\n writeFile(filePath, content);\n console.log(chalk.cyan(`[EFC] Task scaffolded`));\n}\n\nfunction generateMiddleware(name: string): void {\n const cwd = process.cwd();\n const filePath = path.join(cwd, 'src', 'middlewares', `${name}.ts`);\n\n const content = `import type { Request, Response, NextFunction } from 'express';\n\nexport function ${name}(req: Request, res: Response, next: NextFunction): void {\n // TODO: implement middleware logic\n next();\n}\n`;\n\n writeFile(filePath, content);\n console.log(chalk.cyan(`[EFC] Middleware scaffolded`));\n}\n","import { Command } from 'commander';\nimport { scanDir } from '../../router/scan.js';\nimport path from 'node:path';\nimport fs from 'node:fs';\nimport chalk from 'chalk';\n\nexport function diagnosticsCommands(): Command[] {\n return [routesCommand(), tasksCommand(), doctorCommand()];\n}\n\nfunction routesCommand(): Command {\n return new Command('routes')\n .description('Print the resolved route table')\n .action(() => {\n const apiDir = resolveApiDir();\n if (!apiDir) {\n console.error(chalk.red('[EFC] Could not find apiDir (expected src/api)'));\n process.exit(1);\n }\n\n const routes = scanDir(apiDir);\n if (routes.length === 0) {\n console.log(chalk.yellow('No routes found.'));\n return;\n }\n\n console.log(chalk.bold('\\n Route Table\\n'));\n console.log(chalk.dim(' ' + '─'.repeat(60)));\n for (const route of routes) {\n const rel = path.relative(process.cwd(), route.filePath);\n console.log(` ${chalk.cyan(route.urlPath.padEnd(35))} ${chalk.dim(rel)}`);\n }\n console.log(chalk.dim(' ' + '─'.repeat(60)));\n console.log(chalk.dim(`\\n ${routes.length} route(s) found\\n`));\n });\n}\n\nfunction tasksCommand(): Command {\n return new Command('tasks')\n .description('List registered background tasks')\n .action(() => {\n const tasksDir = resolveTasksDir();\n if (!tasksDir || !fs.existsSync(tasksDir)) {\n console.log(chalk.yellow('No tasks directory found.'));\n return;\n }\n\n const files = fs.readdirSync(tasksDir).filter((f) => /\\.(ts|js)$/.test(f));\n if (files.length === 0) {\n console.log(chalk.yellow('No tasks found.'));\n return;\n }\n\n console.log(chalk.bold('\\n Background Tasks\\n'));\n for (const file of files) {\n console.log(` ${chalk.cyan(path.basename(file, path.extname(file)))}`);\n }\n console.log();\n });\n}\n\nfunction doctorCommand(): Command {\n return new Command('doctor')\n .description('Validate config, env vars, and project setup')\n .action(() => {\n const cwd = process.cwd();\n const checks: { label: string; ok: boolean; hint?: string }[] = [\n {\n label: 'package.json exists',\n ok: fs.existsSync(path.join(cwd, 'package.json')),\n },\n {\n label: 'tsconfig.json exists',\n ok: fs.existsSync(path.join(cwd, 'tsconfig.json')),\n hint: 'Run `tsc --init` to create one',\n },\n {\n label: 'src/api directory exists',\n ok: fs.existsSync(path.join(cwd, 'src', 'api')),\n hint: 'Create src/api/ and add route files',\n },\n {\n label: 'DATABASE_URL set',\n ok: Boolean(process.env['DATABASE_URL']),\n hint: 'Add DATABASE_URL to .env',\n },\n {\n label: 'JWT_SECRET set',\n ok: Boolean(process.env['JWT_SECRET']),\n hint: 'Add JWT_SECRET to .env (generate: openssl rand -hex 64)',\n },\n ];\n\n console.log(chalk.bold('\\n EFC Doctor\\n'));\n let allOk = true;\n for (const check of checks) {\n const icon = check.ok ? chalk.green('✓') : chalk.red('✗');\n console.log(` ${icon} ${check.label}`);\n if (!check.ok) {\n allOk = false;\n if (check.hint) console.log(chalk.dim(` → ${check.hint}`));\n }\n }\n console.log();\n if (allOk) {\n console.log(chalk.green(' All checks passed!\\n'));\n } else {\n console.log(chalk.yellow(' Some checks failed. Fix the issues above.\\n'));\n process.exit(1);\n }\n });\n}\n\nfunction resolveApiDir(): string | null {\n const cwd = process.cwd();\n const candidates = [path.join(cwd, 'src', 'api'), path.join(cwd, 'api')];\n return candidates.find((d) => fs.existsSync(d)) ?? null;\n}\n\nfunction resolveTasksDir(): string | null {\n const cwd = process.cwd();\n const candidates = [path.join(cwd, 'src', 'tasks'), path.join(cwd, 'tasks')];\n return candidates.find((d) => fs.existsSync(d)) ?? null;\n}\n","import fs from 'node:fs';\nimport path from 'node:path';\nimport type { RouteEntry } from '../types.js';\n\nconst ROUTE_FILE_RE = /\\.(ts|js|mts|mjs|cts|cjs)$/;\nconst DYNAMIC_SEGMENT_RE = /\\[([^\\]]+)\\]/g;\n\nfunction filePathToUrlPath(relativePath: string): string {\n let p = relativePath.replace(ROUTE_FILE_RE, '');\n // index files map to parent path\n p = p.replace(/\\/index$/, '');\n // [param] → :param\n p = p.replace(DYNAMIC_SEGMENT_RE, ':$1');\n return p === '' ? '/' : p.startsWith('/') ? p : `/${p}`;\n}\n\nfunction extractParams(relativePath: string): string[] {\n const params: string[] = [];\n let match: RegExpExecArray | null;\n const re = new RegExp(DYNAMIC_SEGMENT_RE.source, 'g');\n while ((match = re.exec(relativePath)) !== null) {\n if (match[1]) params.push(match[1]);\n }\n return params;\n}\n\nexport function scanDir(dir: string, base: string = dir): RouteEntry[] {\n if (!fs.existsSync(dir)) return [];\n\n const entries: RouteEntry[] = [];\n const items = fs.readdirSync(dir, { withFileTypes: true });\n\n for (const item of items) {\n const fullPath = path.join(dir, item.name);\n if (item.isDirectory()) {\n entries.push(...scanDir(fullPath, base));\n } else if (ROUTE_FILE_RE.test(item.name)) {\n const relative = '/' + path.relative(base, fullPath).replace(/\\\\/g, '/');\n entries.push({\n urlPath: filePathToUrlPath(relative),\n filePath: fullPath,\n params: extractParams(relative),\n });\n }\n }\n\n // Sort: static routes before dynamic ones at each segment level\n return entries.sort((a, b) => {\n const aDynamic = a.urlPath.includes(':') ? 1 : 0;\n const bDynamic = b.urlPath.includes(':') ? 1 : 0;\n return aDynamic - bDynamic || a.urlPath.localeCompare(b.urlPath);\n });\n}\n\nexport { filePathToUrlPath };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AACA,IAAAA,oBAAwB;;;ACDxB,uBAAwB;AACxB,gCAAsB;AACtB,uBAAiB;AACjB,qBAAe;AACf,mBAAkB;AAEX,SAAS,eAAwB;AACtC,QAAM,MAAM,IAAI,yBAAQ,OAAO;AAE/B,MACG,SAAS,UAAU,YAAY,EAC/B,YAAY,sBAAsB,EAClC,OAAO,CAAC,SAAiB;AACxB,QAAI,SAAS,OAAO;AAClB,eAAS;AAAA,IACX,WAAW,SAAS,QAAQ;AAC1B,gBAAU;AAAA,IACZ,OAAO;AACL,cAAQ,MAAM,aAAAC,QAAM,IAAI,iBAAiB,IAAI,wBAAwB,CAAC;AACtE,cAAQ,KAAK,CAAC;AAAA,IAChB;AAAA,EACF,CAAC;AAEH,SAAO;AACT;AAEA,SAAS,YAAY,KAAqC;AACxD,QAAM,UAAU,iBAAAC,QAAK,KAAK,KAAK,MAAM;AACrC,MAAI,CAAC,eAAAC,QAAG,WAAW,OAAO,EAAG,QAAO,CAAC;AACrC,QAAM,OAA+B,CAAC;AACtC,aAAW,QAAQ,eAAAA,QAAG,aAAa,SAAS,MAAM,EAAE,MAAM,IAAI,GAAG;AAC/D,UAAM,UAAU,KAAK,KAAK;AAC1B,QAAI,CAAC,WAAW,QAAQ,WAAW,G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ACzE,cAAQ,KAAK,CAAC;AAAA,IAChB;AAAA,EACF,CAAC;AACL;AAEA,SAAS,gBAA+B;AACtC,QAAM,MAAM,QAAQ,IAAI;AACxB,QAAM,aAAa,CAAC,kBAAAC,QAAK,KAAK,KAAK,OAAO,KAAK,GAAG,kBAAAA,QAAK,KAAK,KAAK,KAAK,CAAC;AACvE,SAAO,WAAW,KAAK,CAAC,MAAM,gBAAAC,QAAG,WAAW,CAAC,CAAC,KAAK;AACrD;AAEA,SAAS,kBAAiC;AACxC,QAAM,MAAM,QAAQ,IAAI;AACxB,QAAM,aAAa,CAAC,kBAAAD,QAAK,KAAK,KAAK,OAAO,OAAO,GAAG,kBAAAA,QAAK,KAAK,KAAK,OAAO,CAAC;AAC3E,SAAO,WAAW,KAAK,CAAC,MAAM,gBAAAC,QAAG,WAAW,CAAC,CAAC,KAAK;AACrD;;;ALnHA,IAAM,UAAU,IAAI,0BAAQ,KAAK,EAC9B,YAAY,0BAA0B,EACtC,QAAQ,OAAO;AAElB,QAAQ,WAAW,aAAa,CAAC;AACjC,QAAQ,WAAW,aAAa,CAAC;AACjC,QAAQ,WAAW,WAAW,CAAC;AAC/B,QAAQ,WAAW,gBAAgB,CAAC;AAEpC,WAAW,OAAO,oBAAoB,GAAG;AACvC,UAAQ,WAAW,GAAG;AACxB;AAEA,QAAQ,MAAM,QAAQ,IAAI;","names":["import_commander","chalk","path","fs","import_commander","import_node_child_process","import_chalk","chalk","import_commander","import_node_child_process","import_chalk","chalk","import_commander","import_node_fs","import_node_path","import_chalk","path","fs","chalk","import_commander","import_node_fs","import_node_path","fs","path","import_node_path","import_node_fs","import_chalk","chalk","path","fs"]}
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/efc.js/efc.js/packages/core/dist/cli/index.cjs","../../src/cli/index.ts","../../src/cli/commands/start.ts","../../src/cli/commands/build.ts","../../src/cli/commands/run.ts","../../src/cli/commands/generate.ts","../../src/cli/commands/diagnostics.ts"],"names":["path","pc"],"mappings":"AAAA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AG8B;AACA;AACF;AACK;AAEE;AACd,EAAA;AACxB;AAE0B","file":"/home/runner/work/efc.js/efc.js/packages/core/dist/cli/index.cjs","sourcesContent":[null,"#!/usr/bin/env node\nimport { Command } from 'commander';\nimport { startCommand } from './commands/start.js';\nimport { buildCommand } from './commands/build.js';\nimport { runCommand } from './commands/run.js';\nimport { generateCommand } from './commands/generate.js';\nimport { diagnosticsCommands } from './commands/diagnostics.js';\n\nconst program = new Command('efc')\n .description('Express File Cluster CLI')\n .version('0.1.0');\n\nprogram.addCommand(startCommand());\nprogram.addCommand(buildCommand());\nprogram.addCommand(runCommand());\nprogram.addCommand(generateCommand());\n\nfor (const cmd of diagnosticsCommands()) {\n program.addCommand(cmd);\n}\n\nprogram.parse(process.argv);\n","import { Command } from 'commander';\nimport { spawn } from 'node:child_process';\nimport path from 'node:path';\nimport fs from 'node:fs';\nimport pc from 'picocolors';\n\nexport function startCommand(): Command {\n const cmd = new Command('start');\n\n cmd\n .argument('<mode>', 'dev | prod')\n .description('Start the EFC server')\n .action((mode: string) => {\n if (mode === 'dev') {\n startDev();\n } else if (mode === 'prod') {\n startProd();\n } else {\n console.error(pc.red(`Unknown mode: ${mode}. Use 'dev' or 'prod'.`));\n process.exit(1);\n }\n });\n\n return cmd;\n}\n\nfunction parseDotenv(cwd: string): Record<string, string> {\n const envFile = path.join(cwd, '.env');\n if (!fs.existsSync(envFile)) return {};\n const vars: Record<string, string> = {};\n for (const line of fs.readFileSync(envFile, 'utf8').split('\\n')) {\n const trimmed = line.trim();\n if (!trimmed || trimmed.startsWith('#')) continue;\n const eq = trimmed.indexOf('=');\n if (eq === -1) continue;\n const key = trimmed.slice(0, eq).trim();\n const raw = trimmed.slice(eq + 1).trim();\n vars[key] = raw.replace(/^(['\"])(.*)\\1$/, '$2');\n }\n return vars;\n}\n\nfunction startDev(): void {\n const entry = resolveEntry();\n if (!entry) {\n console.error(pc.red('[EFC] Could not find entry point. Expected src/index.ts or index.ts'));\n process.exit(1);\n }\n\n console.log(pc.cyan('[EFC] Starting development server…'));\n console.log(pc.dim(` Entry: ${entry}`));\n\n const cwd = process.cwd();\n const localTsx = path.join(cwd, 'node_modules', '.bin', 'tsx');\n const tsx = fs.existsSync(localTsx) ? localTsx : 'tsx';\n\n // .env values are base; existing process.env takes precedence (same as dotenv default)\n const env: NodeJS.ProcessEnv = { ...parseDotenv(cwd), ...process.env, NODE_ENV: 'development' };\n\n const child = spawn(tsx, ['watch', '--include', 'src', entry], { stdio: 'inherit', env });\n child.on('exit', (code) => process.exit(code ?? 0));\n}\n\nfunction startProd(): void {\n const cwd = process.cwd();\n const distEntry = path.join(cwd, 'dist', 'index.js');\n\n if (!fs.existsSync(distEntry)) {\n console.error(pc.red('[EFC] dist/index.js not found. Run `efc build prod` first.'));\n process.exit(1);\n }\n\n console.log(pc.cyan('[EFC] Starting production server…'));\n\n // Production env comes exclusively from process.env — no .env file loading.\n // Platforms (Docker, Kubernetes, Railway, Heroku, etc.) inject vars directly.\n const child = spawn('node', [distEntry], {\n stdio: 'inherit',\n env: { ...process.env, NODE_ENV: 'production' },\n });\n child.on('exit', (code) => process.exit(code ?? 0));\n}\n\nfunction resolveEntry(): string | null {\n const cwd = process.cwd();\n const candidates = [\n path.join(cwd, 'src', 'index.ts'),\n path.join(cwd, 'index.ts'),\n path.join(cwd, 'src', 'index.js'),\n path.join(cwd, 'index.js'),\n ];\n return candidates.find((f) => fs.existsSync(f)) ?? null;\n}\n","import { Command } from 'commander';\nimport { spawn } from 'node:child_process';\nimport pc from 'picocolors';\n\nexport function buildCommand(): Command {\n const cmd = new Command('build');\n\n cmd\n .argument('<mode>', 'prod')\n .description('Build the application for production')\n .action((mode: string) => {\n if (mode !== 'prod') {\n console.error(pc.red(`Unknown build mode: ${mode}. Use 'prod'.`));\n process.exit(1);\n }\n buildProd();\n });\n\n return cmd;\n}\n\nfunction buildProd(): void {\n console.log(pc.cyan('[EFC] Building for production…'));\n\n // Type-check first\n const tsc = spawn('npx', ['tsc', '--noEmit'], { stdio: 'inherit' });\n\n tsc.on('exit', (code) => {\n if (code !== 0) {\n console.error(pc.red('[EFC] TypeScript errors found. Fix them before building.'));\n process.exit(1);\n }\n\n const tsup = spawn('npx', ['tsup'], { stdio: 'inherit' });\n tsup.on('exit', (tsupCode) => {\n if (tsupCode === 0) {\n console.log(pc.green('[EFC] Build complete → dist/'));\n } else {\n process.exit(tsupCode ?? 1);\n }\n });\n });\n}\n","import { Command } from 'commander';\nimport { spawn } from 'node:child_process';\nimport pc from 'picocolors';\n\nexport function runCommand(): Command {\n const cmd = new Command('run');\n\n cmd\n .argument('<runner>', 'tests')\n .description('Run EFC sub-commands (tests)')\n .allowUnknownOption()\n .action((runner: string) => {\n if (runner === 'tests') {\n runTests(cmd.args.slice(1));\n } else {\n console.error(pc.red(`Unknown runner: ${runner}. Use 'tests'.`));\n process.exit(1);\n }\n });\n\n return cmd;\n}\n\nfunction runTests(extraArgs: string[]): void {\n console.log(pc.cyan('[EFC] Running tests via Vitest…'));\n const child = spawn('npx', ['vitest', 'run', ...extraArgs], { stdio: 'inherit' });\n child.on('exit', (code) => process.exit(code ?? 0));\n}\n","import { Command } from 'commander';\nimport fs from 'node:fs';\nimport path from 'node:path';\nimport pc from 'picocolors';\n\nexport function generateCommand(): Command {\n const cmd = new Command('generate').alias('g').description('Scaffold EFC modules');\n\n cmd\n .command('route <routePath>')\n .description('Scaffold a route module, e.g. users/[id]')\n .action((routePath: string) => generateRoute(routePath));\n\n cmd\n .command('task <name>')\n .description('Scaffold a background task module')\n .action((name: string) => generateTask(name));\n\n cmd\n .command('middleware <name>')\n .description('Scaffold a middleware module')\n .action((name: string) => generateMiddleware(name));\n\n return cmd;\n}\n\nfunction writeFile(filePath: string, content: string): void {\n const dir = path.dirname(filePath);\n fs.mkdirSync(dir, { recursive: true });\n if (fs.existsSync(filePath)) {\n console.error(pc.red(`File already exists: ${filePath}`));\n process.exit(1);\n }\n fs.writeFileSync(filePath, content, 'utf8');\n console.log(pc.green(` created ${path.relative(process.cwd(), filePath)}`));\n}\n\nfunction generateRoute(routePath: string): void {\n const cwd = process.cwd();\n const filePath = path.join(cwd, 'src', 'api', `${routePath}.ts`);\n\n const content = `import type { Request, Response } from 'express';\n\nexport const GET = async (req: Request, res: Response) => {\n res.json({ message: 'OK' });\n};\n\nexport const POST = async (req: Request, res: Response) => {\n res.status(201).json({ message: 'Created' });\n};\n`;\n\n writeFile(filePath, content);\n console.log(pc.cyan(`[EFC] Route scaffolded`));\n}\n\nfunction generateTask(name: string): void {\n const cwd = process.cwd();\n const filePath = path.join(cwd, 'src', 'tasks', `${name}.ts`);\n\n const content = `import { defineTask } from 'express-file-cluster/tasks';\n\ninterface ${name}Payload {\n // TODO: define payload fields\n}\n\nexport default defineTask<${name}Payload>(async (payload) => {\n // TODO: implement task logic\n console.log('[Task:${name}]', payload);\n});\n`;\n\n writeFile(filePath, content);\n console.log(pc.cyan(`[EFC] Task scaffolded`));\n}\n\nfunction generateMiddleware(name: string): void {\n const cwd = process.cwd();\n const filePath = path.join(cwd, 'src', 'middlewares', `${name}.ts`);\n\n const content = `import type { Request, Response, NextFunction } from 'express';\n\nexport function ${name}(req: Request, res: Response, next: NextFunction): void {\n // TODO: implement middleware logic\n next();\n}\n`;\n\n writeFile(filePath, content);\n console.log(pc.cyan(`[EFC] Middleware scaffolded`));\n}\n","import { Command } from 'commander';\nimport { scanDir } from '../../router/scan.js';\nimport path from 'node:path';\nimport fs from 'node:fs';\nimport pc from 'picocolors';\n\nexport function diagnosticsCommands(): Command[] {\n return [routesCommand(), tasksCommand(), doctorCommand()];\n}\n\nfunction routesCommand(): Command {\n return new Command('routes')\n .description('Print the resolved route table')\n .action(() => {\n const apiDir = resolveApiDir();\n if (!apiDir) {\n console.error(pc.red('[EFC] Could not find apiDir (expected src/api)'));\n process.exit(1);\n }\n\n const routes = scanDir(apiDir);\n if (routes.length === 0) {\n console.log(pc.yellow('No routes found.'));\n return;\n }\n\n console.log(pc.bold('\\n Route Table\\n'));\n console.log(pc.dim(' ' + '─'.repeat(60)));\n for (const route of routes) {\n const rel = path.relative(process.cwd(), route.filePath);\n console.log(` ${pc.cyan(route.urlPath.padEnd(35))} ${pc.dim(rel)}`);\n }\n console.log(pc.dim(' ' + '─'.repeat(60)));\n console.log(pc.dim(`\\n ${routes.length} route(s) found\\n`));\n });\n}\n\nfunction tasksCommand(): Command {\n return new Command('tasks')\n .description('List registered background tasks')\n .action(() => {\n const tasksDir = resolveTasksDir();\n if (!tasksDir || !fs.existsSync(tasksDir)) {\n console.log(pc.yellow('No tasks directory found.'));\n return;\n }\n\n const files = fs.readdirSync(tasksDir).filter((f) => /\\.(ts|js)$/.test(f));\n if (files.length === 0) {\n console.log(pc.yellow('No tasks found.'));\n return;\n }\n\n console.log(pc.bold('\\n Background Tasks\\n'));\n for (const file of files) {\n console.log(` ${pc.cyan(path.basename(file, path.extname(file)))}`);\n }\n console.log();\n });\n}\n\nfunction doctorCommand(): Command {\n return new Command('doctor')\n .description('Validate config, env vars, and project setup')\n .action(() => {\n const cwd = process.cwd();\n const checks: { label: string; ok: boolean; hint?: string }[] = [\n {\n label: 'package.json exists',\n ok: fs.existsSync(path.join(cwd, 'package.json')),\n },\n {\n label: 'tsconfig.json exists',\n ok: fs.existsSync(path.join(cwd, 'tsconfig.json')),\n hint: 'Run `tsc --init` to create one',\n },\n {\n label: 'src/api directory exists',\n ok: fs.existsSync(path.join(cwd, 'src', 'api')),\n hint: 'Create src/api/ and add route files',\n },\n {\n label: 'DATABASE_URL set',\n ok: Boolean(process.env['DATABASE_URL']),\n hint: 'Add DATABASE_URL to .env',\n },\n {\n label: 'JWT_SECRET set',\n ok: Boolean(process.env['JWT_SECRET']),\n hint: 'Add JWT_SECRET to .env (generate: openssl rand -hex 64)',\n },\n ];\n\n console.log(pc.bold('\\n EFC Doctor\\n'));\n let allOk = true;\n for (const check of checks) {\n const icon = check.ok ? pc.green('✓') : pc.red('✗');\n console.log(` ${icon} ${check.label}`);\n if (!check.ok) {\n allOk = false;\n if (check.hint) console.log(pc.dim(` → ${check.hint}`));\n }\n }\n console.log();\n if (allOk) {\n console.log(pc.green(' All checks passed!\\n'));\n } else {\n console.log(pc.yellow(' Some checks failed. Fix the issues above.\\n'));\n process.exit(1);\n }\n });\n}\n\nfunction resolveApiDir(): string | null {\n const cwd = process.cwd();\n const candidates = [path.join(cwd, 'src', 'api'), path.join(cwd, 'api')];\n return candidates.find((d) => fs.existsSync(d)) ?? null;\n}\n\nfunction resolveTasksDir(): string | null {\n const cwd = process.cwd();\n const candidates = [path.join(cwd, 'src', 'tasks'), path.join(cwd, 'tasks')];\n return candidates.find((d) => fs.existsSync(d)) ?? null;\n}\n"]}
|