@aerogel/cli 0.0.0-next.702e17f12493b62feba1d0af54d7c3b1d07f934c → 0.0.0-next.73a6df428477c011a1aebe0a932ebef0aa5e1b16

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 (90) hide show
  1. package/bin/gel +1 -1
  2. package/dist/aerogel-cli.d.ts +1 -2
  3. package/dist/aerogel-cli.js +790 -0
  4. package/dist/aerogel-cli.js.map +1 -0
  5. package/package.json +21 -33
  6. package/src/cli.ts +11 -11
  7. package/src/commands/Command.ts +3 -3
  8. package/src/commands/create.test.ts +2 -25
  9. package/src/commands/create.ts +15 -19
  10. package/src/commands/generate-component.test.ts +1 -61
  11. package/src/commands/generate-component.ts +14 -79
  12. package/src/commands/generate-model.test.ts +1 -1
  13. package/src/commands/generate-model.ts +11 -11
  14. package/src/commands/generate-service.test.ts +2 -2
  15. package/src/commands/generate-service.ts +14 -14
  16. package/src/commands/info.ts +15 -0
  17. package/src/commands/install.test.ts +63 -14
  18. package/src/commands/install.ts +29 -15
  19. package/src/lib/App.ts +50 -48
  20. package/src/lib/Editor.ts +3 -4
  21. package/src/lib/File.mock.ts +13 -11
  22. package/src/lib/File.ts +33 -3
  23. package/src/lib/Log.mock.ts +4 -8
  24. package/src/lib/Log.test.ts +4 -4
  25. package/src/lib/Log.ts +7 -7
  26. package/src/lib/Shell.mock.ts +6 -2
  27. package/src/lib/Shell.ts +2 -2
  28. package/src/lib/Template.ts +19 -16
  29. package/src/lib/utils/app.ts +2 -2
  30. package/src/lib/utils/edit.ts +2 -2
  31. package/src/lib/utils/paths.ts +19 -7
  32. package/src/plugins/LocalFirst.ts +9 -0
  33. package/src/plugins/Plugin.ts +37 -39
  34. package/src/plugins/Solid.ts +18 -24
  35. package/src/plugins/Soukai.ts +8 -7
  36. package/src/testing/setup.ts +36 -31
  37. package/src/utils/package.ts +23 -0
  38. package/templates/app/README.md +1 -1
  39. package/templates/service/[service.name].ts +1 -1
  40. package/.prettierignore +0 -1
  41. package/dist/aerogel-cli.cjs.js +0 -2
  42. package/dist/aerogel-cli.cjs.js.map +0 -1
  43. package/dist/aerogel-cli.esm.js +0 -2
  44. package/dist/aerogel-cli.esm.js.map +0 -1
  45. package/src/commands/generate-overrides.ts +0 -85
  46. package/src/plugins/Histoire.ts +0 -105
  47. package/templates/app/.github/workflows/ci.yml +0 -29
  48. package/templates/app/.gitignore.template +0 -2
  49. package/templates/app/.nvmrc +0 -1
  50. package/templates/app/.vscode/launch.json +0 -16
  51. package/templates/app/.vscode/settings.json +0 -10
  52. package/templates/app/cypress/cypress.config.ts +0 -14
  53. package/templates/app/cypress/e2e/app.cy.ts +0 -9
  54. package/templates/app/cypress/support/e2e.ts +0 -1
  55. package/templates/app/cypress/tsconfig.json +0 -12
  56. package/templates/app/index.html +0 -13
  57. package/templates/app/package.json +0 -66
  58. package/templates/app/postcss.config.js +0 -6
  59. package/templates/app/src/App.vue +0 -12
  60. package/templates/app/src/assets/css/styles.css +0 -3
  61. package/templates/app/src/assets/public/robots.txt +0 -2
  62. package/templates/app/src/lang/en.yaml +0 -3
  63. package/templates/app/src/main.test.ts +0 -9
  64. package/templates/app/src/main.ts +0 -13
  65. package/templates/app/src/types/globals.d.ts +0 -2
  66. package/templates/app/src/types/shims.d.ts +0 -7
  67. package/templates/app/src/types/ts-reset.d.ts +0 -1
  68. package/templates/app/tailwind.config.js +0 -5
  69. package/templates/app/tsconfig.json +0 -19
  70. package/templates/app/vite.config.ts +0 -29
  71. package/templates/component-button/[component.name].vue +0 -42
  72. package/templates/component-button-story/[component.name].story.vue +0 -77
  73. package/templates/component-input/[component.name].vue +0 -16
  74. package/templates/component-input-story/[component.name].story.vue +0 -63
  75. package/templates/component-story/[component.name].story.vue +0 -7
  76. package/templates/histoire/histoire.config.ts +0 -7
  77. package/templates/histoire/patches/histoire+0.17.6.patch +0 -13
  78. package/templates/histoire/src/main.histoire.ts +0 -8
  79. package/templates/overrides/components/index.ts +0 -15
  80. package/templates/overrides/components/overrides/AlertModal.vue +0 -11
  81. package/templates/overrides/components/overrides/ConfirmModal.vue +0 -20
  82. package/templates/overrides/components/overrides/ErrorReportModal.vue +0 -35
  83. package/templates/overrides/components/overrides/LoadingModal.vue +0 -12
  84. package/templates/overrides/components/overrides/ModalWrapper.vue +0 -22
  85. package/templates/overrides/components/overrides/SnackbarNotification.vue +0 -34
  86. package/templates/overrides-story/Overrides.story.vue +0 -86
  87. package/templates/postcss-pseudo-classes/postcss.config.js +0 -15
  88. package/tsconfig.json +0 -11
  89. package/vite.config.ts +0 -14
  90. /package/src/{main.ts → index.ts} +0 -0
