@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.
Files changed (63) hide show
  1. package/dist/aerogel-cli.js +292 -349
  2. package/dist/aerogel-cli.js.map +1 -1
  3. package/package.json +3 -2
  4. package/src/cli.ts +0 -2
  5. package/src/commands/create.test.ts +0 -23
  6. package/src/commands/create.ts +4 -8
  7. package/src/commands/generate-component.test.ts +0 -60
  8. package/src/commands/generate-component.ts +3 -79
  9. package/src/commands/install.test.ts +69 -6
  10. package/src/commands/install.ts +21 -6
  11. package/src/lib/App.ts +40 -41
  12. package/src/lib/Editor.ts +0 -1
  13. package/src/lib/File.mock.ts +6 -0
  14. package/src/lib/File.ts +32 -2
  15. package/src/lib/Shell.mock.ts +4 -0
  16. package/src/lib/utils/paths.ts +4 -0
  17. package/src/plugins/LocalFirst.ts +9 -0
  18. package/src/plugins/Plugin.ts +30 -32
  19. package/src/plugins/Solid.ts +8 -15
  20. package/src/plugins/Soukai.ts +6 -5
  21. package/src/testing/setup.ts +6 -0
  22. package/src/utils/package.ts +23 -0
  23. package/src/commands/generate-overrides.ts +0 -85
  24. package/templates/app/.github/workflows/ci.yml +0 -29
  25. package/templates/app/.gitignore.template +0 -2
  26. package/templates/app/.nvmrc +0 -1
  27. package/templates/app/.vscode/launch.json +0 -17
  28. package/templates/app/.vscode/settings.json +0 -10
  29. package/templates/app/cypress/cypress.config.ts +0 -14
  30. package/templates/app/cypress/e2e/app.cy.ts +0 -9
  31. package/templates/app/cypress/support/e2e.ts +0 -1
  32. package/templates/app/cypress/tsconfig.json +0 -11
  33. package/templates/app/index.html +0 -13
  34. package/templates/app/package.json +0 -66
  35. package/templates/app/postcss.config.js +0 -6
  36. package/templates/app/src/App.vue +0 -12
  37. package/templates/app/src/assets/css/main.css +0 -3
  38. package/templates/app/src/assets/public/robots.txt +0 -2
  39. package/templates/app/src/lang/en.yaml +0 -3
  40. package/templates/app/src/main.test.ts +0 -9
  41. package/templates/app/src/main.ts +0 -13
  42. package/templates/app/src/types/globals.d.ts +0 -2
  43. package/templates/app/src/types/shims.d.ts +0 -7
  44. package/templates/app/src/types/ts-reset.d.ts +0 -1
  45. package/templates/app/tailwind.config.js +0 -5
  46. package/templates/app/tsconfig.json +0 -12
  47. package/templates/app/vite.config.ts +0 -31
  48. package/templates/component-button/[component.name].vue +0 -42
  49. package/templates/component-button-story/[component.name].story.vue +0 -77
  50. package/templates/component-checkbox/[component.name].vue +0 -34
  51. package/templates/component-checkbox-story/[component.name].story.vue +0 -63
  52. package/templates/component-input/[component.name].vue +0 -17
  53. package/templates/component-input-story/[component.name].story.vue +0 -63
  54. package/templates/component-story/[component.name].story.vue +0 -7
  55. package/templates/overrides/components/index.ts +0 -15
  56. package/templates/overrides/components/overrides/AlertModal.vue +0 -11
  57. package/templates/overrides/components/overrides/ConfirmModal.vue +0 -20
  58. package/templates/overrides/components/overrides/ErrorReportModal.vue +0 -35
  59. package/templates/overrides/components/overrides/LoadingModal.vue +0 -12
  60. package/templates/overrides/components/overrides/ModalWrapper.vue +0 -22
  61. package/templates/overrides/components/overrides/SnackbarNotification.vue +0 -34
  62. package/templates/overrides-story/Overrides.story.vue +0 -86
  63. package/templates/postcss-pseudo-classes/postcss.config.js +0 -15
