@aerogel/cli 0.0.0-next.4d82ed613002ee486648f88f720678424e7263f1 → 0.0.0-next.5953e1862a7c89a8fc80da087467d67d4f4e8c73

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 (39) hide show
  1. package/dist/aerogel-cli.cjs.js +1 -1
  2. package/dist/aerogel-cli.cjs.js.map +1 -1
  3. package/dist/aerogel-cli.esm.js +1 -1
  4. package/dist/aerogel-cli.esm.js.map +1 -1
  5. package/package.json +9 -3
  6. package/src/commands/create.test.ts +1 -2
  7. package/src/commands/generate-component.test.ts +28 -2
  8. package/src/commands/generate-component.ts +25 -9
  9. package/src/commands/generate-model.test.ts +1 -1
  10. package/src/commands/generate-model.ts +1 -2
  11. package/src/commands/generate-service.ts +1 -2
  12. package/src/commands/install.test.ts +24 -1
  13. package/src/commands/install.ts +2 -1
  14. package/src/lib/Editor.ts +9 -7
  15. package/src/lib/Shell.mock.ts +1 -1
  16. package/src/lib/Template.ts +5 -1
  17. package/src/lib/utils/app.ts +1 -1
  18. package/src/lib/utils/paths.ts +1 -1
  19. package/src/plugins/Histoire.ts +93 -0
  20. package/src/plugins/Plugin.ts +57 -4
  21. package/src/plugins/Solid.ts +6 -42
  22. package/templates/app/index.html +3 -2
  23. package/templates/app/package.json +13 -2
  24. package/templates/app/src/App.vue +2 -2
  25. package/templates/app/src/assets/public/robots.txt +2 -0
  26. package/templates/app/src/main.ts +1 -1
  27. package/templates/app/vite.config.ts +2 -1
  28. package/templates/component-input/[component.name].vue +16 -0
  29. package/templates/component-input-story/[component.name].story.vue +63 -0
  30. package/templates/histoire/histoire.config.ts +7 -0
  31. package/templates/histoire/patches/histoire+0.17.6.patch +13 -0
  32. package/templates/histoire/src/main.histoire.ts +8 -0
  33. package/.eslintrc.js +0 -7
  34. package/src/lib/utils/format.test.ts +0 -33
  35. package/src/lib/utils/format.ts +0 -38
  36. package/templates/app/.eslintrc.js +0 -3
  37. package/templates/app/prettier.config.js +0 -5
  38. /package/templates/app/{cypress.config.ts → cypress/cypress.config.ts} +0 -0
  39. /package/templates/app/src/assets/{styles.css → css/styles.css} +0 -0
