@aerogel/cli 0.0.0-next.b58141fee5d2fe7d25debdbca6b1d2bf1c13e48e → 0.0.0-next.bf95405357e75d2e8b0268a5e8ce7b2b7dd0c895
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/bin/gel +4 -0
- package/dist/aerogel-cli.d.ts +2 -2
- package/dist/aerogel-cli.js +833 -0
- package/dist/aerogel-cli.js.map +1 -0
- package/package.json +25 -32
- package/src/cli.ts +28 -8
- package/src/commands/Command.ts +14 -9
- package/src/commands/create.test.ts +3 -4
- package/src/commands/create.ts +11 -11
- package/src/commands/generate-component.test.ts +50 -3
- package/src/commands/generate-component.ts +68 -22
- package/src/commands/generate-model.test.ts +2 -2
- package/src/commands/generate-model.ts +13 -14
- package/src/commands/generate-overrides.ts +85 -0
- package/src/commands/generate-service.test.ts +2 -2
- package/src/commands/generate-service.ts +16 -17
- package/src/commands/info.ts +15 -0
- package/src/commands/install.test.ts +11 -2
- package/src/commands/install.ts +9 -9
- package/src/lib/App.ts +9 -6
- package/src/lib/Editor.ts +12 -11
- package/src/lib/File.mock.ts +7 -11
- package/src/lib/File.ts +3 -3
- package/src/lib/Log.mock.ts +4 -8
- package/src/lib/Log.test.ts +4 -4
- package/src/lib/Log.ts +7 -7
- package/src/lib/Shell.mock.ts +3 -3
- package/src/lib/Shell.ts +2 -2
- package/src/lib/Template.ts +24 -17
- package/src/lib/utils/app.ts +3 -3
- package/src/lib/utils/edit.ts +2 -2
- package/src/lib/utils/paths.ts +16 -8
- package/src/plugins/Plugin.ts +46 -12
- package/src/plugins/Solid.ts +15 -58
- package/src/plugins/Soukai.ts +4 -4
- package/src/testing/setup.ts +30 -31
- package/templates/app/.github/workflows/ci.yml +4 -4
- package/templates/app/.nvmrc +1 -1
- package/templates/app/.vscode/launch.json +1 -0
- package/templates/app/{cypress.config.ts → cypress/cypress.config.ts} +2 -4
- package/templates/app/cypress/support/e2e.ts +1 -3
- package/templates/app/cypress/tsconfig.json +7 -8
- package/templates/app/index.html +5 -4
- package/templates/app/package.json +27 -15
- package/templates/app/src/App.vue +2 -2
- package/templates/app/src/assets/css/main.css +4 -0
- package/templates/app/src/assets/public/robots.txt +2 -0
- package/templates/app/src/main.ts +4 -4
- package/templates/app/tsconfig.json +3 -10
- package/templates/app/vite.config.ts +7 -4
- package/templates/component-button/[component.name].vue +42 -0
- package/templates/component-button-story/[component.name].story.vue +77 -0
- package/templates/component-checkbox/[component.name].vue +34 -0
- package/templates/component-checkbox-story/[component.name].story.vue +63 -0
- package/templates/component-input/[component.name].vue +17 -0
- package/templates/component-input-story/[component.name].story.vue +63 -0
- package/templates/overrides/components/index.ts +15 -0
- package/templates/overrides/components/overrides/AlertModal.vue +11 -0
- package/templates/overrides/components/overrides/ConfirmModal.vue +20 -0
- package/templates/overrides/components/overrides/ErrorReportModal.vue +35 -0
- package/templates/overrides/components/overrides/LoadingModal.vue +12 -0
- package/templates/overrides/components/overrides/ModalWrapper.vue +22 -0
- package/templates/overrides/components/overrides/SnackbarNotification.vue +34 -0
- package/templates/overrides-story/Overrides.story.vue +86 -0
- package/templates/service/[service.name].ts +1 -1
- package/.eslintrc.js +0 -7
- package/bin/ag +0 -4
- package/dist/aerogel-cli.cjs.js +0 -2
- package/dist/aerogel-cli.cjs.js.map +0 -1
- package/dist/aerogel-cli.esm.js +0 -2
- package/dist/aerogel-cli.esm.js.map +0 -1
- package/src/lib/utils/format.test.ts +0 -33
- package/src/lib/utils/format.ts +0 -38
- package/templates/app/.eslintrc.js +0 -3
- package/templates/app/postcss.config.js +0 -6
- package/templates/app/prettier.config.js +0 -5
- package/templates/app/src/assets/styles.css +0 -3
- package/templates/app/tailwind.config.js +0 -5
- package/tsconfig.json +0 -11
- package/vite.config.ts +0 -14
- /package/src/{main.ts → index.ts} +0 -0
|
@@ -0,0 +1,833 @@
|
|
|
1
|
+
var Q = Object.defineProperty;
|
|
2
|
+
var X = (o, e, t) => e in o ? Q(o, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : o[e] = t;
|
|
3
|
+
var a = (o, e, t) => X(o, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
+
import { Command as Z } from "commander";
|
|
5
|
+
import { existsSync as N, lstatSync as O, readFileSync as z, readdirSync as G, mkdirSync as H, writeFileSync as ee } from "node:fs";
|
|
6
|
+
import { facade as L, stringMatchAll as te, toString as ie, stringMatch as se, arrayFrom as I, stringToSlug as T, stringToTitleCase as ne, arrayFilter as ae, stringToStudlyCase as re, formatCodeBlock as M, stringToCamelCase as oe, fail as ce } from "@noeldemartin/utils";
|
|
7
|
+
import { fileURLToPath as x, URL as S } from "node:url";
|
|
8
|
+
import { resolve as J, dirname as W, basename as le } from "node:path";
|
|
9
|
+
import P from "chalk";
|
|
10
|
+
import { cursorTo as pe, clearLine as de } from "node:readline";
|
|
11
|
+
import ue from "mustache";
|
|
12
|
+
import { Project as ge, SyntaxKind as j, Node as d } from "ts-morph";
|
|
13
|
+
import { exec as me } from "node:child_process";
|
|
14
|
+
class fe {
|
|
15
|
+
contains(e, t) {
|
|
16
|
+
var i;
|
|
17
|
+
return !!((i = this.read(e)) != null && i.includes(t));
|
|
18
|
+
}
|
|
19
|
+
exists(e) {
|
|
20
|
+
return N(e);
|
|
21
|
+
}
|
|
22
|
+
isSymlink(e) {
|
|
23
|
+
return O(e).isSymbolicLink();
|
|
24
|
+
}
|
|
25
|
+
read(e) {
|
|
26
|
+
return this.isFile(e) ? z(e).toString() : null;
|
|
27
|
+
}
|
|
28
|
+
getFiles(e) {
|
|
29
|
+
const t = G(e, { withFileTypes: !0 }), i = [];
|
|
30
|
+
for (const s of t) {
|
|
31
|
+
const n = J(e, s.name);
|
|
32
|
+
s.isDirectory() ? i.push(...this.getFiles(n)) : i.push(n);
|
|
33
|
+
}
|
|
34
|
+
return i;
|
|
35
|
+
}
|
|
36
|
+
isDirectory(e) {
|
|
37
|
+
return this.exists(e) && O(e).isDirectory();
|
|
38
|
+
}
|
|
39
|
+
isFile(e) {
|
|
40
|
+
return this.exists(e) && O(e).isFile();
|
|
41
|
+
}
|
|
42
|
+
isEmptyDirectory(e) {
|
|
43
|
+
return this.isDirectory(e) ? this.getFiles(e).length === 0 : !1;
|
|
44
|
+
}
|
|
45
|
+
makeDirectory(e) {
|
|
46
|
+
H(e, { recursive: !0 });
|
|
47
|
+
}
|
|
48
|
+
write(e, t) {
|
|
49
|
+
N(W(e)) || H(W(e), { recursive: !0 }), ee(e, t);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
const c = L(fe);
|
|
53
|
+
class he {
|
|
54
|
+
constructor() {
|
|
55
|
+
a(this, "renderInfo", P.hex("#00ffff"));
|
|
56
|
+
a(this, "renderSuccess", P.hex("#00ff00"));
|
|
57
|
+
a(this, "renderError", P.hex("#ff0000"));
|
|
58
|
+
}
|
|
59
|
+
async animate(e, t) {
|
|
60
|
+
const i = (u = "", k = !1) => {
|
|
61
|
+
const E = this.renderInfo(this.renderMarkdown(e) + (k ? "..." : ".".repeat(s % 4))) + u;
|
|
62
|
+
this.stdout(E);
|
|
63
|
+
};
|
|
64
|
+
let s = 0;
|
|
65
|
+
i();
|
|
66
|
+
const n = setInterval(() => (s++, i()), 1e3), l = await t();
|
|
67
|
+
return clearInterval(n), i(`
|
|
68
|
+
`, !0), l;
|
|
69
|
+
}
|
|
70
|
+
info(e) {
|
|
71
|
+
this.log(this.renderMarkdown(e), this.renderInfo);
|
|
72
|
+
}
|
|
73
|
+
error(e) {
|
|
74
|
+
this.log(this.renderMarkdown(e), this.renderError);
|
|
75
|
+
}
|
|
76
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
77
|
+
fail(e) {
|
|
78
|
+
this.error(e), process.exit(1);
|
|
79
|
+
}
|
|
80
|
+
success(e) {
|
|
81
|
+
this.log(this.renderMarkdown(e), this.renderSuccess);
|
|
82
|
+
}
|
|
83
|
+
renderMarkdown(e) {
|
|
84
|
+
const t = te(e, /\*\*(.*)\*\*/g);
|
|
85
|
+
for (const i of t)
|
|
86
|
+
e = e.replace(i[0], P.bold(i[1]));
|
|
87
|
+
return e;
|
|
88
|
+
}
|
|
89
|
+
log(e, t) {
|
|
90
|
+
this.formatMessage(e).forEach((i) => {
|
|
91
|
+
this.logLine(t ? t(i) : i);
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
formatMessage(e) {
|
|
95
|
+
var t;
|
|
96
|
+
if (e[0] === `
|
|
97
|
+
`) {
|
|
98
|
+
e = e.slice(1).trimEnd();
|
|
99
|
+
const i = e.split(`
|
|
100
|
+
`), s = e.trim()[0] ?? "", n = ((t = i.find((l) => l.trim().length > 0)) == null ? void 0 : t.indexOf(s)) ?? 0;
|
|
101
|
+
return i.map((l) => l.slice(n));
|
|
102
|
+
}
|
|
103
|
+
return [e];
|
|
104
|
+
}
|
|
105
|
+
logLine(e) {
|
|
106
|
+
console.log(e);
|
|
107
|
+
}
|
|
108
|
+
stdout(e) {
|
|
109
|
+
pe(process.stdout, 0), de(process.stdout, 0), process.stdout.write(e);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
const r = L(he);
|
|
113
|
+
class f {
|
|
114
|
+
constructor(e) {
|
|
115
|
+
this.path = e;
|
|
116
|
+
}
|
|
117
|
+
static instantiate(e, t = "./", i = {}) {
|
|
118
|
+
return new f(e).instantiate(t, i);
|
|
119
|
+
}
|
|
120
|
+
instantiate(e, t = {}) {
|
|
121
|
+
const i = this.getFilenameReplacements(t), s = [];
|
|
122
|
+
e = `${e}/`.replace(/\/\//, "/");
|
|
123
|
+
for (const n of c.getFiles(this.path)) {
|
|
124
|
+
const l = Object.entries(i).reduce(
|
|
125
|
+
(E, [Y, _]) => E.replaceAll(Y, _),
|
|
126
|
+
n.substring(this.path.length + 1)
|
|
127
|
+
), u = z(n).toString(), k = e + (l.endsWith(".template") ? l.slice(0, -9) : l);
|
|
128
|
+
c.write(k, ue.render(u, t, void 0, ["<%", "%>"])), s.push(k);
|
|
129
|
+
}
|
|
130
|
+
return s;
|
|
131
|
+
}
|
|
132
|
+
getFilenameReplacements(e, t = "") {
|
|
133
|
+
return Object.entries(e).reduce(
|
|
134
|
+
(i, [s, n]) => (typeof n == "object" ? Object.assign(
|
|
135
|
+
i,
|
|
136
|
+
this.getFilenameReplacements(n, `${s}.`)
|
|
137
|
+
) : i[`[${t}${s}]`] = ie(n), i),
|
|
138
|
+
{}
|
|
139
|
+
);
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
function ye(o = "") {
|
|
143
|
+
if (c.contains(
|
|
144
|
+
x(new S(
|
|
145
|
+
/* @vite-ignore */
|
|
146
|
+
"../../../package.json",
|
|
147
|
+
import.meta.url
|
|
148
|
+
)),
|
|
149
|
+
'"packages/create-aerogel"'
|
|
150
|
+
))
|
|
151
|
+
return J(x(new S(
|
|
152
|
+
/* @vite-ignore */
|
|
153
|
+
"../",
|
|
154
|
+
import.meta.url
|
|
155
|
+
)), o);
|
|
156
|
+
const e = c.read(
|
|
157
|
+
x(new S(
|
|
158
|
+
/* @vite-ignore */
|
|
159
|
+
"../../../../package.json",
|
|
160
|
+
import.meta.url
|
|
161
|
+
))
|
|
162
|
+
), t = se(e ?? "", /"@aerogel\/core": "file:(.*)\/aerogel-core-[\d.]*\.tgz"/), i = (t == null ? void 0 : t[1]) ?? r.fail("Could not determine base path");
|
|
163
|
+
return J(i, o);
|
|
164
|
+
}
|
|
165
|
+
function h(o) {
|
|
166
|
+
return r.fail(`Could not find ${o} pack file, did you run 'npm pack'?`);
|
|
167
|
+
}
|
|
168
|
+
function y(o) {
|
|
169
|
+
return c.getFiles(m(o)).find((e) => e.endsWith(".tgz")) ?? null;
|
|
170
|
+
}
|
|
171
|
+
function m(o) {
|
|
172
|
+
return ye(`../${o}`);
|
|
173
|
+
}
|
|
174
|
+
function w(o) {
|
|
175
|
+
return x(new S(
|
|
176
|
+
/* @vite-ignore */
|
|
177
|
+
`../templates/${o}`,
|
|
178
|
+
import.meta.url
|
|
179
|
+
));
|
|
180
|
+
}
|
|
181
|
+
class ve {
|
|
182
|
+
constructor() {
|
|
183
|
+
a(this, "cwd", null);
|
|
184
|
+
}
|
|
185
|
+
setWorkingDirectory(e) {
|
|
186
|
+
this.cwd = e;
|
|
187
|
+
}
|
|
188
|
+
async run(e) {
|
|
189
|
+
await new Promise((t, i) => {
|
|
190
|
+
me(e, { cwd: this.cwd ?? void 0 }, (s) => {
|
|
191
|
+
if (s) {
|
|
192
|
+
i(s);
|
|
193
|
+
return;
|
|
194
|
+
}
|
|
195
|
+
t();
|
|
196
|
+
});
|
|
197
|
+
});
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
const p = L(ve);
|
|
201
|
+
class we {
|
|
202
|
+
constructor() {
|
|
203
|
+
a(this, "project");
|
|
204
|
+
a(this, "modifiedFiles");
|
|
205
|
+
this.project = new ge({ tsConfigFilePath: "tsconfig.json" }), this.modifiedFiles = /* @__PURE__ */ new Set(), this.project.addSourceFilesAtPaths("src/**/*.ts"), this.project.addSourceFilesAtPaths("vite.config.ts"), this.project.addSourceFilesAtPaths("package.json");
|
|
206
|
+
}
|
|
207
|
+
addSourceFile(e) {
|
|
208
|
+
this.project.addSourceFilesAtPaths(e);
|
|
209
|
+
}
|
|
210
|
+
requireSourceFile(e) {
|
|
211
|
+
return this.project.getSourceFileOrThrow(e);
|
|
212
|
+
}
|
|
213
|
+
async format() {
|
|
214
|
+
await r.animate("Formatting modified files", async () => {
|
|
215
|
+
const e = c.exists("prettier.config.js") || c.contains("package.json", '"prettier": {'), t = c.exists(".eslintrc.js") || c.contains("package.json", '"eslintConfig"'), s = c.contains("package.json", '"prettier-eslint-cli"') ? (n) => p.run(`npx prettier-eslint ${n} --write`) : async (n) => {
|
|
216
|
+
e && await p.run(`npx prettier ${n} --write`), n.match(/\.(ts|js|vue)$/) && t && await p.run(`npx eslint ${n} --fix`);
|
|
217
|
+
};
|
|
218
|
+
await Promise.all(I(this.modifiedFiles).map(async (n) => s(n)));
|
|
219
|
+
});
|
|
220
|
+
}
|
|
221
|
+
async save(e) {
|
|
222
|
+
await e.save(), this.addModifiedFile(e.getFilePath());
|
|
223
|
+
}
|
|
224
|
+
addModifiedFile(e) {
|
|
225
|
+
this.modifiedFiles.add(e);
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
class K {
|
|
229
|
+
constructor(e, t = {}) {
|
|
230
|
+
this.name = e, this.options = t;
|
|
231
|
+
}
|
|
232
|
+
create(e) {
|
|
233
|
+
c.exists(e) && (!c.isDirectory(e) || !c.isEmptyDirectory(e)) && r.fail(`Folder at '${e}' already exists!`), f.instantiate(w("app"), e, {
|
|
234
|
+
app: {
|
|
235
|
+
name: this.name,
|
|
236
|
+
slug: T(this.name)
|
|
237
|
+
},
|
|
238
|
+
dependencies: this.getDependencies(),
|
|
239
|
+
contentPath: this.options.linkedLocal ? `${m("core")}/dist/**/*.js` : "./node_modules/@aerogel/core/dist/**/*.js"
|
|
240
|
+
});
|
|
241
|
+
}
|
|
242
|
+
edit() {
|
|
243
|
+
return new we();
|
|
244
|
+
}
|
|
245
|
+
getDependencies() {
|
|
246
|
+
const e = (t) => Object.entries(t).reduce(
|
|
247
|
+
(i, [s, n]) => Object.assign(i, { [s]: `file:${n}` }),
|
|
248
|
+
{}
|
|
249
|
+
);
|
|
250
|
+
return this.options.linkedLocal ? e({
|
|
251
|
+
aerogelCli: m("cli"),
|
|
252
|
+
aerogelCore: m("core"),
|
|
253
|
+
aerogelCypress: m("cypress"),
|
|
254
|
+
aerogelPluginI18n: m("plugin-i18n"),
|
|
255
|
+
aerogelPluginSoukai: m("plugin-soukai"),
|
|
256
|
+
aerogelVite: m("vite")
|
|
257
|
+
}) : this.options.local ? e({
|
|
258
|
+
aerogelCli: y("cli") ?? h("cli"),
|
|
259
|
+
aerogelCore: y("core") ?? h("core"),
|
|
260
|
+
aerogelCypress: y("cypress") ?? h("cypress"),
|
|
261
|
+
aerogelPluginI18n: y("plugin-i18n") ?? h("plugin-i18n"),
|
|
262
|
+
aerogelPluginSoukai: y("plugin-soukai") ?? h("plugin-soukai"),
|
|
263
|
+
aerogelVite: y("vite") ?? h("vite")
|
|
264
|
+
}) : {
|
|
265
|
+
aerogelCli: "next",
|
|
266
|
+
aerogelCore: "next",
|
|
267
|
+
aerogelCypress: "next",
|
|
268
|
+
aerogelPluginI18n: "next",
|
|
269
|
+
aerogelPluginSoukai: "next",
|
|
270
|
+
aerogelVite: "next"
|
|
271
|
+
};
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
class g {
|
|
275
|
+
static define(e) {
|
|
276
|
+
e = e.command(this.command).description(this.description);
|
|
277
|
+
for (const [t, i] of this.parameters)
|
|
278
|
+
e = e.argument(`<${t}>`, i);
|
|
279
|
+
for (const [t, i] of Object.entries(this.options)) {
|
|
280
|
+
const s = typeof i == "string" ? i : i.description, n = typeof i == "string" ? "string" : i.type ?? "string";
|
|
281
|
+
e = e.option(n === "boolean" ? `--${t}` : `--${t} <${n}>`, s);
|
|
282
|
+
}
|
|
283
|
+
e = e.action((...t) => this.run.call(this, ...t));
|
|
284
|
+
}
|
|
285
|
+
static async run(...e) {
|
|
286
|
+
const t = new this(...e);
|
|
287
|
+
await t.validate(), await t.run();
|
|
288
|
+
}
|
|
289
|
+
async validate() {
|
|
290
|
+
}
|
|
291
|
+
async run() {
|
|
292
|
+
}
|
|
293
|
+
assertAerogelOrDirectory(e) {
|
|
294
|
+
const t = c.read("package.json");
|
|
295
|
+
if (t != null && t.includes("@aerogel/core") || e && c.isDirectory(e))
|
|
296
|
+
return;
|
|
297
|
+
const i = e ? `${e} folder does not exist.` : "package.json does not contain @aerogel/core.";
|
|
298
|
+
r.fail(`${i} Are you sure this is an Aerogel app?`);
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
a(g, "command", ""), a(g, "description", ""), a(g, "parameters", []), a(g, "options", {});
|
|
302
|
+
class $ extends g {
|
|
303
|
+
constructor(t, i = {}) {
|
|
304
|
+
super();
|
|
305
|
+
a(this, "path");
|
|
306
|
+
a(this, "options");
|
|
307
|
+
this.path = t, this.options = i;
|
|
308
|
+
}
|
|
309
|
+
async run() {
|
|
310
|
+
const t = this.path, i = this.options.name ?? ne(le(t));
|
|
311
|
+
p.setWorkingDirectory(t), await this.createApp(i, t), await this.installDependencies(), await this.initializeGit(), r.success(`
|
|
312
|
+
|
|
313
|
+
That's it! You can start working on **${i}** doing the following:
|
|
314
|
+
|
|
315
|
+
cd ${t}
|
|
316
|
+
npm run dev
|
|
317
|
+
|
|
318
|
+
Have fun!
|
|
319
|
+
`);
|
|
320
|
+
}
|
|
321
|
+
async createApp(t, i) {
|
|
322
|
+
r.info(`Creating **${t}**...`), new K(t, {
|
|
323
|
+
local: this.options.local,
|
|
324
|
+
linkedLocal: this.options.local && !this.options.copy
|
|
325
|
+
}).create(i);
|
|
326
|
+
}
|
|
327
|
+
async installDependencies() {
|
|
328
|
+
await r.animate("Installing dependencies", async () => {
|
|
329
|
+
await p.run("npm install");
|
|
330
|
+
});
|
|
331
|
+
}
|
|
332
|
+
async initializeGit() {
|
|
333
|
+
await r.animate("Initializing git", async () => {
|
|
334
|
+
await p.run("git init"), await p.run("git add ."), await p.run('git commit -m "Start"');
|
|
335
|
+
});
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
a($, "command", "create"), a($, "description", "Create AerogelJS app"), a($, "parameters", [["path", "Application path"]]), a($, "options", {
|
|
339
|
+
name: "Application name",
|
|
340
|
+
local: {
|
|
341
|
+
type: "boolean",
|
|
342
|
+
description: "Whether to create an app using local Aerogel packages (used for core development)"
|
|
343
|
+
},
|
|
344
|
+
copy: {
|
|
345
|
+
type: "boolean",
|
|
346
|
+
description: "Whether to create an app linked to local Aerogel packages (used in CI)"
|
|
347
|
+
}
|
|
348
|
+
});
|
|
349
|
+
function q() {
|
|
350
|
+
return new K("");
|
|
351
|
+
}
|
|
352
|
+
function ke() {
|
|
353
|
+
return c.contains("package.json", '"@aerogel/core": "file:');
|
|
354
|
+
}
|
|
355
|
+
function xe() {
|
|
356
|
+
return c.isSymlink("node_modules/@aerogel/core");
|
|
357
|
+
}
|
|
358
|
+
function v(o, e = {}) {
|
|
359
|
+
if (!o)
|
|
360
|
+
return;
|
|
361
|
+
const t = e.guard ?? (() => !0), i = e.validate ?? (() => !0), s = I(e.skip ?? []);
|
|
362
|
+
return o.forEachDescendant((n, l) => {
|
|
363
|
+
if (t(n) && i(n))
|
|
364
|
+
return n;
|
|
365
|
+
const u = n.getKind();
|
|
366
|
+
s.includes(u) && l.skip();
|
|
367
|
+
});
|
|
368
|
+
}
|
|
369
|
+
function R(o, e) {
|
|
370
|
+
if (!(!o || !e(o)))
|
|
371
|
+
return o;
|
|
372
|
+
}
|
|
373
|
+
class b extends g {
|
|
374
|
+
constructor(t, i = {}) {
|
|
375
|
+
super();
|
|
376
|
+
a(this, "path");
|
|
377
|
+
a(this, "options");
|
|
378
|
+
this.path = t, this.options = i;
|
|
379
|
+
}
|
|
380
|
+
async validate() {
|
|
381
|
+
ae([this.options.button, this.options.input, this.options.checkbox]).length > 1 && r.fail("Can only use one of 'button', 'input', or 'checkbox' flags!");
|
|
382
|
+
}
|
|
383
|
+
async run() {
|
|
384
|
+
this.assertAerogelOrDirectory("src/components"), this.assertHistoireInstalled();
|
|
385
|
+
const t = /* @__PURE__ */ new Set(), [i, s] = this.parsePathComponents();
|
|
386
|
+
await this.createComponent(i, s, t), await this.createStory(i, s, t), await this.declareComponents();
|
|
387
|
+
const n = I(t).map((l) => `- ${l}`).join(`
|
|
388
|
+
`);
|
|
389
|
+
r.info(`${s} component created successfully! The following files were created:
|
|
390
|
+
|
|
391
|
+
${n}`);
|
|
392
|
+
}
|
|
393
|
+
assertHistoireInstalled() {
|
|
394
|
+
this.options.story && !c.contains("package.json", '"histoire"') && !c.contains("package.json", '"@aerogel/histoire"') && r.fail(`
|
|
395
|
+
Histoire is not installed yet! You can install it running:
|
|
396
|
+
npx gel install histoire
|
|
397
|
+
`);
|
|
398
|
+
}
|
|
399
|
+
async createComponent(t, i, s) {
|
|
400
|
+
await r.animate("Creating component", async () => {
|
|
401
|
+
c.exists(`src/components/${this.path}.vue`) && r.fail(`${this.path} component already exists!`);
|
|
402
|
+
const n = this.options.input ? "component-input" : this.options.button ? "component-button" : this.options.checkbox ? "component-checkbox" : "component";
|
|
403
|
+
f.instantiate(w(n), `src/components/${t}`, {
|
|
404
|
+
component: {
|
|
405
|
+
name: i,
|
|
406
|
+
slug: T(i)
|
|
407
|
+
}
|
|
408
|
+
}).forEach((u) => s.add(u));
|
|
409
|
+
});
|
|
410
|
+
}
|
|
411
|
+
async createStory(t, i, s) {
|
|
412
|
+
this.options.story && await r.animate("Creating story", async () => {
|
|
413
|
+
const n = this.options.input ? "component-input-story" : this.options.button ? "component-button-story" : this.options.checkbox ? "component-checkbox-story" : "component-story";
|
|
414
|
+
f.instantiate(w(n), `src/components/${t}`, {
|
|
415
|
+
component: {
|
|
416
|
+
name: i,
|
|
417
|
+
slug: T(i)
|
|
418
|
+
}
|
|
419
|
+
}).forEach((u) => s.add(u));
|
|
420
|
+
});
|
|
421
|
+
}
|
|
422
|
+
async declareComponents() {
|
|
423
|
+
const t = q().edit(), i = t.requireSourceFile("vite.config.ts"), s = this.getComponentDirsArray(i);
|
|
424
|
+
if (!s)
|
|
425
|
+
return r.fail("Could not find component dirs declaration in vite config!");
|
|
426
|
+
s.getDescendantsOfKind(j.StringLiteral).some((n) => n.getText() === "'src/components'") || (await r.animate("Updating vite config", async () => {
|
|
427
|
+
s.addElement("'src/components'"), await t.save(i);
|
|
428
|
+
}), await t.format());
|
|
429
|
+
}
|
|
430
|
+
getComponentDirsArray(t) {
|
|
431
|
+
const i = v(t, {
|
|
432
|
+
guard: d.isCallExpression,
|
|
433
|
+
validate: (l) => l.getText().startsWith("Components("),
|
|
434
|
+
skip: j.ImportDeclaration
|
|
435
|
+
});
|
|
436
|
+
if (!i)
|
|
437
|
+
return null;
|
|
438
|
+
const s = v(i, {
|
|
439
|
+
guard: d.isPropertyAssignment,
|
|
440
|
+
validate: (l) => l.getName() === "dirs"
|
|
441
|
+
}), n = s == null ? void 0 : s.getInitializer();
|
|
442
|
+
return d.isArrayLiteralExpression(n) ? n : this.declareComponentDirsArray(i);
|
|
443
|
+
}
|
|
444
|
+
declareComponentDirsArray(t) {
|
|
445
|
+
const i = v(t, { guard: d.isObjectLiteralExpression }), s = i == null ? void 0 : i.addPropertyAssignment({
|
|
446
|
+
name: "dirs",
|
|
447
|
+
initializer: "[]"
|
|
448
|
+
});
|
|
449
|
+
return (s == null ? void 0 : s.getInitializer()) ?? null;
|
|
450
|
+
}
|
|
451
|
+
parsePathComponents() {
|
|
452
|
+
const t = this.path.lastIndexOf("/");
|
|
453
|
+
return t === -1 ? ["", this.path] : [this.path.substring(0, t), this.path.substring(t + 1)];
|
|
454
|
+
}
|
|
455
|
+
}
|
|
456
|
+
a(b, "command", "generate:component"), a(b, "description", "Generate an AerogelJS Component"), a(b, "parameters", [
|
|
457
|
+
["path", "Component path (relative to components folder; extension not necessary)"]
|
|
458
|
+
]), a(b, "options", {
|
|
459
|
+
button: {
|
|
460
|
+
description: "Create a custom button",
|
|
461
|
+
type: "boolean"
|
|
462
|
+
},
|
|
463
|
+
checkbox: {
|
|
464
|
+
description: "Create a custom checkbox",
|
|
465
|
+
type: "boolean"
|
|
466
|
+
},
|
|
467
|
+
input: {
|
|
468
|
+
description: "Create a custom input",
|
|
469
|
+
type: "boolean"
|
|
470
|
+
},
|
|
471
|
+
story: {
|
|
472
|
+
description: "Create component story using Histoire",
|
|
473
|
+
type: "boolean"
|
|
474
|
+
}
|
|
475
|
+
});
|
|
476
|
+
class F extends g {
|
|
477
|
+
constructor(t, i = {}) {
|
|
478
|
+
super();
|
|
479
|
+
a(this, "name");
|
|
480
|
+
a(this, "options");
|
|
481
|
+
this.name = t, this.options = i;
|
|
482
|
+
}
|
|
483
|
+
async run() {
|
|
484
|
+
this.assertAerogelOrDirectory("src/models"), c.exists(`src/models/${this.name}.ts`) && r.fail(`${this.name} model already exists!`), this.assertSoukaiInstalled();
|
|
485
|
+
const t = await r.animate("Creating model", async () => f.instantiate(w("model"), "src/models", {
|
|
486
|
+
model: {
|
|
487
|
+
name: this.name,
|
|
488
|
+
fieldsDefinition: this.getFieldsDefinition()
|
|
489
|
+
},
|
|
490
|
+
soukaiImports: this.options.fields ? "FieldType, defineModelSchema" : "defineModelSchema"
|
|
491
|
+
}).map((s) => `- ${s}`).join(`
|
|
492
|
+
`));
|
|
493
|
+
r.info(`${this.name} model created successfully! The following files were created:
|
|
494
|
+
|
|
495
|
+
${t}`);
|
|
496
|
+
}
|
|
497
|
+
getFieldsDefinition() {
|
|
498
|
+
if (!this.options.fields)
|
|
499
|
+
return " //";
|
|
500
|
+
const t = this.options.fields.split(",").map((i) => {
|
|
501
|
+
const [s, n, l] = i.split(":");
|
|
502
|
+
return {
|
|
503
|
+
name: s,
|
|
504
|
+
type: re(n ?? "string"),
|
|
505
|
+
required: l === "required"
|
|
506
|
+
};
|
|
507
|
+
}).reduce((i, s) => {
|
|
508
|
+
const n = s.required ? M(`
|
|
509
|
+
${s.name}: {
|
|
510
|
+
type: FieldType.${s.type},
|
|
511
|
+
required: true,
|
|
512
|
+
}
|
|
513
|
+
`) : `${s.name}: FieldType.${s.type}`;
|
|
514
|
+
return i + `
|
|
515
|
+
${n},`;
|
|
516
|
+
}, "");
|
|
517
|
+
return M(t, { indent: 8 });
|
|
518
|
+
}
|
|
519
|
+
assertSoukaiInstalled() {
|
|
520
|
+
!c.contains("package.json", '"soukai"') && !c.contains("package.json", '"@aerogel/plugin-soukai"') && r.fail(`
|
|
521
|
+
Soukai is not installed yet! You can install it running:
|
|
522
|
+
npx gel install soukai
|
|
523
|
+
`);
|
|
524
|
+
}
|
|
525
|
+
}
|
|
526
|
+
a(F, "command", "generate:model"), a(F, "description", "Generate an AerogelJS Model"), a(F, "parameters", [["name", "Model name"]]), a(F, "options", {
|
|
527
|
+
fields: "Create model with the given fields"
|
|
528
|
+
});
|
|
529
|
+
class D extends g {
|
|
530
|
+
constructor(t = {}) {
|
|
531
|
+
super();
|
|
532
|
+
a(this, "options");
|
|
533
|
+
this.options = t;
|
|
534
|
+
}
|
|
535
|
+
async run() {
|
|
536
|
+
this.assertAerogelOrDirectory("src/components"), this.assertHistoireInstalled();
|
|
537
|
+
const t = /* @__PURE__ */ new Set();
|
|
538
|
+
await this.createComponents(t), await this.createStory(t);
|
|
539
|
+
const i = I(t).map((s) => `- ${s}`).join(`
|
|
540
|
+
`);
|
|
541
|
+
r.info(`Overrides created successfully! The following files were created:
|
|
542
|
+
|
|
543
|
+
${i}`), r.info(`
|
|
544
|
+
Remember to declare your components in main.ts and main.histoire.ts!`);
|
|
545
|
+
}
|
|
546
|
+
assertHistoireInstalled() {
|
|
547
|
+
this.options.story && !c.contains("package.json", '"histoire"') && !c.contains("package.json", '"@aerogel/histoire"') && r.fail(`
|
|
548
|
+
Histoire is not installed yet! You can install it running:
|
|
549
|
+
npx gel install histoire
|
|
550
|
+
`);
|
|
551
|
+
}
|
|
552
|
+
async createComponents(t) {
|
|
553
|
+
await r.animate("Creating components", async () => {
|
|
554
|
+
c.exists("src/components/ModalWrapper.vue") && r.fail("ModalWrapper component already exists!"), f.instantiate(w("overrides"), "src").forEach((i) => t.add(i));
|
|
555
|
+
});
|
|
556
|
+
}
|
|
557
|
+
async createStory(t) {
|
|
558
|
+
this.options.story && await r.animate("Creating story", async () => {
|
|
559
|
+
f.instantiate(w("overrides-story"), "src/components/overrides/").forEach((i) => t.add(i));
|
|
560
|
+
});
|
|
561
|
+
}
|
|
562
|
+
}
|
|
563
|
+
a(D, "command", "generate:overrides"), a(D, "description", "Generate AerogelJS component overrides"), a(D, "options", {
|
|
564
|
+
story: {
|
|
565
|
+
description: "Create overrides story using Histoire",
|
|
566
|
+
type: "boolean"
|
|
567
|
+
}
|
|
568
|
+
});
|
|
569
|
+
class C extends g {
|
|
570
|
+
constructor(t) {
|
|
571
|
+
super();
|
|
572
|
+
a(this, "name");
|
|
573
|
+
this.name = t;
|
|
574
|
+
}
|
|
575
|
+
async run() {
|
|
576
|
+
this.assertAerogelOrDirectory("src/services");
|
|
577
|
+
const t = /* @__PURE__ */ new Set(), i = q().edit();
|
|
578
|
+
await this.createService(t), await this.registerService(i), await i.format();
|
|
579
|
+
const s = I(t).map((n) => `- ${n}`).join(`
|
|
580
|
+
`);
|
|
581
|
+
r.info(`${this.name} service created successfully! The following files were created:
|
|
582
|
+
|
|
583
|
+
${s}`);
|
|
584
|
+
}
|
|
585
|
+
async createService(t) {
|
|
586
|
+
await r.animate("Creating service", async () => {
|
|
587
|
+
c.exists(`src/services/${this.name}.ts`) && r.fail(`${this.name} service already exists!`), f.instantiate(w("service"), "src/services", {
|
|
588
|
+
service: {
|
|
589
|
+
name: this.name
|
|
590
|
+
}
|
|
591
|
+
}).forEach((s) => t.add(s));
|
|
592
|
+
});
|
|
593
|
+
}
|
|
594
|
+
async registerService(t) {
|
|
595
|
+
await r.animate("Registering service", async () => {
|
|
596
|
+
c.exists("src/services/index.ts") || await this.createServicesIndex(t);
|
|
597
|
+
const i = t.requireSourceFile("src/services/index.ts"), s = this.getServicesObject(i);
|
|
598
|
+
if (!s)
|
|
599
|
+
return r.fail("Could not find services object in services config, please add it manually.");
|
|
600
|
+
i.addImportDeclaration({
|
|
601
|
+
defaultImport: this.name,
|
|
602
|
+
moduleSpecifier: `./${this.name}`
|
|
603
|
+
}), s.addPropertyAssignment({
|
|
604
|
+
name: `$${oe(this.name)}`,
|
|
605
|
+
initializer: this.name
|
|
606
|
+
}), await t.save(i);
|
|
607
|
+
});
|
|
608
|
+
}
|
|
609
|
+
async createServicesIndex(t) {
|
|
610
|
+
c.write(
|
|
611
|
+
"src/services/index.ts",
|
|
612
|
+
M(`
|
|
613
|
+
export const services = {};
|
|
614
|
+
|
|
615
|
+
export type AppServices = typeof services;
|
|
616
|
+
|
|
617
|
+
declare module '@aerogel/core' {
|
|
618
|
+
interface Services extends AppServices {}
|
|
619
|
+
}
|
|
620
|
+
`)
|
|
621
|
+
), t.addSourceFile("src/services/index.ts");
|
|
622
|
+
const i = t.requireSourceFile("src/main.ts"), s = this.getBootstrapOptions(i);
|
|
623
|
+
if (!s)
|
|
624
|
+
return r.fail("Could not find options object in bootstrap config, please add the services manually.");
|
|
625
|
+
s.insertShorthandPropertyAssignment(0, { name: "services" }), i.addImportDeclaration({
|
|
626
|
+
namedImports: ["services"],
|
|
627
|
+
moduleSpecifier: "./services"
|
|
628
|
+
}), await t.save(i);
|
|
629
|
+
}
|
|
630
|
+
getBootstrapOptions(t) {
|
|
631
|
+
const i = v(t, {
|
|
632
|
+
guard: d.isCallExpression,
|
|
633
|
+
validate: (n) => n.getExpression().getText() === "bootstrap",
|
|
634
|
+
skip: j.ImportDeclaration
|
|
635
|
+
}), s = i == null ? void 0 : i.getArguments()[1];
|
|
636
|
+
return d.isObjectLiteralExpression(s) ? s : null;
|
|
637
|
+
}
|
|
638
|
+
getServicesObject(t) {
|
|
639
|
+
const i = v(t, {
|
|
640
|
+
guard: d.isVariableDeclaration,
|
|
641
|
+
validate: (n) => n.getName() === "services"
|
|
642
|
+
}), s = i == null ? void 0 : i.getInitializer();
|
|
643
|
+
return d.isObjectLiteralExpression(s) ? s : null;
|
|
644
|
+
}
|
|
645
|
+
}
|
|
646
|
+
a(C, "command", "generate:service"), a(C, "description", "Generate an AerogelJS Service"), a(C, "parameters", [["name", "Service name"]]);
|
|
647
|
+
class B extends g {
|
|
648
|
+
async run() {
|
|
649
|
+
r.info("[AerogelJS CLI info]"), r.info("Installation directory: " + x(new S(
|
|
650
|
+
/* @vite-ignore */
|
|
651
|
+
"./",
|
|
652
|
+
import.meta.url
|
|
653
|
+
)));
|
|
654
|
+
}
|
|
655
|
+
}
|
|
656
|
+
a(B, "command", "info"), a(B, "description", "Show debugging information about the CLI");
|
|
657
|
+
class U {
|
|
658
|
+
constructor(e) {
|
|
659
|
+
a(this, "name");
|
|
660
|
+
this.name = e;
|
|
661
|
+
}
|
|
662
|
+
async install() {
|
|
663
|
+
this.assertNotInstalled(), await this.beforeInstall(), await this.installDependencies();
|
|
664
|
+
{
|
|
665
|
+
const e = q().edit();
|
|
666
|
+
await this.updateFiles(e), await e.format();
|
|
667
|
+
}
|
|
668
|
+
await this.afterInstall(), r.info(`Plugin ${this.name} installed!`);
|
|
669
|
+
}
|
|
670
|
+
assertNotInstalled() {
|
|
671
|
+
c.contains("package.json", `"${this.getNpmPackageName()}"`) && r.fail(`${this.name} is already installed!`);
|
|
672
|
+
}
|
|
673
|
+
async beforeInstall() {
|
|
674
|
+
}
|
|
675
|
+
async afterInstall() {
|
|
676
|
+
}
|
|
677
|
+
async installDependencies() {
|
|
678
|
+
await r.animate("Installing plugin dependencies", async () => {
|
|
679
|
+
await this.installNpmDependencies();
|
|
680
|
+
});
|
|
681
|
+
}
|
|
682
|
+
async updateFiles(e) {
|
|
683
|
+
this.isForDevelopment() || await this.updateBootstrapConfig(e);
|
|
684
|
+
}
|
|
685
|
+
async installNpmDependencies() {
|
|
686
|
+
const e = this.isForDevelopment() ? "--save-dev" : "";
|
|
687
|
+
if (xe()) {
|
|
688
|
+
await p.run(`npm install file:${m(this.getLocalPackageName())} ${e}`);
|
|
689
|
+
return;
|
|
690
|
+
}
|
|
691
|
+
if (ke()) {
|
|
692
|
+
const t = y(this.getLocalPackageName()) ?? h(this.getLocalPackageName());
|
|
693
|
+
await p.run(`npm install file:${t} ${e}`);
|
|
694
|
+
return;
|
|
695
|
+
}
|
|
696
|
+
await p.run(`npm install ${this.getNpmPackageName()}@next --save-exact ${e}`);
|
|
697
|
+
}
|
|
698
|
+
async updateBootstrapConfig(e) {
|
|
699
|
+
await r.animate("Injecting plugin in bootstrap configuration", async () => {
|
|
700
|
+
const t = e.requireSourceFile("src/main.ts"), i = this.getBootstrapPluginsDeclaration(t);
|
|
701
|
+
if (!i)
|
|
702
|
+
return r.fail(`
|
|
703
|
+
Could not find plugins array in bootstrap config, please add the following manually:
|
|
704
|
+
|
|
705
|
+
${this.getBootstrapConfig()}
|
|
706
|
+
`);
|
|
707
|
+
t.addImportDeclaration(this.getBootstrapImport()), i.addElement(this.getBootstrapConfig()), await e.save(t);
|
|
708
|
+
});
|
|
709
|
+
}
|
|
710
|
+
getBootstrapPluginsDeclaration(e) {
|
|
711
|
+
var l, u;
|
|
712
|
+
const t = v(e, {
|
|
713
|
+
guard: d.isCallExpression,
|
|
714
|
+
validate: (k) => k.getExpression().getText() === "bootstrap",
|
|
715
|
+
skip: j.ImportDeclaration
|
|
716
|
+
}), i = t == null ? void 0 : t.getArguments()[1], s = (l = R(i, d.isObjectLiteralExpression)) == null ? void 0 : l.getProperty("plugins"), n = (u = R(s, d.isPropertyAssignment)) == null ? void 0 : u.getInitializer();
|
|
717
|
+
return d.isArrayLiteralExpression(n) ? n : null;
|
|
718
|
+
}
|
|
719
|
+
getTailwindContentArray(e) {
|
|
720
|
+
const t = v(e, {
|
|
721
|
+
guard: d.isPropertyAssignment,
|
|
722
|
+
validate: (s) => s.getName() === "content",
|
|
723
|
+
skip: j.JSDoc
|
|
724
|
+
}), i = t == null ? void 0 : t.getInitializer();
|
|
725
|
+
return d.isArrayLiteralExpression(i) ? i : null;
|
|
726
|
+
}
|
|
727
|
+
getBootstrapImport() {
|
|
728
|
+
return {
|
|
729
|
+
defaultImport: this.name,
|
|
730
|
+
moduleSpecifier: `@aerogel/plugin-${this.name}`
|
|
731
|
+
};
|
|
732
|
+
}
|
|
733
|
+
getNpmPackageName() {
|
|
734
|
+
return `@aerogel/${this.getLocalPackageName()}`;
|
|
735
|
+
}
|
|
736
|
+
getLocalPackageName() {
|
|
737
|
+
return `plugin-${this.name}`;
|
|
738
|
+
}
|
|
739
|
+
isForDevelopment() {
|
|
740
|
+
return !1;
|
|
741
|
+
}
|
|
742
|
+
getBootstrapConfig() {
|
|
743
|
+
return `${this.name}()`;
|
|
744
|
+
}
|
|
745
|
+
}
|
|
746
|
+
class Se extends U {
|
|
747
|
+
constructor() {
|
|
748
|
+
super("solid");
|
|
749
|
+
}
|
|
750
|
+
async updateFiles(e) {
|
|
751
|
+
await this.updateNpmScripts(e), await this.updateGitIgnore(), await super.updateFiles(e);
|
|
752
|
+
}
|
|
753
|
+
async installNpmDependencies() {
|
|
754
|
+
await p.run("npm install soukai-solid@next --save-exact"), await p.run("npm install @noeldemartin/solid-utils@next --save-exact"), await p.run("npm install @solid/community-server@7.1.6 --save-dev -E"), await super.installNpmDependencies();
|
|
755
|
+
}
|
|
756
|
+
async updateNpmScripts(e) {
|
|
757
|
+
r.info("Updating npm scripts...");
|
|
758
|
+
const t = c.read("package.json");
|
|
759
|
+
if (!t)
|
|
760
|
+
return r.fail("Could not find package.json file");
|
|
761
|
+
c.write(
|
|
762
|
+
"package.json",
|
|
763
|
+
t.replace(
|
|
764
|
+
'"cy:dev": "concurrently --kill-others \\"npm run test:serve-app\\" \\"npm run cy:open\\"",',
|
|
765
|
+
'"cy:dev": "concurrently --kill-others \\"npm run test:serve-app\\" \\"npm run test:serve-pod\\" \\"npm run cy:open\\"",'
|
|
766
|
+
).replace(
|
|
767
|
+
'"cy:test": "start-server-and-test test:serve-app http-get://localhost:5001 cy:run",',
|
|
768
|
+
'"cy:test": "start-server-and-test test:serve-app http-get://localhost:5001 test:serve-pod http-get://localhost:3000 cy:run",'
|
|
769
|
+
).replace(
|
|
770
|
+
'"dev": "vite",',
|
|
771
|
+
`"dev": "vite",
|
|
772
|
+
"dev:serve-pod": "community-solid-server -c @css:config/file.json -f ./solid",`
|
|
773
|
+
).replace(
|
|
774
|
+
'"test:serve-app": "vite --port 5001 --mode testing"',
|
|
775
|
+
`"test:serve-app": "vite --port 5001 --mode testing",
|
|
776
|
+
"test:serve-pod": "community-solid-server -l warn"`
|
|
777
|
+
)
|
|
778
|
+
), e.addModifiedFile("package.json");
|
|
779
|
+
}
|
|
780
|
+
async updateGitIgnore() {
|
|
781
|
+
r.info("Updating .gitignore");
|
|
782
|
+
const e = c.read(".gitignore") ?? "";
|
|
783
|
+
c.write(".gitignore", `${e}/solid
|
|
784
|
+
`);
|
|
785
|
+
}
|
|
786
|
+
}
|
|
787
|
+
class $e extends U {
|
|
788
|
+
constructor() {
|
|
789
|
+
super("soukai");
|
|
790
|
+
}
|
|
791
|
+
async installNpmDependencies() {
|
|
792
|
+
await p.run("npm install soukai@next --save-exact"), await super.installNpmDependencies();
|
|
793
|
+
}
|
|
794
|
+
getBootstrapConfig() {
|
|
795
|
+
return "soukai({ models: import.meta.glob('@/models/*', { eager: true }) })";
|
|
796
|
+
}
|
|
797
|
+
}
|
|
798
|
+
const V = [new $e(), new Se()].reduce(
|
|
799
|
+
(o, e) => Object.assign(o, { [e.name]: e }),
|
|
800
|
+
{}
|
|
801
|
+
);
|
|
802
|
+
class A extends g {
|
|
803
|
+
constructor(t) {
|
|
804
|
+
super();
|
|
805
|
+
a(this, "plugin");
|
|
806
|
+
this.plugin = V[t] ?? r.fail(`Plugin '${t}' doesn't exist. Available plugins: ${Object.keys(V).join(", ")}`);
|
|
807
|
+
}
|
|
808
|
+
async run() {
|
|
809
|
+
await this.plugin.install();
|
|
810
|
+
}
|
|
811
|
+
}
|
|
812
|
+
a(A, "command", "install"), a(A, "description", "Install an AerogelJS plugin"), a(A, "parameters", [["plugin", "Plugin to install"]]);
|
|
813
|
+
class be {
|
|
814
|
+
run(e) {
|
|
815
|
+
const t = new Z();
|
|
816
|
+
t.name("gel").description("AerogelJS CLI").version(this.getVersion()), $.define(t), b.define(t), F.define(t), D.define(t), C.define(t), B.define(t), A.define(t), t.parse(e);
|
|
817
|
+
}
|
|
818
|
+
getVersion() {
|
|
819
|
+
const e = "Could not find CLI's version, please report this bug.", t = x(new S(
|
|
820
|
+
/* @vite-ignore */
|
|
821
|
+
"../package.json",
|
|
822
|
+
import.meta.url
|
|
823
|
+
));
|
|
824
|
+
if (!N(t))
|
|
825
|
+
throw new Error(e);
|
|
826
|
+
return JSON.parse(z(t).toString()).version ?? ce(e);
|
|
827
|
+
}
|
|
828
|
+
}
|
|
829
|
+
const Te = L(be);
|
|
830
|
+
export {
|
|
831
|
+
Te as CLI
|
|
832
|
+
};
|
|
833
|
+
//# sourceMappingURL=aerogel-cli.js.map
|