@@ -1,64 +1,76 @@
1
- var X = Object.defineProperty;
2
- var Z = (o, e, t) => e in o ? X(o, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : o[e] = t;
3
- var r = (o, e, t) => Z(o, typeof e != "symbol" ? e + "" : e, t);
4
- import { Command as G } from "commander";
5
- import { existsSync as N, lstatSync as O, readFileSync as z, readdirSync as ee, mkdirSync as H, writeFileSync as te } from "node:fs";
6
- import { facade as L, stringMatchAll as ie, toString as se, stringMatch as ne, arrayFrom as C, stringToSlug as T, stringToTitleCase as ae, arrayFilter as re, stringToStudlyCase as oe, formatCodeBlock as M, stringToCamelCase as ce, fail as le } from "@noeldemartin/utils";
7
- import { fileURLToPath as x, URL as S } from "node:url";
8
- import { resolve as J, dirname as W, basename as pe } from "node:path";
9
- import I from "chalk";
10
- import { cursorTo as de, clearLine as ue } from "node:readline";
11
- import ge from "mustache";
12
- import { Project as me, SyntaxKind as F, Node as d } from "ts-morph";
13
- import { exec as fe } from "node:child_process";
14
- class he {
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 N(e);
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 O(e).isSymbolicLink();
31
+ return C(e).isSymbolicLink();
24
32
  }
25
33
  read(e) {
26
- return this.isFile(e) ? z(e).toString() : null;
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 = ee(e, { withFileTypes: !0 }), i = [];
41
+ const t = te(e, { withFileTypes: !0 }), i = [];
30
42
  for (const s of t) {
31
- const n = J(e, s.name);
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) && O(e).isDirectory();
49
+ return this.exists(e) && C(e).isDirectory();
38
50
  }
39
51
  isFile(e) {
40
- return this.exists(e) && O(e).isFile();
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
- H(e, { recursive: !0 });
58
+ W(e, { recursive: !0 });
47
59
  }
48
60
  write(e, t) {
49
- N(W(e)) || H(W(e), { recursive: !0 }), te(e, t);
61
+ T(K(e)) || W(K(e), { recursive: !0 }), ie(e, t);
50
62
  }
51
63
  }