@@ -8,28 +8,34 @@ export class FileMockService extends FileService {
8
8
 
9
9
  private virtualFilesystem: Record<string, string | { directory: true }> = {};
10
10
 
11
- public exists(path: string): boolean {
11
+ public override delete(path: string): void {
12
+ if (path in this.virtualFilesystem) {
13
+ delete this.virtualFilesystem[path];
14
+ }
15
+ }
16
+
17
+ public override exists(path: string): boolean {
12
18
  return super.exists(path) || path in this.virtualFilesystem;
13
19
  }
14
20
 
15
- public isDirectory(path: string): boolean {
21
+ public override isDirectory(path: string): boolean {
16
22
  return (
17
23
  super.isDirectory(path) ||
18
24
  (path in this.virtualFilesystem && typeof this.virtualFilesystem[path] === 'object')
19
25
  );
20
26
  }
21
27
 
22
- public isFile(path: string): boolean {
28
+ public override isFile(path: string): boolean {
23
29
  return (
24
30
  super.isFile(path) || (path in this.virtualFilesystem && typeof this.virtualFilesystem[path] === 'string')
25
31
  );
26
32
  }
27
33
 
28
- public makeDirectory(path: string): void {
34
+ public override makeDirectory(path: string): void {
29
35
  this.virtualFilesystem[path] = { directory: true };
30
36
  }
31
37
 
32
- public read(path: string): string | null {
38
+ public override read(path: string): string | null {
33
39
  if (path in this.virtualFilesystem && typeof this.virtualFilesystem[path] === 'string') {
34
40
  return this.virtualFilesystem[path] as string;
35
41
  }
@@ -37,14 +43,10 @@ export class FileMockService extends FileService {
37
43
  return super.read(path);
38
44
  }
39
45
 
40
- public write(path: string, contents: string): void {
46
+ public override write(path: string, contents: string): void {
41
47
  this.virtualFilesystem[path] = contents;
42
48
  }
43
49
 
44
- public reset(): void {
45
- this.virtualFilesystem = {};
46
- }
47
-
48
50
  public expectCreated(path: string, expectContent?: (contents: string) => void): Assertion<string> {
49
51
  expect(typeof this.virtualFilesystem[path] === 'string', `expected '${path}' file to have been created`).toBe(
50
52
  true,
@@ -63,4 +65,4 @@ export class FileMockService extends FileService {
63
65
 
64
66
  }
65
67
 
66
- export default facade(new FileMockService());
68
+ export default facade(FileMockService);
package/src/lib/File.ts CHANGED
@@ -1,6 +1,16 @@
1
- import { existsSync, lstatSync, mkdirSync, readFileSync, readdirSync, writeFileSync } from 'fs';
1
+ import {
2
+ existsSync,
3
+ lstatSync,
4
+ mkdirSync,
5
+ readFileSync,
6
+ readdirSync,
7
+ rmSync,
8
+ unlinkSync,
9
+ writeFileSync,
10
+ } from 'node:fs';
11
+ import { dirname, resolve } from 'node:path';
12
+
2
13
  import { facade } from '@noeldemartin/utils';
3
- import { dirname, resolve } from 'path';
4
14
 
5
15
  export class FileService {
6
16
 
@@ -12,6 +22,16 @@ export class FileService {
12
22
  return existsSync(path);
13
23
  }
14
24
 
25
+ public delete(path: string): void {
26
+ if (this.isDirectory(path)) {
27
+ rmSync(path, { recursive: true });
28
+
29
+ return;
30
+ }
31
+
32
+ unlinkSync(path);
33
+ }
34
+
15
35
  public isSymlink(path: string): boolean {
16
36
  const stats = lstatSync(path);
17
37
 
@@ -26,6 +46,16 @@ export class FileService {
26
46
  return readFileSync(path).toString();
27
47
  }
28
48
 
49
+ public replace(path: string, search: string | RegExp, replacement: string): void {
50
+ const contents = this.read(path);
51
+
52
+ if (!contents) {
53
+ return;
54
+ }
55
+
56
+ this.write(path, contents.replaceAll(search, replacement));
57
+ }
58
+
29
59
  public getFiles(directoryPath: string): string[] {
30
60
  const children = readdirSync(directoryPath, { withFileTypes: true });
31
61
  const files: string[] = [];
@@ -73,4 +103,4 @@ export class FileService {
73
103
 
74
104
  }
75
105
 
76
- export default facade(new FileService());
106
+ export default facade(FileService);
@@ -15,23 +15,19 @@ export class LogServiceMock extends LogService {
15
15
  expect(this.logs, `Expected log to have length ${count}`).toHaveLength(count);
16
16
  }
17
17
 
18
- protected logLine(message: string): void {
18
+ protected override logLine(message: string): void {
19
19
  this.logs.push(message);
20
20
  }
21
21
 
22
22
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
23
- public fail<T = any>(message: string): T {
23
+ public override fail<T = any>(message: string): T {
24
24
  throw new Error(`Fail: ${message}`);
25
25
  }
26
26
 
27
- public reset(): void {
28
- this.logs = [];
29
- }
30
-
31
- protected stdout(): void {
27
+ protected override stdout(): void {
32
28
  //
33
29
  }
34
30
 
35
31
  }
36
32
 
37
- export default facade(new LogServiceMock());
33
+ export default facade(LogServiceMock);
@@ -1,11 +1,11 @@
1
- import { bold, hex } from 'chalk';
1
+ import chalk from 'chalk';
2
2
  import { describe, it } from 'vitest';
3
3
 
4
- import LogMock from '@/lib/Log.mock';
4
+ import LogMock from '@aerogel/cli/lib/Log.mock';
5
5
 
6
6
  import Log from './Log';
7
7
 
8
- const info = hex('#00ffff');
8
+ const info = chalk.hex('#00ffff');
9
9
 
10
10
  describe('Log', () => {
11
11
 
@@ -14,7 +14,7 @@ describe('Log', () => {
14
14
  Log.info('Foo **bar**');
15
15
 
16
16
  // Assert
17
- LogMock.expectLogged(info(`Foo ${bold('bar')}`));
17
+ LogMock.expectLogged(info(`Foo ${chalk.bold('bar')}`));
18
18
  });
19
19
 
20
20
  it('renders multiline messages', () => {
package/src/lib/Log.ts CHANGED
@@ -1,12 +1,12 @@
1
+ import chalk from 'chalk';
2
+ import { clearLine, cursorTo } from 'node:readline';
1
3
  import { facade, stringMatchAll } from '@noeldemartin/utils';
2
- import { bold, hex } from 'chalk';
3
- import { clearLine, cursorTo } from 'readline';
4
4
 
5
5
  export class LogService {
6
6
 
7
- protected renderInfo = hex('#00ffff');
8
- protected renderSuccess = hex('#00ff00');
9
- protected renderError = hex('#ff0000');
7
+ protected renderInfo = chalk.hex('#00ffff');
8
+ protected renderSuccess = chalk.hex('#00ff00');
9
+ protected renderError = chalk.hex('#ff0000');
10
10
 
11
11
  public async animate<T>(message: string, operation: () => Promise<T>): Promise<T> {
12
12
  const updateStdout = (end: string = '', done: boolean = false) => {
@@ -52,7 +52,7 @@ export class LogService {
52
52
  const matches = stringMatchAll<2>(message, /\*\*(.*)\*\*/g);
53
53
 
54
54
  for (const match of matches) {
55
- message = message.replace(match[0], bold(match[1]));
55
+ message = message.replace(match[0], chalk.bold(match[1]));
56
56
  }
57
57
 
58
58
  return message;
@@ -92,4 +92,4 @@ export class LogService {
92
92
 
93
93
  }
94
94
 
95
- export default facade(new LogService());
95
+ export default facade(LogService);
@@ -7,7 +7,7 @@ export class ShellServiceMock extends ShellService {
7
7
 
8
8
  private history: string[] = [];
9
9
 
10
- public async run(command: string): Promise<void> {
10
+ public override async run(command: string): Promise<void> {
11
11
  this.history.push(command.trim());
12
12
  }
13
13
 
@@ -15,6 +15,10 @@ export class ShellServiceMock extends ShellService {
15
15
  expect(this.history, `expected '${command}' command to have been executed`).toContain(command);
16
16
  }
17
17
 
18
+ public expectNotRan(command: string): void {
19
+ expect(this.history, `expected '${command}' command to not have been executed`).not.toContain(command);
20
+ }
21
+
18
22
  }
19
23
 
20
- export default facade(new ShellServiceMock());
24
+ export default facade(ShellServiceMock);
package/src/lib/Shell.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { exec } from 'child_process';
1
+ import { exec } from 'node:child_process';
2
2
  import { facade } from '@noeldemartin/utils';
3
3
 
4
4
  export class ShellService {
@@ -25,4 +25,4 @@ export class ShellService {
25
25
 
26
26
  }
27
27
 
28
- export default facade(new ShellService());
28
+ export default facade(ShellService);
@@ -1,8 +1,8 @@
1
- import { readFileSync } from 'fs';
2
- import { render } from 'mustache';
1
+ import Mustache from 'mustache';
2
+ import { readFileSync } from 'node:fs';
3
3
  import { toString } from '@noeldemartin/utils';
4
4
 
5
- import File from '@/lib/File';
5
+ import File from '@aerogel/cli/lib/File';
6
6
 
7
7
  export default class Template {
8
8
 
@@ -32,7 +32,7 @@ export default class Template {
32
32
  const filePath =
33
33
  destination + (relativePath.endsWith('.template') ? relativePath.slice(0, -9) : relativePath);
34
34
 
35
- File.write(filePath, render(fileContents, replacements, undefined, ['<%', '%>']));
35
+ File.write(filePath, Mustache.render(fileContents, replacements, undefined, ['<%', '%>']));
36
36
  files.push(filePath);
37
37
  }
38
38
 
@@ -43,18 +43,21 @@ export default class Template {
43
43
  replacements: Record<string, unknown>,
44
44
  prefix: string = '',
45
45
  ): Record<string, string> {
46
- return Object.entries(replacements).reduce((filenameReplacements, [key, value]) => {
47
- if (typeof value === 'object') {
48
- Object.assign(
49
- filenameReplacements,
50
- this.getFilenameReplacements(value as Record<string, unknown>, `${key}.`),
51
- );
52
- } else {
53
- filenameReplacements[`[${prefix}${key}]`] = toString(value);
54
- }
55
-
56
- return filenameReplacements;
57
- }, {} as Record<string, string>);
46
+ return Object.entries(replacements).reduce(
47
+ (filenameReplacements, [key, value]) => {
48
+ if (typeof value === 'object') {
49
+ Object.assign(
50
+ filenameReplacements,
51
+ this.getFilenameReplacements(value as Record<string, unknown>, `${key}.`),
52
+ );
53
+ } else {
54
+ filenameReplacements[`[${prefix}${key}]`] = toString(value);
55
+ }
56
+
57
+ return filenameReplacements;
58
+ },
59
+ {} as Record<string, string>,
60
+ );
58
61
  }
59
62
 
60
63
  }
@@ -1,5 +1,5 @@
1
- import App from '@/lib/App';
2
- import File from '@/lib/File';
1
+ import App from '@aerogel/cli/lib/App';
2
+ import File from '@aerogel/cli/lib/File';
3
3
 
4
4
  export function app(): App {
5
5
  // TODO parse app name
@@ -23,8 +23,8 @@ export function findDescendant<T extends Node>(
23
23
  const skipKinds = arrayFrom(options.skip ?? []);
24
24
 
25
25
  return node.forEachDescendant((descendant, traversal) => {
26
- if (guard(descendant) && validate(descendant)) {
27
- return descendant;
26
+ if (guard(descendant) && validate(descendant as T)) {
27
+ return descendant as T;
28
28
  }
29
29
 
30
30
  const descendantKind = descendant.getKind();
@@ -1,15 +1,27 @@
1
- import { resolve } from 'path';
1
+ import { URL, fileURLToPath } from 'node:url';
2
2
  import { stringMatch } from '@noeldemartin/utils';
3
+ import { resolve } from 'node:path';
3
4
 
4
- import File from '@/lib/File';
5
- import Log from '@/lib/Log';
5
+ import File from '@aerogel/cli/lib/File';
6
+ import Log from '@aerogel/cli/lib/Log';
6
7
 
7
8
  export function basePath(path: string = ''): string {
8
- if (File.contains(resolve(__dirname, '../../../package.json'), '"name": "aerogel"')) {
9
- return resolve(__dirname, '../', path);
9
+ if (process.env.AEROGEL_BASE_PATH) {
10
+ return resolve(process.env.AEROGEL_BASE_PATH, path);
10
11
  }
11
12
 
12
- const packageJson = File.read(resolve(__dirname, '../../../../package.json'));
13
+ if (
14
+ File.contains(
15
+ fileURLToPath(new URL(/* @vite-ignore */ '../../../package.json', import.meta.url)),
16
+ '"packages/create-aerogel"',
17
+ )
18
+ ) {
19
+ return resolve(fileURLToPath(new URL(/* @vite-ignore */ '../', import.meta.url)), path);
20
+ }
21
+
22
+ const packageJson = File.read(
23
+ fileURLToPath(new URL(/* @vite-ignore */ '../../../../package.json', import.meta.url)),
24
+ );
13
25
  const matches = stringMatch<2>(packageJson ?? '', /"@aerogel\/core": "file:(.*)\/aerogel-core-[\d.]*\.tgz"/);
14
26
  const cliPath = matches?.[1] ?? Log.fail<string>('Could not determine base path');
15
27
 
@@ -30,5 +42,5 @@ export function packagePath(packageName: string): string {
30
42
  }
31
43
 
32
44
  export function templatePath(name: string): string {
33
- return resolve(__dirname, `../templates/${name}`);
45
+ return fileURLToPath(new URL(/* @vite-ignore */ `../templates/${name}`, import.meta.url));
34
46
  }
@@ -0,0 +1,9 @@
1
+ import Plugin from '@aerogel/cli/plugins/Plugin';
2
+
3
+ export default class LocalFirst extends Plugin {
4
+
5
+ constructor() {
6
+ super('local-first');
7
+ }
8
+
9
+ }
@@ -1,13 +1,15 @@
1
1
  import { Node, SyntaxKind } from 'ts-morph';
2
+ import { stringToCamelCase } from '@noeldemartin/utils';
2
3
  import type { ArrayLiteralExpression, ImportDeclarationStructure, OptionalKind, SourceFile } from 'ts-morph';
3
4
 
4
- import Log from '@/lib/Log';
5
- import Shell from '@/lib/Shell';
6
- import File from '@/lib/File';
7
- import { app, isLinkedLocalApp, isLocalApp } from '@/lib/utils/app';
8
- import { editFiles, findDescendant, when } from '@/lib/utils/edit';
9
- import { packNotFound, packagePackPath, packagePath } from '@/lib/utils/paths';
10
- import type { Editor } from '@/lib/Editor';
5
+ import Log from '@aerogel/cli/lib/Log';
6
+ import Shell from '@aerogel/cli/lib/Shell';
7
+ import File from '@aerogel/cli/lib/File';
8
+ import { app, isLinkedLocalApp, isLocalApp } from '@aerogel/cli/lib/utils/app';
9
+ import { addNpmDependency } from '@aerogel/cli/utils/package';
10
+ import { editFiles, findDescendant, when } from '@aerogel/cli/lib/utils/edit';
11
+ import { packNotFound, packagePackPath, packagePath } from '@aerogel/cli/lib/utils/paths';
12
+ import type { Editor } from '@aerogel/cli/lib/Editor';
11
13
 
12
14
  export default abstract class Plugin {
13
15
 
@@ -17,15 +19,21 @@ export default abstract class Plugin {
17
19
  this.name = name;
18
20
  }
19
21
 
20
- public async install(): Promise<void> {
22
+ public async install(options: { skipInstall?: boolean } = {}): Promise<void> {
21
23
  this.assertNotInstalled();
22
24
 
23
25
  await this.beforeInstall();
24
- await this.installDependencies();
26
+ await this.addDependencies();
27
+
28
+ if (!options.skipInstall) {
29
+ await this.installDependencies();
30
+ }
25
31
 
26
32
  if (editFiles()) {
27
33
  const editor = app().edit();
28
34
 
35
+ editor.addSourceFile('package.json');
36
+
29
37
  await this.updateFiles(editor);
30
38
  await editor.format();
31
39
  }
@@ -49,23 +57,32 @@ export default abstract class Plugin {
49
57
  // Placeholder for overrides, don't place any functionality here.
50
58
  }
51
59
 
60
+ protected async addDependencies(): Promise<void> {
61
+ Log.info('Adding plugin dependencies');
62
+ this.addNpmDependencies();
63
+ }
64
+
52
65
  protected async installDependencies(): Promise<void> {
53
66
  await Log.animate('Installing plugin dependencies', async () => {
54
- await this.installNpmDependencies();
67
+ await Shell.run('pnpm install --no-save');
55
68
  });
56
69
  }
57
70
 
58
71
  protected async updateFiles(editor: Editor): Promise<void> {
59
- if (!this.isForDevelopment()) {
60
- await this.updateBootstrapConfig(editor);
72
+ if (this.isForDevelopment()) {
73
+ return;
61
74
  }
62
- }
63
75
 
64
- protected async installNpmDependencies(): Promise<void> {
65
- const flags = this.isForDevelopment() ? '--save-dev' : '';
76
+ await this.updateBootstrapConfig(editor);
77
+ }
66
78
 
79
+ protected addNpmDependencies(): void {
67
80
  if (isLinkedLocalApp()) {
68
- await Shell.run(`npm install file:${packagePath(this.getLocalPackageName())} ${flags}`);
81
+ addNpmDependency(
82
+ this.getNpmPackageName(),
83
+ `file:${packagePath(this.getLocalPackageName())}`,
84
+ this.isForDevelopment(),
85
+ );
69
86
 
70
87
  return;
71
88
  }
@@ -73,12 +90,12 @@ export default abstract class Plugin {
73
90
  if (isLocalApp()) {
74
91
  const packPath = packagePackPath(this.getLocalPackageName()) ?? packNotFound(this.getLocalPackageName());
75
92
 
76
- await Shell.run(`npm install file:${packPath} ${flags}`);
93
+ addNpmDependency(this.getNpmPackageName(), `file:${packPath}`, this.isForDevelopment());
77
94
 
78
95
  return;
79
96
  }
80
97
 
81
- await Shell.run(`npm install ${this.getNpmPackageName()}@next --save-exact ${flags}`);
98
+ addNpmDependency(this.getNpmPackageName(), 'next', this.isForDevelopment());
82
99
  }
83
100
 
84
101
  protected async updateBootstrapConfig(editor: Editor): Promise<void> {
@@ -101,25 +118,6 @@ export default abstract class Plugin {
101
118
  });
102
119
  }
103
120
 
104
- protected async updateTailwindConfig(editor: Editor, options: { content: string }): Promise<void> {
105
- await Log.animate('Updating tailwind configuration', async () => {
106
- const tailwindConfig = editor.requireSourceFile('tailwind.config.js');
107
- const contentArray = this.getTailwindContentArray(tailwindConfig);
108
-
109
- if (!contentArray) {
110
- return Log.fail(`
111
- Could not find content array in tailwind config, please add the following manually:
112
-
113
- ${options.content}
114
- `);
115
- }
116
-
117
- contentArray.addElement(options.content);
118
-
119
- await editor.save(tailwindConfig);
120
- });
121
- }
122
-
123
121
  protected getBootstrapPluginsDeclaration(mainConfig: SourceFile): ArrayLiteralExpression | null {
124
122
  const bootstrapAppCall = findDescendant(mainConfig, {
125
123
  guard: Node.isCallExpression,
@@ -154,7 +152,7 @@ export default abstract class Plugin {
154
152
 
155
153
  protected getBootstrapImport(): OptionalKind<ImportDeclarationStructure> {
156
154
  return {
157
- defaultImport: this.name,
155
+ defaultImport: stringToCamelCase(this.name),
158
156
  moduleSpecifier: `@aerogel/plugin-${this.name}`,
159
157
  };
160
158
  }
@@ -172,7 +170,7 @@ export default abstract class Plugin {
172
170
  }
173
171
 
174
172
  protected getBootstrapConfig(): string {
175
- return `${this.name}()`;
173
+ return `${stringToCamelCase(this.name)}()`;
176
174
  }
177
175
 
178
176
  }
@@ -1,34 +1,27 @@
1
- import File from '@/lib/File';
2
- import Log from '@/lib/Log';
3
- import Plugin from '@/plugins/Plugin';
4
- import Shell from '@/lib/Shell';
5
- import { isLinkedLocalApp } from '@/lib/utils/app';
6
- import { packagePath } from '@/lib/utils/paths';
7
- import type { Editor } from '@/lib/Editor';
1
+ import File from '@aerogel/cli/lib/File';
2
+ import Log from '@aerogel/cli/lib/Log';
3
+ import Plugin from '@aerogel/cli/plugins/Plugin';
4
+ import { addNpmDependency } from '@aerogel/cli/utils/package';
5
+ import type { Editor } from '@aerogel/cli/lib/Editor';
8
6
 
9
- export class Solid extends Plugin {
7
+ export default class Solid extends Plugin {
10
8
 
11
9
  constructor() {
12
10
  super('solid');
13
11
  }
14
12
 
15
- protected async updateFiles(editor: Editor): Promise<void> {
16
- await this.updateTailwindConfig(editor, {
17
- content: isLinkedLocalApp()
18
- ? `'${packagePath('plugin-solid')}/dist/**/*.js'`
19
- : '\'./node_modules/@aerogel/plugin-solid/dist/**/*.js\'',
20
- });
21
-
13
+ protected override async updateFiles(editor: Editor): Promise<void> {
22
14
  await this.updateNpmScripts(editor);
23
15
  await this.updateGitIgnore();
24
16
  await super.updateFiles(editor);
25
17
  }
26
18
 
27
- protected async installNpmDependencies(): Promise<void> {
28
- await Shell.run('npm install soukai-solid@next --save-exact');
29
- await Shell.run('npm install @noeldemartin/solid-utils@next --save-exact');
30
- await Shell.run('npm install @solid/community-server@7 --save');
31
- await super.installNpmDependencies();
19
+ protected override addNpmDependencies(): void {
20
+ addNpmDependency('soukai-solid', 'next');
21
+ addNpmDependency('@noeldemartin/solid-utils', 'next');
22
+ addNpmDependency('@solid/community-server', '7.1.6', true);
23
+
24
+ super.addNpmDependencies();
32
25
  }
33
26
 
34
27
  protected async updateNpmScripts(editor: Editor): Promise<void> {
@@ -56,11 +49,12 @@ export class Solid extends Plugin {
56
49
  .replace(
57
50
  '"dev": "vite",',
58
51
  '"dev": "vite",\n' +
59
- '"dev:serve-pod": "community-solid-server -c @css:config/file.json -f ./solid-data",',
52
+ '"dev:serve-pod": "community-solid-server -c @css:config/file.json -f ./solid",',
60
53
  )
61
54
  .replace(
62
- '"test:serve-app": "vite --port 5001"',
63
- '"test:serve-app": "vite --port 5001",\n"test:serve-pod": "community-solid-server -l warn"',
55
+ '"test:serve-app": "vite --port 5001 --mode testing"',
56
+ '"test:serve-app": "vite --port 5001 --mode testing",\n' +
57
+ '"test:serve-pod": "community-solid-server -l warn"',
64
58
  ),
65
59
  );
66
60
 
@@ -72,7 +66,7 @@ export class Solid extends Plugin {
72
66
 
73
67
  const gitignore = File.read('.gitignore') ?? '';
74
68
 
75
- File.write('.gitignore', `${gitignore}/solid-data\n`);
69
+ File.write('.gitignore', `${gitignore}/solid\n`);
76
70
  }
77
71
 
78
72
  }
@@ -1,18 +1,19 @@
1
- import Plugin from '@/plugins/Plugin';
2
- import Shell from '@/lib/Shell';
1
+ import Plugin from '@aerogel/cli/plugins/Plugin';
2
+ import { addNpmDependency } from '@aerogel/cli/utils/package';
3
3
 
4
- export class Soukai extends Plugin {
4
+ export default class Soukai extends Plugin {
5
5
 
6
6
  constructor() {
7
7
  super('soukai');
8
8
  }
9
9
 
10
- protected async installNpmDependencies(): Promise<void> {
11
- await Shell.run('npm install soukai@next --save-exact');
12
- await super.installNpmDependencies();
10
+ protected override addNpmDependencies(): void {
11
+ addNpmDependency('soukai', 'next');
12
+
13
+ super.addNpmDependencies();
13
14
  }
14
15
 
15
- protected getBootstrapConfig(): string {
16
+ protected override getBootstrapConfig(): string {
16
17
  return 'soukai({ models: import.meta.glob(\'@/models/*\', { eager: true }) })';
17
18
  }
18
19