create-absolutejs 0.2.1 → 0.3.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/commands/formatProject.d.ts +6 -0
- package/dist/commands/installDependencies.d.ts +6 -0
- package/dist/constants.d.ts +4 -0
- package/dist/data.d.ts +15 -0
- package/dist/generators/configurations/addConfigurationFiles.d.ts +7 -0
- package/dist/generators/configurations/generateDrizzleConfig.d.ts +7 -0
- package/dist/generators/configurations/generatePackageJson.d.ts +7 -0
- package/dist/generators/configurations/generatePrettierrc.d.ts +2 -0
- package/dist/generators/configurations/initializeRoot.d.ts +5 -0
- package/dist/generators/db/scaffoldDatabase.d.ts +9 -0
- package/dist/generators/html/scaffoldHTML.d.ts +6 -0
- package/dist/generators/htmx/scaffoldHTMX.d.ts +2 -0
- package/dist/generators/project/generateMarkupCSS.d.ts +1 -0
- package/dist/generators/project/generateServer.d.ts +7 -0
- package/dist/generators/project/scaffoldFrontends.d.ts +8 -0
- package/dist/generators/react/scaffoldReact.d.ts +2 -0
- package/dist/generators/svelte/scaffoldSvelte.d.ts +2 -0
- package/dist/generators/vue/scaffoldVue.d.ts +4 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +460 -517
- package/dist/messages.d.ts +14 -0
- package/dist/prompt.d.ts +2 -0
- package/dist/questions/authProvider.d.ts +1 -0
- package/dist/questions/codeQualityTool.d.ts +1 -0
- package/dist/questions/configurationType.d.ts +1 -0
- package/dist/questions/databaseEngine.d.ts +1 -0
- package/dist/questions/databaseHost.d.ts +2 -0
- package/dist/questions/directoryConfiguration.d.ts +14 -0
- package/dist/questions/frontendDirectoryConfigurations.d.ts +2 -0
- package/dist/questions/frontends.d.ts +1 -0
- package/dist/questions/htmlScriptingOption.d.ts +1 -0
- package/dist/questions/initializeGitNow.d.ts +1 -0
- package/dist/questions/installDependenciesNow.d.ts +1 -0
- package/dist/questions/orm.d.ts +1 -0
- package/dist/questions/plugins.d.ts +1 -0
- package/dist/questions/projectName.d.ts +1 -0
- package/dist/questions/useTailwind.d.ts +1 -0
- package/dist/scaffold.d.ts +8 -0
- package/dist/templates/assets/ico/favicon.ico +0 -0
- package/dist/templates/assets/png/absolutejs-temp.png +0 -0
- package/dist/templates/assets/svg/HTML5_Badge.svg +7 -0
- package/dist/templates/assets/svg/htmx-logo-black.svg +9 -0
- package/dist/templates/assets/svg/htmx-logo-white.svg +9 -0
- package/dist/templates/assets/svg/svelte-logo.svg +1 -0
- package/dist/templates/assets/svg/vue-logo.svg +4 -0
- package/dist/templates/html/pages/HTMLExample.html +66 -0
- package/dist/templates/html/scripts/typescript-example.ts +21 -0
- package/dist/templates/htmx/pages/HTMXExample.html +92 -0
- package/dist/templates/react/components/App.tsx +52 -0
- package/dist/templates/react/components/Dropdown.tsx +23 -0
- package/dist/templates/react/components/Head.tsx +34 -0
- package/dist/templates/react/pages/ReactExample.tsx +18 -0
- package/dist/templates/styles/colors.ts +11 -0
- package/dist/templates/styles/reset.css +84 -0
- package/dist/templates/svelte/components/Counter.svelte +19 -0
- package/dist/templates/svelte/composables/counter.svelte.ts +14 -0
- package/dist/templates/svelte/pages/SvelteExample.svelte +215 -0
- package/dist/templates/vue/components/CountButton.vue +39 -0
- package/dist/templates/vue/composables/useCount.ts +14 -0
- package/dist/templates/vue/pages/VueExample.vue +266 -0
- package/dist/typeGuards.d.ts +8 -0
- package/dist/types.d.ts +128 -0
- package/dist/utils/abort.d.ts +1 -0
- package/dist/utils/commandMaps.d.ts +2 -0
- package/dist/utils/getPackageVersion.d.ts +1 -0
- package/dist/utils/parseCommandLineOptions.d.ts +7 -0
- package/dist/utils/t3-utils.d.ts +7 -0
- package/package.json +8 -7
- package/dist/templates/react/hooks/useMediaQuery.ts +0 -54
- package/dist/templates/react/styles/defaultStyles.ts +0 -28
package/dist/index.js
CHANGED
|
@@ -188,14 +188,14 @@ var W = { exports: {} };
|
|
|
188
188
|
return i;
|
|
189
189
|
}, u.slice = function(F, s, i) {
|
|
190
190
|
textLen = u.length(F), s = s || 0, i = i || 1, s < 0 && (s = textLen + s), i < 0 && (i = textLen + i);
|
|
191
|
-
for (var D = "",
|
|
191
|
+
for (var D = "", C = 0, n = t(F), E = 0;E < n.length; E++) {
|
|
192
192
|
var a = n[E], o = u.length(a);
|
|
193
|
-
if (
|
|
194
|
-
if (
|
|
193
|
+
if (C >= s - (o == 2 ? 1 : 0))
|
|
194
|
+
if (C + o <= i)
|
|
195
195
|
D += a;
|
|
196
196
|
else
|
|
197
197
|
break;
|
|
198
|
-
|
|
198
|
+
C += o;
|
|
199
199
|
}
|
|
200
200
|
return D;
|
|
201
201
|
};
|
|
@@ -234,19 +234,19 @@ var w = 10;
|
|
|
234
234
|
var N = (e = 0) => (u) => `\x1B[${u + e}m`;
|
|
235
235
|
var I = (e = 0) => (u) => `\x1B[${38 + e};5;${u}m`;
|
|
236
236
|
var R = (e = 0) => (u, t, F) => `\x1B[${38 + e};2;${u};${t};${F}m`;
|
|
237
|
-
var
|
|
238
|
-
Object.keys(
|
|
239
|
-
var iD = Object.keys(
|
|
240
|
-
var
|
|
237
|
+
var r = { modifier: { reset: [0, 0], bold: [1, 22], dim: [2, 22], italic: [3, 23], underline: [4, 24], overline: [53, 55], inverse: [7, 27], hidden: [8, 28], strikethrough: [9, 29] }, color: { black: [30, 39], red: [31, 39], green: [32, 39], yellow: [33, 39], blue: [34, 39], magenta: [35, 39], cyan: [36, 39], white: [37, 39], blackBright: [90, 39], gray: [90, 39], grey: [90, 39], redBright: [91, 39], greenBright: [92, 39], yellowBright: [93, 39], blueBright: [94, 39], magentaBright: [95, 39], cyanBright: [96, 39], whiteBright: [97, 39] }, bgColor: { bgBlack: [40, 49], bgRed: [41, 49], bgGreen: [42, 49], bgYellow: [43, 49], bgBlue: [44, 49], bgMagenta: [45, 49], bgCyan: [46, 49], bgWhite: [47, 49], bgBlackBright: [100, 49], bgGray: [100, 49], bgGrey: [100, 49], bgRedBright: [101, 49], bgGreenBright: [102, 49], bgYellowBright: [103, 49], bgBlueBright: [104, 49], bgMagentaBright: [105, 49], bgCyanBright: [106, 49], bgWhiteBright: [107, 49] } };
|
|
238
|
+
Object.keys(r.modifier);
|
|
239
|
+
var iD = Object.keys(r.color);
|
|
240
|
+
var CD = Object.keys(r.bgColor);
|
|
241
241
|
[...iD];
|
|
242
|
-
function
|
|
242
|
+
function rD() {
|
|
243
243
|
const e = new Map;
|
|
244
|
-
for (const [u, t] of Object.entries(
|
|
244
|
+
for (const [u, t] of Object.entries(r)) {
|
|
245
245
|
for (const [F, s] of Object.entries(t))
|
|
246
|
-
|
|
247
|
-
Object.defineProperty(
|
|
246
|
+
r[F] = { open: `\x1B[${s[0]}m`, close: `\x1B[${s[1]}m` }, t[F] = r[F], e.set(s[0], s[1]);
|
|
247
|
+
Object.defineProperty(r, u, { value: t, enumerable: false });
|
|
248
248
|
}
|
|
249
|
-
return Object.defineProperty(
|
|
249
|
+
return Object.defineProperty(r, "codes", { value: e, enumerable: false }), r.color.close = "\x1B[39m", r.bgColor.close = "\x1B[49m", r.color.ansi = N(), r.color.ansi256 = I(), r.color.ansi16m = R(), r.bgColor.ansi = N(w), r.bgColor.ansi256 = I(w), r.bgColor.ansi16m = R(w), Object.defineProperties(r, { rgbToAnsi256: { value: (u, t, F) => u === t && t === F ? u < 8 ? 16 : u > 248 ? 231 : Math.round((u - 8) / 247 * 24) + 232 : 16 + 36 * Math.round(u / 255 * 5) + 6 * Math.round(t / 255 * 5) + Math.round(F / 255 * 5), enumerable: false }, hexToRgb: { value: (u) => {
|
|
250
250
|
const t = /[a-f\d]{6}|[a-f\d]{3}/i.exec(u.toString(16));
|
|
251
251
|
if (!t)
|
|
252
252
|
return [0, 0, 0];
|
|
@@ -254,7 +254,7 @@ function CD() {
|
|
|
254
254
|
F.length === 3 && (F = [...F].map((i) => i + i).join(""));
|
|
255
255
|
const s = Number.parseInt(F, 16);
|
|
256
256
|
return [s >> 16 & 255, s >> 8 & 255, s & 255];
|
|
257
|
-
}, enumerable: false }, hexToAnsi256: { value: (u) =>
|
|
257
|
+
}, enumerable: false }, hexToAnsi256: { value: (u) => r.rgbToAnsi256(...r.hexToRgb(u)), enumerable: false }, ansi256ToAnsi: { value: (u) => {
|
|
258
258
|
if (u < 8)
|
|
259
259
|
return 30 + u;
|
|
260
260
|
if (u < 16)
|
|
@@ -264,17 +264,17 @@ function CD() {
|
|
|
264
264
|
t = ((u - 232) * 10 + 8) / 255, F = t, s = t;
|
|
265
265
|
else {
|
|
266
266
|
u -= 16;
|
|
267
|
-
const
|
|
268
|
-
t = Math.floor(u / 36) / 5, F = Math.floor(
|
|
267
|
+
const C = u % 36;
|
|
268
|
+
t = Math.floor(u / 36) / 5, F = Math.floor(C / 6) / 5, s = C % 6 / 5;
|
|
269
269
|
}
|
|
270
270
|
const i = Math.max(t, F, s) * 2;
|
|
271
271
|
if (i === 0)
|
|
272
272
|
return 30;
|
|
273
273
|
let D = 30 + (Math.round(s) << 2 | Math.round(F) << 1 | Math.round(t));
|
|
274
274
|
return i === 2 && (D += 60), D;
|
|
275
|
-
}, enumerable: false }, rgbToAnsi: { value: (u, t, F) =>
|
|
275
|
+
}, enumerable: false }, rgbToAnsi: { value: (u, t, F) => r.ansi256ToAnsi(r.rgbToAnsi256(u, t, F)), enumerable: false }, hexToAnsi: { value: (u) => r.ansi256ToAnsi(r.hexToAnsi256(u)), enumerable: false } }), r;
|
|
276
276
|
}
|
|
277
|
-
var ED =
|
|
277
|
+
var ED = rD();
|
|
278
278
|
var d = new Set(["\x1B", ""]);
|
|
279
279
|
var oD = 39;
|
|
280
280
|
var y = "\x07";
|
|
@@ -288,13 +288,13 @@ var aD = (e) => e.split(" ").map((u) => p(u));
|
|
|
288
288
|
var k = (e, u, t) => {
|
|
289
289
|
const F = [...u];
|
|
290
290
|
let s = false, i = false, D = p(P(e[e.length - 1]));
|
|
291
|
-
for (const [
|
|
291
|
+
for (const [C, n] of F.entries()) {
|
|
292
292
|
const E = p(n);
|
|
293
|
-
if (D + E <= t ? e[e.length - 1] += n : (e.push(n), D = 0), d.has(n) && (s = true, i = F.slice(
|
|
293
|
+
if (D + E <= t ? e[e.length - 1] += n : (e.push(n), D = 0), d.has(n) && (s = true, i = F.slice(C + 1).join("").startsWith(_)), s) {
|
|
294
294
|
i ? n === y && (s = false, i = false) : n === G && (s = false);
|
|
295
295
|
continue;
|
|
296
296
|
}
|
|
297
|
-
D += E, D === t &&
|
|
297
|
+
D += E, D === t && C < F.length - 1 && (e.push(""), D = 0);
|
|
298
298
|
}
|
|
299
299
|
!D && e[e.length - 1].length > 0 && e.length > 1 && (e[e.length - 2] += e.pop());
|
|
300
300
|
};
|
|
@@ -310,30 +310,30 @@ var lD = (e, u, t = {}) => {
|
|
|
310
310
|
return "";
|
|
311
311
|
let F = "", s, i;
|
|
312
312
|
const D = aD(e);
|
|
313
|
-
let
|
|
313
|
+
let C = [""];
|
|
314
314
|
for (const [E, a] of e.split(" ").entries()) {
|
|
315
|
-
t.trim !== false && (
|
|
316
|
-
let o = p(
|
|
317
|
-
if (E !== 0 && (o >= u && (t.wordWrap === false || t.trim === false) && (
|
|
315
|
+
t.trim !== false && (C[C.length - 1] = C[C.length - 1].trimStart());
|
|
316
|
+
let o = p(C[C.length - 1]);
|
|
317
|
+
if (E !== 0 && (o >= u && (t.wordWrap === false || t.trim === false) && (C.push(""), o = 0), (o > 0 || t.trim === false) && (C[C.length - 1] += " ", o++)), t.hard && D[E] > u) {
|
|
318
318
|
const c = u - o, f = 1 + Math.floor((D[E] - c - 1) / u);
|
|
319
|
-
Math.floor((D[E] - 1) / u) < f &&
|
|
319
|
+
Math.floor((D[E] - 1) / u) < f && C.push(""), k(C, a, u);
|
|
320
320
|
continue;
|
|
321
321
|
}
|
|
322
322
|
if (o + D[E] > u && o > 0 && D[E] > 0) {
|
|
323
323
|
if (t.wordWrap === false && o < u) {
|
|
324
|
-
k(
|
|
324
|
+
k(C, a, u);
|
|
325
325
|
continue;
|
|
326
326
|
}
|
|
327
|
-
|
|
327
|
+
C.push("");
|
|
328
328
|
}
|
|
329
329
|
if (o + D[E] > u && t.wordWrap === false) {
|
|
330
|
-
k(
|
|
330
|
+
k(C, a, u);
|
|
331
331
|
continue;
|
|
332
332
|
}
|
|
333
|
-
|
|
333
|
+
C[C.length - 1] += a;
|
|
334
334
|
}
|
|
335
|
-
t.trim !== false && (
|
|
336
|
-
const n = [...
|
|
335
|
+
t.trim !== false && (C = C.map((E) => hD(E)));
|
|
336
|
+
const n = [...C.join(`
|
|
337
337
|
`)];
|
|
338
338
|
for (const [E, a] of n.entries()) {
|
|
339
339
|
if (F += a, d.has(a)) {
|
|
@@ -389,15 +389,15 @@ function m(e, u) {
|
|
|
389
389
|
function fD({ input: e = j, output: u = M, overwrite: t = true, hideCursor: F = true } = {}) {
|
|
390
390
|
const s = g.createInterface({ input: e, output: u, prompt: "", tabSize: 1 });
|
|
391
391
|
g.emitKeypressEvents(e, s), e.isTTY && e.setRawMode(true);
|
|
392
|
-
const i = (D, { name:
|
|
392
|
+
const i = (D, { name: C, sequence: n }) => {
|
|
393
393
|
const E = String(D);
|
|
394
|
-
if ($([E,
|
|
394
|
+
if ($([E, C, n], "cancel")) {
|
|
395
395
|
F && u.write(import_sisteransi.cursor.show), process.exit(0);
|
|
396
396
|
return;
|
|
397
397
|
}
|
|
398
398
|
if (!t)
|
|
399
399
|
return;
|
|
400
|
-
const a =
|
|
400
|
+
const a = C === "return" ? 0 : -1, o = C === "return" ? -1 : 0;
|
|
401
401
|
g.moveCursor(u, a, o, () => {
|
|
402
402
|
g.clearLine(u, 1, () => {
|
|
403
403
|
e.once("keypress", i);
|
|
@@ -415,8 +415,8 @@ var h = (e, u, t) => (vD(e, typeof u != "symbol" ? u + "" : u, t), t);
|
|
|
415
415
|
class x {
|
|
416
416
|
constructor(u, t = true) {
|
|
417
417
|
h(this, "input"), h(this, "output"), h(this, "_abortSignal"), h(this, "rl"), h(this, "opts"), h(this, "_render"), h(this, "_track", false), h(this, "_prevFrame", ""), h(this, "_subscribers", new Map), h(this, "_cursor", 0), h(this, "state", "initial"), h(this, "error", ""), h(this, "value");
|
|
418
|
-
const { input: F = j, output: s = M, render: i, signal: D, ...
|
|
419
|
-
this.opts =
|
|
418
|
+
const { input: F = j, output: s = M, render: i, signal: D, ...C } = u;
|
|
419
|
+
this.opts = C, this.onKeypress = this.onKeypress.bind(this), this.close = this.close.bind(this), this.render = this.render.bind(this), this._render = i.bind(this), this._track = t, this._abortSignal = D, this.input = F, this.output = s;
|
|
420
420
|
}
|
|
421
421
|
unsubscribe() {
|
|
422
422
|
this._subscribers.clear();
|
|
@@ -459,7 +459,7 @@ class x {
|
|
|
459
459
|
}
|
|
460
460
|
onKeypress(u, t) {
|
|
461
461
|
if (this.state === "error" && (this.state = "active"), t?.name && (!this._track && B.aliases.has(t.name) && this.emit("cursor", B.aliases.get(t.name)), B.actions.has(t.name) && this.emit("cursor", t.name)), u && (u.toLowerCase() === "y" || u.toLowerCase() === "n") && this.emit("confirm", u.toLowerCase() === "y"), u === "\t" && this.opts.placeholder && (this.value || (this.rl?.write(this.opts.placeholder), this.emit("value", this.opts.placeholder))), u && this.emit("key", u.toLowerCase()), t?.name === "return") {
|
|
462
|
-
if (
|
|
462
|
+
if (this.opts.validate) {
|
|
463
463
|
const F = this.opts.validate(this.value);
|
|
464
464
|
F && (this.error = F instanceof Error ? F.message : F, this.state = "error", this.rl?.write(this.value));
|
|
465
465
|
}
|
|
@@ -619,7 +619,7 @@ var u = (t, n) => V2 ? t : n;
|
|
|
619
619
|
var le = u("◆", "*");
|
|
620
620
|
var L2 = u("■", "x");
|
|
621
621
|
var W2 = u("▲", "x");
|
|
622
|
-
var
|
|
622
|
+
var C = u("◇", "o");
|
|
623
623
|
var ue = u("┌", "T");
|
|
624
624
|
var o = u("│", "|");
|
|
625
625
|
var d2 = u("└", "—");
|
|
@@ -654,11 +654,10 @@ var availableFrontends = [
|
|
|
654
654
|
"react",
|
|
655
655
|
"html",
|
|
656
656
|
"svelte",
|
|
657
|
+
"vue",
|
|
657
658
|
"htmx"
|
|
658
659
|
];
|
|
659
660
|
var availableAuthProviders = ["absoluteAuth", "none"];
|
|
660
|
-
var availableLanguages = ["ts", "js"];
|
|
661
|
-
var availableHTMLScriptOptions = ["js", "ts", "none"];
|
|
662
661
|
var availableDatabaseEngines = [
|
|
663
662
|
"postgresql",
|
|
664
663
|
"mysql",
|
|
@@ -686,8 +685,9 @@ var availableCodeQualityTools = ["eslint+prettier", "biome"];
|
|
|
686
685
|
var frontendLabels = {
|
|
687
686
|
react: import_picocolors3.cyan("React"),
|
|
688
687
|
html: "HTML",
|
|
688
|
+
htmx: "HTMX",
|
|
689
689
|
svelte: import_picocolors3.magenta("Svelte"),
|
|
690
|
-
|
|
690
|
+
vue: import_picocolors3.green("Vue")
|
|
691
691
|
};
|
|
692
692
|
var availablePlugins = [
|
|
693
693
|
{
|
|
@@ -720,6 +720,17 @@ var absoluteAuthPlugin = {
|
|
|
720
720
|
latestVersion: "0.3.2",
|
|
721
721
|
value: "@absolutejs/auth"
|
|
722
722
|
};
|
|
723
|
+
var scopedStatePlugin = {
|
|
724
|
+
imports: [
|
|
725
|
+
{
|
|
726
|
+
config: { count: { value: 0 } },
|
|
727
|
+
isPlugin: true,
|
|
728
|
+
packageName: "scopedState"
|
|
729
|
+
}
|
|
730
|
+
],
|
|
731
|
+
latestVersion: "0.1.1",
|
|
732
|
+
value: "elysia-scoped-state"
|
|
733
|
+
};
|
|
723
734
|
var eslintAndPrettierDependencies = [
|
|
724
735
|
{
|
|
725
736
|
latestVersion: "9.27.0",
|
|
@@ -740,10 +751,11 @@ var defaultDependencies = [
|
|
|
740
751
|
var defaultPlugins = [
|
|
741
752
|
{
|
|
742
753
|
imports: [
|
|
754
|
+
{ isPlugin: false, packageName: "asset" },
|
|
743
755
|
{ isPlugin: false, packageName: "build" },
|
|
744
|
-
{ isPlugin: true, packageName: "
|
|
756
|
+
{ isPlugin: true, packageName: "networking" }
|
|
745
757
|
],
|
|
746
|
-
latestVersion: "0.
|
|
758
|
+
latestVersion: "0.11.1",
|
|
747
759
|
value: "@absolutejs/absolute"
|
|
748
760
|
},
|
|
749
761
|
{
|
|
@@ -783,14 +795,13 @@ Options:
|
|
|
783
795
|
${import_picocolors4.cyan("--host")} ${import_picocolors4.dim(import_picocolors4.cyan("<host>"))} Database host provider (neon | planetscale | supabase | turso | vercel | upstash | atlas) or 'none' to skip database host setup
|
|
784
796
|
${import_picocolors4.cyan("--html")} ${import_picocolors4.dim(import_picocolors4.cyan("<dir>"))} Directory name for an HTML frontend
|
|
785
797
|
${import_picocolors4.cyan("--htmx")} ${import_picocolors4.dim(import_picocolors4.cyan("<dir>"))} Directory name for an HTMX frontend
|
|
786
|
-
${import_picocolors4.cyan("--lang")} ${import_picocolors4.dim(import_picocolors4.cyan("<lang>"))} Language: "ts" or "js"
|
|
787
798
|
${import_picocolors4.cyan("--lts")} Use LTS versions of required packages
|
|
788
799
|
${import_picocolors4.cyan("--npm")} Use the package manager that invoked this command to install dependencies
|
|
789
800
|
${import_picocolors4.cyan("--orm")} ${import_picocolors4.dim(import_picocolors4.cyan("<orm>"))} ORM to configure: "drizzle" or "prisma" or 'none' to skip ORM setup
|
|
790
801
|
${import_picocolors4.cyan("--plugin")} ${import_picocolors4.dim(import_picocolors4.cyan("<plugin>"))} Elysia plugin(s) to include (can be specified multiple times), passing 'none' will skip plugin setup and ignore any other plugin options
|
|
791
802
|
${import_picocolors4.cyan("--quality")} ${import_picocolors4.dim(import_picocolors4.cyan("<tool>"))} Code quality tool: "eslint+prettier" or "biome"
|
|
792
803
|
${import_picocolors4.cyan("--react")} ${import_picocolors4.dim(import_picocolors4.cyan("<dir>"))} Directory name for a React frontend
|
|
793
|
-
${import_picocolors4.cyan("--script")} ${import_picocolors4.dim(import_picocolors4.cyan("<option>"))}
|
|
804
|
+
${import_picocolors4.cyan("--html-script")} ${import_picocolors4.dim(import_picocolors4.cyan("<option>"))} Enable HTML scripting with TypeScript
|
|
794
805
|
${import_picocolors4.cyan("--skip")} Skips non required prompts and uses 'none' for all optional configurations
|
|
795
806
|
${import_picocolors4.cyan("--svelte")} ${import_picocolors4.dim(import_picocolors4.cyan("<dir>"))} Directory name for a Svelte frontend
|
|
796
807
|
${import_picocolors4.cyan("--tailwind")} Include Tailwind CSS setup
|
|
@@ -810,13 +821,12 @@ var getOutroMessage = ({
|
|
|
810
821
|
var getDebugMessage = ({
|
|
811
822
|
response: {
|
|
812
823
|
projectName,
|
|
813
|
-
language,
|
|
814
824
|
codeQualityTool,
|
|
815
825
|
directoryConfig,
|
|
816
826
|
useTailwind,
|
|
817
827
|
tailwind,
|
|
818
828
|
frontends,
|
|
819
|
-
|
|
829
|
+
useHTMLScripts,
|
|
820
830
|
frontendDirectories,
|
|
821
831
|
buildDirectory,
|
|
822
832
|
assetsDirectory,
|
|
@@ -831,12 +841,7 @@ var getDebugMessage = ({
|
|
|
831
841
|
},
|
|
832
842
|
packageManager
|
|
833
843
|
}) => {
|
|
834
|
-
const
|
|
835
|
-
js: import_picocolors4.yellow("JavaScript"),
|
|
836
|
-
none: import_picocolors4.dim("None"),
|
|
837
|
-
ts: import_picocolors4.blueBright("TypeScript")
|
|
838
|
-
};
|
|
839
|
-
const htmlScriptingValue = htmlScriptOption ? htmlLabels[htmlScriptOption] : import_picocolors4.dim("None");
|
|
844
|
+
const htmlScriptingValue = useHTMLScripts ? import_picocolors4.blueBright("TypeScript") : import_picocolors4.dim("None");
|
|
840
845
|
const frameworkConfig = frontends.map((name) => `${frontendLabels[name]}: src/frontend/${frontendDirectories[name]}`).join(`
|
|
841
846
|
`);
|
|
842
847
|
const tailwindSection = useTailwind && tailwind ? `Input: ${tailwind.input}
|
|
@@ -846,7 +851,6 @@ Output: ${tailwind.output}` : import_picocolors4.dim("None");
|
|
|
846
851
|
["Project Name", projectName],
|
|
847
852
|
["Package Manager", packageManager],
|
|
848
853
|
["Config Type", isCustomConfig ? import_picocolors4.green("Custom") : import_picocolors4.dim("Default")],
|
|
849
|
-
["Language", language === "ts" ? import_picocolors4.blueBright("TypeScript") : import_picocolors4.yellow("JavaScript")],
|
|
850
854
|
["Linting", codeQualityTool === "eslint+prettier" ? "ESLint + Prettier" : "Biome"],
|
|
851
855
|
["Tailwind Configuration", tailwindSection],
|
|
852
856
|
[frontends.length === 1 ? "Frontend" : "Frontends", frontends.map((name) => frontendLabels[name]).join(", ")],
|
|
@@ -886,7 +890,7 @@ var u2 = (t, n) => V3 ? t : n;
|
|
|
886
890
|
var le2 = u2("◆", "*");
|
|
887
891
|
var L3 = u2("■", "x");
|
|
888
892
|
var W3 = u2("▲", "x");
|
|
889
|
-
var
|
|
893
|
+
var C2 = u2("◇", "o");
|
|
890
894
|
var ue2 = u2("┌", "T");
|
|
891
895
|
var o2 = u2("│", "|");
|
|
892
896
|
var d3 = u2("└", "—");
|
|
@@ -914,15 +918,15 @@ var b2 = (t) => {
|
|
|
914
918
|
case "error":
|
|
915
919
|
return import_picocolors5.default.yellow(W3);
|
|
916
920
|
case "submit":
|
|
917
|
-
return import_picocolors5.default.green(
|
|
921
|
+
return import_picocolors5.default.green(C2);
|
|
918
922
|
}
|
|
919
923
|
};
|
|
920
924
|
var G2 = (t) => {
|
|
921
|
-
const { cursor: n, options:
|
|
925
|
+
const { cursor: n, options: r2, style: i } = t, s = t.maxItems ?? Number.POSITIVE_INFINITY, c = Math.max(process.stdout.rows - 4, 0), a = Math.min(c, Math.max(s, 5));
|
|
922
926
|
let l2 = 0;
|
|
923
|
-
n >= l2 + a - 3 ? l2 = Math.max(Math.min(n - a + 3,
|
|
924
|
-
const $2 = a <
|
|
925
|
-
return
|
|
927
|
+
n >= l2 + a - 3 ? l2 = Math.max(Math.min(n - a + 3, r2.length - a), 0) : n < l2 + 2 && (l2 = Math.max(n - 2, 0));
|
|
928
|
+
const $2 = a < r2.length && l2 > 0, g2 = a < r2.length && l2 + a < r2.length;
|
|
929
|
+
return r2.slice(l2, l2 + a).map((p2, v2, f) => {
|
|
926
930
|
const j2 = v2 === 0 && $2, E = v2 === f.length - 1 && g2;
|
|
927
931
|
return j2 || E ? import_picocolors5.default.dim("...") : i(p2, v2 + l2 === n);
|
|
928
932
|
});
|
|
@@ -930,7 +934,7 @@ var G2 = (t) => {
|
|
|
930
934
|
var he = (t) => new RD({ validate: t.validate, placeholder: t.placeholder, defaultValue: t.defaultValue, initialValue: t.initialValue, render() {
|
|
931
935
|
const n = `${import_picocolors5.default.gray(o2)}
|
|
932
936
|
${b2(this.state)} ${t.message}
|
|
933
|
-
`,
|
|
937
|
+
`, r2 = t.placeholder ? import_picocolors5.default.inverse(t.placeholder[0]) + import_picocolors5.default.dim(t.placeholder.slice(1)) : import_picocolors5.default.inverse(import_picocolors5.default.hidden("_")), i = this.value ? this.valueWithCursor : r2;
|
|
934
938
|
switch (this.state) {
|
|
935
939
|
case "error":
|
|
936
940
|
return `${n.trim()}
|
|
@@ -949,11 +953,11 @@ ${import_picocolors5.default.cyan(d3)}
|
|
|
949
953
|
}
|
|
950
954
|
} }).prompt();
|
|
951
955
|
var ye = (t) => {
|
|
952
|
-
const n = t.active ?? "Yes",
|
|
953
|
-
return new dD({ active: n, inactive:
|
|
956
|
+
const n = t.active ?? "Yes", r2 = t.inactive ?? "No";
|
|
957
|
+
return new dD({ active: n, inactive: r2, initialValue: t.initialValue ?? true, render() {
|
|
954
958
|
const i = `${import_picocolors5.default.gray(o2)}
|
|
955
959
|
${b2(this.state)} ${t.message}
|
|
956
|
-
`, s = this.value ? n :
|
|
960
|
+
`, s = this.value ? n : r2;
|
|
957
961
|
switch (this.state) {
|
|
958
962
|
case "submit":
|
|
959
963
|
return `${i}${import_picocolors5.default.gray(o2)} ${import_picocolors5.default.dim(s)}`;
|
|
@@ -961,20 +965,20 @@ ${b2(this.state)} ${t.message}
|
|
|
961
965
|
return `${i}${import_picocolors5.default.gray(o2)} ${import_picocolors5.default.strikethrough(import_picocolors5.default.dim(s))}
|
|
962
966
|
${import_picocolors5.default.gray(o2)}`;
|
|
963
967
|
default:
|
|
964
|
-
return `${i}${import_picocolors5.default.cyan(o2)} ${this.value ? `${import_picocolors5.default.green(k3)} ${n}` : `${import_picocolors5.default.dim(P3)} ${import_picocolors5.default.dim(n)}`} ${import_picocolors5.default.dim("/")} ${this.value ? `${import_picocolors5.default.dim(P3)} ${import_picocolors5.default.dim(
|
|
968
|
+
return `${i}${import_picocolors5.default.cyan(o2)} ${this.value ? `${import_picocolors5.default.green(k3)} ${n}` : `${import_picocolors5.default.dim(P3)} ${import_picocolors5.default.dim(n)}`} ${import_picocolors5.default.dim("/")} ${this.value ? `${import_picocolors5.default.dim(P3)} ${import_picocolors5.default.dim(r2)}` : `${import_picocolors5.default.green(k3)} ${r2}`}
|
|
965
969
|
${import_picocolors5.default.cyan(d3)}
|
|
966
970
|
`;
|
|
967
971
|
}
|
|
968
972
|
} }).prompt();
|
|
969
973
|
};
|
|
970
974
|
var ve = (t) => {
|
|
971
|
-
const n = (
|
|
972
|
-
const s =
|
|
975
|
+
const n = (r2, i) => {
|
|
976
|
+
const s = r2.label ?? String(r2.value);
|
|
973
977
|
switch (i) {
|
|
974
978
|
case "selected":
|
|
975
979
|
return `${import_picocolors5.default.dim(s)}`;
|
|
976
980
|
case "active":
|
|
977
|
-
return `${import_picocolors5.default.green(k3)} ${s} ${
|
|
981
|
+
return `${import_picocolors5.default.green(k3)} ${s} ${r2.hint ? import_picocolors5.default.dim(`(${r2.hint})`) : ""}`;
|
|
978
982
|
case "cancelled":
|
|
979
983
|
return `${import_picocolors5.default.strikethrough(import_picocolors5.default.dim(s))}`;
|
|
980
984
|
default:
|
|
@@ -982,17 +986,17 @@ var ve = (t) => {
|
|
|
982
986
|
}
|
|
983
987
|
};
|
|
984
988
|
return new LD({ options: t.options, initialValue: t.initialValue, render() {
|
|
985
|
-
const
|
|
989
|
+
const r2 = `${import_picocolors5.default.gray(o2)}
|
|
986
990
|
${b2(this.state)} ${t.message}
|
|
987
991
|
`;
|
|
988
992
|
switch (this.state) {
|
|
989
993
|
case "submit":
|
|
990
|
-
return `${
|
|
994
|
+
return `${r2}${import_picocolors5.default.gray(o2)} ${n(this.options[this.cursor], "selected")}`;
|
|
991
995
|
case "cancel":
|
|
992
|
-
return `${
|
|
996
|
+
return `${r2}${import_picocolors5.default.gray(o2)} ${n(this.options[this.cursor], "cancelled")}
|
|
993
997
|
${import_picocolors5.default.gray(o2)}`;
|
|
994
998
|
default:
|
|
995
|
-
return `${
|
|
999
|
+
return `${r2}${import_picocolors5.default.cyan(o2)} ${G2({ cursor: this.cursor, options: this.options, maxItems: t.maxItems, style: (i, s) => n(i, s ? "active" : "inactive") }).join(`
|
|
996
1000
|
${import_picocolors5.default.cyan(o2)} `)}
|
|
997
1001
|
${import_picocolors5.default.cyan(d3)}
|
|
998
1002
|
`;
|
|
@@ -1000,16 +1004,16 @@ ${import_picocolors5.default.cyan(d3)}
|
|
|
1000
1004
|
} }).prompt();
|
|
1001
1005
|
};
|
|
1002
1006
|
var fe = (t) => {
|
|
1003
|
-
const n = (
|
|
1004
|
-
const s =
|
|
1005
|
-
return i === "active" ? `${import_picocolors5.default.cyan(A3)} ${s} ${
|
|
1007
|
+
const n = (r2, i) => {
|
|
1008
|
+
const s = r2.label ?? String(r2.value);
|
|
1009
|
+
return i === "active" ? `${import_picocolors5.default.cyan(A3)} ${s} ${r2.hint ? import_picocolors5.default.dim(`(${r2.hint})`) : ""}` : i === "selected" ? `${import_picocolors5.default.green(T2)} ${import_picocolors5.default.dim(s)} ${r2.hint ? import_picocolors5.default.dim(`(${r2.hint})`) : ""}` : i === "cancelled" ? `${import_picocolors5.default.strikethrough(import_picocolors5.default.dim(s))}` : i === "active-selected" ? `${import_picocolors5.default.green(T2)} ${s} ${r2.hint ? import_picocolors5.default.dim(`(${r2.hint})`) : ""}` : i === "submitted" ? `${import_picocolors5.default.dim(s)}` : `${import_picocolors5.default.dim(F2)} ${import_picocolors5.default.dim(s)}`;
|
|
1006
1010
|
};
|
|
1007
|
-
return new SD({ options: t.options, initialValues: t.initialValues, required: t.required ?? true, cursorAt: t.cursorAt, validate(
|
|
1008
|
-
if (this.required &&
|
|
1011
|
+
return new SD({ options: t.options, initialValues: t.initialValues, required: t.required ?? true, cursorAt: t.cursorAt, validate(r2) {
|
|
1012
|
+
if (this.required && r2.length === 0)
|
|
1009
1013
|
return `Please select at least one option.
|
|
1010
1014
|
${import_picocolors5.default.reset(import_picocolors5.default.dim(`Press ${import_picocolors5.default.gray(import_picocolors5.default.bgWhite(import_picocolors5.default.inverse(" space ")))} to select, ${import_picocolors5.default.gray(import_picocolors5.default.bgWhite(import_picocolors5.default.inverse(" enter ")))} to submit`))}`;
|
|
1011
1015
|
}, render() {
|
|
1012
|
-
const
|
|
1016
|
+
const r2 = `${import_picocolors5.default.gray(o2)}
|
|
1013
1017
|
${b2(this.state)} ${t.message}
|
|
1014
1018
|
`, i = (s, c) => {
|
|
1015
1019
|
const a = this.value.includes(s.value);
|
|
@@ -1017,23 +1021,23 @@ ${b2(this.state)} ${t.message}
|
|
|
1017
1021
|
};
|
|
1018
1022
|
switch (this.state) {
|
|
1019
1023
|
case "submit":
|
|
1020
|
-
return `${
|
|
1024
|
+
return `${r2}${import_picocolors5.default.gray(o2)} ${this.options.filter(({ value: s }) => this.value.includes(s)).map((s) => n(s, "submitted")).join(import_picocolors5.default.dim(", ")) || import_picocolors5.default.dim("none")}`;
|
|
1021
1025
|
case "cancel": {
|
|
1022
1026
|
const s = this.options.filter(({ value: c }) => this.value.includes(c)).map((c) => n(c, "cancelled")).join(import_picocolors5.default.dim(", "));
|
|
1023
|
-
return `${
|
|
1027
|
+
return `${r2}${import_picocolors5.default.gray(o2)} ${s.trim() ? `${s}
|
|
1024
1028
|
${import_picocolors5.default.gray(o2)}` : ""}`;
|
|
1025
1029
|
}
|
|
1026
1030
|
case "error": {
|
|
1027
1031
|
const s = this.error.split(`
|
|
1028
1032
|
`).map((c, a) => a === 0 ? `${import_picocolors5.default.yellow(d3)} ${import_picocolors5.default.yellow(c)}` : ` ${c}`).join(`
|
|
1029
1033
|
`);
|
|
1030
|
-
return `${
|
|
1034
|
+
return `${r2 + import_picocolors5.default.yellow(o2)} ${G2({ options: this.options, cursor: this.cursor, maxItems: t.maxItems, style: i }).join(`
|
|
1031
1035
|
${import_picocolors5.default.yellow(o2)} `)}
|
|
1032
1036
|
${s}
|
|
1033
1037
|
`;
|
|
1034
1038
|
}
|
|
1035
1039
|
default:
|
|
1036
|
-
return `${
|
|
1040
|
+
return `${r2}${import_picocolors5.default.cyan(o2)} ${G2({ options: this.options, cursor: this.cursor, maxItems: t.maxItems, style: i }).join(`
|
|
1037
1041
|
${import_picocolors5.default.cyan(o2)} `)}
|
|
1038
1042
|
${import_picocolors5.default.cyan(d3)}
|
|
1039
1043
|
`;
|
|
@@ -1047,7 +1051,7 @@ var xe = (t = "") => {
|
|
|
1047
1051
|
};
|
|
1048
1052
|
var J3 = `${import_picocolors5.default.gray(o2)} `;
|
|
1049
1053
|
var Y2 = ({ indicator: t = "dots" } = {}) => {
|
|
1050
|
-
const n = V3 ? ["◒", "◐", "◓", "◑"] : ["•", "o", "O", "0"],
|
|
1054
|
+
const n = V3 ? ["◒", "◐", "◓", "◑"] : ["•", "o", "O", "0"], r2 = V3 ? 80 : 120, i = process.env.CI === "true";
|
|
1051
1055
|
let s, c, a = false, l2 = "", $2, g2 = performance.now();
|
|
1052
1056
|
const p2 = (m2) => {
|
|
1053
1057
|
const h2 = m2 > 1 ? "Something went wrong" : "Canceled";
|
|
@@ -1085,10 +1089,10 @@ var Y2 = ({ indicator: t = "dots" } = {}) => {
|
|
|
1085
1089
|
process.stdout.write(`${I2} ${l2}${z2}`);
|
|
1086
1090
|
}
|
|
1087
1091
|
h2 = h2 + 1 < n.length ? h2 + 1 : 0, w2 = w2 < n.length ? w2 + 0.125 : 0;
|
|
1088
|
-
},
|
|
1092
|
+
}, r2);
|
|
1089
1093
|
}, N2 = (m2 = "", h2 = 0) => {
|
|
1090
1094
|
a = false, clearInterval(c), B2();
|
|
1091
|
-
const w2 = h2 === 0 ? import_picocolors5.default.green(
|
|
1095
|
+
const w2 = h2 === 0 ? import_picocolors5.default.green(C2) : h2 === 1 ? import_picocolors5.default.red(L3) : import_picocolors5.default.red(W3);
|
|
1092
1096
|
l2 = R2(m2 ?? l2), t === "timer" ? process.stdout.write(`${w2} ${l2} ${O2(g2)}
|
|
1093
1097
|
`) : process.stdout.write(`${w2} ${l2}
|
|
1094
1098
|
`), E(), s();
|
|
@@ -1322,14 +1326,12 @@ var getFrontendDirectoryConfigurations = async (directoryConfiguration, frontend
|
|
|
1322
1326
|
};
|
|
1323
1327
|
|
|
1324
1328
|
// src/typeGuards.ts
|
|
1325
|
-
var isLanguage = (value) => value === "ts" || value === "js";
|
|
1326
1329
|
var isAuthProvider = (value) => value === "absoluteAuth" || value === "none" || value === undefined;
|
|
1327
1330
|
var isDirectoryConfig = (value) => value === "default" || value === "custom";
|
|
1328
1331
|
var isDatabaseEngine = (value) => value === "postgresql" || value === "mysql" || value === "sqlite" || value === "mongodb" || value === "redis" || value === "singlestore" || value === "cockroachdb" || value === "mssql" || value === "none" || value === undefined;
|
|
1329
1332
|
var isDatabaseHost = (value) => value === "neon" || value === "planetscale" || value === "supabase" || value === "turso" || value === "vercel" || value === "upstash" || value === "atlas" || value === undefined;
|
|
1330
1333
|
var isORM = (value) => value === "drizzle" || value === "prisma" || value === undefined;
|
|
1331
1334
|
var isCodeQualityTool = (value) => value === "eslint+prettier" || value === "biome" || value === undefined;
|
|
1332
|
-
var isHTMLScriptOption = (value) => value === "ts" || value === "js" || value === "ts+ssr" || value === "js+ssr" || value === "none" || value === undefined;
|
|
1333
1335
|
var isFrontend = (value) => value !== undefined && Object.keys(frontendLabels).includes(value);
|
|
1334
1336
|
|
|
1335
1337
|
// src/questions/frontends.ts
|
|
@@ -1347,13 +1349,13 @@ var getFrontends = async () => {
|
|
|
1347
1349
|
};
|
|
1348
1350
|
|
|
1349
1351
|
// src/questions/htmlScriptingOption.ts
|
|
1350
|
-
var getHtmlScriptingOption = async (
|
|
1352
|
+
var getHtmlScriptingOption = async () => {
|
|
1351
1353
|
const useScripts = await ye({
|
|
1352
1354
|
message: "Would you like to use scripts for your HTML pages?"
|
|
1353
1355
|
});
|
|
1354
1356
|
if (pD(useScripts))
|
|
1355
1357
|
abort();
|
|
1356
|
-
return useScripts
|
|
1358
|
+
return useScripts;
|
|
1357
1359
|
};
|
|
1358
1360
|
|
|
1359
1361
|
// src/questions/initializeGitNow.ts
|
|
@@ -1376,30 +1378,15 @@ var getInstallDependencies = async () => {
|
|
|
1376
1378
|
return installDependenciesNow;
|
|
1377
1379
|
};
|
|
1378
1380
|
|
|
1379
|
-
// src/questions/language.ts
|
|
1380
|
-
var import_picocolors11 = __toESM(require_picocolors(), 1);
|
|
1381
|
-
var getLanguage = async () => {
|
|
1382
|
-
const language = await ve({
|
|
1383
|
-
message: "Language:",
|
|
1384
|
-
options: [
|
|
1385
|
-
{ label: import_picocolors11.blueBright("TypeScript"), value: "ts" },
|
|
1386
|
-
{ label: import_picocolors11.yellow("JavaScript"), value: "js" }
|
|
1387
|
-
]
|
|
1388
|
-
});
|
|
1389
|
-
if (pD(language))
|
|
1390
|
-
abort();
|
|
1391
|
-
return language;
|
|
1392
|
-
};
|
|
1393
|
-
|
|
1394
1381
|
// src/questions/orm.ts
|
|
1395
|
-
var
|
|
1382
|
+
var import_picocolors11 = __toESM(require_picocolors(), 1);
|
|
1396
1383
|
var getORM = async () => {
|
|
1397
1384
|
const orm = await ve({
|
|
1398
1385
|
message: "Choose an ORM (optional):",
|
|
1399
1386
|
options: [
|
|
1400
1387
|
{ label: "None", value: "none" },
|
|
1401
|
-
{ label:
|
|
1402
|
-
{ label:
|
|
1388
|
+
{ label: import_picocolors11.cyan("Drizzle"), value: "drizzle" },
|
|
1389
|
+
{ label: import_picocolors11.magenta("Prisma"), value: "prisma" }
|
|
1403
1390
|
]
|
|
1404
1391
|
});
|
|
1405
1392
|
if (pD(orm))
|
|
@@ -1427,7 +1414,7 @@ var getProjectName = async () => {
|
|
|
1427
1414
|
});
|
|
1428
1415
|
if (pD(projectName))
|
|
1429
1416
|
abort();
|
|
1430
|
-
return projectName;
|
|
1417
|
+
return projectName ?? "absolutejs-project";
|
|
1431
1418
|
};
|
|
1432
1419
|
|
|
1433
1420
|
// src/questions/useTailwind.ts
|
|
@@ -1441,11 +1428,10 @@ var getUseTailwind = async () => {
|
|
|
1441
1428
|
// src/prompt.ts
|
|
1442
1429
|
var prompt = async (argumentConfiguration) => {
|
|
1443
1430
|
const projectName = argumentConfiguration.projectName ?? await getProjectName();
|
|
1444
|
-
const language = argumentConfiguration.language ?? await getLanguage();
|
|
1445
1431
|
const codeQualityTool = argumentConfiguration.codeQualityTool ?? await getCodeQualityTool();
|
|
1446
1432
|
const useTailwind = argumentConfiguration.useTailwind ?? await getUseTailwind();
|
|
1447
1433
|
const frontends = argumentConfiguration.frontends?.filter((frontend) => frontend !== undefined) ?? await getFrontends();
|
|
1448
|
-
const
|
|
1434
|
+
const useHTMLScripts = !frontends.includes("html") || argumentConfiguration.useHTMLScripts === undefined ? false : argumentConfiguration.useHTMLScripts ?? await getHtmlScriptingOption();
|
|
1449
1435
|
const databaseEngine = argumentConfiguration.databaseEngine ?? await getDatabaseEngine();
|
|
1450
1436
|
const databaseHost = argumentConfiguration.databaseHost ?? await getDatabaseHost(databaseEngine);
|
|
1451
1437
|
const orm = databaseEngine !== undefined && databaseEngine !== "none" ? argumentConfiguration.orm ?? await getORM() : undefined;
|
|
@@ -1474,28 +1460,27 @@ var prompt = async (argumentConfiguration) => {
|
|
|
1474
1460
|
directoryConfig,
|
|
1475
1461
|
frontendDirectories,
|
|
1476
1462
|
frontends,
|
|
1477
|
-
htmlScriptOption,
|
|
1478
1463
|
initializeGitNow,
|
|
1479
1464
|
installDependenciesNow,
|
|
1480
|
-
language,
|
|
1481
1465
|
orm,
|
|
1482
1466
|
plugins,
|
|
1483
1467
|
projectName,
|
|
1484
1468
|
tailwind,
|
|
1469
|
+
useHTMLScripts,
|
|
1485
1470
|
useTailwind
|
|
1486
1471
|
};
|
|
1487
1472
|
return values;
|
|
1488
1473
|
};
|
|
1489
1474
|
|
|
1490
1475
|
// src/scaffold.ts
|
|
1491
|
-
import { copyFileSync as
|
|
1492
|
-
import { join as
|
|
1476
|
+
import { copyFileSync as copyFileSync8 } from "node:fs";
|
|
1477
|
+
import { join as join12, dirname } from "node:path";
|
|
1493
1478
|
import { fileURLToPath } from "node:url";
|
|
1494
1479
|
|
|
1495
1480
|
// src/commands/formatProject.ts
|
|
1496
1481
|
import { execSync } from "child_process";
|
|
1497
1482
|
import { exit as exit2 } from "process";
|
|
1498
|
-
var
|
|
1483
|
+
var import_picocolors12 = __toESM(require_picocolors(), 1);
|
|
1499
1484
|
|
|
1500
1485
|
// src/utils/commandMaps.ts
|
|
1501
1486
|
var formatCommands = {
|
|
@@ -1521,9 +1506,9 @@ var formatProject = ({
|
|
|
1521
1506
|
const fmt = formatCommands[packageManager] ?? "bun run format";
|
|
1522
1507
|
spin.start("Formatting files…");
|
|
1523
1508
|
execSync(fmt, { cwd: projectName, stdio: "pipe" });
|
|
1524
|
-
spin.stop(
|
|
1509
|
+
spin.stop(import_picocolors12.green("Files formatted"));
|
|
1525
1510
|
} catch (err) {
|
|
1526
|
-
spin.stop(
|
|
1511
|
+
spin.stop(import_picocolors12.red("Failed to format files"), 1);
|
|
1527
1512
|
console.error("Error formatting:", err);
|
|
1528
1513
|
exit2(1);
|
|
1529
1514
|
}
|
|
@@ -1532,7 +1517,7 @@ var formatProject = ({
|
|
|
1532
1517
|
// src/commands/installDependencies.ts
|
|
1533
1518
|
import { execSync as execSync2 } from "child_process";
|
|
1534
1519
|
import { exit as exit3 } from "process";
|
|
1535
|
-
var
|
|
1520
|
+
var import_picocolors13 = __toESM(require_picocolors(), 1);
|
|
1536
1521
|
var installDependencies = async ({
|
|
1537
1522
|
projectName,
|
|
1538
1523
|
packageManager
|
|
@@ -1542,16 +1527,16 @@ var installDependencies = async ({
|
|
|
1542
1527
|
try {
|
|
1543
1528
|
spin.start("Installing dependencies…");
|
|
1544
1529
|
execSync2(cmd, { cwd: projectName, stdio: "pipe" });
|
|
1545
|
-
spin.stop(
|
|
1530
|
+
spin.stop(import_picocolors13.green("Dependencies installed"));
|
|
1546
1531
|
} catch (err) {
|
|
1547
|
-
spin.stop(
|
|
1532
|
+
spin.stop(import_picocolors13.red("Installation failed"), 1);
|
|
1548
1533
|
console.error("Error installing dependencies:", err);
|
|
1549
1534
|
exit3(1);
|
|
1550
1535
|
}
|
|
1551
1536
|
};
|
|
1552
1537
|
|
|
1553
1538
|
// src/generators/configurations/addConfigurationFiles.ts
|
|
1554
|
-
var
|
|
1539
|
+
var import_picocolors14 = __toESM(require_picocolors(), 1);
|
|
1555
1540
|
import { copyFileSync, writeFileSync } from "fs";
|
|
1556
1541
|
import { join } from "path";
|
|
1557
1542
|
|
|
@@ -1575,34 +1560,32 @@ var generatePrettierrc = (frontends) => {
|
|
|
1575
1560
|
var addConfigurationFiles = ({
|
|
1576
1561
|
tailwind,
|
|
1577
1562
|
templatesDirectory,
|
|
1578
|
-
language,
|
|
1579
1563
|
codeQualityTool,
|
|
1580
1564
|
frontends,
|
|
1581
1565
|
initializeGitNow,
|
|
1582
1566
|
projectName
|
|
1583
1567
|
}) => {
|
|
1568
|
+
copyFileSync(join(templatesDirectory, "configurations", "tsconfig.example.json"), join(projectName, "tsconfig.json"));
|
|
1584
1569
|
if (tailwind) {
|
|
1585
1570
|
copyFileSync(join(templatesDirectory, "tailwind", "postcss.config.ts"), join(projectName, "postcss.config.ts"));
|
|
1586
1571
|
copyFileSync(join(templatesDirectory, "tailwind", "tailwind.config.ts"), join(projectName, "tailwind.config.ts"));
|
|
1587
1572
|
}
|
|
1588
1573
|
if (initializeGitNow)
|
|
1589
1574
|
copyFileSync(join(templatesDirectory, "git", "gitignore"), join(projectName, ".gitignore"));
|
|
1590
|
-
if (language === "ts")
|
|
1591
|
-
copyFileSync(join(templatesDirectory, "configurations", "tsconfig.example.json"), join(projectName, "tsconfig.json"));
|
|
1592
1575
|
if (codeQualityTool === "eslint+prettier") {
|
|
1593
1576
|
copyFileSync(join(templatesDirectory, "configurations", "eslint.config.mjs"), join(projectName, "eslint.config.mjs"));
|
|
1594
1577
|
copyFileSync(join(templatesDirectory, "configurations", ".prettierignore"), join(projectName, ".prettierignore"));
|
|
1595
1578
|
const prettierrc = generatePrettierrc(frontends);
|
|
1596
1579
|
writeFileSync(join(projectName, ".prettierrc.json"), prettierrc);
|
|
1597
1580
|
} else
|
|
1598
|
-
console.warn(`${
|
|
1599
|
-
${
|
|
1581
|
+
console.warn(`${import_picocolors14.dim("│")}
|
|
1582
|
+
${import_picocolors14.yellow("▲")} Biome support not implemented yet`);
|
|
1600
1583
|
};
|
|
1601
1584
|
|
|
1602
1585
|
// src/generators/configurations/generatePackageJson.ts
|
|
1603
1586
|
import { writeFileSync as writeFileSync2 } from "fs";
|
|
1604
1587
|
import { join as join2 } from "path";
|
|
1605
|
-
var
|
|
1588
|
+
var import_picocolors15 = __toESM(require_picocolors(), 1);
|
|
1606
1589
|
|
|
1607
1590
|
// src/utils/getPackageVersion.ts
|
|
1608
1591
|
import { execSync as execSync3 } from "child_process";
|
|
@@ -1632,8 +1615,10 @@ var createPackageJson = ({
|
|
|
1632
1615
|
const resolveVersion = (name, listed) => latest ? getPackageVersion(name) ?? listed : listed;
|
|
1633
1616
|
const dependencies = {};
|
|
1634
1617
|
const devDependencies = {};
|
|
1635
|
-
const
|
|
1636
|
-
const
|
|
1618
|
+
const requiresReact = frontendDirectories["react"] !== undefined;
|
|
1619
|
+
const requiresSvelte = frontendDirectories["svelte"] !== undefined;
|
|
1620
|
+
const requiresVue = frontendDirectories["vue"] !== undefined;
|
|
1621
|
+
const requiresHtmx = frontendDirectories["htmx"] !== undefined;
|
|
1637
1622
|
for (const p2 of defaultPlugins) {
|
|
1638
1623
|
dependencies[p2.value] = resolveVersion(p2.value, p2.latestVersion);
|
|
1639
1624
|
}
|
|
@@ -1657,20 +1642,26 @@ var createPackageJson = ({
|
|
|
1657
1642
|
devDependencies["tailwindcss"] = resolveVersion("tailwindcss", "4.1.7");
|
|
1658
1643
|
devDependencies["@tailwindcss/cli"] = resolveVersion("@tailwindcss/cli", "4.1.7");
|
|
1659
1644
|
}
|
|
1660
|
-
if (
|
|
1645
|
+
if (requiresReact) {
|
|
1661
1646
|
dependencies["react"] = resolveVersion("react", "19.1.0");
|
|
1662
1647
|
dependencies["react-dom"] = resolveVersion("react-dom", "19.1.0");
|
|
1663
1648
|
devDependencies["@types/react"] = resolveVersion("@types/react", "19.1.5");
|
|
1664
1649
|
devDependencies["@types/react-dom"] = resolveVersion("@types/react-dom", "19.1.5");
|
|
1665
1650
|
}
|
|
1666
|
-
if (
|
|
1651
|
+
if (requiresSvelte) {
|
|
1667
1652
|
dependencies["svelte"] = resolveVersion("svelte", "5.34.7");
|
|
1668
1653
|
codeQualityTool === "eslint+prettier" && (devDependencies["prettier-plugin-svelte"] = resolveVersion("prettier-plugin-svelte", "3.4.0"));
|
|
1669
1654
|
}
|
|
1670
|
-
|
|
1655
|
+
if (requiresVue) {
|
|
1656
|
+
dependencies["vue"] = resolveVersion("vue", "3.5.17");
|
|
1657
|
+
}
|
|
1658
|
+
if (requiresHtmx) {
|
|
1659
|
+
dependencies["elysia-scoped-state"] = resolveVersion("elysia-scoped-state", "0.1.1");
|
|
1660
|
+
}
|
|
1661
|
+
latest && s.stop(import_picocolors15.green("Package versions resolved"));
|
|
1671
1662
|
const scripts = {
|
|
1672
|
-
dev: "bun run src/backend/server.ts",
|
|
1673
|
-
format: `prettier --write "./**/*.{js,ts,css,json,mjs,md${
|
|
1663
|
+
dev: "bun run --watch src/backend/server.ts",
|
|
1664
|
+
format: `prettier --write "./**/*.{js,ts,css,json,mjs,md${requiresReact ? ",jsx,tsx" : ""}${requiresSvelte ? ",svelte" : ""}${requiresVue ? ",vue" : ""}}"`,
|
|
1674
1665
|
lint: "eslint ./src",
|
|
1675
1666
|
test: 'echo "Error: no test specified" && exit 1',
|
|
1676
1667
|
typecheck: "bun run tsc --noEmit"
|
|
@@ -1681,35 +1672,41 @@ var createPackageJson = ({
|
|
|
1681
1672
|
name: projectName,
|
|
1682
1673
|
scripts,
|
|
1683
1674
|
type: "module",
|
|
1684
|
-
version: "0.
|
|
1675
|
+
version: "0.0.0"
|
|
1685
1676
|
};
|
|
1686
1677
|
writeFileSync2(join2(projectName, "package.json"), JSON.stringify(packageJson));
|
|
1687
1678
|
};
|
|
1688
1679
|
|
|
1689
1680
|
// src/generators/configurations/initializeRoot.ts
|
|
1690
|
-
import { copyFileSync as copyFileSync2,
|
|
1681
|
+
import { copyFileSync as copyFileSync2, existsSync, mkdirSync } from "node:fs";
|
|
1691
1682
|
import { join as join3 } from "node:path";
|
|
1692
1683
|
var initalizeRoot = (projectName, templatesDirectory) => {
|
|
1693
|
-
if (existsSync(projectName))
|
|
1684
|
+
if (existsSync(projectName)) {
|
|
1694
1685
|
throw new Error(`Cannot create project "${projectName}": directory already exists.`);
|
|
1686
|
+
}
|
|
1695
1687
|
mkdirSync(projectName);
|
|
1696
1688
|
const srcDir = join3(projectName, "src");
|
|
1697
1689
|
mkdirSync(srcDir);
|
|
1698
|
-
|
|
1690
|
+
mkdirSync(join3(srcDir, "types"));
|
|
1691
|
+
const constantsSrc = join3(templatesDirectory, "constants.ts");
|
|
1692
|
+
const constantsDest = join3(srcDir, "constants.ts");
|
|
1693
|
+
copyFileSync2(constantsSrc, constantsDest);
|
|
1699
1694
|
const frontendDirectory = join3(srcDir, "frontend");
|
|
1700
1695
|
const backendDirectory = join3(srcDir, "backend");
|
|
1701
1696
|
mkdirSync(frontendDirectory);
|
|
1702
1697
|
mkdirSync(backendDirectory);
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1698
|
+
const projectAssetsDirectory = join3(backendDirectory, "assets");
|
|
1699
|
+
mkdirSync(projectAssetsDirectory);
|
|
1700
|
+
mkdirSync(join3(projectAssetsDirectory, "ico"), { recursive: true });
|
|
1701
|
+
mkdirSync(join3(projectAssetsDirectory, "png"), { recursive: true });
|
|
1702
|
+
mkdirSync(join3(projectAssetsDirectory, "svg"), { recursive: true });
|
|
1703
|
+
copyFileSync2(join3(templatesDirectory, "assets", "ico", "favicon.ico"), join3(projectAssetsDirectory, "ico", "favicon.ico"));
|
|
1704
|
+
copyFileSync2(join3(templatesDirectory, "assets", "png", "absolutejs-temp.png"), join3(projectAssetsDirectory, "png", "absolutejs-temp.png"));
|
|
1705
|
+
return { backendDirectory, frontendDirectory, projectAssetsDirectory };
|
|
1709
1706
|
};
|
|
1710
1707
|
|
|
1711
1708
|
// src/generators/db/scaffoldDatabase.ts
|
|
1712
|
-
var
|
|
1709
|
+
var import_picocolors16 = __toESM(require_picocolors(), 1);
|
|
1713
1710
|
import { mkdirSync as mkdirSync2 } from "fs";
|
|
1714
1711
|
import { join as join5 } from "path";
|
|
1715
1712
|
|
|
@@ -1738,15 +1735,15 @@ var scaffoldDatabase = ({
|
|
|
1738
1735
|
}) => {
|
|
1739
1736
|
mkdirSync2(join5(projectName, databaseDirectory), { recursive: true });
|
|
1740
1737
|
if (databaseEngine !== "postgresql" && databaseEngine !== "none") {
|
|
1741
|
-
console.warn(`${
|
|
1742
|
-
${
|
|
1738
|
+
console.warn(`${import_picocolors16.dim("│")}
|
|
1739
|
+
${import_picocolors16.yellow("▲")} Only PostgreSQL support is implemented so far`);
|
|
1743
1740
|
}
|
|
1744
1741
|
if (orm === "drizzle") {
|
|
1745
1742
|
createDrizzleConfig({ databaseEngine, projectName });
|
|
1746
1743
|
}
|
|
1747
1744
|
if (orm === "prisma") {
|
|
1748
|
-
console.warn(`${
|
|
1749
|
-
${
|
|
1745
|
+
console.warn(`${import_picocolors16.dim("│")}
|
|
1746
|
+
${import_picocolors16.yellow("▲")} Prisma support is not implemented yet`);
|
|
1750
1747
|
}
|
|
1751
1748
|
};
|
|
1752
1749
|
|
|
@@ -1772,30 +1769,46 @@ var createServerFile = ({
|
|
|
1772
1769
|
const htmlDirectory = frontendDirectories["html"];
|
|
1773
1770
|
const reactDirectory = frontendDirectories["react"];
|
|
1774
1771
|
const svelteDirectory = frontendDirectories["svelte"];
|
|
1772
|
+
const vueDirectory = frontendDirectories["vue"];
|
|
1773
|
+
const htmxDirectory = frontendDirectories["htmx"];
|
|
1775
1774
|
const requiresHtml = htmlDirectory !== undefined;
|
|
1776
1775
|
const requiresReact = reactDirectory !== undefined;
|
|
1777
1776
|
const requiresSvelte = svelteDirectory !== undefined;
|
|
1777
|
+
const requiresVue = vueDirectory !== undefined;
|
|
1778
|
+
const requiresHtmx = htmxDirectory !== undefined;
|
|
1779
|
+
const nonFrameworkOnly = (requiresHtml || requiresHtmx) && !requiresReact && !requiresSvelte && !requiresVue;
|
|
1778
1780
|
const selectedCustomPlugins = availablePlugins2.filter(({ value }) => plugins.indexOf(value) !== UNFOUND_INDEX);
|
|
1779
1781
|
const authenticationPlugins = authProvider === "absoluteAuth" ? [absoluteAuthPlugin] : [];
|
|
1782
|
+
const htmxPlugins = requiresHtmx ? [scopedStatePlugin] : [];
|
|
1780
1783
|
const allDependencies = [
|
|
1781
1784
|
...defaultDependencies,
|
|
1782
1785
|
...defaultPlugins,
|
|
1783
1786
|
...selectedCustomPlugins,
|
|
1784
|
-
...authenticationPlugins
|
|
1787
|
+
...authenticationPlugins,
|
|
1788
|
+
...htmxPlugins
|
|
1785
1789
|
];
|
|
1786
1790
|
const uniqueDependencies = Array.from(new Map(allDependencies.map((dependency) => [dependency.value, dependency])).values()).sort((a, b3) => a.value.localeCompare(b3.value));
|
|
1787
|
-
const importLines = uniqueDependencies.flatMap(({ value, imports }) =>
|
|
1788
|
-
|
|
1789
|
-
|
|
1791
|
+
const importLines = uniqueDependencies.flatMap(({ value, imports }) => {
|
|
1792
|
+
const filteredImports = nonFrameworkOnly && imports ? imports.filter(({ packageName }) => packageName !== "asset") : imports;
|
|
1793
|
+
return filteredImports && filteredImports.length > 0 ? [
|
|
1794
|
+
`import { ${filteredImports.map(({ packageName }) => packageName).join(", ")} } from '${value}';`
|
|
1795
|
+
] : [];
|
|
1796
|
+
});
|
|
1790
1797
|
const absoluteImportIdx = importLines.findIndex((line) => line.includes("from '@absolutejs/absolute'"));
|
|
1791
1798
|
if (absoluteImportIdx !== UNFOUND_INDEX && importLines[absoluteImportIdx]) {
|
|
1792
1799
|
const existingItems = importLines[absoluteImportIdx].replace(/import\s*\{\s*|\}\s*from.*$/g, "").split(",").map((item) => item.trim()).filter((value) => value.length > 0);
|
|
1793
1800
|
const additionalItems = [
|
|
1794
1801
|
requiresHtml && !existingItems.includes("handleHTMLPageRequest") && "handleHTMLPageRequest",
|
|
1795
1802
|
requiresReact && !existingItems.includes("handleReactPageRequest") && "handleReactPageRequest",
|
|
1796
|
-
requiresSvelte && !existingItems.includes("handleSveltePageRequest") && "handleSveltePageRequest"
|
|
1803
|
+
requiresSvelte && !existingItems.includes("handleSveltePageRequest") && "handleSveltePageRequest",
|
|
1804
|
+
requiresVue && !existingItems.includes("handleVuePageRequest") && "handleVuePageRequest",
|
|
1805
|
+
requiresVue && !existingItems.includes("generateHeadElement") && "generateHeadElement",
|
|
1806
|
+
requiresHtmx && !existingItems.includes("handleHTMXPageRequest") && "handleHTMXPageRequest"
|
|
1797
1807
|
].filter((value) => typeof value === "string");
|
|
1798
|
-
importLines[absoluteImportIdx] = `import { ${[
|
|
1808
|
+
importLines[absoluteImportIdx] = `import { ${[
|
|
1809
|
+
...existingItems,
|
|
1810
|
+
...additionalItems
|
|
1811
|
+
].join(", ")} } from '@absolutejs/absolute';`;
|
|
1799
1812
|
}
|
|
1800
1813
|
if (reactDirectory !== undefined) {
|
|
1801
1814
|
const reactImportSource = reactDirectory === "" ? "../frontend/pages/ReactExample" : `../frontend/${reactDirectory}/pages/ReactExample`;
|
|
@@ -1805,6 +1818,10 @@ var createServerFile = ({
|
|
|
1805
1818
|
const svelteImportSource = svelteDirectory === "" ? "../frontend/pages/SvelteExample" : `../frontend/${svelteDirectory}/pages/SvelteExample`;
|
|
1806
1819
|
importLines.push(`import SvelteExample from '${svelteImportSource}.svelte';`);
|
|
1807
1820
|
}
|
|
1821
|
+
if (requiresVue) {
|
|
1822
|
+
const vueImportSource = vueDirectory === "" ? "../frontend/pages/VueExample" : `../frontend/${vueDirectory}/pages/VueExample`;
|
|
1823
|
+
importLines.push(`import VueExample from '${vueImportSource}.vue';`);
|
|
1824
|
+
}
|
|
1808
1825
|
const useStatements = uniqueDependencies.flatMap(({ imports }) => imports ?? []).filter((entry) => entry.isPlugin).map((entry) => {
|
|
1809
1826
|
if (entry.config === undefined)
|
|
1810
1827
|
return `.use(${entry.packageName})`;
|
|
@@ -1818,40 +1835,53 @@ var createServerFile = ({
|
|
|
1818
1835
|
...Object.entries(frontendDirectories).map(([frameworkName, directory]) => `${frameworkName}Directory: './src/frontend/${directory}'`),
|
|
1819
1836
|
tailwind ? `tailwind: ${JSON.stringify(tailwind)}` : ""
|
|
1820
1837
|
].filter(Boolean);
|
|
1821
|
-
const manifestDeclaration =
|
|
1838
|
+
const manifestDeclaration = `${nonFrameworkOnly ? "" : "const manifest = "}await build({
|
|
1822
1839
|
${manifestOptions.join(`,
|
|
1823
1840
|
`)}
|
|
1824
1841
|
});`;
|
|
1825
|
-
const
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
|
|
1842
|
+
const routesData = Object.entries(frontendDirectories).reduce((acc, [frameworkName, directory], index) => {
|
|
1843
|
+
let handler;
|
|
1844
|
+
switch (frameworkName) {
|
|
1845
|
+
case "html":
|
|
1846
|
+
handler = `handleHTMLPageRequest(\`${buildDirectory}${directory ? `/${directory}` : ""}/pages/HTMLExample.html\`)`;
|
|
1847
|
+
break;
|
|
1848
|
+
case "react":
|
|
1849
|
+
handler = `handleReactPageRequest(ReactExample, asset(manifest, 'ReactExampleIndex'), { initialCount: 0, cssPath: asset(manifest, 'ReactExampleCSS') })`;
|
|
1850
|
+
break;
|
|
1851
|
+
case "svelte":
|
|
1852
|
+
handler = `handleSveltePageRequest(SvelteExample, asset(manifest, 'SvelteExample'), asset(manifest, 'SvelteExampleIndex'), { initialCount: 0, cssPath: asset(manifest, 'SvelteExampleCSS') })`;
|
|
1853
|
+
break;
|
|
1854
|
+
case "vue":
|
|
1855
|
+
handler = `handleVuePageRequest(VueExample, asset(manifest, 'VueExample'), asset(manifest, 'VueExampleIndex'), generateHeadElement({ cssPath: asset(manifest, 'VueExampleCSS'), title: 'AbsoluteJS + Vue' }), { initialCount: 0 })`;
|
|
1856
|
+
break;
|
|
1857
|
+
case "htmx":
|
|
1858
|
+
handler = `handleHTMXPageRequest(\`${buildDirectory}${directory ? `/${directory}` : ""}/pages/HTMXExample.html\`)`;
|
|
1859
|
+
if (index === 0) {
|
|
1860
|
+
acc.indexRoute = `.get('/', () => ${handler})`;
|
|
1861
|
+
}
|
|
1862
|
+
acc.otherRoutes.push(`.post('/htmx/reset', ({ resetScopedStore }) => resetScopedStore())`, `.get('/htmx/count', ({ scopedStore }) => scopedStore.count)`, `.post('/htmx/increment', ({ scopedStore }) => ++scopedStore.count)`, `.get('htmx', () => ${handler})`);
|
|
1863
|
+
return acc;
|
|
1864
|
+
default:
|
|
1865
|
+
return acc;
|
|
1838
1866
|
}
|
|
1839
|
-
if (
|
|
1840
|
-
|
|
1867
|
+
if (index === 0) {
|
|
1868
|
+
acc.indexRoute = `.get('/', () => ${handler})`;
|
|
1841
1869
|
}
|
|
1842
|
-
|
|
1843
|
-
|
|
1870
|
+
acc.otherRoutes.push(`.get('${frameworkName}', () => ${handler})`);
|
|
1871
|
+
return acc;
|
|
1872
|
+
}, { indexRoute: null, otherRoutes: [] });
|
|
1873
|
+
const routes = [routesData.indexRoute ?? "", ...routesData.otherRoutes].filter(Boolean).join(`
|
|
1844
1874
|
`);
|
|
1875
|
+
const useLines = useStatements.map((s) => ` ${s}`).join(`
|
|
1876
|
+
`);
|
|
1845
1877
|
const serverFileContent = `${importLines.join(`
|
|
1846
1878
|
`)}
|
|
1847
1879
|
|
|
1848
1880
|
${manifestDeclaration}
|
|
1849
1881
|
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
${useStatements.map((s) => ` ${s}`).join(`
|
|
1854
|
-
`)}
|
|
1882
|
+
new Elysia()
|
|
1883
|
+
${useLines}
|
|
1884
|
+
${routes}
|
|
1855
1885
|
.on('error', (err) => {
|
|
1856
1886
|
const { request } = err;
|
|
1857
1887
|
console.error(\`Server error on \${request.method} \${request.url}: \${err.message}\`);
|
|
@@ -1861,352 +1891,256 @@ ${useStatements.map((s) => ` ${s}`).join(`
|
|
|
1861
1891
|
};
|
|
1862
1892
|
|
|
1863
1893
|
// src/generators/project/scaffoldFrontends.ts
|
|
1864
|
-
import {
|
|
1865
|
-
import { join as
|
|
1894
|
+
import { cpSync as cpSync6, mkdirSync as mkdirSync7 } from "node:fs";
|
|
1895
|
+
import { join as join11 } from "node:path";
|
|
1866
1896
|
|
|
1867
1897
|
// src/generators/html/scaffoldHTML.ts
|
|
1868
|
-
import { mkdirSync as mkdirSync3, writeFileSync as writeFileSync5 } from "fs";
|
|
1869
|
-
import { join as join6 } from "path";
|
|
1870
|
-
|
|
1871
|
-
// src/generators/
|
|
1872
|
-
var
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
<link rel="stylesheet" type="text/css" href="/assets/css/HtmlHome.css">
|
|
1884
|
-
<link rel="icon" href="/assets/ico/favicon.ico" />
|
|
1885
|
-
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
1886
|
-
</head>
|
|
1887
|
-
<body>
|
|
1888
|
-
<header>
|
|
1889
|
-
<img id="logo" src="/assets/svg/brand_logo.svg" alt="AbsoluteJS Logo">
|
|
1890
|
-
<h1 id="greeting"></h1>
|
|
1891
|
-
</header>
|
|
1892
|
-
<main>
|
|
1893
|
-
<p>Welcome to AbsoluteJS, the next generation JavaScript framework. We're glad you're here.</p>
|
|
1894
|
-
<button id="counter-button">Click me!</button>
|
|
1895
|
-
<p id="counter">0</p>
|
|
1896
|
-
<nav id="links">
|
|
1897
|
-
<a href="/react" id="react-link">React</a>
|
|
1898
|
-
<a href="/vue" id="vue-link">Vue</a>
|
|
1899
|
-
<a href="/angular" id="angular-link">Angular</a>
|
|
1900
|
-
<a href="/svelte" id="svelte-link">Svelte</a>
|
|
1901
|
-
<a href="/ember" id="ember-link">Ember</a>
|
|
1902
|
-
<a href="/htmx" id="htmx-link">HTMX</a>
|
|
1903
|
-
</nav>
|
|
1904
|
-
</main>
|
|
1905
|
-
<footer>
|
|
1906
|
-
<p id="footer-text"></p>
|
|
1907
|
-
</footer>${scriptTag ? `
|
|
1908
|
-
${scriptTag}` : ""}
|
|
1909
|
-
</body>
|
|
1910
|
-
</html>`;
|
|
1911
|
-
};
|
|
1898
|
+
import { copyFileSync as copyFileSync3, cpSync, mkdirSync as mkdirSync3, writeFileSync as writeFileSync5 } from "node:fs";
|
|
1899
|
+
import { join as join6 } from "node:path";
|
|
1900
|
+
|
|
1901
|
+
// src/generators/project/generateMarkupCSS.ts
|
|
1902
|
+
var generateMarkupCSS = (isSingleFrontend) => `@import url('${isSingleFrontend ? "../styles/reset.css" : "../../styles/reset.css"}');
|
|
1903
|
+
|
|
1904
|
+
header {
|
|
1905
|
+
align-items: center;
|
|
1906
|
+
background-color: #1a1a1a;
|
|
1907
|
+
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
|
|
1908
|
+
display: flex;
|
|
1909
|
+
justify-content: space-between;
|
|
1910
|
+
padding: 2rem;
|
|
1911
|
+
text-align: center;
|
|
1912
|
+
}
|
|
1912
1913
|
|
|
1913
|
-
|
|
1914
|
-
|
|
1914
|
+
header a {
|
|
1915
|
+
position: relative;
|
|
1916
|
+
color: #5fbeeb;
|
|
1917
|
+
text-decoration: none;
|
|
1918
|
+
}
|
|
1915
1919
|
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
+
header a::after {
|
|
1921
|
+
content: '';
|
|
1922
|
+
position: absolute;
|
|
1923
|
+
left: 0;
|
|
1924
|
+
bottom: 0;
|
|
1925
|
+
width: 100%;
|
|
1926
|
+
height: 2px;
|
|
1927
|
+
background: linear-gradient(90deg, #5fbeeb 0%, #35d5a2 50%, #ff4b91 100%);
|
|
1928
|
+
transform: scaleX(0);
|
|
1929
|
+
transform-origin: left;
|
|
1930
|
+
transition: transform 0.25s ease-in-out;
|
|
1931
|
+
}
|
|
1920
1932
|
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
} else if (hours < HOURS_IN_DAY * TWO_THIRDS) {
|
|
1924
|
-
greeting.textContent = 'Good Afternoon, welcome to AbsoluteJS !';
|
|
1925
|
-
} else {
|
|
1926
|
-
greeting.textContent = 'Good Evening, welcome to AbsoluteJS !';
|
|
1933
|
+
header a:hover::after {
|
|
1934
|
+
transform: scaleX(1);
|
|
1927
1935
|
}
|
|
1928
1936
|
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
|
|
1933
|
-
button.addEventListener('click', () => {
|
|
1934
|
-
count++;
|
|
1935
|
-
counter.textContent = count.toString();
|
|
1936
|
-
});
|
|
1937
|
+
h1 {
|
|
1938
|
+
font-size: 2.5rem;
|
|
1939
|
+
margin-top: 2rem;
|
|
1940
|
+
}
|
|
1937
1941
|
|
|
1938
|
-
|
|
1939
|
-
|
|
1940
|
-
|
|
1941
|
-
|
|
1942
|
-
|
|
1942
|
+
.logo {
|
|
1943
|
+
height: 8rem;
|
|
1944
|
+
width: 8rem;
|
|
1945
|
+
will-change: filter;
|
|
1946
|
+
transition: filter 300ms;
|
|
1947
|
+
}
|
|
1948
|
+
|
|
1949
|
+
.logo:hover {
|
|
1950
|
+
filter: drop-shadow(0 0 2rem #5fbeeb);
|
|
1951
|
+
}
|
|
1952
|
+
|
|
1953
|
+
.logo.html:hover {
|
|
1954
|
+
filter: drop-shadow(0 0 2rem #e34f26);
|
|
1955
|
+
}
|
|
1956
|
+
|
|
1957
|
+
nav {
|
|
1958
|
+
display: flex;
|
|
1959
|
+
gap: 4rem;
|
|
1960
|
+
justify-content: center;
|
|
1961
|
+
}
|
|
1962
|
+
|
|
1963
|
+
header details {
|
|
1964
|
+
position: relative;
|
|
1965
|
+
}
|
|
1966
|
+
|
|
1967
|
+
header details summary {
|
|
1968
|
+
list-style: none;
|
|
1969
|
+
appearance: none;
|
|
1970
|
+
-webkit-appearance: none;
|
|
1971
|
+
cursor: pointer;
|
|
1972
|
+
user-select: none;
|
|
1973
|
+
color: #5fbeeb;
|
|
1974
|
+
font-size: 1.5rem;
|
|
1975
|
+
font-weight: 500;
|
|
1976
|
+
padding: 0.5rem 1rem;
|
|
1977
|
+
}
|
|
1978
|
+
|
|
1979
|
+
header summary::after {
|
|
1980
|
+
content: '▼';
|
|
1981
|
+
display: inline-block;
|
|
1982
|
+
margin-left: 0.5rem;
|
|
1983
|
+
font-size: 0.75rem;
|
|
1984
|
+
transition: transform 0.3s ease;
|
|
1985
|
+
}
|
|
1986
|
+
|
|
1987
|
+
header details[open] summary::after {
|
|
1988
|
+
transform: rotate(180deg);
|
|
1989
|
+
}
|
|
1990
|
+
|
|
1991
|
+
header details nav {
|
|
1992
|
+
position: absolute;
|
|
1993
|
+
top: 100%;
|
|
1994
|
+
right: -0.5rem;
|
|
1995
|
+
display: flex;
|
|
1996
|
+
flex-direction: column;
|
|
1997
|
+
gap: 0.75rem;
|
|
1998
|
+
background: rgba(185, 185, 185, 0.1);
|
|
1999
|
+
backdrop-filter: blur(4px);
|
|
2000
|
+
border: 1px solid #5fbeeb;
|
|
2001
|
+
border-radius: 1rem;
|
|
2002
|
+
padding: 1rem 1.5rem;
|
|
2003
|
+
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
|
|
2004
|
+
opacity: 0;
|
|
2005
|
+
transform: translateY(-8px);
|
|
2006
|
+
pointer-events: none;
|
|
2007
|
+
transition:
|
|
2008
|
+
opacity 0.3s ease,
|
|
2009
|
+
transform 0.3s ease;
|
|
2010
|
+
z-index: 1000;
|
|
2011
|
+
}
|
|
2012
|
+
|
|
2013
|
+
header details[open] nav {
|
|
2014
|
+
opacity: 1;
|
|
2015
|
+
transform: translateY(0);
|
|
2016
|
+
pointer-events: auto;
|
|
2017
|
+
}
|
|
1943
2018
|
|
|
1944
|
-
|
|
1945
|
-
|
|
1946
|
-
|
|
2019
|
+
header details nav a {
|
|
2020
|
+
font-size: 1.1rem;
|
|
2021
|
+
padding: 0.25rem 0;
|
|
2022
|
+
white-space: nowrap;
|
|
2023
|
+
}
|
|
2024
|
+
|
|
2025
|
+
@media (prefers-color-scheme: light) {
|
|
2026
|
+
header {
|
|
2027
|
+
background-color: #ffffff;
|
|
2028
|
+
}
|
|
2029
|
+
|
|
2030
|
+
button {
|
|
2031
|
+
background-color: #ffffff;
|
|
2032
|
+
}
|
|
2033
|
+
}
|
|
1947
2034
|
`;
|
|
1948
2035
|
|
|
1949
2036
|
// src/generators/html/scaffoldHTML.ts
|
|
1950
2037
|
var scaffoldHTML = ({
|
|
1951
2038
|
isSingleFrontend,
|
|
1952
2039
|
targetDirectory,
|
|
1953
|
-
|
|
2040
|
+
useHTMLScripts,
|
|
2041
|
+
templatesDirectory,
|
|
2042
|
+
projectAssetsDirectory
|
|
1954
2043
|
}) => {
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
writeFileSync5(join6(scriptsDir, scriptFileName), script);
|
|
1965
|
-
}
|
|
1966
|
-
};
|
|
1967
|
-
|
|
1968
|
-
// src/generators/react/scaffoldReact.ts
|
|
1969
|
-
import { cpSync as cpSync2, mkdirSync as mkdirSync4, writeFileSync as writeFileSync6 } from "node:fs";
|
|
1970
|
-
import { join as join7 } from "node:path";
|
|
1971
|
-
|
|
1972
|
-
// src/generators/react/generateHeadComponent.ts
|
|
1973
|
-
var generateHeadComponent = (isSingleFrontend) => `import { styleReset } from '${isSingleFrontend ? "../../styles" : "../../../styles/react"}/defaultStyles';
|
|
1974
|
-
|
|
1975
|
-
type HeadProps = {
|
|
1976
|
-
title?: string;
|
|
1977
|
-
icon?: string;
|
|
1978
|
-
font?: string;
|
|
2044
|
+
copyFileSync3(join6(templatesDirectory, "assets", "svg", "HTML5_Badge.svg"), join6(projectAssetsDirectory, "svg", "HTML5_Badge.svg"));
|
|
2045
|
+
cpSync(join6(templatesDirectory, "html"), targetDirectory, {
|
|
2046
|
+
recursive: true
|
|
2047
|
+
});
|
|
2048
|
+
const cssOutputDir = join6(targetDirectory, "styles");
|
|
2049
|
+
mkdirSync3(cssOutputDir, { recursive: true });
|
|
2050
|
+
const cssOutputFile = join6(cssOutputDir, "html-example.css");
|
|
2051
|
+
const htmlCSS = generateMarkupCSS(isSingleFrontend);
|
|
2052
|
+
writeFileSync5(cssOutputFile, htmlCSS, "utf-8");
|
|
1979
2053
|
};
|
|
1980
2054
|
|
|
1981
|
-
|
|
1982
|
-
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
-
|
|
1991
|
-
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
rel="stylesheet"
|
|
2001
|
-
/>
|
|
2002
|
-
<style>{styleReset}</style>
|
|
2003
|
-
</head>
|
|
2004
|
-
);
|
|
2005
|
-
`;
|
|
2006
|
-
|
|
2007
|
-
// src/generators/react/generateReactPage.ts
|
|
2008
|
-
var generateReactPage = (isSingleFrontend) => `import { useState } from 'react';
|
|
2009
|
-
import { Head } from '../components/utils/Head';
|
|
2010
|
-
import {
|
|
2011
|
-
bodyDefault,
|
|
2012
|
-
htmlDefault,
|
|
2013
|
-
mainDefault
|
|
2014
|
-
} from '${isSingleFrontend ? "../styles" : "../../styles/react"}/defaultStyles';
|
|
2015
|
-
|
|
2016
|
-
export const ReactExample = () => {
|
|
2017
|
-
const [count, setCount] = useState(0);
|
|
2018
|
-
|
|
2019
|
-
return (
|
|
2020
|
-
<html lang="en" style={htmlDefault}>
|
|
2021
|
-
<Head />
|
|
2022
|
-
<body style={bodyDefault}>
|
|
2023
|
-
<main style={mainDefault}>
|
|
2024
|
-
<style>{\`
|
|
2025
|
-
@keyframes spin {
|
|
2026
|
-
from { transform: rotate(0deg); }
|
|
2027
|
-
to { transform: rotate(360deg); }
|
|
2028
|
-
}
|
|
2029
|
-
\`}</style>
|
|
2030
|
-
<div
|
|
2031
|
-
style={{
|
|
2032
|
-
flex: 1,
|
|
2033
|
-
display: 'flex',
|
|
2034
|
-
flexDirection: 'column',
|
|
2035
|
-
justifyContent: 'center',
|
|
2036
|
-
alignItems: 'center',
|
|
2037
|
-
padding: '1rem',
|
|
2038
|
-
gap: '1.5rem'
|
|
2039
|
-
}}
|
|
2040
|
-
>
|
|
2041
|
-
<a
|
|
2042
|
-
href="https://react.dev"
|
|
2043
|
-
target="_blank"
|
|
2044
|
-
rel="noreferrer"
|
|
2045
|
-
style={{
|
|
2046
|
-
textDecoration: 'none'
|
|
2047
|
-
}}
|
|
2048
|
-
>
|
|
2049
|
-
<img
|
|
2050
|
-
src="/assets/svg/react.svg"
|
|
2051
|
-
alt="React logo"
|
|
2052
|
-
style={{
|
|
2053
|
-
animation: 'spin 20s linear infinite',
|
|
2054
|
-
transformOrigin: 'center center',
|
|
2055
|
-
height: 145,
|
|
2056
|
-
display: 'block'
|
|
2057
|
-
}}
|
|
2058
|
-
/>
|
|
2059
|
-
</a>
|
|
2060
|
-
<h1
|
|
2061
|
-
style={{
|
|
2062
|
-
fontSize: '2rem',
|
|
2063
|
-
fontWeight: 600,
|
|
2064
|
-
color: '#333',
|
|
2065
|
-
margin: 0
|
|
2066
|
-
}}
|
|
2067
|
-
>
|
|
2068
|
-
AbsoluteJS + React
|
|
2069
|
-
</h1>
|
|
2070
|
-
<button
|
|
2071
|
-
onClick={() => setCount(prev => prev + 1)}
|
|
2072
|
-
style={{
|
|
2073
|
-
padding: '0.75rem 1.5rem',
|
|
2074
|
-
fontSize: '1rem',
|
|
2075
|
-
fontWeight: 500,
|
|
2076
|
-
backgroundColor: '#0070f3',
|
|
2077
|
-
color: '#fff',
|
|
2078
|
-
border: 'none',
|
|
2079
|
-
borderRadius: '5px',
|
|
2080
|
-
cursor: 'pointer'
|
|
2081
|
-
}}
|
|
2082
|
-
>
|
|
2083
|
-
count is {count}
|
|
2084
|
-
</button>
|
|
2085
|
-
<p style={{ fontSize: '1rem', color: '#555', margin: 0 }}>
|
|
2086
|
-
Edit{' '}
|
|
2087
|
-
<code
|
|
2088
|
-
style={{
|
|
2089
|
-
backgroundColor: '#f5f5f5',
|
|
2090
|
-
padding: '0.2rem 0.4rem',
|
|
2091
|
-
borderRadius: '3px',
|
|
2092
|
-
fontFamily: 'monospace'
|
|
2093
|
-
}}
|
|
2094
|
-
>
|
|
2095
|
-
src/frontend/${isSingleFrontend ? "" : "react"}/pages/ReactExample.tsx
|
|
2096
|
-
</code>{' '}
|
|
2097
|
-
to edit this page
|
|
2098
|
-
</p>
|
|
2099
|
-
</div>
|
|
2100
|
-
</main>
|
|
2101
|
-
</body>
|
|
2102
|
-
</html>
|
|
2103
|
-
);
|
|
2055
|
+
// src/generators/htmx/scaffoldHTMX.ts
|
|
2056
|
+
import { copyFileSync as copyFileSync4, cpSync as cpSync2, mkdirSync as mkdirSync4, writeFileSync as writeFileSync6 } from "fs";
|
|
2057
|
+
import { join as join7 } from "path";
|
|
2058
|
+
var scaffoldHTMX = ({
|
|
2059
|
+
targetDirectory,
|
|
2060
|
+
templatesDirectory,
|
|
2061
|
+
projectAssetsDirectory,
|
|
2062
|
+
isSingleFrontend
|
|
2063
|
+
}) => {
|
|
2064
|
+
copyFileSync4(join7(templatesDirectory, "assets", "svg", "htmx-logo-black.svg"), join7(projectAssetsDirectory, "svg", "htmx-logo-black.svg"));
|
|
2065
|
+
copyFileSync4(join7(templatesDirectory, "assets", "svg", "htmx-logo-white.svg"), join7(projectAssetsDirectory, "svg", "htmx-logo-white.svg"));
|
|
2066
|
+
cpSync2(join7(templatesDirectory, "htmx"), targetDirectory, {
|
|
2067
|
+
recursive: true
|
|
2068
|
+
});
|
|
2069
|
+
const cssOutputDir = join7(targetDirectory, "styles");
|
|
2070
|
+
mkdirSync4(cssOutputDir, { recursive: true });
|
|
2071
|
+
const cssOutputFile = join7(cssOutputDir, "htmx-example.css");
|
|
2072
|
+
const htmxCSS = generateMarkupCSS(isSingleFrontend);
|
|
2073
|
+
writeFileSync6(cssOutputFile, htmxCSS, "utf-8");
|
|
2104
2074
|
};
|
|
2105
|
-
`;
|
|
2106
2075
|
|
|
2107
2076
|
// src/generators/react/scaffoldReact.ts
|
|
2077
|
+
import { copyFileSync as copyFileSync5, cpSync as cpSync3, mkdirSync as mkdirSync5, writeFileSync as writeFileSync7 } from "fs";
|
|
2078
|
+
import { join as join8 } from "path";
|
|
2108
2079
|
var scaffoldReact = ({
|
|
2109
|
-
stylesDirectory,
|
|
2110
|
-
templatesDirectory,
|
|
2111
2080
|
isSingleFrontend,
|
|
2112
|
-
targetDirectory
|
|
2081
|
+
targetDirectory,
|
|
2082
|
+
templatesDirectory,
|
|
2083
|
+
projectAssetsDirectory
|
|
2113
2084
|
}) => {
|
|
2114
|
-
|
|
2115
|
-
|
|
2116
|
-
const pagesDirectory = join7(targetDirectory, "pages");
|
|
2117
|
-
const componentsDirectory = join7(targetDirectory, "components");
|
|
2118
|
-
const pageExample = generateReactPage(isSingleFrontend);
|
|
2119
|
-
const headComponent = generateHeadComponent(isSingleFrontend);
|
|
2120
|
-
mkdirSync4(pagesDirectory, { recursive: true });
|
|
2121
|
-
writeFileSync6(join7(pagesDirectory, "ReactExample.tsx"), pageExample);
|
|
2122
|
-
mkdirSync4(join7(componentsDirectory, "utils"), { recursive: true });
|
|
2123
|
-
writeFileSync6(join7(componentsDirectory, "utils", "Head.tsx"), headComponent);
|
|
2124
|
-
cpSync2(join7(reactTemplates, "hooks"), join7(targetDirectory, "hooks"), {
|
|
2085
|
+
copyFileSync5(join8(templatesDirectory, "assets", "svg", "react.svg"), join8(projectAssetsDirectory, "svg", "react.svg"));
|
|
2086
|
+
cpSync3(join8(templatesDirectory, "react"), targetDirectory, {
|
|
2125
2087
|
recursive: true
|
|
2126
2088
|
});
|
|
2127
|
-
|
|
2128
|
-
|
|
2129
|
-
|
|
2130
|
-
|
|
2131
|
-
|
|
2132
|
-
const dest = join7(stylesDirectory, "react");
|
|
2133
|
-
mkdirSync4(dest, { recursive: true });
|
|
2134
|
-
cpSync2(reactStylesSrc, dest, {
|
|
2135
|
-
recursive: true
|
|
2136
|
-
});
|
|
2137
|
-
}
|
|
2089
|
+
const cssOutputDir = join8(targetDirectory, "styles");
|
|
2090
|
+
mkdirSync5(cssOutputDir, { recursive: true });
|
|
2091
|
+
const cssOutputFile = join8(cssOutputDir, "react-example.css");
|
|
2092
|
+
const reactCSS = generateMarkupCSS(isSingleFrontend);
|
|
2093
|
+
writeFileSync7(cssOutputFile, reactCSS, "utf-8");
|
|
2138
2094
|
};
|
|
2139
2095
|
|
|
2140
2096
|
// src/generators/svelte/scaffoldSvelte.ts
|
|
2141
|
-
import { mkdirSync as
|
|
2142
|
-
import { join as
|
|
2143
|
-
|
|
2144
|
-
|
|
2145
|
-
|
|
2146
|
-
|
|
2147
|
-
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
|
|
2152
|
-
|
|
2153
|
-
|
|
2154
|
-
|
|
2155
|
-
|
|
2156
|
-
|
|
2157
|
-
|
|
2158
|
-
<link rel="icon" href="/assets/ico/favicon.ico" />
|
|
2159
|
-
</svelte:head>
|
|
2160
|
-
|
|
2161
|
-
<main>
|
|
2162
|
-
<header><h1>This page was built with Svelte</h1></header>
|
|
2163
|
-
|
|
2164
|
-
<p>Welcome to the Svelte home page. This page was built using Svelte.</p>
|
|
2165
|
-
|
|
2166
|
-
<p>Counter: {count}</p>
|
|
2167
|
-
<button onclick={() => (count += 1)}>Increment</button>
|
|
2168
|
-
|
|
2169
|
-
<div id="links">
|
|
2170
|
-
<a href="/">Html</a>
|
|
2171
|
-
<a href="/vue">Vue</a>
|
|
2172
|
-
</div>
|
|
2173
|
-
|
|
2174
|
-
<footer><p>© {year} AbsoluteJS</p></footer>
|
|
2175
|
-
</main>
|
|
2176
|
-
`;
|
|
2097
|
+
import { copyFileSync as copyFileSync6, cpSync as cpSync4, mkdirSync as mkdirSync6, writeFileSync as writeFileSync8 } from "fs";
|
|
2098
|
+
import { join as join9 } from "path";
|
|
2099
|
+
var scaffoldSvelte = ({
|
|
2100
|
+
isSingleFrontend,
|
|
2101
|
+
targetDirectory,
|
|
2102
|
+
templatesDirectory,
|
|
2103
|
+
projectAssetsDirectory
|
|
2104
|
+
}) => {
|
|
2105
|
+
copyFileSync6(join9(templatesDirectory, "assets", "svg", "svelte-logo.svg"), join9(projectAssetsDirectory, "svg", "svelte-logo.svg"));
|
|
2106
|
+
cpSync4(join9(templatesDirectory, "svelte"), targetDirectory, {
|
|
2107
|
+
recursive: true
|
|
2108
|
+
});
|
|
2109
|
+
const cssOutputDirectory = join9(targetDirectory, "styles");
|
|
2110
|
+
mkdirSync6(cssOutputDirectory, { recursive: true });
|
|
2111
|
+
const cssOutputFile = join9(cssOutputDirectory, "svelte-example.css");
|
|
2112
|
+
const svelteCSS = `@import url('${isSingleFrontend ? "../" : "../../"}styles/reset.css');`;
|
|
2113
|
+
writeFileSync8(cssOutputFile, svelteCSS, "utf-8");
|
|
2177
2114
|
};
|
|
2178
2115
|
|
|
2179
|
-
// src/generators/
|
|
2180
|
-
|
|
2116
|
+
// src/generators/vue/scaffoldVue.ts
|
|
2117
|
+
import { cpSync as cpSync5, copyFileSync as copyFileSync7 } from "fs";
|
|
2118
|
+
import { join as join10 } from "path";
|
|
2119
|
+
var scaffoldVue = ({
|
|
2181
2120
|
targetDirectory,
|
|
2182
|
-
|
|
2121
|
+
templatesDirectory,
|
|
2122
|
+
projectAssetsDirectory
|
|
2183
2123
|
}) => {
|
|
2184
|
-
|
|
2185
|
-
|
|
2186
|
-
|
|
2187
|
-
|
|
2188
|
-
writeFileSync7(join8(pagesDirectory, "SvelteExample.svelte"), pageExample);
|
|
2189
|
-
mkdirSync5(join8(componentsDirectory), { recursive: true });
|
|
2124
|
+
copyFileSync7(join10(templatesDirectory, "assets", "svg", "vue-logo.svg"), join10(projectAssetsDirectory, "svg", "vue-logo.svg"));
|
|
2125
|
+
cpSync5(join10(templatesDirectory, "vue"), targetDirectory, {
|
|
2126
|
+
recursive: true
|
|
2127
|
+
});
|
|
2190
2128
|
};
|
|
2191
2129
|
|
|
2192
2130
|
// src/generators/project/scaffoldFrontends.ts
|
|
2193
2131
|
var scaffoldFrontends = ({
|
|
2194
2132
|
frontendDirectory,
|
|
2195
2133
|
templatesDirectory,
|
|
2196
|
-
|
|
2197
|
-
|
|
2198
|
-
|
|
2199
|
-
htmlScriptOption
|
|
2134
|
+
projectAssetsDirectory,
|
|
2135
|
+
useHTMLScripts,
|
|
2136
|
+
frontendDirectories
|
|
2200
2137
|
}) => {
|
|
2138
|
+
const stylesTargetDirectory = join11(frontendDirectory, "styles");
|
|
2139
|
+
cpSync6(join11(templatesDirectory, "styles"), stylesTargetDirectory, {
|
|
2140
|
+
recursive: true
|
|
2141
|
+
});
|
|
2201
2142
|
const frontendEntries = Object.entries(frontendDirectories);
|
|
2202
2143
|
const isSingleFrontend = frontendEntries.length === 1;
|
|
2203
|
-
const stylesDirectory = join9(frontendDirectory, "styles");
|
|
2204
|
-
const needsStylesDir = !(isSingleFrontend && frontendEntries[0]?.[0] === "svelte");
|
|
2205
|
-
if (needsStylesDir)
|
|
2206
|
-
mkdirSync6(stylesDirectory);
|
|
2207
|
-
if (needsStylesDir && tailwind !== undefined) {
|
|
2208
|
-
copyFileSync3(join9(templatesDirectory, "tailwind", "tailwind.css"), join9(stylesDirectory, "tailwind.css"));
|
|
2209
|
-
}
|
|
2210
2144
|
const directoryMap = new Map;
|
|
2211
2145
|
for (const [frontendName, rawDirectory] of frontendEntries) {
|
|
2212
2146
|
const directory = rawDirectory?.trim() ?? (isSingleFrontend ? "" : frontendName);
|
|
@@ -2214,26 +2148,51 @@ var scaffoldFrontends = ({
|
|
|
2214
2148
|
throw new Error(`Frontend directory collision: "${directory}" is assigned to both "${directoryMap.get(directory)}" and "${frontendName}". Please pick unique directories.`);
|
|
2215
2149
|
}
|
|
2216
2150
|
directoryMap.set(directory, frontendName);
|
|
2217
|
-
const targetDirectory =
|
|
2151
|
+
const targetDirectory = join11(frontendDirectory, directory);
|
|
2218
2152
|
if (!isSingleFrontend)
|
|
2219
|
-
|
|
2153
|
+
mkdirSync7(targetDirectory);
|
|
2220
2154
|
switch (frontendName) {
|
|
2221
2155
|
case "react":
|
|
2222
2156
|
scaffoldReact({
|
|
2223
2157
|
isSingleFrontend,
|
|
2224
|
-
|
|
2158
|
+
projectAssetsDirectory,
|
|
2225
2159
|
targetDirectory,
|
|
2226
2160
|
templatesDirectory
|
|
2227
2161
|
});
|
|
2228
2162
|
break;
|
|
2229
2163
|
case "svelte":
|
|
2230
|
-
scaffoldSvelte({
|
|
2164
|
+
scaffoldSvelte({
|
|
2165
|
+
isSingleFrontend,
|
|
2166
|
+
projectAssetsDirectory,
|
|
2167
|
+
targetDirectory,
|
|
2168
|
+
templatesDirectory
|
|
2169
|
+
});
|
|
2170
|
+
break;
|
|
2171
|
+
case "vue":
|
|
2172
|
+
scaffoldVue({
|
|
2173
|
+
projectAssetsDirectory,
|
|
2174
|
+
targetDirectory,
|
|
2175
|
+
templatesDirectory
|
|
2176
|
+
});
|
|
2177
|
+
break;
|
|
2178
|
+
case "angular":
|
|
2179
|
+
console.warn("Angular is not yet supported. Refer to the documentation for more information.");
|
|
2231
2180
|
break;
|
|
2232
2181
|
case "html":
|
|
2233
2182
|
scaffoldHTML({
|
|
2234
|
-
htmlScriptOption,
|
|
2235
2183
|
isSingleFrontend,
|
|
2236
|
-
|
|
2184
|
+
projectAssetsDirectory,
|
|
2185
|
+
targetDirectory,
|
|
2186
|
+
templatesDirectory,
|
|
2187
|
+
useHTMLScripts
|
|
2188
|
+
});
|
|
2189
|
+
break;
|
|
2190
|
+
case "htmx":
|
|
2191
|
+
scaffoldHTMX({
|
|
2192
|
+
isSingleFrontend,
|
|
2193
|
+
projectAssetsDirectory,
|
|
2194
|
+
targetDirectory,
|
|
2195
|
+
templatesDirectory
|
|
2237
2196
|
});
|
|
2238
2197
|
break;
|
|
2239
2198
|
}
|
|
@@ -2244,11 +2203,10 @@ var scaffoldFrontends = ({
|
|
|
2244
2203
|
var scaffold = ({
|
|
2245
2204
|
response: {
|
|
2246
2205
|
projectName,
|
|
2247
|
-
language,
|
|
2248
2206
|
codeQualityTool,
|
|
2249
2207
|
initializeGitNow,
|
|
2250
2208
|
databaseEngine,
|
|
2251
|
-
|
|
2209
|
+
useHTMLScripts,
|
|
2252
2210
|
useTailwind,
|
|
2253
2211
|
databaseDirectory,
|
|
2254
2212
|
orm,
|
|
@@ -2265,14 +2223,13 @@ var scaffold = ({
|
|
|
2265
2223
|
packageManager
|
|
2266
2224
|
}) => {
|
|
2267
2225
|
const __dirname2 = dirname(fileURLToPath(import.meta.url));
|
|
2268
|
-
const templatesDirectory =
|
|
2269
|
-
const { frontendDirectory, backendDirectory } = initalizeRoot(projectName, templatesDirectory);
|
|
2270
|
-
|
|
2226
|
+
const templatesDirectory = join12(__dirname2, "/templates");
|
|
2227
|
+
const { frontendDirectory, backendDirectory, projectAssetsDirectory } = initalizeRoot(projectName, templatesDirectory);
|
|
2228
|
+
copyFileSync8(join12(templatesDirectory, "README.md"), join12(projectName, "README.md"));
|
|
2271
2229
|
addConfigurationFiles({
|
|
2272
2230
|
codeQualityTool,
|
|
2273
2231
|
frontends,
|
|
2274
2232
|
initializeGitNow,
|
|
2275
|
-
language,
|
|
2276
2233
|
projectName,
|
|
2277
2234
|
tailwind,
|
|
2278
2235
|
templatesDirectory
|
|
@@ -2286,7 +2243,7 @@ var scaffold = ({
|
|
|
2286
2243
|
projectName,
|
|
2287
2244
|
useTailwind
|
|
2288
2245
|
});
|
|
2289
|
-
const serverFilePath =
|
|
2246
|
+
const serverFilePath = join12(backendDirectory, "server.ts");
|
|
2290
2247
|
createServerFile({
|
|
2291
2248
|
assetsDirectory,
|
|
2292
2249
|
authProvider,
|
|
@@ -2306,10 +2263,9 @@ var scaffold = ({
|
|
|
2306
2263
|
scaffoldFrontends({
|
|
2307
2264
|
frontendDirectories,
|
|
2308
2265
|
frontendDirectory,
|
|
2309
|
-
|
|
2310
|
-
|
|
2311
|
-
|
|
2312
|
-
templatesDirectory
|
|
2266
|
+
projectAssetsDirectory,
|
|
2267
|
+
templatesDirectory,
|
|
2268
|
+
useHTMLScripts
|
|
2313
2269
|
});
|
|
2314
2270
|
if (installDependenciesNow) {
|
|
2315
2271
|
installDependencies({ packageManager, projectName });
|
|
@@ -2342,15 +2298,14 @@ var parseCommandLineOptions = () => {
|
|
|
2342
2298
|
help: { default: false, short: "h", type: "boolean" },
|
|
2343
2299
|
host: { type: "string" },
|
|
2344
2300
|
html: { type: "string" },
|
|
2301
|
+
"html-script": { type: "boolean" },
|
|
2345
2302
|
htmx: { type: "string" },
|
|
2346
|
-
lang: { type: "string" },
|
|
2347
2303
|
lts: { default: false, type: "boolean" },
|
|
2348
2304
|
npm: { type: "boolean" },
|
|
2349
2305
|
orm: { type: "string" },
|
|
2350
2306
|
plugin: { multiple: true, type: "string" },
|
|
2351
2307
|
quality: { type: "string" },
|
|
2352
2308
|
react: { type: "string" },
|
|
2353
|
-
script: { type: "string" },
|
|
2354
2309
|
skip: { type: "boolean" },
|
|
2355
2310
|
svelte: { type: "string" },
|
|
2356
2311
|
tailwind: { type: "boolean" },
|
|
@@ -2360,6 +2315,7 @@ var parseCommandLineOptions = () => {
|
|
|
2360
2315
|
}
|
|
2361
2316
|
});
|
|
2362
2317
|
const errors = [];
|
|
2318
|
+
const projectName = positionals[0] ?? values.skip ? "absolutejs-project" : undefined;
|
|
2363
2319
|
let authProvider;
|
|
2364
2320
|
if (values.auth !== undefined && !isAuthProvider(values.auth)) {
|
|
2365
2321
|
errors.push(`Invalid auth provider: "${values.auth}". Expected: [ ${availableAuthProviders.join(", ")} ]`);
|
|
@@ -2397,18 +2353,6 @@ var parseCommandLineOptions = () => {
|
|
|
2397
2353
|
if (values.quality !== undefined && codeQualityTool === undefined) {
|
|
2398
2354
|
errors.push(`Invalid code quality tool: "${values.quality}". Expected: [ ${availableCodeQualityTools.join(", ")} ]`);
|
|
2399
2355
|
}
|
|
2400
|
-
let htmlScriptOption;
|
|
2401
|
-
if (values.script !== undefined && !isHTMLScriptOption(values.script)) {
|
|
2402
|
-
errors.push(`Invalid HTML script option: "${values.script}". Expected: [ ${availableHTMLScriptOptions.join(", ")} ]`);
|
|
2403
|
-
} else if (values.script !== undefined) {
|
|
2404
|
-
htmlScriptOption = values.script;
|
|
2405
|
-
} else if (values.skip) {
|
|
2406
|
-
htmlScriptOption = "none";
|
|
2407
|
-
}
|
|
2408
|
-
const language = values.lang !== undefined && isLanguage(values.lang) ? values.lang : undefined;
|
|
2409
|
-
if (values.lang !== undefined && language === undefined) {
|
|
2410
|
-
errors.push(`Invalid language: "${values.lang}". Expected: [ ${availableLanguages.join(", ")} ]`);
|
|
2411
|
-
}
|
|
2412
2356
|
const directoryConfig = values.directory !== undefined && isDirectoryConfig(values.directory) ? values.directory : undefined;
|
|
2413
2357
|
if (values.directory !== undefined && directoryConfig === undefined) {
|
|
2414
2358
|
errors.push(`Invalid directory configuration: "${values.directory}". Expected: [ ${availableDirectoryConfigurations.join(", ")} ]`);
|
|
@@ -2470,14 +2414,13 @@ var parseCommandLineOptions = () => {
|
|
|
2470
2414
|
directoryConfig,
|
|
2471
2415
|
frontendDirectories,
|
|
2472
2416
|
frontends: values.frontend?.filter(isFrontend),
|
|
2473
|
-
htmlScriptOption,
|
|
2474
2417
|
initializeGitNow: values.git,
|
|
2475
2418
|
installDependenciesNow: values.npm,
|
|
2476
|
-
language,
|
|
2477
2419
|
orm,
|
|
2478
2420
|
plugins,
|
|
2479
|
-
projectName
|
|
2421
|
+
projectName,
|
|
2480
2422
|
tailwind,
|
|
2423
|
+
useHTMLScripts: values["html-script"],
|
|
2481
2424
|
useTailwind
|
|
2482
2425
|
};
|
|
2483
2426
|
return {
|