52
- const c = L(he);
53
- class ye {
64
+ const o = L(ve);
65
+ class we {
54
66
  constructor() {
55
- r(this, "renderInfo", I.hex("#00ffff"));
56
- r(this, "renderSuccess", I.hex("#00ff00"));
57
- r(this, "renderError", I.hex("#ff0000"));
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 = (u = "", k = !1) => {
61
- const E = this.renderInfo(this.renderMarkdown(e) + (k ? "..." : ".".repeat(s % 4))) + u;
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 = ie(e, /\*\*(.*)\*\*/g);
96
+ const t = se(e, /\*\*(.*)\*\*/g);
85
97
  for (const i of t)
86
- e = e.replace(i[0], I.bold(i[1]));
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
- de(process.stdout, 0), ue(process.stdout, 0), process.stdout.write(e);
121
+ ue(process.stdout, 0), ge(process.stdout, 0), process.stdout.write(e);
110
122
  }
111
123
  }
112
- const a = L(ye);
113
- class f {
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 f(e).instantiate(t, i);
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 c.getFiles(this.path)) {
135
+ for (const n of o.getFiles(this.path)) {
124
136
  const l = Object.entries(i).reduce(
125
- (E, [_, Q]) => E.replaceAll(_, Q),
137
+ (E, [H, V]) => E.replaceAll(H, V),
126
138
  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, ge.render(u, t, void 0, ["<%", "%>"])), s.push(k);
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}]`] = se(n), i),
149
+ ) : i[`[${t}${s}]`] = ne(n), i),
138
150
  {}
139
151
  );
140
152
  }
141
153
  }
142
- function we(o = "") {
143
- if (c.contains(
144
- x(new S(
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 J(x(new S(
165
+ return m(S(new x(
152
166
  /* @vite-ignore */
153
167
  "../",
154
168
  import.meta.url
155
- )), o);
156
- const e = c.read(
157
- x(new S(
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 = ne(e ?? "", /"@aerogel\/core": "file:(.*)\/aerogel-core-[\d.]*\.tgz"/), i = (t == null ? void 0 : t[1]) ?? a.fail("Could not determine base path");
163
- return J(i, o);
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(o) {
166
- return a.fail(`Could not find ${o} pack file, did you run 'npm pack'?`);
179
+ function h(r) {
180
+ return c.fail(`Could not find ${r} pack file, did you run 'npm pack'?`);
167
181
  }
168
- function y(o) {
169
- return c.getFiles(m(o)).find((e) => e.endsWith(".tgz")) ?? null;
182
+ function y(r) {
183
+ return o.getFiles(g(r)).find((e) => e.endsWith(".tgz")) ?? null;
170
184
  }
171
- function m(o) {
172
- return we(`../${o}`);
185
+ function g(r) {
186
+ return ke(`../${r}`);
173
187
  }
174
- function v(o) {
175
- return x(new S(
188
+ function O(r) {
189
+ return S(new x(
176
190
  /* @vite-ignore */
177
- `../templates/${o}`,
191
+ `../templates/${r}`,
178
192
  import.meta.url
179
193
  ));
180
194
  }
181
- class ve {
195
+ class Se {
182
196
  constructor() {
183
- r(this, "cwd", null);
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
- fe(e, { cwd: this.cwd ?? void 0 }, (s) => {
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 p = L(ve);
201
- class ke {
214
+ const f = L(Se);
215
+ class xe {
202
216
  constructor() {
203
- r(this, "project");
204
- r(this, "modifiedFiles");
205
- this.project = new me({ tsConfigFilePath: "tsconfig.json" }), this.modifiedFiles = /* @__PURE__ */ new Set(), this.project.addSourceFilesAtPaths("src/**/*.ts"), this.project.addSourceFilesAtPaths("tailwind.config.js"), this.project.addSourceFilesAtPaths("vite.config.ts"), this.project.addSourceFilesAtPaths("package.json");
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 a.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`);
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(C(this.modifiedFiles).map(async (n) => s(n)));
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 V {
242
+ class G {
229
243
  constructor(e, t = {}) {
230
244
  this.name = e, this.options = t;
231
245
  }
232
- create(e) {
233
- c.exists(e) && (!c.isDirectory(e) || !c.isEmptyDirectory(e)) && a.fail(`Folder at '${e}' already exists!`), f.instantiate(v("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
- });
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 ke();
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
- 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")
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
- 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
- };
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 g {
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 = c.read("package.json");
295
- if (t != null && t.includes("@aerogel/core") || e && c.isDirectory(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
- a.fail(`${i} Are you sure this is an Aerogel app?`);
309
+ c.fail(`${i} Are you sure this is an Aerogel app?`);
299
310
  }
300
311
  }
301
- r(g, "command", ""), r(g, "description", ""), r(g, "parameters", []), r(g, "options", {});
302
- class $ extends g {
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
- r(this, "path");
306
- r(this, "options");
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(pe(t));
311
- p.setWorkingDirectory(t), await this.createApp(i, t), await this.installDependencies(), await this.initializeGit(), a.success(`
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
- a.info(`Creating **${t}**...`), new V(t, {
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 a.animate("Initializing git", async () => {
334
- await p.run("git init"), await p.run("git add ."), await p.run('git commit -m "Start"');
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
- r($, "command", "create"), r($, "description", "Create AerogelJS app"), r($, "parameters", [["path", "Application path"]]), r($, "options", {
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 V("");
357
+ return new G("");
351
358
  }
352
- function xe() {
353
- return c.contains("package.json", '"@aerogel/core": "file:');
359
+ function $e() {
360
+ return o.contains("package.json", '"@aerogel/core": "file:');
354
361
  }
355
- function K() {
356
- return c.isSymlink("node_modules/@aerogel/core");
362
+ function Fe() {
363
+ return o.isSymlink("node_modules/@aerogel/core");
357
364
  }
358
- function w(o, e = {}) {
359
- if (!o)
365
+ function v(r, e = {}) {
366
+ if (!r)
360
367
  return;
361
- const t = e.guard ?? (() => !0), i = e.validate ?? (() => !0), s = C(e.skip ?? []);
362
- return o.forEachDescendant((n, l) => {
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 u = n.getKind();
366
- s.includes(u) && l.skip();
372
+ const d = n.getKind();
373
+ s.includes(d) && l.skip();
367
374
  });
368
375
  }
369
- function R(o, e) {
370
- if (!(!o || !e(o)))
371
- return o;
376
+ function U(r, e) {
377
+ if (!(!r || !e(r)))
378
+ return r;
372
379
  }
373
- class b extends g {
374
- constructor(t, i = {}) {
380
+ class I extends u {
381
+ constructor(t) {
375
382
  super();
376
- r(this, "path");
377
- r(this, "options");
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"), this.assertHistoireInstalled();
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.createStory(i, s, t), await this.declareComponents();
387
- const n = C(t).map((l) => `- ${l}`).join(`
389
+ await this.createComponent(i, s, t), await this.declareComponents();
390
+ const n = N(t).map((l) => `- ${l}`).join(`
388
391
  `);
389
- a.info(`${s} component created successfully! The following files were created:
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 a.animate("Creating component", async () => {
401
- c.exists(`src/components/${this.path}.vue`) && a.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(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: T(i)
401
+ slug: oe(i)
407
402
  }
408
- }).forEach((u) => s.add(u));
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 a.fail("Could not find component dirs declaration in vite config!");
426
- s.getDescendantsOfKind(F.StringLiteral).some((n) => n.getText() === "'src/components'") || (await a.animate("Updating vite config", async () => {
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 = w(t, {
432
- guard: d.isCallExpression,
415
+ const i = v(t, {
416
+ guard: p.isCallExpression,
433
417
  validate: (l) => l.getText().startsWith("Components("),
434
- skip: F.ImportDeclaration
418
+ skip: D.ImportDeclaration
435
419
  });
436
420
  if (!i)
437
421
  return null;
438
- const s = w(i, {
439
- guard: d.isPropertyAssignment,
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 d.isArrayLiteralExpression(n) ? n : this.declareComponentDirsArray(i);
426
+ return p.isArrayLiteralExpression(n) ? n : this.declareComponentDirsArray(i);
443
427
  }
444
428
  declareComponentDirsArray(t) {
445
- const i = w(t, { guard: d.isObjectLiteralExpression }), s = i == null ? void 0 : i.addPropertyAssignment({
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
- r(b, "command", "generate:component"), r(b, "description", "Generate an AerogelJS Component"), r(b, "parameters", [
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
- ]), r(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 j extends g {
442
+ ]);
443
+ class j extends u {
477
444
  constructor(t, i = {}) {
478
445
  super();
479
- r(this, "name");
480
- r(this, "options");
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"), c.exists(`src/models/${this.name}.ts`) && a.fail(`${this.name} model already exists!`), this.assertSoukaiInstalled();
485
- const t = await a.animate("Creating model", async () => f.instantiate(v("model"), "src/models", {
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
- a.info(`${this.name} model created successfully! The following files were created:
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: oe(n ?? "string"),
471
+ type: ce(n ?? "string"),
505
472
  required: l === "required"
506
473
  };
507
474
  }).reduce((i, s) => {
508
- const n = s.required ? M(`
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 M(t, { indent: 8 });
484
+ return B(t, { indent: 8 });
518
485
  }
519
486
  assertSoukaiInstalled() {
520
- !c.contains("package.json", '"soukai"') && !c.contains("package.json", '"@aerogel/plugin-soukai"') && a.fail(`
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
- r(j, "command", "generate:model"), r(j, "description", "Generate an AerogelJS Model"), r(j, "parameters", [["name", "Model name"]]), r(j, "options", {
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 P extends g {
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
- r(this, "name");
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 = C(t).map((n) => `- ${n}`).join(`
506
+ const s = N(t).map((n) => `- ${n}`).join(`
580
507
  `);
581
- a.info(`${this.name} service created successfully! The following files were created:
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 a.animate("Creating service", async () => {
587
- c.exists(`src/services/${this.name}.ts`) && a.fail(`${this.name} service already exists!`), f.instantiate(v("service"), "src/services", {
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 a.animate("Registering service", async () => {
596
- c.exists("src/services/index.ts") || await this.createServicesIndex(t);
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 a.fail("Could not find services object in services config, please add it manually.");
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: `$${ce(this.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
- c.write(
537
+ o.write(
611
538
  "src/services/index.ts",
612
- M(`
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 a.fail("Could not find options object in bootstrap config, please add the services manually.");
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 = w(t, {
632
- guard: d.isCallExpression,
558
+ const i = v(t, {
559
+ guard: p.isCallExpression,
633
560
  validate: (n) => n.getExpression().getText() === "bootstrap",
634
- skip: F.ImportDeclaration
561
+ skip: D.ImportDeclaration
635
562
  }), s = i == null ? void 0 : i.getArguments()[1];
636
- return d.isObjectLiteralExpression(s) ? s : null;
563
+ return p.isObjectLiteralExpression(s) ? s : null;
637
564
  }
638
565
  getServicesObject(t) {
639
- const i = w(t, {
640
- guard: d.isVariableDeclaration,
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 d.isObjectLiteralExpression(s) ? s : null;
570
+ return p.isObjectLiteralExpression(s) ? s : null;
644
571
  }
645
572
  }
646
- r(A, "command", "generate:service"), r(A, "description", "Generate an AerogelJS Service"), r(A, "parameters", [["name", "Service name"]]);
647
- class B extends g {
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
- a.info("[AerogelJS CLI info]"), a.info("Installation directory: " + x(new S(
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
- r(B, "command", "info"), r(B, "description", "Show debugging information about the CLI");
657
- class Y {
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
- r(this, "name");
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 e = q().edit();
666
- await this.updateFiles(e), await e.format();
603
+ const t = q().edit();
604
+ t.addSourceFile("package.json"), await this.updateFiles(t), await t.format();
667
605
  }
668
- await this.afterInstall(), a.info(`Plugin ${this.name} installed!`);
606
+ await this.afterInstall(), c.info(`Plugin ${this.name} installed!`);
669
607
  }
670
608
  assertNotInstalled() {
671
- c.contains("package.json", `"${this.getNpmPackageName()}"`) && a.fail(`${this.name} is already installed!`);
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 a.animate("Installing plugin dependencies", async () => {
679
- await this.installNpmDependencies();
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
- async installNpmDependencies() {
686
- const e = this.isForDevelopment() ? "--save-dev" : "";
687
- if (K()) {
688
- await p.run(`npm install file:${m(this.getLocalPackageName())} ${e}`);
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 (xe()) {
692
- const t = y(this.getLocalPackageName()) ?? h(this.getLocalPackageName());
693
- await p.run(`npm install file:${t} ${e}`);
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
- await p.run(`npm install ${this.getNpmPackageName()}@next --save-exact ${e}`);
640
+ w(this.getNpmPackageName(), "next", this.isForDevelopment());
697
641
  }
698
642
  async updateBootstrapConfig(e) {
699
- await a.animate("Injecting plugin in bootstrap configuration", async () => {
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 a.fail(`
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, u;
724
- const t = w(e, {
725
- guard: d.isCallExpression,
655
+ var l, d;
656
+ const t = v(e, {
657
+ guard: p.isCallExpression,
726
658
  validate: (k) => k.getExpression().getText() === "bootstrap",
727
- skip: F.ImportDeclaration
728
- }), 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();
729
- return d.isArrayLiteralExpression(n) ? n : null;
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 = w(e, {
733
- guard: d.isPropertyAssignment,
664
+ const t = v(e, {
665
+ guard: p.isPropertyAssignment,
734
666
  validate: (s) => s.getName() === "content",
735
- skip: F.JSDoc
667
+ skip: D.JSDoc
736
668
  }), i = t == null ? void 0 : t.getInitializer();
737
- return d.isArrayLiteralExpression(i) ? i : null;
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 Se extends Y {
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.updateTailwindConfig(e, {
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
- async installNpmDependencies() {
768
- 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();
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
- a.info("Updating npm scripts...");
772
- const t = c.read("package.json");
706
+ c.info("Updating npm scripts...");
707
+ const t = o.read("package.json");
773
708
  if (!t)
774
- return a.fail("Could not find package.json file");
775
- c.write(
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
- a.info("Updating .gitignore");
796
- const e = c.read(".gitignore") ?? "";
797
- c.write(".gitignore", `${e}/solid
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 $e extends Y {
736
+ class De extends R {
802
737
  constructor() {
803
738
  super("soukai");
804
739
  }
805
- async installNpmDependencies() {
806
- await p.run("npm install soukai@next --save-exact"), await super.installNpmDependencies();
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 U = [new $e(), new Se()].reduce(
813
- (o, e) => Object.assign(o, { [e.name]: e }),
747
+ const _ = [new De(), new Ae(), new je()].reduce(
748
+ (r, e) => Object.assign(r, { [e.name]: e }),
814
749
  {}
815
750
  );
816
- class D extends g {
817
- constructor(t) {
751
+ class A extends u {
752
+ constructor(t, i = {}) {
818
753
  super();
819
- r(this, "plugin");
820
- this.plugin = U[t] ?? a.fail(`Plugin '${t}' doesn't exist. Available plugins: ${Object.keys(U).join(", ")}`);
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
- r(D, "command", "install"), r(D, "description", "Install an AerogelJS plugin"), r(D, "parameters", [["plugin", "Plugin to install"]]);
827
- class be {
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 G();
830
- t.name("gel").description("AerogelJS CLI").version(this.getVersion()), $.define(t), b.define(t), j.define(t), P.define(t), A.define(t), B.define(t), D.define(t), t.parse(e);
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 = x(new S(
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 (!N(t))
781
+ if (!T(t))
839
782
  throw new Error(e);
840
- return JSON.parse(z(t).toString()).version ?? le(e);
783
+ return JSON.parse(J(t).toString()).version ?? pe(e);
841
784
  }
842
785
  }
843
- const Te = L(be);
786
+ const qe = L(Pe);
844
787
  export {
845
- Te as CLI
788
+ qe as CLI
846
789
  };
847
790
  //# sourceMappingURL=aerogel-cli.js.map