@aerogel/cli 0.0.0-next.deed5f96c88f54b3908a9da7fe630324e78aa4ac → 0.0.0-next.e3690204fb6f5fb723525710ac64e3b3fe4fd487

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