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