@flight-framework/cli 0.3.6 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin.js +545 -952
- package/dist/bin.js.map +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.js +545 -952
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/bin.js
CHANGED
|
@@ -1,706 +1,24 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
2
|
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
9
3
|
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
10
4
|
}) : x)(function(x) {
|
|
11
5
|
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
12
6
|
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
13
7
|
});
|
|
14
|
-
var __commonJS = (cb, mod) => function __require2() {
|
|
15
|
-
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
16
|
-
};
|
|
17
|
-
var __copyProps = (to, from, except, desc) => {
|
|
18
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
19
|
-
for (let key of __getOwnPropNames(from))
|
|
20
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
21
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
22
|
-
}
|
|
23
|
-
return to;
|
|
24
|
-
};
|
|
25
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
26
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
27
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
28
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
29
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
30
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
31
|
-
mod
|
|
32
|
-
));
|
|
33
|
-
|
|
34
|
-
// ../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js
|
|
35
|
-
var require_picocolors = __commonJS({
|
|
36
|
-
"../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js"(exports, module) {
|
|
37
|
-
"use strict";
|
|
38
|
-
var p = process || {};
|
|
39
|
-
var argv = p.argv || [];
|
|
40
|
-
var env = p.env || {};
|
|
41
|
-
var isColorSupported = !(!!env.NO_COLOR || argv.includes("--no-color")) && (!!env.FORCE_COLOR || argv.includes("--color") || p.platform === "win32" || (p.stdout || {}).isTTY && env.TERM !== "dumb" || !!env.CI);
|
|
42
|
-
var formatter = (open, close, replace = open) => (input) => {
|
|
43
|
-
let string = "" + input, index = string.indexOf(close, open.length);
|
|
44
|
-
return ~index ? open + replaceClose(string, close, replace, index) + close : open + string + close;
|
|
45
|
-
};
|
|
46
|
-
var replaceClose = (string, close, replace, index) => {
|
|
47
|
-
let result = "", cursor = 0;
|
|
48
|
-
do {
|
|
49
|
-
result += string.substring(cursor, index) + replace;
|
|
50
|
-
cursor = index + close.length;
|
|
51
|
-
index = string.indexOf(close, cursor);
|
|
52
|
-
} while (~index);
|
|
53
|
-
return result + string.substring(cursor);
|
|
54
|
-
};
|
|
55
|
-
var createColors = (enabled = isColorSupported) => {
|
|
56
|
-
let f = enabled ? formatter : () => String;
|
|
57
|
-
return {
|
|
58
|
-
isColorSupported: enabled,
|
|
59
|
-
reset: f("\x1B[0m", "\x1B[0m"),
|
|
60
|
-
bold: f("\x1B[1m", "\x1B[22m", "\x1B[22m\x1B[1m"),
|
|
61
|
-
dim: f("\x1B[2m", "\x1B[22m", "\x1B[22m\x1B[2m"),
|
|
62
|
-
italic: f("\x1B[3m", "\x1B[23m"),
|
|
63
|
-
underline: f("\x1B[4m", "\x1B[24m"),
|
|
64
|
-
inverse: f("\x1B[7m", "\x1B[27m"),
|
|
65
|
-
hidden: f("\x1B[8m", "\x1B[28m"),
|
|
66
|
-
strikethrough: f("\x1B[9m", "\x1B[29m"),
|
|
67
|
-
black: f("\x1B[30m", "\x1B[39m"),
|
|
68
|
-
red: f("\x1B[31m", "\x1B[39m"),
|
|
69
|
-
green: f("\x1B[32m", "\x1B[39m"),
|
|
70
|
-
yellow: f("\x1B[33m", "\x1B[39m"),
|
|
71
|
-
blue: f("\x1B[34m", "\x1B[39m"),
|
|
72
|
-
magenta: f("\x1B[35m", "\x1B[39m"),
|
|
73
|
-
cyan: f("\x1B[36m", "\x1B[39m"),
|
|
74
|
-
white: f("\x1B[37m", "\x1B[39m"),
|
|
75
|
-
gray: f("\x1B[90m", "\x1B[39m"),
|
|
76
|
-
bgBlack: f("\x1B[40m", "\x1B[49m"),
|
|
77
|
-
bgRed: f("\x1B[41m", "\x1B[49m"),
|
|
78
|
-
bgGreen: f("\x1B[42m", "\x1B[49m"),
|
|
79
|
-
bgYellow: f("\x1B[43m", "\x1B[49m"),
|
|
80
|
-
bgBlue: f("\x1B[44m", "\x1B[49m"),
|
|
81
|
-
bgMagenta: f("\x1B[45m", "\x1B[49m"),
|
|
82
|
-
bgCyan: f("\x1B[46m", "\x1B[49m"),
|
|
83
|
-
bgWhite: f("\x1B[47m", "\x1B[49m"),
|
|
84
|
-
blackBright: f("\x1B[90m", "\x1B[39m"),
|
|
85
|
-
redBright: f("\x1B[91m", "\x1B[39m"),
|
|
86
|
-
greenBright: f("\x1B[92m", "\x1B[39m"),
|
|
87
|
-
yellowBright: f("\x1B[93m", "\x1B[39m"),
|
|
88
|
-
blueBright: f("\x1B[94m", "\x1B[39m"),
|
|
89
|
-
magentaBright: f("\x1B[95m", "\x1B[39m"),
|
|
90
|
-
cyanBright: f("\x1B[96m", "\x1B[39m"),
|
|
91
|
-
whiteBright: f("\x1B[97m", "\x1B[39m"),
|
|
92
|
-
bgBlackBright: f("\x1B[100m", "\x1B[49m"),
|
|
93
|
-
bgRedBright: f("\x1B[101m", "\x1B[49m"),
|
|
94
|
-
bgGreenBright: f("\x1B[102m", "\x1B[49m"),
|
|
95
|
-
bgYellowBright: f("\x1B[103m", "\x1B[49m"),
|
|
96
|
-
bgBlueBright: f("\x1B[104m", "\x1B[49m"),
|
|
97
|
-
bgMagentaBright: f("\x1B[105m", "\x1B[49m"),
|
|
98
|
-
bgCyanBright: f("\x1B[106m", "\x1B[49m"),
|
|
99
|
-
bgWhiteBright: f("\x1B[107m", "\x1B[49m")
|
|
100
|
-
};
|
|
101
|
-
};
|
|
102
|
-
module.exports = createColors();
|
|
103
|
-
module.exports.createColors = createColors;
|
|
104
|
-
}
|
|
105
|
-
});
|
|
106
|
-
|
|
107
|
-
// ../../node_modules/.pnpm/cac@6.7.14/node_modules/cac/dist/index.mjs
|
|
108
|
-
import { EventEmitter } from "events";
|
|
109
|
-
function toArr(any) {
|
|
110
|
-
return any == null ? [] : Array.isArray(any) ? any : [any];
|
|
111
|
-
}
|
|
112
|
-
function toVal(out, key, val, opts) {
|
|
113
|
-
var x, old = out[key], nxt = !!~opts.string.indexOf(key) ? val == null || val === true ? "" : String(val) : typeof val === "boolean" ? val : !!~opts.boolean.indexOf(key) ? val === "false" ? false : val === "true" || (out._.push((x = +val, x * 0 === 0) ? x : val), !!val) : (x = +val, x * 0 === 0) ? x : val;
|
|
114
|
-
out[key] = old == null ? nxt : Array.isArray(old) ? old.concat(nxt) : [old, nxt];
|
|
115
|
-
}
|
|
116
|
-
function mri2(args, opts) {
|
|
117
|
-
args = args || [];
|
|
118
|
-
opts = opts || {};
|
|
119
|
-
var k, arr, arg, name, val, out = { _: [] };
|
|
120
|
-
var i = 0, j = 0, idx = 0, len = args.length;
|
|
121
|
-
const alibi = opts.alias !== void 0;
|
|
122
|
-
const strict = opts.unknown !== void 0;
|
|
123
|
-
const defaults = opts.default !== void 0;
|
|
124
|
-
opts.alias = opts.alias || {};
|
|
125
|
-
opts.string = toArr(opts.string);
|
|
126
|
-
opts.boolean = toArr(opts.boolean);
|
|
127
|
-
if (alibi) {
|
|
128
|
-
for (k in opts.alias) {
|
|
129
|
-
arr = opts.alias[k] = toArr(opts.alias[k]);
|
|
130
|
-
for (i = 0; i < arr.length; i++) {
|
|
131
|
-
(opts.alias[arr[i]] = arr.concat(k)).splice(i, 1);
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
for (i = opts.boolean.length; i-- > 0; ) {
|
|
136
|
-
arr = opts.alias[opts.boolean[i]] || [];
|
|
137
|
-
for (j = arr.length; j-- > 0; ) opts.boolean.push(arr[j]);
|
|
138
|
-
}
|
|
139
|
-
for (i = opts.string.length; i-- > 0; ) {
|
|
140
|
-
arr = opts.alias[opts.string[i]] || [];
|
|
141
|
-
for (j = arr.length; j-- > 0; ) opts.string.push(arr[j]);
|
|
142
|
-
}
|
|
143
|
-
if (defaults) {
|
|
144
|
-
for (k in opts.default) {
|
|
145
|
-
name = typeof opts.default[k];
|
|
146
|
-
arr = opts.alias[k] = opts.alias[k] || [];
|
|
147
|
-
if (opts[name] !== void 0) {
|
|
148
|
-
opts[name].push(k);
|
|
149
|
-
for (i = 0; i < arr.length; i++) {
|
|
150
|
-
opts[name].push(arr[i]);
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
const keys = strict ? Object.keys(opts.alias) : [];
|
|
156
|
-
for (i = 0; i < len; i++) {
|
|
157
|
-
arg = args[i];
|
|
158
|
-
if (arg === "--") {
|
|
159
|
-
out._ = out._.concat(args.slice(++i));
|
|
160
|
-
break;
|
|
161
|
-
}
|
|
162
|
-
for (j = 0; j < arg.length; j++) {
|
|
163
|
-
if (arg.charCodeAt(j) !== 45) break;
|
|
164
|
-
}
|
|
165
|
-
if (j === 0) {
|
|
166
|
-
out._.push(arg);
|
|
167
|
-
} else if (arg.substring(j, j + 3) === "no-") {
|
|
168
|
-
name = arg.substring(j + 3);
|
|
169
|
-
if (strict && !~keys.indexOf(name)) {
|
|
170
|
-
return opts.unknown(arg);
|
|
171
|
-
}
|
|
172
|
-
out[name] = false;
|
|
173
|
-
} else {
|
|
174
|
-
for (idx = j + 1; idx < arg.length; idx++) {
|
|
175
|
-
if (arg.charCodeAt(idx) === 61) break;
|
|
176
|
-
}
|
|
177
|
-
name = arg.substring(j, idx);
|
|
178
|
-
val = arg.substring(++idx) || (i + 1 === len || ("" + args[i + 1]).charCodeAt(0) === 45 || args[++i]);
|
|
179
|
-
arr = j === 2 ? [name] : name;
|
|
180
|
-
for (idx = 0; idx < arr.length; idx++) {
|
|
181
|
-
name = arr[idx];
|
|
182
|
-
if (strict && !~keys.indexOf(name)) return opts.unknown("-".repeat(j) + name);
|
|
183
|
-
toVal(out, name, idx + 1 < arr.length || val, opts);
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
if (defaults) {
|
|
188
|
-
for (k in opts.default) {
|
|
189
|
-
if (out[k] === void 0) {
|
|
190
|
-
out[k] = opts.default[k];
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
if (alibi) {
|
|
195
|
-
for (k in out) {
|
|
196
|
-
arr = opts.alias[k] || [];
|
|
197
|
-
while (arr.length > 0) {
|
|
198
|
-
out[arr.shift()] = out[k];
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
-
return out;
|
|
203
|
-
}
|
|
204
|
-
var removeBrackets = (v) => v.replace(/[<[].+/, "").trim();
|
|
205
|
-
var findAllBrackets = (v) => {
|
|
206
|
-
const ANGLED_BRACKET_RE_GLOBAL = /<([^>]+)>/g;
|
|
207
|
-
const SQUARE_BRACKET_RE_GLOBAL = /\[([^\]]+)\]/g;
|
|
208
|
-
const res = [];
|
|
209
|
-
const parse = (match) => {
|
|
210
|
-
let variadic = false;
|
|
211
|
-
let value = match[1];
|
|
212
|
-
if (value.startsWith("...")) {
|
|
213
|
-
value = value.slice(3);
|
|
214
|
-
variadic = true;
|
|
215
|
-
}
|
|
216
|
-
return {
|
|
217
|
-
required: match[0].startsWith("<"),
|
|
218
|
-
value,
|
|
219
|
-
variadic
|
|
220
|
-
};
|
|
221
|
-
};
|
|
222
|
-
let angledMatch;
|
|
223
|
-
while (angledMatch = ANGLED_BRACKET_RE_GLOBAL.exec(v)) {
|
|
224
|
-
res.push(parse(angledMatch));
|
|
225
|
-
}
|
|
226
|
-
let squareMatch;
|
|
227
|
-
while (squareMatch = SQUARE_BRACKET_RE_GLOBAL.exec(v)) {
|
|
228
|
-
res.push(parse(squareMatch));
|
|
229
|
-
}
|
|
230
|
-
return res;
|
|
231
|
-
};
|
|
232
|
-
var getMriOptions = (options) => {
|
|
233
|
-
const result = { alias: {}, boolean: [] };
|
|
234
|
-
for (const [index, option] of options.entries()) {
|
|
235
|
-
if (option.names.length > 1) {
|
|
236
|
-
result.alias[option.names[0]] = option.names.slice(1);
|
|
237
|
-
}
|
|
238
|
-
if (option.isBoolean) {
|
|
239
|
-
if (option.negated) {
|
|
240
|
-
const hasStringTypeOption = options.some((o, i) => {
|
|
241
|
-
return i !== index && o.names.some((name) => option.names.includes(name)) && typeof o.required === "boolean";
|
|
242
|
-
});
|
|
243
|
-
if (!hasStringTypeOption) {
|
|
244
|
-
result.boolean.push(option.names[0]);
|
|
245
|
-
}
|
|
246
|
-
} else {
|
|
247
|
-
result.boolean.push(option.names[0]);
|
|
248
|
-
}
|
|
249
|
-
}
|
|
250
|
-
}
|
|
251
|
-
return result;
|
|
252
|
-
};
|
|
253
|
-
var findLongest = (arr) => {
|
|
254
|
-
return arr.sort((a, b) => {
|
|
255
|
-
return a.length > b.length ? -1 : 1;
|
|
256
|
-
})[0];
|
|
257
|
-
};
|
|
258
|
-
var padRight = (str, length) => {
|
|
259
|
-
return str.length >= length ? str : `${str}${" ".repeat(length - str.length)}`;
|
|
260
|
-
};
|
|
261
|
-
var camelcase = (input) => {
|
|
262
|
-
return input.replace(/([a-z])-([a-z])/g, (_, p1, p2) => {
|
|
263
|
-
return p1 + p2.toUpperCase();
|
|
264
|
-
});
|
|
265
|
-
};
|
|
266
|
-
var setDotProp = (obj, keys, val) => {
|
|
267
|
-
let i = 0;
|
|
268
|
-
let length = keys.length;
|
|
269
|
-
let t = obj;
|
|
270
|
-
let x;
|
|
271
|
-
for (; i < length; ++i) {
|
|
272
|
-
x = t[keys[i]];
|
|
273
|
-
t = t[keys[i]] = i === length - 1 ? val : x != null ? x : !!~keys[i + 1].indexOf(".") || !(+keys[i + 1] > -1) ? {} : [];
|
|
274
|
-
}
|
|
275
|
-
};
|
|
276
|
-
var setByType = (obj, transforms) => {
|
|
277
|
-
for (const key of Object.keys(transforms)) {
|
|
278
|
-
const transform = transforms[key];
|
|
279
|
-
if (transform.shouldTransform) {
|
|
280
|
-
obj[key] = Array.prototype.concat.call([], obj[key]);
|
|
281
|
-
if (typeof transform.transformFunction === "function") {
|
|
282
|
-
obj[key] = obj[key].map(transform.transformFunction);
|
|
283
|
-
}
|
|
284
|
-
}
|
|
285
|
-
}
|
|
286
|
-
};
|
|
287
|
-
var getFileName = (input) => {
|
|
288
|
-
const m = /([^\\\/]+)$/.exec(input);
|
|
289
|
-
return m ? m[1] : "";
|
|
290
|
-
};
|
|
291
|
-
var camelcaseOptionName = (name) => {
|
|
292
|
-
return name.split(".").map((v, i) => {
|
|
293
|
-
return i === 0 ? camelcase(v) : v;
|
|
294
|
-
}).join(".");
|
|
295
|
-
};
|
|
296
|
-
var CACError = class extends Error {
|
|
297
|
-
constructor(message) {
|
|
298
|
-
super(message);
|
|
299
|
-
this.name = this.constructor.name;
|
|
300
|
-
if (typeof Error.captureStackTrace === "function") {
|
|
301
|
-
Error.captureStackTrace(this, this.constructor);
|
|
302
|
-
} else {
|
|
303
|
-
this.stack = new Error(message).stack;
|
|
304
|
-
}
|
|
305
|
-
}
|
|
306
|
-
};
|
|
307
|
-
var Option = class {
|
|
308
|
-
constructor(rawName, description, config) {
|
|
309
|
-
this.rawName = rawName;
|
|
310
|
-
this.description = description;
|
|
311
|
-
this.config = Object.assign({}, config);
|
|
312
|
-
rawName = rawName.replace(/\.\*/g, "");
|
|
313
|
-
this.negated = false;
|
|
314
|
-
this.names = removeBrackets(rawName).split(",").map((v) => {
|
|
315
|
-
let name = v.trim().replace(/^-{1,2}/, "");
|
|
316
|
-
if (name.startsWith("no-")) {
|
|
317
|
-
this.negated = true;
|
|
318
|
-
name = name.replace(/^no-/, "");
|
|
319
|
-
}
|
|
320
|
-
return camelcaseOptionName(name);
|
|
321
|
-
}).sort((a, b) => a.length > b.length ? 1 : -1);
|
|
322
|
-
this.name = this.names[this.names.length - 1];
|
|
323
|
-
if (this.negated && this.config.default == null) {
|
|
324
|
-
this.config.default = true;
|
|
325
|
-
}
|
|
326
|
-
if (rawName.includes("<")) {
|
|
327
|
-
this.required = true;
|
|
328
|
-
} else if (rawName.includes("[")) {
|
|
329
|
-
this.required = false;
|
|
330
|
-
} else {
|
|
331
|
-
this.isBoolean = true;
|
|
332
|
-
}
|
|
333
|
-
}
|
|
334
|
-
};
|
|
335
|
-
var processArgs = process.argv;
|
|
336
|
-
var platformInfo = `${process.platform}-${process.arch} node-${process.version}`;
|
|
337
|
-
var Command = class {
|
|
338
|
-
constructor(rawName, description, config = {}, cli2) {
|
|
339
|
-
this.rawName = rawName;
|
|
340
|
-
this.description = description;
|
|
341
|
-
this.config = config;
|
|
342
|
-
this.cli = cli2;
|
|
343
|
-
this.options = [];
|
|
344
|
-
this.aliasNames = [];
|
|
345
|
-
this.name = removeBrackets(rawName);
|
|
346
|
-
this.args = findAllBrackets(rawName);
|
|
347
|
-
this.examples = [];
|
|
348
|
-
}
|
|
349
|
-
usage(text) {
|
|
350
|
-
this.usageText = text;
|
|
351
|
-
return this;
|
|
352
|
-
}
|
|
353
|
-
allowUnknownOptions() {
|
|
354
|
-
this.config.allowUnknownOptions = true;
|
|
355
|
-
return this;
|
|
356
|
-
}
|
|
357
|
-
ignoreOptionDefaultValue() {
|
|
358
|
-
this.config.ignoreOptionDefaultValue = true;
|
|
359
|
-
return this;
|
|
360
|
-
}
|
|
361
|
-
version(version, customFlags = "-v, --version") {
|
|
362
|
-
this.versionNumber = version;
|
|
363
|
-
this.option(customFlags, "Display version number");
|
|
364
|
-
return this;
|
|
365
|
-
}
|
|
366
|
-
example(example) {
|
|
367
|
-
this.examples.push(example);
|
|
368
|
-
return this;
|
|
369
|
-
}
|
|
370
|
-
option(rawName, description, config) {
|
|
371
|
-
const option = new Option(rawName, description, config);
|
|
372
|
-
this.options.push(option);
|
|
373
|
-
return this;
|
|
374
|
-
}
|
|
375
|
-
alias(name) {
|
|
376
|
-
this.aliasNames.push(name);
|
|
377
|
-
return this;
|
|
378
|
-
}
|
|
379
|
-
action(callback) {
|
|
380
|
-
this.commandAction = callback;
|
|
381
|
-
return this;
|
|
382
|
-
}
|
|
383
|
-
isMatched(name) {
|
|
384
|
-
return this.name === name || this.aliasNames.includes(name);
|
|
385
|
-
}
|
|
386
|
-
get isDefaultCommand() {
|
|
387
|
-
return this.name === "" || this.aliasNames.includes("!");
|
|
388
|
-
}
|
|
389
|
-
get isGlobalCommand() {
|
|
390
|
-
return this instanceof GlobalCommand;
|
|
391
|
-
}
|
|
392
|
-
hasOption(name) {
|
|
393
|
-
name = name.split(".")[0];
|
|
394
|
-
return this.options.find((option) => {
|
|
395
|
-
return option.names.includes(name);
|
|
396
|
-
});
|
|
397
|
-
}
|
|
398
|
-
outputHelp() {
|
|
399
|
-
const { name, commands } = this.cli;
|
|
400
|
-
const {
|
|
401
|
-
versionNumber,
|
|
402
|
-
options: globalOptions,
|
|
403
|
-
helpCallback
|
|
404
|
-
} = this.cli.globalCommand;
|
|
405
|
-
let sections = [
|
|
406
|
-
{
|
|
407
|
-
body: `${name}${versionNumber ? `/${versionNumber}` : ""}`
|
|
408
|
-
}
|
|
409
|
-
];
|
|
410
|
-
sections.push({
|
|
411
|
-
title: "Usage",
|
|
412
|
-
body: ` $ ${name} ${this.usageText || this.rawName}`
|
|
413
|
-
});
|
|
414
|
-
const showCommands = (this.isGlobalCommand || this.isDefaultCommand) && commands.length > 0;
|
|
415
|
-
if (showCommands) {
|
|
416
|
-
const longestCommandName = findLongest(commands.map((command) => command.rawName));
|
|
417
|
-
sections.push({
|
|
418
|
-
title: "Commands",
|
|
419
|
-
body: commands.map((command) => {
|
|
420
|
-
return ` ${padRight(command.rawName, longestCommandName.length)} ${command.description}`;
|
|
421
|
-
}).join("\n")
|
|
422
|
-
});
|
|
423
|
-
sections.push({
|
|
424
|
-
title: `For more info, run any command with the \`--help\` flag`,
|
|
425
|
-
body: commands.map((command) => ` $ ${name}${command.name === "" ? "" : ` ${command.name}`} --help`).join("\n")
|
|
426
|
-
});
|
|
427
|
-
}
|
|
428
|
-
let options = this.isGlobalCommand ? globalOptions : [...this.options, ...globalOptions || []];
|
|
429
|
-
if (!this.isGlobalCommand && !this.isDefaultCommand) {
|
|
430
|
-
options = options.filter((option) => option.name !== "version");
|
|
431
|
-
}
|
|
432
|
-
if (options.length > 0) {
|
|
433
|
-
const longestOptionName = findLongest(options.map((option) => option.rawName));
|
|
434
|
-
sections.push({
|
|
435
|
-
title: "Options",
|
|
436
|
-
body: options.map((option) => {
|
|
437
|
-
return ` ${padRight(option.rawName, longestOptionName.length)} ${option.description} ${option.config.default === void 0 ? "" : `(default: ${option.config.default})`}`;
|
|
438
|
-
}).join("\n")
|
|
439
|
-
});
|
|
440
|
-
}
|
|
441
|
-
if (this.examples.length > 0) {
|
|
442
|
-
sections.push({
|
|
443
|
-
title: "Examples",
|
|
444
|
-
body: this.examples.map((example) => {
|
|
445
|
-
if (typeof example === "function") {
|
|
446
|
-
return example(name);
|
|
447
|
-
}
|
|
448
|
-
return example;
|
|
449
|
-
}).join("\n")
|
|
450
|
-
});
|
|
451
|
-
}
|
|
452
|
-
if (helpCallback) {
|
|
453
|
-
sections = helpCallback(sections) || sections;
|
|
454
|
-
}
|
|
455
|
-
console.log(sections.map((section) => {
|
|
456
|
-
return section.title ? `${section.title}:
|
|
457
|
-
${section.body}` : section.body;
|
|
458
|
-
}).join("\n\n"));
|
|
459
|
-
}
|
|
460
|
-
outputVersion() {
|
|
461
|
-
const { name } = this.cli;
|
|
462
|
-
const { versionNumber } = this.cli.globalCommand;
|
|
463
|
-
if (versionNumber) {
|
|
464
|
-
console.log(`${name}/${versionNumber} ${platformInfo}`);
|
|
465
|
-
}
|
|
466
|
-
}
|
|
467
|
-
checkRequiredArgs() {
|
|
468
|
-
const minimalArgsCount = this.args.filter((arg) => arg.required).length;
|
|
469
|
-
if (this.cli.args.length < minimalArgsCount) {
|
|
470
|
-
throw new CACError(`missing required args for command \`${this.rawName}\``);
|
|
471
|
-
}
|
|
472
|
-
}
|
|
473
|
-
checkUnknownOptions() {
|
|
474
|
-
const { options, globalCommand } = this.cli;
|
|
475
|
-
if (!this.config.allowUnknownOptions) {
|
|
476
|
-
for (const name of Object.keys(options)) {
|
|
477
|
-
if (name !== "--" && !this.hasOption(name) && !globalCommand.hasOption(name)) {
|
|
478
|
-
throw new CACError(`Unknown option \`${name.length > 1 ? `--${name}` : `-${name}`}\``);
|
|
479
|
-
}
|
|
480
|
-
}
|
|
481
|
-
}
|
|
482
|
-
}
|
|
483
|
-
checkOptionValue() {
|
|
484
|
-
const { options: parsedOptions, globalCommand } = this.cli;
|
|
485
|
-
const options = [...globalCommand.options, ...this.options];
|
|
486
|
-
for (const option of options) {
|
|
487
|
-
const value = parsedOptions[option.name.split(".")[0]];
|
|
488
|
-
if (option.required) {
|
|
489
|
-
const hasNegated = options.some((o) => o.negated && o.names.includes(option.name));
|
|
490
|
-
if (value === true || value === false && !hasNegated) {
|
|
491
|
-
throw new CACError(`option \`${option.rawName}\` value is missing`);
|
|
492
|
-
}
|
|
493
|
-
}
|
|
494
|
-
}
|
|
495
|
-
}
|
|
496
|
-
};
|
|
497
|
-
var GlobalCommand = class extends Command {
|
|
498
|
-
constructor(cli2) {
|
|
499
|
-
super("@@global@@", "", {}, cli2);
|
|
500
|
-
}
|
|
501
|
-
};
|
|
502
|
-
var __assign = Object.assign;
|
|
503
|
-
var CAC = class extends EventEmitter {
|
|
504
|
-
constructor(name = "") {
|
|
505
|
-
super();
|
|
506
|
-
this.name = name;
|
|
507
|
-
this.commands = [];
|
|
508
|
-
this.rawArgs = [];
|
|
509
|
-
this.args = [];
|
|
510
|
-
this.options = {};
|
|
511
|
-
this.globalCommand = new GlobalCommand(this);
|
|
512
|
-
this.globalCommand.usage("<command> [options]");
|
|
513
|
-
}
|
|
514
|
-
usage(text) {
|
|
515
|
-
this.globalCommand.usage(text);
|
|
516
|
-
return this;
|
|
517
|
-
}
|
|
518
|
-
command(rawName, description, config) {
|
|
519
|
-
const command = new Command(rawName, description || "", config, this);
|
|
520
|
-
command.globalCommand = this.globalCommand;
|
|
521
|
-
this.commands.push(command);
|
|
522
|
-
return command;
|
|
523
|
-
}
|
|
524
|
-
option(rawName, description, config) {
|
|
525
|
-
this.globalCommand.option(rawName, description, config);
|
|
526
|
-
return this;
|
|
527
|
-
}
|
|
528
|
-
help(callback) {
|
|
529
|
-
this.globalCommand.option("-h, --help", "Display this message");
|
|
530
|
-
this.globalCommand.helpCallback = callback;
|
|
531
|
-
this.showHelpOnExit = true;
|
|
532
|
-
return this;
|
|
533
|
-
}
|
|
534
|
-
version(version, customFlags = "-v, --version") {
|
|
535
|
-
this.globalCommand.version(version, customFlags);
|
|
536
|
-
this.showVersionOnExit = true;
|
|
537
|
-
return this;
|
|
538
|
-
}
|
|
539
|
-
example(example) {
|
|
540
|
-
this.globalCommand.example(example);
|
|
541
|
-
return this;
|
|
542
|
-
}
|
|
543
|
-
outputHelp() {
|
|
544
|
-
if (this.matchedCommand) {
|
|
545
|
-
this.matchedCommand.outputHelp();
|
|
546
|
-
} else {
|
|
547
|
-
this.globalCommand.outputHelp();
|
|
548
|
-
}
|
|
549
|
-
}
|
|
550
|
-
outputVersion() {
|
|
551
|
-
this.globalCommand.outputVersion();
|
|
552
|
-
}
|
|
553
|
-
setParsedInfo({ args, options }, matchedCommand, matchedCommandName) {
|
|
554
|
-
this.args = args;
|
|
555
|
-
this.options = options;
|
|
556
|
-
if (matchedCommand) {
|
|
557
|
-
this.matchedCommand = matchedCommand;
|
|
558
|
-
}
|
|
559
|
-
if (matchedCommandName) {
|
|
560
|
-
this.matchedCommandName = matchedCommandName;
|
|
561
|
-
}
|
|
562
|
-
return this;
|
|
563
|
-
}
|
|
564
|
-
unsetMatchedCommand() {
|
|
565
|
-
this.matchedCommand = void 0;
|
|
566
|
-
this.matchedCommandName = void 0;
|
|
567
|
-
}
|
|
568
|
-
parse(argv = processArgs, {
|
|
569
|
-
run: run2 = true
|
|
570
|
-
} = {}) {
|
|
571
|
-
this.rawArgs = argv;
|
|
572
|
-
if (!this.name) {
|
|
573
|
-
this.name = argv[1] ? getFileName(argv[1]) : "cli";
|
|
574
|
-
}
|
|
575
|
-
let shouldParse = true;
|
|
576
|
-
for (const command of this.commands) {
|
|
577
|
-
const parsed = this.mri(argv.slice(2), command);
|
|
578
|
-
const commandName = parsed.args[0];
|
|
579
|
-
if (command.isMatched(commandName)) {
|
|
580
|
-
shouldParse = false;
|
|
581
|
-
const parsedInfo = __assign(__assign({}, parsed), {
|
|
582
|
-
args: parsed.args.slice(1)
|
|
583
|
-
});
|
|
584
|
-
this.setParsedInfo(parsedInfo, command, commandName);
|
|
585
|
-
this.emit(`command:${commandName}`, command);
|
|
586
|
-
}
|
|
587
|
-
}
|
|
588
|
-
if (shouldParse) {
|
|
589
|
-
for (const command of this.commands) {
|
|
590
|
-
if (command.name === "") {
|
|
591
|
-
shouldParse = false;
|
|
592
|
-
const parsed = this.mri(argv.slice(2), command);
|
|
593
|
-
this.setParsedInfo(parsed, command);
|
|
594
|
-
this.emit(`command:!`, command);
|
|
595
|
-
}
|
|
596
|
-
}
|
|
597
|
-
}
|
|
598
|
-
if (shouldParse) {
|
|
599
|
-
const parsed = this.mri(argv.slice(2));
|
|
600
|
-
this.setParsedInfo(parsed);
|
|
601
|
-
}
|
|
602
|
-
if (this.options.help && this.showHelpOnExit) {
|
|
603
|
-
this.outputHelp();
|
|
604
|
-
run2 = false;
|
|
605
|
-
this.unsetMatchedCommand();
|
|
606
|
-
}
|
|
607
|
-
if (this.options.version && this.showVersionOnExit && this.matchedCommandName == null) {
|
|
608
|
-
this.outputVersion();
|
|
609
|
-
run2 = false;
|
|
610
|
-
this.unsetMatchedCommand();
|
|
611
|
-
}
|
|
612
|
-
const parsedArgv = { args: this.args, options: this.options };
|
|
613
|
-
if (run2) {
|
|
614
|
-
this.runMatchedCommand();
|
|
615
|
-
}
|
|
616
|
-
if (!this.matchedCommand && this.args[0]) {
|
|
617
|
-
this.emit("command:*");
|
|
618
|
-
}
|
|
619
|
-
return parsedArgv;
|
|
620
|
-
}
|
|
621
|
-
mri(argv, command) {
|
|
622
|
-
const cliOptions = [
|
|
623
|
-
...this.globalCommand.options,
|
|
624
|
-
...command ? command.options : []
|
|
625
|
-
];
|
|
626
|
-
const mriOptions = getMriOptions(cliOptions);
|
|
627
|
-
let argsAfterDoubleDashes = [];
|
|
628
|
-
const doubleDashesIndex = argv.indexOf("--");
|
|
629
|
-
if (doubleDashesIndex > -1) {
|
|
630
|
-
argsAfterDoubleDashes = argv.slice(doubleDashesIndex + 1);
|
|
631
|
-
argv = argv.slice(0, doubleDashesIndex);
|
|
632
|
-
}
|
|
633
|
-
let parsed = mri2(argv, mriOptions);
|
|
634
|
-
parsed = Object.keys(parsed).reduce((res, name) => {
|
|
635
|
-
return __assign(__assign({}, res), {
|
|
636
|
-
[camelcaseOptionName(name)]: parsed[name]
|
|
637
|
-
});
|
|
638
|
-
}, { _: [] });
|
|
639
|
-
const args = parsed._;
|
|
640
|
-
const options = {
|
|
641
|
-
"--": argsAfterDoubleDashes
|
|
642
|
-
};
|
|
643
|
-
const ignoreDefault = command && command.config.ignoreOptionDefaultValue ? command.config.ignoreOptionDefaultValue : this.globalCommand.config.ignoreOptionDefaultValue;
|
|
644
|
-
let transforms = /* @__PURE__ */ Object.create(null);
|
|
645
|
-
for (const cliOption of cliOptions) {
|
|
646
|
-
if (!ignoreDefault && cliOption.config.default !== void 0) {
|
|
647
|
-
for (const name of cliOption.names) {
|
|
648
|
-
options[name] = cliOption.config.default;
|
|
649
|
-
}
|
|
650
|
-
}
|
|
651
|
-
if (Array.isArray(cliOption.config.type)) {
|
|
652
|
-
if (transforms[cliOption.name] === void 0) {
|
|
653
|
-
transforms[cliOption.name] = /* @__PURE__ */ Object.create(null);
|
|
654
|
-
transforms[cliOption.name]["shouldTransform"] = true;
|
|
655
|
-
transforms[cliOption.name]["transformFunction"] = cliOption.config.type[0];
|
|
656
|
-
}
|
|
657
|
-
}
|
|
658
|
-
}
|
|
659
|
-
for (const key of Object.keys(parsed)) {
|
|
660
|
-
if (key !== "_") {
|
|
661
|
-
const keys = key.split(".");
|
|
662
|
-
setDotProp(options, keys, parsed[key]);
|
|
663
|
-
setByType(options, transforms);
|
|
664
|
-
}
|
|
665
|
-
}
|
|
666
|
-
return {
|
|
667
|
-
args,
|
|
668
|
-
options
|
|
669
|
-
};
|
|
670
|
-
}
|
|
671
|
-
runMatchedCommand() {
|
|
672
|
-
const { args, options, matchedCommand: command } = this;
|
|
673
|
-
if (!command || !command.commandAction)
|
|
674
|
-
return;
|
|
675
|
-
command.checkUnknownOptions();
|
|
676
|
-
command.checkOptionValue();
|
|
677
|
-
command.checkRequiredArgs();
|
|
678
|
-
const actionArgs = [];
|
|
679
|
-
command.args.forEach((arg, index) => {
|
|
680
|
-
if (arg.variadic) {
|
|
681
|
-
actionArgs.push(args.slice(index));
|
|
682
|
-
} else {
|
|
683
|
-
actionArgs.push(args[index]);
|
|
684
|
-
}
|
|
685
|
-
});
|
|
686
|
-
actionArgs.push(options);
|
|
687
|
-
return command.commandAction.apply(this, actionArgs);
|
|
688
|
-
}
|
|
689
|
-
};
|
|
690
|
-
var cac = (name = "") => new CAC(name);
|
|
691
8
|
|
|
692
9
|
// src/index.ts
|
|
693
|
-
|
|
10
|
+
import { defineCommand, runMain } from "citty";
|
|
11
|
+
import { consola as consola7 } from "consola";
|
|
694
12
|
|
|
695
13
|
// src/version.ts
|
|
696
14
|
var VERSION = "0.0.1";
|
|
697
15
|
|
|
698
16
|
// src/commands/create.ts
|
|
699
|
-
var import_picocolors = __toESM(require_picocolors(), 1);
|
|
700
17
|
import { existsSync, mkdirSync, readdirSync, readFileSync, writeFileSync, copyFileSync, unlinkSync } from "fs";
|
|
701
18
|
import { join, resolve, dirname } from "path";
|
|
702
19
|
import { execSync } from "child_process";
|
|
703
20
|
import { fileURLToPath } from "url";
|
|
21
|
+
import { consola } from "consola";
|
|
704
22
|
import prompts from "prompts";
|
|
705
23
|
var __dirname = dirname(fileURLToPath(import.meta.url));
|
|
706
24
|
var TEMPLATES_DIR = resolve(__dirname, "../../templates");
|
|
@@ -717,12 +35,13 @@ var UI_FRAMEWORKS = [
|
|
|
717
35
|
];
|
|
718
36
|
var BUNDLERS = [
|
|
719
37
|
{ title: "Vite", value: "vite", description: "Next Gen Frontend Tooling (recommended)" },
|
|
38
|
+
{ title: "FlightPack", value: "flightpack", description: "Native Rust bundler for maximum performance" },
|
|
720
39
|
{ title: "esbuild", value: "esbuild", description: "Ultra-fast builds for performance-focused projects" },
|
|
721
40
|
{ title: "Rolldown", value: "rolldown", description: "Rust-based Rollup replacement (experimental)" }
|
|
722
41
|
];
|
|
723
42
|
async function createCommand(name, options) {
|
|
724
43
|
printLogo();
|
|
725
|
-
|
|
44
|
+
consola.info("Creating a new Flight project...\n");
|
|
726
45
|
let projectName = name;
|
|
727
46
|
let uiFramework = options.ui;
|
|
728
47
|
if (!projectName) {
|
|
@@ -740,7 +59,7 @@ async function createCommand(name, options) {
|
|
|
740
59
|
projectName = response.name;
|
|
741
60
|
}
|
|
742
61
|
if (!projectName) {
|
|
743
|
-
|
|
62
|
+
consola.error("Project creation cancelled.");
|
|
744
63
|
return;
|
|
745
64
|
}
|
|
746
65
|
if (options.raw) {
|
|
@@ -769,7 +88,7 @@ async function createCommand(name, options) {
|
|
|
769
88
|
uiFramework = response.ui;
|
|
770
89
|
}
|
|
771
90
|
if (!uiFramework) {
|
|
772
|
-
|
|
91
|
+
consola.error("Project creation cancelled.");
|
|
773
92
|
return;
|
|
774
93
|
}
|
|
775
94
|
let useCase = options.useCase;
|
|
@@ -787,7 +106,7 @@ async function createCommand(name, options) {
|
|
|
787
106
|
bundler = response.bundler;
|
|
788
107
|
}
|
|
789
108
|
if (!bundler) {
|
|
790
|
-
|
|
109
|
+
consola.error("Project creation cancelled.");
|
|
791
110
|
return;
|
|
792
111
|
}
|
|
793
112
|
const projectPath = resolve(process.cwd(), projectName);
|
|
@@ -801,56 +120,56 @@ async function createCommand(name, options) {
|
|
|
801
120
|
initial: false
|
|
802
121
|
});
|
|
803
122
|
if (!response.overwrite) {
|
|
804
|
-
|
|
123
|
+
consola.error("Project creation cancelled.");
|
|
805
124
|
return;
|
|
806
125
|
}
|
|
807
126
|
}
|
|
808
127
|
}
|
|
809
|
-
|
|
128
|
+
consola.log(`
|
|
810
129
|
Creating project in ${projectPath}...
|
|
811
|
-
`)
|
|
130
|
+
`);
|
|
812
131
|
try {
|
|
813
132
|
if (isUseCase && useCase) {
|
|
814
133
|
copyUseCaseTemplate(projectPath, useCase, projectName);
|
|
815
134
|
} else {
|
|
816
135
|
copyTemplate(projectPath, uiFramework, bundler, projectName);
|
|
817
136
|
}
|
|
818
|
-
|
|
137
|
+
consola.success("Project structure created");
|
|
819
138
|
if (options.git) {
|
|
820
139
|
try {
|
|
821
140
|
execSync("git init", { cwd: projectPath, stdio: "ignore" });
|
|
822
|
-
|
|
141
|
+
consola.success("Git repository initialized");
|
|
823
142
|
} catch {
|
|
824
|
-
|
|
143
|
+
consola.warn("Could not initialize git repository");
|
|
825
144
|
}
|
|
826
145
|
}
|
|
827
146
|
if (options.install) {
|
|
828
|
-
|
|
147
|
+
consola.log("\nInstalling dependencies...\n");
|
|
829
148
|
try {
|
|
830
149
|
const pm = detectPackageManager();
|
|
831
150
|
execSync(`${pm} install`, { cwd: projectPath, stdio: "inherit" });
|
|
832
|
-
|
|
151
|
+
consola.success("Dependencies installed");
|
|
833
152
|
} catch {
|
|
834
|
-
|
|
153
|
+
consola.warn("Could not install dependencies. Run `npm install` manually.");
|
|
835
154
|
}
|
|
836
155
|
}
|
|
837
|
-
|
|
838
|
-
|
|
156
|
+
consola.box(`
|
|
157
|
+
Project created successfully!
|
|
839
158
|
|
|
840
|
-
|
|
159
|
+
Next steps:
|
|
841
160
|
|
|
842
|
-
$
|
|
843
|
-
$
|
|
161
|
+
$ cd ${projectName}
|
|
162
|
+
$ ${options.install ? "" : "npm install && "}npm run dev
|
|
844
163
|
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
164
|
+
Your project is 100% yours:
|
|
165
|
+
\u2022 No telemetry
|
|
166
|
+
\u2022 No lock-in
|
|
167
|
+
\u2022 Deploy anywhere
|
|
849
168
|
|
|
850
|
-
|
|
169
|
+
Happy flying!
|
|
851
170
|
`);
|
|
852
171
|
} catch (error) {
|
|
853
|
-
|
|
172
|
+
consola.error("Failed to create project:", error);
|
|
854
173
|
process.exit(1);
|
|
855
174
|
}
|
|
856
175
|
}
|
|
@@ -1032,28 +351,28 @@ if (detectRuntime() === 'node') {
|
|
|
1032
351
|
} catch {
|
|
1033
352
|
}
|
|
1034
353
|
}
|
|
1035
|
-
|
|
1036
|
-
|
|
354
|
+
consola.box(`
|
|
355
|
+
Raw project created!
|
|
1037
356
|
|
|
1038
|
-
|
|
357
|
+
ZERO dependencies. ZERO lock-in. 100% Web Standards.
|
|
1039
358
|
|
|
1040
|
-
|
|
359
|
+
Run with any runtime:
|
|
1041
360
|
|
|
1042
|
-
|
|
361
|
+
# Bun (fastest)
|
|
1043
362
|
bun server.js
|
|
1044
363
|
|
|
1045
|
-
|
|
364
|
+
# Deno
|
|
1046
365
|
deno run --allow-net server.js
|
|
1047
366
|
|
|
1048
|
-
|
|
367
|
+
# Node.js 22+
|
|
1049
368
|
node server.js
|
|
1050
369
|
|
|
1051
|
-
|
|
1052
|
-
flight add http
|
|
1053
|
-
flight add db
|
|
1054
|
-
flight add cache
|
|
370
|
+
Want to add Flight later? Just run:
|
|
371
|
+
flight add http # HTTP server with routing
|
|
372
|
+
flight add db # Database abstraction
|
|
373
|
+
flight add cache # Caching layer
|
|
1055
374
|
|
|
1056
|
-
|
|
375
|
+
Path: ${projectPath}
|
|
1057
376
|
`);
|
|
1058
377
|
}
|
|
1059
378
|
function createEmptyProject(projectPath, projectName, options) {
|
|
@@ -1082,24 +401,24 @@ function createEmptyProject(projectPath, projectName, options) {
|
|
|
1082
401
|
} catch {
|
|
1083
402
|
}
|
|
1084
403
|
}
|
|
1085
|
-
|
|
1086
|
-
|
|
404
|
+
consola.box(`
|
|
405
|
+
Empty project created!
|
|
1087
406
|
|
|
1088
|
-
|
|
407
|
+
Your project is a blank canvas. Add what you need:
|
|
1089
408
|
|
|
1090
|
-
|
|
409
|
+
# HTTP server
|
|
1091
410
|
npm install @flight-framework/http
|
|
1092
411
|
|
|
1093
|
-
|
|
412
|
+
# Database
|
|
1094
413
|
npm install @flight-framework/db
|
|
1095
414
|
|
|
1096
|
-
|
|
415
|
+
# Cache
|
|
1097
416
|
npm install @flight-framework/cache
|
|
1098
417
|
|
|
1099
|
-
|
|
418
|
+
# Authentication
|
|
1100
419
|
npm install @flight-framework/auth
|
|
1101
420
|
|
|
1102
|
-
|
|
421
|
+
Path: ${projectPath}
|
|
1103
422
|
`);
|
|
1104
423
|
}
|
|
1105
424
|
function createMinimalProject(projectPath, projectName, options) {
|
|
@@ -1160,40 +479,40 @@ export default { port, fetch: app.fetch };
|
|
|
1160
479
|
}
|
|
1161
480
|
}
|
|
1162
481
|
if (options.install) {
|
|
1163
|
-
|
|
482
|
+
consola.log("\nInstalling dependencies...\n");
|
|
1164
483
|
try {
|
|
1165
484
|
const pm = detectPackageManager();
|
|
1166
485
|
execSync(`${pm} install`, { cwd: projectPath, stdio: "inherit" });
|
|
1167
486
|
} catch {
|
|
1168
487
|
}
|
|
1169
488
|
}
|
|
1170
|
-
|
|
1171
|
-
|
|
489
|
+
consola.box(`
|
|
490
|
+
Minimal project created!
|
|
1172
491
|
|
|
1173
|
-
|
|
492
|
+
Next steps:
|
|
1174
493
|
|
|
1175
|
-
$
|
|
1176
|
-
$
|
|
494
|
+
$ cd ${projectName}
|
|
495
|
+
$ ${options.install ? "" : "npm install && "}npm run dev
|
|
1177
496
|
|
|
1178
|
-
|
|
497
|
+
Add more features as needed:
|
|
1179
498
|
|
|
1180
|
-
|
|
499
|
+
# File-based routing
|
|
1181
500
|
npm install @flight-framework/core
|
|
1182
501
|
|
|
1183
|
-
|
|
502
|
+
# Database
|
|
1184
503
|
npm install @flight-framework/db pg
|
|
1185
504
|
|
|
1186
|
-
|
|
505
|
+
# Caching
|
|
1187
506
|
npm install @flight-framework/cache
|
|
1188
507
|
|
|
1189
|
-
|
|
508
|
+
Happy flying!
|
|
1190
509
|
`);
|
|
1191
510
|
}
|
|
1192
511
|
|
|
1193
512
|
// src/commands/dev.ts
|
|
1194
|
-
var import_picocolors2 = __toESM(require_picocolors(), 1);
|
|
1195
513
|
import { resolve as resolve3, join as join3 } from "path";
|
|
1196
514
|
import { readFileSync as readFileSync3, existsSync as existsSync3 } from "fs";
|
|
515
|
+
import { consola as consola2 } from "consola";
|
|
1197
516
|
import { loadConfig } from "@flight-framework/core/config";
|
|
1198
517
|
|
|
1199
518
|
// src/generators/typegen.ts
|
|
@@ -1553,7 +872,7 @@ function watchAndGenerate(options) {
|
|
|
1553
872
|
async function devCommand(options) {
|
|
1554
873
|
const startTime = Date.now();
|
|
1555
874
|
printLogo();
|
|
1556
|
-
|
|
875
|
+
consola2.info("Starting Flight development server...\n");
|
|
1557
876
|
try {
|
|
1558
877
|
const root = resolve3(process.cwd());
|
|
1559
878
|
const config = await loadConfig(root);
|
|
@@ -1568,7 +887,7 @@ async function devCommand(options) {
|
|
|
1568
887
|
includeEnv: false,
|
|
1569
888
|
projectRoot: root
|
|
1570
889
|
});
|
|
1571
|
-
|
|
890
|
+
consola2.success(`Route types generated: ${result.routeCount} routes`);
|
|
1572
891
|
const cleanup = watchAndGenerate({
|
|
1573
892
|
routesDir,
|
|
1574
893
|
outputDir,
|
|
@@ -1576,13 +895,13 @@ async function devCommand(options) {
|
|
|
1576
895
|
includeEnv: false,
|
|
1577
896
|
projectRoot: root,
|
|
1578
897
|
onRegenerate: (watchResult) => {
|
|
1579
|
-
|
|
898
|
+
consola2.info(`Route types updated: ${watchResult.routeCount} routes`);
|
|
1580
899
|
}
|
|
1581
900
|
});
|
|
1582
901
|
process.on("SIGINT", () => cleanup());
|
|
1583
902
|
process.on("SIGTERM", () => cleanup());
|
|
1584
903
|
} catch (typeError) {
|
|
1585
|
-
|
|
904
|
+
consola2.warn(`Route type generation skipped: ${typeError}`);
|
|
1586
905
|
}
|
|
1587
906
|
}
|
|
1588
907
|
const port = options.port ? parseInt(options.port, 10) : config.dev.port;
|
|
@@ -1591,59 +910,69 @@ async function devCommand(options) {
|
|
|
1591
910
|
const ssrEnabled = options.ssr ?? config.rendering?.default === "ssr";
|
|
1592
911
|
const entryServerPath = join3(root, "src", "entry-server.tsx");
|
|
1593
912
|
const hasSSREntry = existsSync3(entryServerPath);
|
|
1594
|
-
const
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
}
|
|
1602
|
-
try {
|
|
1603
|
-
await import("@flight-framework/core/file-router");
|
|
1604
|
-
flightRouterAvailable = true;
|
|
1605
|
-
} catch {
|
|
1606
|
-
}
|
|
1607
|
-
const vite = await createViteServer({
|
|
1608
|
-
root,
|
|
1609
|
-
mode: "development",
|
|
1610
|
-
server: {
|
|
1611
|
-
middlewareMode: ssrEnabled && hasSSREntry,
|
|
1612
|
-
port: ssrEnabled && hasSSREntry ? void 0 : port,
|
|
1613
|
-
host: host === true ? "0.0.0.0" : host,
|
|
1614
|
-
open: ssrEnabled && hasSSREntry ? false : open,
|
|
1615
|
-
https: options.https ? {} : void 0
|
|
1616
|
-
},
|
|
1617
|
-
appType: ssrEnabled && hasSSREntry ? "custom" : "spa",
|
|
1618
|
-
plugins: [
|
|
1619
|
-
// Add Flight plugin when @flight-framework/http is available
|
|
1620
|
-
flightHttpAvailable ? flightDevPlugin(root) : null
|
|
1621
|
-
].filter(Boolean)
|
|
1622
|
-
});
|
|
1623
|
-
if (ssrEnabled && hasSSREntry) {
|
|
1624
|
-
await startSSRServer(vite, root, port, host);
|
|
913
|
+
const bundler = config.bundler;
|
|
914
|
+
if (bundler && typeof bundler.createDevServer === "function") {
|
|
915
|
+
consola2.info(`Using bundler: ${bundler.name || bundler.bundler || "custom"}`);
|
|
916
|
+
const devServer = await bundler.createDevServer(config);
|
|
917
|
+
const elapsed = Date.now() - startTime;
|
|
918
|
+
consola2.success(`Flight dev server ready in ${elapsed}ms`);
|
|
919
|
+
devServer.printUrls?.();
|
|
1625
920
|
} else {
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
921
|
+
consola2.info("Using bundler: Vite (default)");
|
|
922
|
+
const { createServer: createViteServer } = await import("vite");
|
|
923
|
+
let flightHttpAvailable = false;
|
|
924
|
+
let flightRouterAvailable = false;
|
|
925
|
+
try {
|
|
926
|
+
await import("@flight-framework/http");
|
|
927
|
+
flightHttpAvailable = true;
|
|
928
|
+
} catch {
|
|
929
|
+
}
|
|
930
|
+
try {
|
|
931
|
+
await import("@flight-framework/core/file-router");
|
|
932
|
+
flightRouterAvailable = true;
|
|
933
|
+
} catch {
|
|
934
|
+
}
|
|
935
|
+
const vite = await createViteServer({
|
|
936
|
+
root,
|
|
937
|
+
mode: "development",
|
|
938
|
+
server: {
|
|
939
|
+
middlewareMode: ssrEnabled && hasSSREntry,
|
|
940
|
+
port: ssrEnabled && hasSSREntry ? void 0 : port,
|
|
941
|
+
host: host === true ? "0.0.0.0" : host,
|
|
942
|
+
open: ssrEnabled && hasSSREntry ? false : open,
|
|
943
|
+
https: options.https ? {} : void 0
|
|
944
|
+
},
|
|
945
|
+
appType: ssrEnabled && hasSSREntry ? "custom" : "spa",
|
|
946
|
+
plugins: [
|
|
947
|
+
// Add Flight plugin when @flight-framework/http is available
|
|
948
|
+
flightHttpAvailable ? flightDevPlugin(root) : null
|
|
949
|
+
].filter(Boolean)
|
|
950
|
+
});
|
|
951
|
+
if (ssrEnabled && hasSSREntry) {
|
|
952
|
+
await startSSRServer(vite, root, port, host);
|
|
953
|
+
} else {
|
|
954
|
+
await vite.listen();
|
|
955
|
+
}
|
|
956
|
+
const elapsed = Date.now() - startTime;
|
|
957
|
+
const isSSR = ssrEnabled && hasSSREntry;
|
|
958
|
+
consola2.success(`Flight dev server ready in ${elapsed}ms`);
|
|
959
|
+
consola2.log(`
|
|
960
|
+
\u279C Local: http://localhost:${port}/`);
|
|
961
|
+
if (host === true || host === "0.0.0.0") {
|
|
962
|
+
consola2.log(` \u279C Network: http://${getNetworkAddress()}:${port}/`);
|
|
963
|
+
}
|
|
964
|
+
consola2.log("");
|
|
965
|
+
consola2.log(` ${isSSR ? "\u2713" : "\u25CB"} SSR ${isSSR ? "enabled (streaming)" : "disabled (CSR mode)"}`);
|
|
966
|
+
consola2.log(` ${flightHttpAvailable ? "\u2713" : "\u25CB"} @flight-framework/http ${flightHttpAvailable ? "enabled" : "not installed"}`);
|
|
967
|
+
consola2.log(` ${flightRouterAvailable ? "\u2713" : "\u25CB"} File-based routing ${flightRouterAvailable ? "enabled" : "not available"}`);
|
|
968
|
+
consola2.log("");
|
|
969
|
+
consola2.log(" press h to show help");
|
|
970
|
+
if (!isSSR) {
|
|
971
|
+
vite.bindCLIShortcuts({ print: true });
|
|
972
|
+
}
|
|
1644
973
|
}
|
|
1645
974
|
} catch (error) {
|
|
1646
|
-
|
|
975
|
+
consola2.error("Failed to start dev server:", error);
|
|
1647
976
|
process.exit(1);
|
|
1648
977
|
}
|
|
1649
978
|
}
|
|
@@ -1664,7 +993,7 @@ async function startSSRServer(vite, root, port, host) {
|
|
|
1664
993
|
moduleLoader
|
|
1665
994
|
// Use Vite's ssrLoadModule
|
|
1666
995
|
});
|
|
1667
|
-
|
|
996
|
+
consola2.success(`Page router loaded: ${pageRouter.routes.filter((r) => r.type === "page").length} pages`);
|
|
1668
997
|
} catch {
|
|
1669
998
|
}
|
|
1670
999
|
const server = createHttpServer(async (req, res) => {
|
|
@@ -1719,7 +1048,7 @@ async function startSSRServer(vite, root, port, host) {
|
|
|
1719
1048
|
}
|
|
1720
1049
|
} catch (e) {
|
|
1721
1050
|
vite.ssrFixStacktrace(e);
|
|
1722
|
-
|
|
1051
|
+
consola2.error("[SSR Error]", e.stack);
|
|
1723
1052
|
if (!res.headersSent) {
|
|
1724
1053
|
res.writeHead(500, { "Content-Type": "text/plain" });
|
|
1725
1054
|
res.end(`SSR Error: ${e.message}
|
|
@@ -1730,7 +1059,7 @@ ${e.stack}`);
|
|
|
1730
1059
|
});
|
|
1731
1060
|
const listenHost = host === true ? "0.0.0.0" : host || "localhost";
|
|
1732
1061
|
server.listen(port, listenHost, () => {
|
|
1733
|
-
|
|
1062
|
+
consola2.success("SSR server listening");
|
|
1734
1063
|
});
|
|
1735
1064
|
}
|
|
1736
1065
|
function flightDevPlugin(root) {
|
|
@@ -1751,7 +1080,7 @@ function flightDevPlugin(root) {
|
|
|
1751
1080
|
const body = await response.text();
|
|
1752
1081
|
res.end(body);
|
|
1753
1082
|
} catch (error) {
|
|
1754
|
-
|
|
1083
|
+
consola2.error("[Flight] Action error:", error);
|
|
1755
1084
|
res.statusCode = 500;
|
|
1756
1085
|
res.end(JSON.stringify({ error: "Internal server error" }));
|
|
1757
1086
|
}
|
|
@@ -1837,9 +1166,9 @@ function getNetworkAddress() {
|
|
|
1837
1166
|
}
|
|
1838
1167
|
|
|
1839
1168
|
// src/commands/build.ts
|
|
1840
|
-
var import_picocolors3 = __toESM(require_picocolors(), 1);
|
|
1841
1169
|
import { resolve as resolve4 } from "path";
|
|
1842
1170
|
import { existsSync as existsSync4 } from "fs";
|
|
1171
|
+
import { consola as consola3 } from "consola";
|
|
1843
1172
|
import { loadConfig as loadConfig2 } from "@flight-framework/core/config";
|
|
1844
1173
|
function findEntryServer(root, srcDir) {
|
|
1845
1174
|
const tsxPath = resolve4(root, srcDir, "entry-server.tsx");
|
|
@@ -1851,111 +1180,138 @@ function findEntryServer(root, srcDir) {
|
|
|
1851
1180
|
async function buildCommand(options) {
|
|
1852
1181
|
const startTime = Date.now();
|
|
1853
1182
|
printLogo();
|
|
1854
|
-
|
|
1183
|
+
consola3.info("Building Flight project for production...\n");
|
|
1855
1184
|
try {
|
|
1856
1185
|
const root = resolve4(process.cwd());
|
|
1857
1186
|
const config = await loadConfig2(root);
|
|
1858
1187
|
const outDir = options.outDir ?? config.build.outDir;
|
|
1859
1188
|
const sourcemap = options.sourcemap ?? config.build.sourcemap;
|
|
1860
1189
|
const minify = options.minify ?? config.build.minify;
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
sourcemap,
|
|
1873
|
-
minify: minify ? "esbuild" : false,
|
|
1874
|
-
rollupOptions: {
|
|
1875
|
-
input: resolve4(root, "index.html")
|
|
1190
|
+
consola3.log(`Output directory: ${outDir}`);
|
|
1191
|
+
consola3.log(`Sourcemaps: ${sourcemap ? "enabled" : "disabled"}`);
|
|
1192
|
+
consola3.log(`Minification: ${minify ? "enabled" : "disabled"}
|
|
1193
|
+
`);
|
|
1194
|
+
const bundler = config.bundler;
|
|
1195
|
+
if (bundler && typeof bundler.build === "function") {
|
|
1196
|
+
consola3.info(`Using bundler: ${bundler.name || bundler.bundler || "custom"}`);
|
|
1197
|
+
const result = await bundler.build(config);
|
|
1198
|
+
if (!result.success) {
|
|
1199
|
+
for (const error of result.errors) {
|
|
1200
|
+
consola3.error(error.message);
|
|
1876
1201
|
}
|
|
1202
|
+
throw new Error("Build failed");
|
|
1877
1203
|
}
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
1204
|
+
const elapsed = Date.now() - startTime;
|
|
1205
|
+
const elapsedSeconds = (elapsed / 1e3).toFixed(2);
|
|
1206
|
+
consola3.success(`Build complete! (${elapsedSeconds}s)`);
|
|
1207
|
+
consola3.log(`
|
|
1208
|
+
Output: ${resolve4(root, outDir)}`);
|
|
1209
|
+
consola3.log(`
|
|
1210
|
+
To preview the build:`);
|
|
1211
|
+
consola3.log(` $ flight preview
|
|
1212
|
+
`);
|
|
1213
|
+
} else {
|
|
1214
|
+
consola3.info("Using bundler: Vite (default)");
|
|
1215
|
+
const { build: build2 } = await import("vite");
|
|
1216
|
+
consola3.info("Building client...");
|
|
1217
|
+
await build2({
|
|
1883
1218
|
root,
|
|
1884
1219
|
mode: "production",
|
|
1885
1220
|
build: {
|
|
1886
|
-
outDir: `${outDir}/
|
|
1221
|
+
outDir: `${outDir}/client`,
|
|
1887
1222
|
sourcemap,
|
|
1888
1223
|
minify: minify ? "esbuild" : false,
|
|
1889
|
-
ssr: true,
|
|
1890
1224
|
rollupOptions: {
|
|
1891
|
-
input:
|
|
1225
|
+
input: resolve4(root, "index.html")
|
|
1892
1226
|
}
|
|
1893
1227
|
}
|
|
1894
1228
|
});
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1229
|
+
consola3.success("Client build complete");
|
|
1230
|
+
if (config.rendering.default !== "csr") {
|
|
1231
|
+
consola3.info("Building server...");
|
|
1232
|
+
await build2({
|
|
1233
|
+
root,
|
|
1234
|
+
mode: "production",
|
|
1235
|
+
build: {
|
|
1236
|
+
outDir: `${outDir}/server`,
|
|
1237
|
+
sourcemap,
|
|
1238
|
+
minify: minify ? "esbuild" : false,
|
|
1239
|
+
ssr: true,
|
|
1240
|
+
rollupOptions: {
|
|
1241
|
+
input: findEntryServer(root, config.build.srcDir)
|
|
1242
|
+
}
|
|
1243
|
+
}
|
|
1244
|
+
});
|
|
1245
|
+
consola3.success("Server build complete");
|
|
1246
|
+
}
|
|
1247
|
+
if (config.adapter) {
|
|
1248
|
+
consola3.info(`Running ${config.adapter.name} adapter...`);
|
|
1249
|
+
consola3.success(`${config.adapter.name} adapter complete`);
|
|
1250
|
+
}
|
|
1251
|
+
const elapsed = Date.now() - startTime;
|
|
1252
|
+
const elapsedSeconds = (elapsed / 1e3).toFixed(2);
|
|
1253
|
+
consola3.success(`Build complete! (${elapsedSeconds}s)`);
|
|
1254
|
+
consola3.log(`
|
|
1255
|
+
Output: ${resolve4(root, outDir)}`);
|
|
1256
|
+
consola3.log(`
|
|
1257
|
+
To preview the build:`);
|
|
1258
|
+
consola3.log(` $ flight preview
|
|
1259
|
+
`);
|
|
1260
|
+
consola3.log(`To deploy:`);
|
|
1261
|
+
consola3.log(` \u2022 Upload ${outDir}/ to your server`);
|
|
1262
|
+
consola3.log(` \u2022 Or use your configured adapter
|
|
1915
1263
|
`);
|
|
1264
|
+
}
|
|
1916
1265
|
} catch (error) {
|
|
1917
|
-
|
|
1266
|
+
consola3.error("Build failed:", error);
|
|
1918
1267
|
process.exit(1);
|
|
1919
1268
|
}
|
|
1920
1269
|
}
|
|
1921
1270
|
|
|
1922
1271
|
// src/commands/preview.ts
|
|
1923
|
-
var import_picocolors4 = __toESM(require_picocolors(), 1);
|
|
1924
1272
|
import { resolve as resolve5 } from "path";
|
|
1273
|
+
import { consola as consola4 } from "consola";
|
|
1925
1274
|
import { loadConfig as loadConfig3 } from "@flight-framework/core/config";
|
|
1926
1275
|
async function previewCommand(options) {
|
|
1927
1276
|
printLogo();
|
|
1928
|
-
|
|
1277
|
+
consola4.info("Starting Flight preview server...\n");
|
|
1929
1278
|
try {
|
|
1930
1279
|
const root = resolve5(process.cwd());
|
|
1931
1280
|
const config = await loadConfig3(root);
|
|
1932
1281
|
const port = options.port ? parseInt(options.port, 10) : config.dev.port + 1;
|
|
1933
1282
|
const host = options.host ?? config.dev.host;
|
|
1934
1283
|
const open = options.open ?? false;
|
|
1935
|
-
const
|
|
1936
|
-
|
|
1937
|
-
|
|
1938
|
-
preview
|
|
1939
|
-
|
|
1940
|
-
|
|
1941
|
-
|
|
1942
|
-
}
|
|
1943
|
-
|
|
1944
|
-
|
|
1284
|
+
const bundler = config.bundler;
|
|
1285
|
+
if (bundler && typeof bundler.preview === "function") {
|
|
1286
|
+
consola4.info(`Using bundler: ${bundler.name || bundler.bundler || "custom"}`);
|
|
1287
|
+
const server = await bundler.preview(config);
|
|
1288
|
+
server.printUrls?.();
|
|
1289
|
+
} else {
|
|
1290
|
+
consola4.info("Using bundler: Vite (default)");
|
|
1291
|
+
const { preview: preview2 } = await import("vite");
|
|
1292
|
+
const server = await preview2({
|
|
1293
|
+
root,
|
|
1294
|
+
preview: {
|
|
1295
|
+
port,
|
|
1296
|
+
host: host === true ? "0.0.0.0" : host,
|
|
1297
|
+
open
|
|
1298
|
+
},
|
|
1299
|
+
build: {
|
|
1300
|
+
outDir: config.build.outDir
|
|
1301
|
+
}
|
|
1302
|
+
});
|
|
1303
|
+
consola4.success("Flight preview server ready");
|
|
1304
|
+
consola4.log(`
|
|
1305
|
+
\u279C Local: http://localhost:${port}/`);
|
|
1306
|
+
if (host === true || host === "0.0.0.0") {
|
|
1307
|
+
consola4.log(` \u279C Network: http://0.0.0.0:${port}/`);
|
|
1945
1308
|
}
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
${import_picocolors4.default.cyan("\u279C")} Local: ${import_picocolors4.default.cyan(`http://localhost:${port}/`)}
|
|
1951
|
-
${host === true || host === "0.0.0.0" ? ` ${import_picocolors4.default.cyan("\u279C")} Network: ${import_picocolors4.default.cyan(`http://0.0.0.0:${port}/`)}` : ""}
|
|
1952
|
-
|
|
1953
|
-
${import_picocolors4.default.dim("This is a preview of your production build.")}
|
|
1954
|
-
${import_picocolors4.default.dim("For development, use")} ${import_picocolors4.default.bold("flight dev")}
|
|
1955
|
-
`);
|
|
1956
|
-
server.printUrls();
|
|
1309
|
+
consola4.log("\n This is a preview of your production build.");
|
|
1310
|
+
consola4.log(" For development, use: flight dev\n");
|
|
1311
|
+
server.printUrls();
|
|
1312
|
+
}
|
|
1957
1313
|
} catch (error) {
|
|
1958
|
-
|
|
1314
|
+
consola4.error("Failed to start preview server:", error);
|
|
1959
1315
|
process.exit(1);
|
|
1960
1316
|
}
|
|
1961
1317
|
}
|
|
@@ -2307,10 +1663,10 @@ async function typesGenerateCommand(options = {}) {
|
|
|
2307
1663
|
}
|
|
2308
1664
|
|
|
2309
1665
|
// src/commands/add.ts
|
|
2310
|
-
var import_picocolors5 = __toESM(require_picocolors(), 1);
|
|
2311
1666
|
import { existsSync as existsSync6 } from "fs";
|
|
2312
1667
|
import { join as join5 } from "path";
|
|
2313
1668
|
import { execSync as execSync2 } from "child_process";
|
|
1669
|
+
import { consola as consola5 } from "consola";
|
|
2314
1670
|
var PACKAGES = {
|
|
2315
1671
|
// Core
|
|
2316
1672
|
"http": {
|
|
@@ -2383,7 +1739,7 @@ var PACKAGES = {
|
|
|
2383
1739
|
async function addCommand(packageName) {
|
|
2384
1740
|
const cwd = process.cwd();
|
|
2385
1741
|
if (!existsSync6(join5(cwd, "package.json"))) {
|
|
2386
|
-
|
|
1742
|
+
consola5.error("No package.json found. Run this command from your project directory.");
|
|
2387
1743
|
process.exit(1);
|
|
2388
1744
|
}
|
|
2389
1745
|
if (!packageName) {
|
|
@@ -2392,24 +1748,21 @@ async function addCommand(packageName) {
|
|
|
2392
1748
|
}
|
|
2393
1749
|
const pkg = PACKAGES[packageName];
|
|
2394
1750
|
if (!pkg) {
|
|
2395
|
-
|
|
2396
|
-
|
|
1751
|
+
consola5.error(`Unknown package: ${packageName}`);
|
|
1752
|
+
consola5.log("Run `flight add` to see available packages.");
|
|
2397
1753
|
process.exit(1);
|
|
2398
1754
|
}
|
|
2399
|
-
|
|
2400
|
-
|
|
2401
|
-
|
|
2402
|
-
console.log();
|
|
1755
|
+
consola5.info(`Adding ${pkg.name}...`);
|
|
1756
|
+
consola5.log(pkg.description);
|
|
1757
|
+
consola5.log("");
|
|
2403
1758
|
const pm = detectPackageManager2();
|
|
2404
1759
|
try {
|
|
2405
1760
|
const installCmd = pm === "npm" ? "npm install" : `${pm} add`;
|
|
2406
1761
|
execSync2(`${installCmd} ${pkg.name}`, { cwd, stdio: "inherit" });
|
|
2407
|
-
|
|
2408
|
-
${import_picocolors5.default.green("[OK]")} ${pkg.name} added successfully!`);
|
|
1762
|
+
consola5.success(`${pkg.name} added successfully!`);
|
|
2409
1763
|
showNextSteps(packageName, pkg);
|
|
2410
1764
|
} catch (error) {
|
|
2411
|
-
|
|
2412
|
-
Failed to install ${pkg.name}`));
|
|
1765
|
+
consola5.error(`Failed to install ${pkg.name}`);
|
|
2413
1766
|
process.exit(1);
|
|
2414
1767
|
}
|
|
2415
1768
|
}
|
|
@@ -2421,34 +1774,34 @@ function detectPackageManager2() {
|
|
|
2421
1774
|
return "npm";
|
|
2422
1775
|
}
|
|
2423
1776
|
function showAvailablePackages() {
|
|
2424
|
-
|
|
2425
|
-
|
|
1777
|
+
consola5.log(`
|
|
1778
|
+
Available Flight packages:
|
|
2426
1779
|
|
|
2427
|
-
|
|
2428
|
-
|
|
2429
|
-
|
|
1780
|
+
Core
|
|
1781
|
+
http HTTP server with routing and middleware
|
|
1782
|
+
core File-based routing and configuration
|
|
2430
1783
|
|
|
2431
|
-
|
|
2432
|
-
|
|
2433
|
-
|
|
1784
|
+
Data
|
|
1785
|
+
db Database abstraction layer
|
|
1786
|
+
cache Caching with multiple adapters
|
|
2434
1787
|
|
|
2435
|
-
|
|
2436
|
-
|
|
1788
|
+
Auth
|
|
1789
|
+
auth Authentication adapters
|
|
2437
1790
|
|
|
2438
|
-
|
|
2439
|
-
|
|
2440
|
-
|
|
2441
|
-
|
|
2442
|
-
|
|
1791
|
+
Frontend
|
|
1792
|
+
forms Type-safe form handling
|
|
1793
|
+
i18n Internationalization
|
|
1794
|
+
seo SEO utilities
|
|
1795
|
+
image Image optimization
|
|
2443
1796
|
|
|
2444
|
-
|
|
2445
|
-
|
|
2446
|
-
|
|
1797
|
+
Communication
|
|
1798
|
+
email Email sending
|
|
1799
|
+
realtime WebSocket and real-time features
|
|
2447
1800
|
|
|
2448
|
-
|
|
2449
|
-
|
|
1801
|
+
Utilities
|
|
1802
|
+
helpers Optional helper utilities
|
|
2450
1803
|
|
|
2451
|
-
|
|
1804
|
+
Usage:
|
|
2452
1805
|
flight add http
|
|
2453
1806
|
flight add db
|
|
2454
1807
|
flight add auth
|
|
@@ -2457,7 +1810,7 @@ ${import_picocolors5.default.cyan("Usage:")}
|
|
|
2457
1810
|
function showNextSteps(packageName, pkg) {
|
|
2458
1811
|
const examples = {
|
|
2459
1812
|
"http": `
|
|
2460
|
-
|
|
1813
|
+
Quick example:
|
|
2461
1814
|
|
|
2462
1815
|
import { createServer } from '@flight-framework/http';
|
|
2463
1816
|
|
|
@@ -2467,7 +1820,7 @@ ${import_picocolors5.default.cyan("Quick example:")}
|
|
|
2467
1820
|
export default { port: 3000, fetch: app.fetch };
|
|
2468
1821
|
`,
|
|
2469
1822
|
"db": `
|
|
2470
|
-
|
|
1823
|
+
Quick example:
|
|
2471
1824
|
|
|
2472
1825
|
import { createDb } from '@flight-framework/db';
|
|
2473
1826
|
import { postgres } from '@flight-framework/db/postgres';
|
|
@@ -2475,13 +1828,13 @@ ${import_picocolors5.default.cyan("Quick example:")}
|
|
|
2475
1828
|
const db = createDb(postgres({ connectionString: process.env.DATABASE_URL }));
|
|
2476
1829
|
const users = await db.query('SELECT * FROM users');
|
|
2477
1830
|
|
|
2478
|
-
|
|
2479
|
-
npm install pg
|
|
2480
|
-
npm install @libsql/client
|
|
2481
|
-
npm install @neondatabase/serverless
|
|
1831
|
+
You may also need a driver:
|
|
1832
|
+
npm install pg # PostgreSQL
|
|
1833
|
+
npm install @libsql/client # Turso/SQLite
|
|
1834
|
+
npm install @neondatabase/serverless # Neon
|
|
2482
1835
|
`,
|
|
2483
1836
|
"cache": `
|
|
2484
|
-
|
|
1837
|
+
Quick example:
|
|
2485
1838
|
|
|
2486
1839
|
import { createCache, lru } from '@flight-framework/cache';
|
|
2487
1840
|
|
|
@@ -2490,7 +1843,7 @@ ${import_picocolors5.default.cyan("Quick example:")}
|
|
|
2490
1843
|
const value = await cache.get('key');
|
|
2491
1844
|
`,
|
|
2492
1845
|
"auth": `
|
|
2493
|
-
|
|
1846
|
+
Quick example:
|
|
2494
1847
|
|
|
2495
1848
|
import { createAuth } from '@flight-framework/auth';
|
|
2496
1849
|
import { betterAuth } from '@flight-framework/auth/better-auth';
|
|
@@ -2499,7 +1852,7 @@ ${import_picocolors5.default.cyan("Quick example:")}
|
|
|
2499
1852
|
const user = await auth.getUser(request);
|
|
2500
1853
|
`,
|
|
2501
1854
|
"forms": `
|
|
2502
|
-
|
|
1855
|
+
Quick example:
|
|
2503
1856
|
|
|
2504
1857
|
import { createForm } from '@flight-framework/forms';
|
|
2505
1858
|
import { zodAdapter } from '@flight-framework/forms/adapters/zod';
|
|
@@ -2509,15 +1862,15 @@ ${import_picocolors5.default.cyan("Quick example:")}
|
|
|
2509
1862
|
`
|
|
2510
1863
|
};
|
|
2511
1864
|
if (examples[packageName]) {
|
|
2512
|
-
|
|
1865
|
+
consola5.log(examples[packageName]);
|
|
2513
1866
|
}
|
|
2514
|
-
|
|
1867
|
+
consola5.log(`Docs: https://flight.dev/docs/packages/${packageName}`);
|
|
2515
1868
|
}
|
|
2516
1869
|
|
|
2517
1870
|
// src/commands/adapter-create.ts
|
|
2518
|
-
var import_picocolors6 = __toESM(require_picocolors(), 1);
|
|
2519
1871
|
import { existsSync as existsSync7, mkdirSync as mkdirSync4, writeFileSync as writeFileSync5 } from "fs";
|
|
2520
1872
|
import { join as join6 } from "path";
|
|
1873
|
+
import { consola as consola6 } from "consola";
|
|
2521
1874
|
async function adapterCreateCommand(name, options = {}) {
|
|
2522
1875
|
const cwd = process.cwd();
|
|
2523
1876
|
const adapterName = name.toLowerCase().replace(/[^a-z0-9-]/g, "-");
|
|
@@ -2525,11 +1878,9 @@ async function adapterCreateCommand(name, options = {}) {
|
|
|
2525
1878
|
const outputDir = options.outputDir || join6(cwd, "packages", `adapter-${adapterName}`);
|
|
2526
1879
|
const type = options.type || "node";
|
|
2527
1880
|
const includeValidation = options.validation || false;
|
|
2528
|
-
|
|
2529
|
-
Creating adapter: ${packageName}
|
|
2530
|
-
`));
|
|
1881
|
+
consola6.info(`Creating adapter: ${packageName}`);
|
|
2531
1882
|
if (existsSync7(outputDir)) {
|
|
2532
|
-
|
|
1883
|
+
consola6.error(`Directory already exists: ${outputDir}`);
|
|
2533
1884
|
process.exit(1);
|
|
2534
1885
|
}
|
|
2535
1886
|
mkdirSync4(join6(outputDir, "src"), { recursive: true });
|
|
@@ -2538,10 +1889,9 @@ async function adapterCreateCommand(name, options = {}) {
|
|
|
2538
1889
|
for (const [filePath, content] of Object.entries(files)) {
|
|
2539
1890
|
const fullPath = join6(outputDir, filePath);
|
|
2540
1891
|
writeFileSync5(fullPath, content, "utf-8");
|
|
2541
|
-
|
|
1892
|
+
consola6.success(`Created ${filePath}`);
|
|
2542
1893
|
}
|
|
2543
|
-
|
|
2544
|
-
Adapter created successfully!
|
|
1894
|
+
consola6.success(`Adapter created successfully!
|
|
2545
1895
|
|
|
2546
1896
|
Next steps:
|
|
2547
1897
|
1. cd packages/adapter-${adapterName}
|
|
@@ -2551,7 +1901,7 @@ async function adapterCreateCommand(name, options = {}) {
|
|
|
2551
1901
|
|
|
2552
1902
|
Documentation:
|
|
2553
1903
|
https://flight.dev/docs/adapters/custom
|
|
2554
|
-
`)
|
|
1904
|
+
`);
|
|
2555
1905
|
}
|
|
2556
1906
|
function generateAdapterFiles(name, packageName, type, includeValidation) {
|
|
2557
1907
|
const pascalName = name.split("-").map((s) => s.charAt(0).toUpperCase() + s.slice(1)).join("");
|
|
@@ -2968,42 +2318,285 @@ MIT
|
|
|
2968
2318
|
}
|
|
2969
2319
|
|
|
2970
2320
|
// src/index.ts
|
|
2971
|
-
var cli = cac("flight");
|
|
2972
2321
|
var LOGO = `
|
|
2973
|
-
|
|
2974
|
-
|
|
2975
|
-
|
|
2976
|
-
|
|
2977
|
-
|
|
2978
|
-
|
|
2322
|
+
\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2557 \u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2557 \u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557
|
|
2323
|
+
\u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255D\u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255D \u2588\u2588\u2551 \u2588\u2588\u2551\u255A\u2550\u2550\u2588\u2588\u2554\u2550\u2550\u255D
|
|
2324
|
+
\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2551 \u2588\u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2551 \u2588\u2588\u2551
|
|
2325
|
+
\u2588\u2588\u2554\u2550\u2550\u255D \u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2551 \u2588\u2588\u2551
|
|
2326
|
+
\u2588\u2588\u2551 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2551\u255A\u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255D\u2588\u2588\u2551 \u2588\u2588\u2551 \u2588\u2588\u2551
|
|
2327
|
+
\u255A\u2550\u255D \u255A\u2550\u2550\u2550\u2550\u2550\u2550\u255D\u255A\u2550\u255D \u255A\u2550\u2550\u2550\u2550\u2550\u255D \u255A\u2550\u255D \u255A\u2550\u255D \u255A\u2550\u255D
|
|
2979
2328
|
|
|
2980
|
-
|
|
2981
|
-
|
|
2329
|
+
The Agnostic Full-Stack Framework
|
|
2330
|
+
Maximum Flexibility. Zero Lock-in.
|
|
2982
2331
|
`;
|
|
2983
2332
|
function printLogo() {
|
|
2984
|
-
|
|
2985
|
-
}
|
|
2986
|
-
|
|
2987
|
-
|
|
2988
|
-
|
|
2989
|
-
|
|
2990
|
-
|
|
2991
|
-
|
|
2992
|
-
|
|
2993
|
-
|
|
2994
|
-
|
|
2995
|
-
|
|
2996
|
-
|
|
2997
|
-
|
|
2998
|
-
|
|
2999
|
-
|
|
3000
|
-
|
|
2333
|
+
consola7.log(LOGO);
|
|
2334
|
+
}
|
|
2335
|
+
var create = defineCommand({
|
|
2336
|
+
meta: {
|
|
2337
|
+
name: "create",
|
|
2338
|
+
description: "Create a new Flight project"
|
|
2339
|
+
},
|
|
2340
|
+
args: {
|
|
2341
|
+
name: {
|
|
2342
|
+
type: "positional",
|
|
2343
|
+
description: "Project name",
|
|
2344
|
+
required: false
|
|
2345
|
+
},
|
|
2346
|
+
template: {
|
|
2347
|
+
type: "string",
|
|
2348
|
+
alias: "t",
|
|
2349
|
+
description: "Project template to use",
|
|
2350
|
+
default: "basic"
|
|
2351
|
+
},
|
|
2352
|
+
ui: {
|
|
2353
|
+
type: "string",
|
|
2354
|
+
description: "UI framework (react, vue, svelte, solid, vanilla)"
|
|
2355
|
+
},
|
|
2356
|
+
"use-case": {
|
|
2357
|
+
type: "string",
|
|
2358
|
+
description: "Use-case template (blog, ecommerce, saas, api, docs)"
|
|
2359
|
+
},
|
|
2360
|
+
ts: {
|
|
2361
|
+
type: "boolean",
|
|
2362
|
+
description: "Use TypeScript",
|
|
2363
|
+
default: true
|
|
2364
|
+
},
|
|
2365
|
+
git: {
|
|
2366
|
+
type: "boolean",
|
|
2367
|
+
description: "Initialize git repository",
|
|
2368
|
+
default: true
|
|
2369
|
+
},
|
|
2370
|
+
install: {
|
|
2371
|
+
type: "boolean",
|
|
2372
|
+
description: "Install dependencies",
|
|
2373
|
+
default: true
|
|
2374
|
+
},
|
|
2375
|
+
raw: {
|
|
2376
|
+
type: "boolean",
|
|
2377
|
+
description: "Create raw project (100% Web Standards, zero dependencies)"
|
|
2378
|
+
},
|
|
2379
|
+
empty: {
|
|
2380
|
+
type: "boolean",
|
|
2381
|
+
description: "Create empty project (just package.json)"
|
|
2382
|
+
},
|
|
2383
|
+
minimal: {
|
|
2384
|
+
type: "boolean",
|
|
2385
|
+
description: "Create minimal project (single server file with Flight)"
|
|
3001
2386
|
}
|
|
3002
|
-
|
|
3003
|
-
|
|
3004
|
-
|
|
3005
|
-
|
|
2387
|
+
},
|
|
2388
|
+
run({ args }) {
|
|
2389
|
+
return createCommand(args.name, args);
|
|
2390
|
+
}
|
|
2391
|
+
});
|
|
2392
|
+
var add = defineCommand({
|
|
2393
|
+
meta: {
|
|
2394
|
+
name: "add",
|
|
2395
|
+
description: "Add a Flight package to your project"
|
|
2396
|
+
},
|
|
2397
|
+
args: {
|
|
2398
|
+
package: {
|
|
2399
|
+
type: "positional",
|
|
2400
|
+
description: "Package name to add",
|
|
2401
|
+
required: false
|
|
2402
|
+
}
|
|
2403
|
+
},
|
|
2404
|
+
run({ args }) {
|
|
2405
|
+
return addCommand(args.package);
|
|
2406
|
+
}
|
|
2407
|
+
});
|
|
2408
|
+
var dev = defineCommand({
|
|
2409
|
+
meta: {
|
|
2410
|
+
name: "dev",
|
|
2411
|
+
description: "Start development server"
|
|
2412
|
+
},
|
|
2413
|
+
args: {
|
|
2414
|
+
port: {
|
|
2415
|
+
type: "string",
|
|
2416
|
+
alias: "p",
|
|
2417
|
+
description: "Port to listen on"
|
|
2418
|
+
},
|
|
2419
|
+
host: {
|
|
2420
|
+
type: "string",
|
|
2421
|
+
alias: "h",
|
|
2422
|
+
description: "Host to bind to"
|
|
2423
|
+
},
|
|
2424
|
+
open: {
|
|
2425
|
+
type: "boolean",
|
|
2426
|
+
description: "Open browser on start"
|
|
2427
|
+
},
|
|
2428
|
+
https: {
|
|
2429
|
+
type: "boolean",
|
|
2430
|
+
description: "Enable HTTPS"
|
|
2431
|
+
},
|
|
2432
|
+
ssr: {
|
|
2433
|
+
type: "boolean",
|
|
2434
|
+
description: "Enable Server-Side Rendering"
|
|
2435
|
+
}
|
|
2436
|
+
},
|
|
2437
|
+
run({ args }) {
|
|
2438
|
+
return devCommand(args);
|
|
2439
|
+
}
|
|
2440
|
+
});
|
|
2441
|
+
var build = defineCommand({
|
|
2442
|
+
meta: {
|
|
2443
|
+
name: "build",
|
|
2444
|
+
description: "Build for production"
|
|
2445
|
+
},
|
|
2446
|
+
args: {
|
|
2447
|
+
outDir: {
|
|
2448
|
+
type: "string",
|
|
2449
|
+
description: "Output directory"
|
|
2450
|
+
},
|
|
2451
|
+
sourcemap: {
|
|
2452
|
+
type: "boolean",
|
|
2453
|
+
description: "Generate source maps"
|
|
2454
|
+
},
|
|
2455
|
+
minify: {
|
|
2456
|
+
type: "boolean",
|
|
2457
|
+
description: "Minify output",
|
|
2458
|
+
default: true
|
|
2459
|
+
}
|
|
2460
|
+
},
|
|
2461
|
+
run({ args }) {
|
|
2462
|
+
return buildCommand(args);
|
|
2463
|
+
}
|
|
2464
|
+
});
|
|
2465
|
+
var preview = defineCommand({
|
|
2466
|
+
meta: {
|
|
2467
|
+
name: "preview",
|
|
2468
|
+
description: "Preview production build"
|
|
2469
|
+
},
|
|
2470
|
+
args: {
|
|
2471
|
+
port: {
|
|
2472
|
+
type: "string",
|
|
2473
|
+
alias: "p",
|
|
2474
|
+
description: "Port to listen on"
|
|
2475
|
+
},
|
|
2476
|
+
host: {
|
|
2477
|
+
type: "string",
|
|
2478
|
+
alias: "h",
|
|
2479
|
+
description: "Host to bind to"
|
|
2480
|
+
},
|
|
2481
|
+
open: {
|
|
2482
|
+
type: "boolean",
|
|
2483
|
+
description: "Open browser on start"
|
|
2484
|
+
}
|
|
2485
|
+
},
|
|
2486
|
+
run({ args }) {
|
|
2487
|
+
return previewCommand(args);
|
|
2488
|
+
}
|
|
2489
|
+
});
|
|
2490
|
+
var routesGenerate = defineCommand({
|
|
2491
|
+
meta: {
|
|
2492
|
+
name: "routes:generate",
|
|
2493
|
+
description: "Generate route manifest from routes directory"
|
|
2494
|
+
},
|
|
2495
|
+
args: {
|
|
2496
|
+
routesDir: {
|
|
2497
|
+
type: "string",
|
|
2498
|
+
description: "Routes directory",
|
|
2499
|
+
default: "src/routes"
|
|
2500
|
+
},
|
|
2501
|
+
outputDir: {
|
|
2502
|
+
type: "string",
|
|
2503
|
+
description: "Output directory",
|
|
2504
|
+
default: "src/.flight"
|
|
2505
|
+
}
|
|
2506
|
+
},
|
|
2507
|
+
run({ args }) {
|
|
2508
|
+
return routesGenerateCommand(args);
|
|
2509
|
+
}
|
|
2510
|
+
});
|
|
2511
|
+
var typesGenerate = defineCommand({
|
|
2512
|
+
meta: {
|
|
2513
|
+
name: "types:generate",
|
|
2514
|
+
description: "Generate TypeScript types for routes and environment"
|
|
2515
|
+
},
|
|
2516
|
+
args: {
|
|
2517
|
+
routesDir: {
|
|
2518
|
+
type: "string",
|
|
2519
|
+
description: "Routes directory",
|
|
2520
|
+
default: "src/routes"
|
|
2521
|
+
},
|
|
2522
|
+
outputDir: {
|
|
2523
|
+
type: "string",
|
|
2524
|
+
description: "Output directory",
|
|
2525
|
+
default: "src/.flight"
|
|
2526
|
+
},
|
|
2527
|
+
routes: {
|
|
2528
|
+
type: "boolean",
|
|
2529
|
+
description: "Generate route types",
|
|
2530
|
+
default: true
|
|
2531
|
+
},
|
|
2532
|
+
env: {
|
|
2533
|
+
type: "boolean",
|
|
2534
|
+
description: "Generate environment variable types"
|
|
2535
|
+
},
|
|
2536
|
+
watch: {
|
|
2537
|
+
type: "boolean",
|
|
2538
|
+
description: "Watch for changes and regenerate"
|
|
2539
|
+
}
|
|
2540
|
+
},
|
|
2541
|
+
run({ args }) {
|
|
2542
|
+
return typesGenerateCommand(args);
|
|
2543
|
+
}
|
|
2544
|
+
});
|
|
2545
|
+
var adapterCreate = defineCommand({
|
|
2546
|
+
meta: {
|
|
2547
|
+
name: "adapter:create",
|
|
2548
|
+
description: "Create a new adapter package"
|
|
2549
|
+
},
|
|
2550
|
+
args: {
|
|
2551
|
+
name: {
|
|
2552
|
+
type: "positional",
|
|
2553
|
+
description: "Adapter name",
|
|
2554
|
+
required: true
|
|
2555
|
+
},
|
|
2556
|
+
type: {
|
|
2557
|
+
type: "string",
|
|
2558
|
+
alias: "t",
|
|
2559
|
+
description: "Platform type (node, edge, container, serverless)",
|
|
2560
|
+
default: "node"
|
|
2561
|
+
},
|
|
2562
|
+
validation: {
|
|
2563
|
+
type: "boolean",
|
|
2564
|
+
description: "Include Zod validation example"
|
|
2565
|
+
},
|
|
2566
|
+
outputDir: {
|
|
2567
|
+
type: "string",
|
|
2568
|
+
description: "Output directory"
|
|
2569
|
+
}
|
|
2570
|
+
},
|
|
2571
|
+
run({ args }) {
|
|
2572
|
+
return adapterCreateCommand(args.name, {
|
|
2573
|
+
...args,
|
|
2574
|
+
type: args.type
|
|
2575
|
+
});
|
|
3006
2576
|
}
|
|
2577
|
+
});
|
|
2578
|
+
var main = defineCommand({
|
|
2579
|
+
meta: {
|
|
2580
|
+
name: "flight",
|
|
2581
|
+
version: VERSION,
|
|
2582
|
+
description: "The Agnostic Full-Stack Framework - Maximum Flexibility. Zero Lock-in."
|
|
2583
|
+
},
|
|
2584
|
+
subCommands: {
|
|
2585
|
+
create,
|
|
2586
|
+
add,
|
|
2587
|
+
dev,
|
|
2588
|
+
build,
|
|
2589
|
+
preview,
|
|
2590
|
+
"routes:generate": routesGenerate,
|
|
2591
|
+
"types:generate": typesGenerate,
|
|
2592
|
+
"adapter:create": adapterCreate
|
|
2593
|
+
},
|
|
2594
|
+
setup() {
|
|
2595
|
+
printLogo();
|
|
2596
|
+
}
|
|
2597
|
+
});
|
|
2598
|
+
function run() {
|
|
2599
|
+
runMain(main);
|
|
3007
2600
|
}
|
|
3008
2601
|
|
|
3009
2602
|
// src/bin.ts
|