@@ -30,8 +30,13 @@ describe('Generate Component command', () => {
30
30
 
31
31
  it('generates components with stories', async () => {
32
32
  // Arrange
33
- FileMock.stub('package.json', '@aerogel/core');
34
- FileMock.stub('src/main.histoire.ts');
33
+ FileMock.stub(
34
+ 'package.json',
35
+ `
36
+ "@aerogel/core": "*",
37
+ "histoire": "*"
38
+ `,
39
+ );
35
40
 
36
41
  // Act
37
42
  await GenerateComponentCommand.run('FooBar', { story: true });
@@ -41,4 +46,25 @@ describe('Generate Component command', () => {
41
46
  FileMock.expectCreated('src/components/FooBar.story.vue').toContain('<FooBar />');
42
47
  });
43
48
 
49
+ it('generates input components with stories', async () => {
50
+ // Arrange
51
+ FileMock.stub(
52
+ 'package.json',
53
+ `
54
+ "@aerogel/core": "*",
55
+ "histoire": "*"
56
+ `,
57
+ );
58
+
59
+ // Act
60
+ await GenerateComponentCommand.run('FooBar', { input: true, story: true });
61
+
62
+ // Assert
63
+ FileMock.expectCreated('src/components/FooBar.vue').toContain('<AGHeadlessInputInput v-bind="attrs" />');
64
+ FileMock.expectCreated('src/components/FooBar.story.vue').toContain('.story-foobar .variant-playground');
65
+ FileMock.expectCreated('src/components/FooBar.story.vue').toContain(
66
+ '<FooBar name="food" :label="label" :placeholder="placeholder" />',
67
+ );
68
+ });
69
+
44
70
  });
@@ -1,4 +1,4 @@
1
- import { arrayFrom } from '@noeldemartin/utils';
1
+ import { arrayFrom, stringToSlug } from '@noeldemartin/utils';
2
2
  import { Node, SyntaxKind } from 'ts-morph';
3
3
  import type { ArrayLiteralExpression, CallExpression, SourceFile } from 'ts-morph';
4
4
 
@@ -13,6 +13,7 @@ import type { CommandOptions } from '@/commands/Command';
13
13
 
14
14
  export interface Options {
15
15
  story?: boolean;
16
+ input?: boolean;
16
17
  }
17
18
 
18
19
  export class GenerateComponentCommand extends Command {
@@ -28,6 +29,10 @@ export class GenerateComponentCommand extends Command {
28
29
  description: 'Create component story using Histoire',
29
30
  type: 'boolean',
30
31
  },
32
+ input: {
33
+ description: 'Create a custom input',
34
+ type: 'boolean',
35
+ },
31
36
  };
32
37
 
33
38
  private path: string;
@@ -48,7 +53,7 @@ export class GenerateComponentCommand extends Command {
48
53
  const [directoryName, componentName] = this.parsePathComponents();
49
54
 
50
55
  await this.createComponent(directoryName, componentName, files);
51
- await this.createStory(componentName, files);
56
+ await this.createStory(directoryName, componentName, files);
52
57
  await this.declareComponents();
53
58
 
54
59
  const filesList = arrayFrom(files)
@@ -63,8 +68,11 @@ export class GenerateComponentCommand extends Command {
63
68
  return;
64
69
  }
65
70
 
66
- if (!File.exists('src/main.histoire.ts')) {
67
- Log.fail('Histoire is not installed yet!');
71
+ if (!File.contains('package.json', '"histoire"') && !File.contains('package.json', '"@aerogel/histoire"')) {
72
+ Log.fail(`
73
+ Histoire is not installed yet! You can install it running:
74
+ npx ag install histoire
75
+ `);
68
76
  }
69
77
  }
70
78
 
@@ -74,22 +82,30 @@ export class GenerateComponentCommand extends Command {
74
82
  Log.fail(`${this.path} component already exists!`);
75
83
  }
76
84
 
77
- const componentFiles = Template.instantiate(templatePath('component'), `src/components/${directoryName}`, {
78
- component: { name: componentName },
85
+ const templateName = this.options.input ? 'component-input' : 'component';
86
+ const componentFiles = Template.instantiate(templatePath(templateName), `src/components/${directoryName}`, {
87
+ component: {
88
+ name: componentName,
89
+ slug: stringToSlug(componentName),
90
+ },
79
91
  });
80
92
 
81
93
  componentFiles.forEach((file) => files.add(file));
82
94
  });
83
95
  }
84
96
 
85
- protected async createStory(componentName: string, files: Set<string>): Promise<void> {
97
+ protected async createStory(directoryName: string, componentName: string, files: Set<string>): Promise<void> {
86
98
  if (!this.options.story) {
87
99
  return;
88
100
  }
89
101
 
90
102
  await Log.animate('Creating story', async () => {
91
- const storyFiles = Template.instantiate(templatePath('component-story'), 'src/components', {
92
- component: { name: componentName },
103
+ const templateName = this.options.input ? 'component-input-story' : 'component-story';
104
+ const storyFiles = Template.instantiate(templatePath(templateName), `src/components/${directoryName}`, {
105
+ component: {
106
+ name: componentName,
107
+ slug: stringToSlug(componentName),
108
+ },
93
109
  });
94
110
 
95
111
  storyFiles.forEach((file) => files.add(file));
@@ -1,7 +1,7 @@
1
1
  import { describe, it } from 'vitest';
2
+ import { formatCodeBlock } from '@noeldemartin/utils';
2
3
 
3
4
  import FileMock from '@/lib/File.mock';
4
- import { formatCodeBlock } from '@/lib/utils/format';
5
5
 
6
6
  import { GenerateModelCommand } from './generate-model';
7
7
 
@@ -1,11 +1,10 @@
1
- import { stringToStudlyCase } from '@noeldemartin/utils';
1
+ import { formatCodeBlock, stringToStudlyCase } from '@noeldemartin/utils';
2
2
 
3
3
  import Command from '@/commands/Command';
4
4
  import File from '@/lib/File';
5
5
  import Log from '@/lib/Log';
6
6
  import Template from '@/lib/Template';
7
7
  import { templatePath } from '@/lib/utils/paths';
8
- import { formatCodeBlock } from '@/lib/utils/format';
9
8
  import type { CommandOptions } from '@/commands/Command';
10
9
 
11
10
  interface Options {
@@ -1,4 +1,4 @@
1
- import { arrayFrom, stringToCamelCase } from '@noeldemartin/utils';
1
+ import { arrayFrom, formatCodeBlock, stringToCamelCase } from '@noeldemartin/utils';
2
2
  import { Node, SyntaxKind } from 'ts-morph';
3
3
  import type { ObjectLiteralExpression, SourceFile } from 'ts-morph';
4
4
 
@@ -9,7 +9,6 @@ import Template from '@/lib/Template';
9
9
  import { app } from '@/lib/utils/app';
10
10
  import { templatePath } from '@/lib/utils/paths';
11
11
  import { editFiles, findDescendant } from '@/lib/utils/edit';
12
- import { formatCodeBlock } from '@/lib/utils/format';
13
12
  import type { Editor } from '@/lib/Editor';
14
13
 
15
14
  export class GenerateServiceCommand extends Command {
@@ -1,12 +1,13 @@
1
1
  import { describe, it } from 'vitest';
2
2
 
3
+ import FileMock from '@/lib/File.mock';
3
4
  import ShellMock from '@/lib/Shell.mock';
4
5
 
5
6
  import { InstallCommand } from './install';
6
7
 
7
8
  describe('Install plugin command', () => {
8
9
 
9
- it('installs plugins', async () => {
10
+ it('installs solid', async () => {
10
11
  // Act
11
12
  await InstallCommand.run('solid');
12
13
 
@@ -15,4 +16,26 @@ describe('Install plugin command', () => {
15
16
  ShellMock.expectRan('npm install @aerogel/plugin-solid@next --save-exact');
16
17
  });
17
18
 
19
+ it('installs soukai', async () => {
20
+ // Act
21
+ await InstallCommand.run('soukai');
22
+
23
+ // Assert
24
+ ShellMock.expectRan('npm install soukai@next --save-exact');
25
+ ShellMock.expectRan('npm install @aerogel/plugin-soukai@next --save-exact');
26
+ });
27
+
28
+ it('installs histoire', async () => {
29
+ // Arrange
30
+ FileMock.stub('package.json', '"@aerogel/core"');
31
+
32
+ // Act
33
+ await InstallCommand.run('histoire');
34
+
35
+ // Assert
36
+ ShellMock.expectRan('npm install histoire@0.17.6 --save-dev');
37
+ ShellMock.expectRan('npm install @aerogel/histoire@next --save-exact --save-dev');
38
+ ShellMock.expectRan('npm install patch-package --save-dev');
39
+ });
40
+
18
41
  });
@@ -1,10 +1,11 @@
1
1
  import Command from '@/commands/Command';
2
2
  import Log from '@/lib/Log';
3
+ import { Histoire } from '@/plugins/Histoire';
3
4
  import { Solid } from '@/plugins/Solid';
4
5
  import { Soukai } from '@/plugins/Soukai';
5
6
  import type Plugin from '@/plugins/Plugin';
6
7
 
7
- const plugins = [new Soukai(), new Solid()].reduce(
8
+ const plugins = [new Soukai(), new Solid(), new Histoire()].reduce(
8
9
  (pluginsObject, plugin) => Object.assign(pluginsObject, { [plugin.name]: plugin }),
9
10
  {} as Record<string, Plugin>,
10
11
  );
package/src/lib/Editor.ts CHANGED
@@ -31,15 +31,17 @@ export class Editor {
31
31
 
32
32
  public async format(): Promise<void> {
33
33
  await Log.animate('Formatting modified files', async () => {
34
- const usingPrettier = File.exists('prettier.config.js');
35
- const usingESLint = File.exists('.eslintrc.js');
36
-
37
- await Promise.all(
38
- arrayFrom(this.modifiedFiles).map(async (file) => {
34
+ const usingPrettier = File.exists('prettier.config.js') || File.contains('package.json', '"prettier": {');
35
+ const usingESLint = File.exists('.eslintrc.js') || File.contains('package.json', '"eslintConfig"');
36
+ const usingPrettierESLint = File.contains('package.json', '"prettier-eslint-cli"');
37
+ const formatFile = usingPrettierESLint
38
+ ? (file: string) => Shell.run(`npx prettier-eslint ${file} --write`)
39
+ : async (file: string) => {
39
40
  usingPrettier && (await Shell.run(`npx prettier ${file} --write`));
40
41
  file.match(/\.(ts|js|vue)$/) && usingESLint && (await Shell.run(`npx eslint ${file} --fix`));
41
- }),
42
- );
42
+ };
43
+
44
+ await Promise.all(arrayFrom(this.modifiedFiles).map(async (file) => formatFile(file)));
43
45
  });
44
46
  }
45
47
 
@@ -8,7 +8,7 @@ export class ShellServiceMock extends ShellService {
8
8
  private history: string[] = [];
9
9
 
10
10
  public async run(command: string): Promise<void> {
11
- this.history.push(command);
11
+ this.history.push(command.trim());
12
12
  }
13
13
 
14
14
  public expectRan(command: string): void {
@@ -6,7 +6,11 @@ import File from '@/lib/File';
6
6
 
7
7
  export default class Template {
8
8
 
9
- public static instantiate(path: string, destination: string, replacements: Record<string, unknown>): string[] {
9
+ public static instantiate(
10
+ path: string,
11
+ destination: string = './',
12
+ replacements: Record<string, unknown> = {},
13
+ ): string[] {
10
14
  const template = new Template(path);
11
15
 
12
16
  return template.instantiate(destination, replacements);
@@ -7,7 +7,7 @@ export function app(): App {
7
7
  }
8
8
 
9
9
  export function isLocalApp(): boolean {
10
- return File.contains('package.json', 'file');
10
+ return File.contains('package.json', '"@aerogel/core": "file:');
11
11
  }
12
12
 
13
13
  export function isLinkedLocalApp(): boolean {
@@ -10,7 +10,7 @@ export function basePath(path: string = ''): string {
10
10
  }
11
11
 
12
12
  const packageJson = File.read(resolve(__dirname, '../../../../package.json'));
13
- const matches = stringMatch<2>(packageJson ?? '', /"@aerogel\/cli": "file:(.*)\/aerogel-cli-[\d.]*\.tgz"/);
13
+ const matches = stringMatch<2>(packageJson ?? '', /"@aerogel\/core": "file:(.*)\/aerogel-core-[\d.]*\.tgz"/);
14
14
  const cliPath = matches?.[1] ?? Log.fail<string>('Could not determine base path');
15
15
 
16
16
  return resolve(cliPath, path);
@@ -0,0 +1,93 @@
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 Template from '@/lib/Template';
6
+ import { isLinkedLocalApp } from '@/lib/utils/app';
7
+ import { packagePath, templatePath } from '@/lib/utils/paths';
8
+ import type { Editor } from '@/lib/Editor';
9
+
10
+ export class Histoire extends Plugin {
11
+
12
+ private installedPatchPackage: boolean = false;
13
+
14
+ constructor() {
15
+ super('histoire');
16
+ }
17
+
18
+ public async beforeInstall(): Promise<void> {
19
+ this.installedPatchPackage = false;
20
+ }
21
+
22
+ protected async afterInstall(): Promise<void> {
23
+ if (!this.installedPatchPackage) {
24
+ return;
25
+ }
26
+
27
+ await Log.animate('Patching dependencies', async () => {
28
+ await Shell.run('npx patch-package');
29
+ });
30
+ }
31
+
32
+ protected async updateFiles(editor: Editor): Promise<void> {
33
+ await this.updateTailwindConfig(editor, {
34
+ content: isLinkedLocalApp()
35
+ ? `'${packagePath('histoire')}/dist/**/*.js'`
36
+ : '\'./node_modules/@aerogel/histoire/dist/**/*.js\'',
37
+ });
38
+
39
+ await this.updateNpmScripts(editor);
40
+ await this.createConfigFiles();
41
+ await super.updateFiles(editor);
42
+ }
43
+
44
+ protected async installNpmDependencies(): Promise<void> {
45
+ // We need this specific version because we're patching it using patch-package
46
+ await Shell.run('npm install histoire@0.17.6 --save-dev');
47
+
48
+ if (!File.contains('package.json', '"patch-package"')) {
49
+ await Shell.run('npm install patch-package --save-dev');
50
+
51
+ this.installedPatchPackage = true;
52
+ }
53
+
54
+ await super.installNpmDependencies();
55
+ }
56
+
57
+ protected getLocalPackageName(): string {
58
+ return this.name;
59
+ }
60
+
61
+ protected async updateNpmScripts(editor: Editor): Promise<void> {
62
+ Log.info('Updating npm scripts...');
63
+
64
+ const packageJson = File.read('package.json');
65
+
66
+ if (!packageJson) {
67
+ return Log.fail('Could not find package.json file');
68
+ }
69
+
70
+ File.write(
71
+ 'package.json',
72
+ packageJson.replace(
73
+ '"lint": "noeldemartin-lint src",',
74
+ this.installedPatchPackage
75
+ ? '"histoire": "histoire dev", "lint": "noeldemartin-lint src", "postinstall": "patch-package",'
76
+ : '"histoire": "histoire dev", "lint": "noeldemartin-lint src",',
77
+ ),
78
+ );
79
+
80
+ editor.addModifiedFile('package.json');
81
+ }
82
+
83
+ protected async createConfigFiles(): Promise<void> {
84
+ Log.info('Creating config files...');
85
+
86
+ Template.instantiate(templatePath('histoire'));
87
+ }
88
+
89
+ protected isForDevelopment(): boolean {
90
+ return true;
91
+ }
92
+
93
+ }
@@ -20,6 +20,7 @@ export default abstract class Plugin {
20
20
  public async install(): Promise<void> {
21
21
  this.assertNotInstalled();
22
22
 
23
+ await this.beforeInstall();
23
24
  await this.installDependencies();
24
25
 
25
26
  if (editFiles()) {
@@ -29,6 +30,8 @@ export default abstract class Plugin {
29
30
  await editor.format();
30
31
  }
31
32
 
33
+ await this.afterInstall();
34
+
32
35
  Log.info(`Plugin ${this.name} installed!`);
33
36
  }
34
37
 
@@ -38,6 +41,14 @@ export default abstract class Plugin {
38
41
  }
39
42
  }
40
43
 
44
+ protected async beforeInstall(): Promise<void> {
45
+ // Placeholder for overrides, don't place any functionality here.
46
+ }
47
+
48
+ protected async afterInstall(): Promise<void> {
49
+ // Placeholder for overrides, don't place any functionality here.
50
+ }
51
+
41
52
  protected async installDependencies(): Promise<void> {
42
53
  await Log.animate('Installing plugin dependencies', async () => {
43
54
  await this.installNpmDependencies();
@@ -45,12 +56,16 @@ export default abstract class Plugin {
45
56
  }
46
57
 
47
58
  protected async updateFiles(editor: Editor): Promise<void> {
48
- await this.updateBootstrapConfig(editor);
59
+ if (!this.isForDevelopment()) {
60
+ await this.updateBootstrapConfig(editor);
61
+ }
49
62
  }
50
63
 
51
64
  protected async installNpmDependencies(): Promise<void> {
65
+ const flags = this.isForDevelopment() ? '--save-dev' : '';
66
+
52
67
  if (isLinkedLocalApp()) {
53
- await Shell.run(`npm install file:${packagePath(this.getLocalPackageName())}`);
68
+ await Shell.run(`npm install file:${packagePath(this.getLocalPackageName())} ${flags}`);
54
69
 
55
70
  return;
56
71
  }
@@ -58,12 +73,12 @@ export default abstract class Plugin {
58
73
  if (isLocalApp()) {
59
74
  const packPath = packagePackPath(this.getLocalPackageName()) ?? packNotFound(this.getLocalPackageName());
60
75
 
61
- await Shell.run(`npm install file:${packPath}`);
76
+ await Shell.run(`npm install file:${packPath} ${flags}`);
62
77
 
63
78
  return;
64
79
  }
65
80
 
66
- await Shell.run(`npm install ${this.getNpmPackageName()}@next --save-exact`);
81
+ await Shell.run(`npm install ${this.getNpmPackageName()}@next --save-exact ${flags}`);
67
82
  }
68
83
 
69
84
  protected async updateBootstrapConfig(editor: Editor): Promise<void> {
@@ -86,6 +101,25 @@ export default abstract class Plugin {
86
101
  });
87
102
  }
88
103
 
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
+
89
123
  protected getBootstrapPluginsDeclaration(mainConfig: SourceFile): ArrayLiteralExpression | null {
90
124
  const bootstrapAppCall = findDescendant(mainConfig, {
91
125
  guard: Node.isCallExpression,
@@ -103,6 +137,21 @@ export default abstract class Plugin {
103
137
  return pluginsArray;
104
138
  }
105
139
 
140
+ protected getTailwindContentArray(tailwindConfig: SourceFile): ArrayLiteralExpression | null {
141
+ const contentAssignment = findDescendant(tailwindConfig, {
142
+ guard: Node.isPropertyAssignment,
143
+ validate: (propertyAssignment) => propertyAssignment.getName() === 'content',
144
+ skip: SyntaxKind.JSDoc,
145
+ });
146
+ const contentArray = contentAssignment?.getInitializer();
147
+
148
+ if (!Node.isArrayLiteralExpression(contentArray)) {
149
+ return null;
150
+ }
151
+
152
+ return contentArray;
153
+ }
154
+
106
155
  protected getBootstrapImport(): OptionalKind<ImportDeclarationStructure> {
107
156
  return {
108
157
  defaultImport: this.name,
@@ -118,6 +167,10 @@ export default abstract class Plugin {
118
167
  return `plugin-${this.name}`;
119
168
  }
120
169
 
170
+ protected isForDevelopment(): boolean {
171
+ return false;
172
+ }
173
+
121
174
  protected getBootstrapConfig(): string {
122
175
  return `${this.name}()`;
123
176
  }
@@ -1,11 +1,7 @@
1
- import { Node, SyntaxKind } from 'ts-morph';
2
- import type { ArrayLiteralExpression, SourceFile } from 'ts-morph';
3
-
4
1
  import File from '@/lib/File';
5
2
  import Log from '@/lib/Log';
6
3
  import Plugin from '@/plugins/Plugin';
7
4
  import Shell from '@/lib/Shell';
8
- import { findDescendant } from '@/lib/utils/edit';
9
5
  import { isLinkedLocalApp } from '@/lib/utils/app';
10
6
  import { packagePath } from '@/lib/utils/paths';
11
7
  import type { Editor } from '@/lib/Editor';
@@ -17,7 +13,12 @@ export class Solid extends Plugin {
17
13
  }
18
14
 
19
15
  protected async updateFiles(editor: Editor): Promise<void> {
20
- await this.updateTailwindConfig(editor);
16
+ await this.updateTailwindConfig(editor, {
17
+ content: isLinkedLocalApp()
18
+ ? `'${packagePath('plugin-solid')}/dist/**/*.js'`
19
+ : '\'./node_modules/@aerogel/plugin-solid/dist/**/*.js\'',
20
+ });
21
+
21
22
  await this.updateNpmScripts(editor);
22
23
  await this.updateGitIgnore();
23
24
  await super.updateFiles(editor);
@@ -29,28 +30,6 @@ export class Solid extends Plugin {
29
30
  await super.installNpmDependencies();
30
31
  }
31
32
 
32
- protected async updateTailwindConfig(editor: Editor): Promise<void> {
33
- await Log.animate('Updating tailwind configuration', async () => {
34
- const tailwindConfig = editor.requireSourceFile('tailwind.config.js');
35
- const contentArray = this.getTailwindContentArray(tailwindConfig);
36
- const contentValue = isLinkedLocalApp()
37
- ? `'${packagePath('plugin-solid')}/dist/**/*.js'`
38
- : '\'./node_modules/@aerogel/plugin-solid/dist/**/*.js\'';
39
-
40
- if (!contentArray) {
41
- return Log.fail(`
42
- Could not find content array in tailwind config, please add the following manually:
43
-
44
- ${contentValue}
45
- `);
46
- }
47
-
48
- contentArray.addElement(contentValue);
49
-
50
- await editor.save(tailwindConfig);
51
- });
52
- }
53
-
54
33
  protected async updateNpmScripts(editor: Editor): Promise<void> {
55
34
  Log.info('Updating npm scripts...');
56
35
 
@@ -96,19 +75,4 @@ export class Solid extends Plugin {
96
75
  File.write('.gitignore', `${gitignore}/solid-data\n`);
97
76
  }
98
77
 
99
- protected getTailwindContentArray(tailwindConfig: SourceFile): ArrayLiteralExpression | null {
100
- const contentAssignment = findDescendant(tailwindConfig, {
101
- guard: Node.isPropertyAssignment,
102
- validate: (propertyAssignment) => propertyAssignment.getName() === 'content',
103
- skip: SyntaxKind.JSDoc,
104
- });
105
- const contentArray = contentAssignment?.getInitializer();
106
-
107
- if (!Node.isArrayLiteralExpression(contentArray)) {
108
- return null;
109
- }
110
-
111
- return contentArray;
112
- }
113
-
114
78
  }
@@ -3,10 +3,11 @@
3
3
  <head>
4
4
  <meta charset="UTF-8" />
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
- <title><% app.name %></title>
6
+ <title>{{ app.name }}</title>
7
+ {{ socialMeta() }}
7
8
  </head>
8
9
  <body class="h-full w-full text-base font-normal leading-tight text-gray-900 antialiased">
9
- <div id="app" class="h-full"></div>
10
+ <div id="app" class="loading h-full"></div>
10
11
  <script type="module" src="./src/main.ts"></script>
11
12
  </body>
12
13
  </html>
@@ -5,8 +5,8 @@
5
5
  "scripts": {
6
6
  "build": "vite build",
7
7
  "cy:dev": "concurrently --kill-others \"npm run test:serve-app\" \"npm run cy:open\"",
8
- "cy:open": "cypress open --e2e --browser chromium",
9
- "cy:run": "cypress run",
8
+ "cy:open": "cypress open --config-file ./cypress/cypress.config.ts --e2e --browser chromium",
9
+ "cy:run": "cypress run --config-file ./cypress/cypress.config.ts",
10
10
  "cy:test": "start-server-and-test test:serve-app http-get://localhost:5001 cy:run",
11
11
  "cy:test-snapshots": "docker run -it -u `id -u ${whoami}` -e CYPRESS_SNAPSHOTS=true -v ./:/app -w /app cypress/base:18.16.0 sh -c \"npx cypress install && npm run cy:test\"",
12
12
  "cy:test-snapshots:ci": "docker run -e CYPRESS_SNAPSHOTS=true -v ./:/app -w /app cypress/base:18.16.0 sh -c \"npx cypress install && npm run cy:test\"",
@@ -51,5 +51,16 @@
51
51
  "vite": "^4.3.0",
52
52
  "vitest": "^0.33.0",
53
53
  "vue-tsc": "^1.8.15"
54
+ },
55
+ "eslintConfig": {
56
+ "extends": [
57
+ "@noeldemartin/eslint-config-vue"
58
+ ]
59
+ },
60
+ "prettier": {
61
+ "plugins": [
62
+ "prettier-plugin-tailwindcss"
63
+ ],
64
+ "printWidth": 120
54
65
  }
55
66
  }
@@ -1,6 +1,6 @@
1
1
  <template>
2
- <AGAppLayout>
3
- <main class="flex flex-grow flex-col items-center justify-center bg-blue-50">
2
+ <AGAppLayout class="bg-blue-50">
3
+ <main class="flex flex-grow flex-col items-center justify-center">
4
4
  <h1 class="text-4xl font-semibold">
5
5
  {{ $t('home.title') }}
6
6
  </h1>
@@ -0,0 +1,2 @@
1
+ User-agent: *
2
+ Disallow:
@@ -2,7 +2,7 @@ import i18n from '@aerogel/plugin-i18n';
2
2
  import soukai from '@aerogel/plugin-soukai';
3
3
  import { bootstrapApplication } from '@aerogel/core';
4
4
 
5
- import './assets/styles.css';
5
+ import './assets/css/styles.css';
6
6
  import App from './App.vue';
7
7
 
8
8
  bootstrapApplication(App, {
@@ -7,8 +7,9 @@ import { defineConfig } from 'vitest/config';
7
7
  import { resolve } from 'path';
8
8
 
9
9
  export default defineConfig({
10
+ publicDir: resolve(__dirname, './src/assets/public/'),
10
11
  plugins: [
11
- Aerogel(),
12
+ Aerogel({ name: '<% app.name %>' }),
12
13
  Components({
13
14
  dts: false,
14
15
  resolvers: [AerogelResolver(), IconsResolver()],