@aerogel/cli 0.0.0-next.a5b6ecb68fdca29d00c8b8906d00aa5bf64a9d7c → 0.0.0-next.a68f133e2c9a1ae9ba84b4e2e42df909289e5fba

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 (46) hide show
  1. package/.prettierignore +1 -0
  2. package/dist/aerogel-cli.cjs.js +1 -1
  3. package/dist/aerogel-cli.cjs.js.map +1 -1
  4. package/dist/aerogel-cli.d.ts +2 -2
  5. package/dist/aerogel-cli.esm.js +1 -1
  6. package/dist/aerogel-cli.esm.js.map +1 -1
  7. package/package.json +2 -2
  8. package/src/cli.ts +23 -3
  9. package/src/commands/Command.ts +1 -4
  10. package/src/commands/create.test.ts +4 -12
  11. package/src/commands/generate-component.test.ts +9 -15
  12. package/src/commands/generate-component.ts +1 -1
  13. package/src/commands/generate-model.test.ts +2 -10
  14. package/src/commands/generate-model.ts +1 -1
  15. package/src/commands/generate-overrides.ts +85 -0
  16. package/src/commands/generate-service.test.ts +3 -11
  17. package/src/commands/generate-service.ts +1 -1
  18. package/src/commands/info.ts +14 -0
  19. package/src/commands/install.test.ts +4 -12
  20. package/src/lib/File.mock.ts +1 -5
  21. package/src/lib/File.ts +1 -1
  22. package/src/lib/Log.mock.ts +1 -5
  23. package/src/lib/Log.ts +1 -1
  24. package/src/lib/Shell.mock.ts +1 -1
  25. package/src/lib/Shell.ts +1 -1
  26. package/src/plugins/Plugin.ts +1 -1
  27. package/src/plugins/Solid.ts +4 -4
  28. package/src/testing/setup.ts +3 -6
  29. package/templates/app/.github/workflows/ci.yml +4 -4
  30. package/templates/app/cypress/cypress.config.ts +2 -4
  31. package/templates/app/cypress/support/e2e.ts +1 -3
  32. package/templates/app/package.json +1 -1
  33. package/templates/app/src/main.ts +3 -3
  34. package/templates/component-button/[component.name].vue +12 -2
  35. package/templates/component-button-story/[component.name].story.vue +7 -1
  36. package/templates/overrides/components/index.ts +15 -0
  37. package/templates/overrides/components/overrides/AlertModal.vue +11 -0
  38. package/templates/overrides/components/overrides/ConfirmModal.vue +20 -0
  39. package/templates/overrides/components/overrides/ErrorReportModal.vue +35 -0
  40. package/templates/overrides/components/overrides/LoadingModal.vue +12 -0
  41. package/templates/overrides/components/overrides/ModalWrapper.vue +22 -0
  42. package/templates/overrides/components/overrides/SnackbarNotification.vue +34 -0
  43. package/templates/overrides-story/Overrides.story.vue +86 -0
  44. package/templates/service/[service.name].ts +1 -1
  45. package/src/testing/stubs/ProgramStub.ts +0 -35
  46. package/src/testing/utils.ts +0 -14
package/src/cli.ts CHANGED
@@ -1,9 +1,14 @@
1
1
  import { Command } from 'commander';
2
+ import { facade, fail } from '@noeldemartin/utils';
3
+ import { resolve } from 'path';
4
+ import { existsSync, readFileSync } from 'fs';
5
+
2
6
  import { CreateCommand } from '@/commands/create';
3
- import { facade } from '@noeldemartin/utils';
4
7
  import { GenerateComponentCommand } from '@/commands/generate-component';
5
8
  import { GenerateModelCommand } from '@/commands/generate-model';
9
+ import { GenerateOverridesCommand } from '@/commands/generate-overrides';
6
10
  import { GenerateServiceCommand } from '@/commands/generate-service';
11
+ import { InfoCommand } from '@/commands/info';
7
12
  import { InstallCommand } from '@/commands/install';
8
13
 
9
14
  export class CLIService {
@@ -11,17 +16,32 @@ export class CLIService {
11
16
  public run(argv?: string[]): void {
12
17
  const program = new Command();
13
18
 
14
- program.name('ag').description('AerogelJS CLI').version('0.0.0');
19
+ program.name('gel').description('AerogelJS CLI').version(this.getVersion());
15
20
 
16
21
  CreateCommand.define(program);
17
22
  GenerateComponentCommand.define(program);
18
23
  GenerateModelCommand.define(program);
24
+ GenerateOverridesCommand.define(program);
19
25
  GenerateServiceCommand.define(program);
26
+ InfoCommand.define(program);
20
27
  InstallCommand.define(program);
21
28
 
22
29
  program.parse(argv);
23
30
  }
24
31
 
32
+ public getVersion(): string {
33
+ const errorMessage = 'Could not find CLI\'s version, please report this bug.';
34
+ const packageJsonPath = resolve(__dirname, '../package.json');
35
+
36
+ if (!existsSync(packageJsonPath)) {
37
+ throw new Error(errorMessage);
38
+ }
39
+
40
+ const packageJson = JSON.parse(readFileSync(packageJsonPath).toString()) as { version?: string };
41
+
42
+ return packageJson.version ?? fail(errorMessage);
43
+ }
44
+
25
45
  }
26
46
 
27
- export default facade(new CLIService());
47
+ export default facade(CLIService);
@@ -30,10 +30,7 @@ export default class Command {
30
30
  program = program.action((...args) => this.run.call(this, ...args));
31
31
  }
32
32
 
33
- protected static async run<T extends CommandConstructor>(
34
- this: T,
35
- ...args: ConstructorParameters<T>
36
- ): Promise<void> {
33
+ public static async run<T extends CommandConstructor>(this: T, ...args: ConstructorParameters<T>): Promise<void> {
37
34
  const instance = new this(...args);
38
35
 
39
36
  await instance.validate();
@@ -1,23 +1,15 @@
1
- import { beforeEach, describe, it } from 'vitest';
1
+ import { describe, it } from 'vitest';
2
2
 
3
3
  import FileMock from '@/lib/File.mock';
4
4
  import ShellMock from '@/lib/Shell.mock';
5
- import { stubCommandRunner } from '@/testing/utils';
6
- import type { StubCommandRunner } from '@/testing/utils';
7
5
 
8
6
  import { CreateCommand } from './create';
9
7
 
10
8
  describe('Create command', () => {
11
9
 
12
- let run: StubCommandRunner<typeof CreateCommand>;
13
-
14
- beforeEach(() => {
15
- run = stubCommandRunner(CreateCommand);
16
- });
17
-
18
10
  it('creates apps', async () => {
19
11
  // Act
20
- await run('./app', { name: 'My App' });
12
+ await CreateCommand.run('./app', { name: 'My App' });
21
13
 
22
14
  // Assert
23
15
  FileMock.expectCreated('./app/.gitignore').toContain('node_modules');
@@ -34,7 +26,7 @@ describe('Create command', () => {
34
26
 
35
27
  it('creates apps for local core development', async () => {
36
28
  // Act
37
- await run('./app', { name: 'My App', local: true });
29
+ await CreateCommand.run('./app', { name: 'My App', local: true });
38
30
 
39
31
  // Assert
40
32
  FileMock.expectCreated('./app/package.json').toMatch(/"@aerogel\/core": "file:[^"]+\/packages\/core"/);
@@ -42,7 +34,7 @@ describe('Create command', () => {
42
34
 
43
35
  it('infers app name from path', async () => {
44
36
  // Act
45
- await run('./my-app');
37
+ await CreateCommand.run('./my-app');
46
38
 
47
39
  // Assert
48
40
  FileMock.expectCreated('./my-app/package.json').toContain('"name": "my-app"');
@@ -1,25 +1,17 @@
1
- import { beforeEach, describe, it } from 'vitest';
1
+ import { describe, it } from 'vitest';
2
2
 
3
3
  import FileMock from '@/lib/File.mock';
4
- import { stubCommandRunner } from '@/testing/utils';
5
- import type { StubCommandRunner } from '@/testing/utils';
6
4
 
7
5
  import { GenerateComponentCommand } from './generate-component';
8
6
 
9
7
  describe('Generate Component command', () => {
10
8
 
11
- let run: StubCommandRunner<typeof GenerateComponentCommand>;
12
-
13
- beforeEach(() => {
14
- run = stubCommandRunner(GenerateComponentCommand);
15
- });
16
-
17
9
  it('generates components', async () => {
18
10
  // Arrange
19
11
  FileMock.stub('package.json', '@aerogel/core');
20
12
 
21
13
  // Act
22
- await run('FooBar');
14
+ await GenerateComponentCommand.run('FooBar');
23
15
 
24
16
  // Assert
25
17
  FileMock.expectCreated('src/components/FooBar.vue').toContain('<div>FooBar</div>');
@@ -30,7 +22,7 @@ describe('Generate Component command', () => {
30
22
  FileMock.stub('package.json', '@aerogel/core');
31
23
 
32
24
  // Act
33
- await run('module/FooBar');
25
+ await GenerateComponentCommand.run('module/FooBar');
34
26
 
35
27
  // Assert
36
28
  FileMock.expectCreated('src/components/module/FooBar.vue').toContain('<div>FooBar</div>');
@@ -47,7 +39,7 @@ describe('Generate Component command', () => {
47
39
  );
48
40
 
49
41
  // Act
50
- await run('FooBar', { story: true });
42
+ await GenerateComponentCommand.run('FooBar', { story: true });
51
43
 
52
44
  // Assert
53
45
  FileMock.expectCreated('src/components/FooBar.vue').toContain('<div>FooBar</div>');
@@ -65,7 +57,7 @@ describe('Generate Component command', () => {
65
57
  );
66
58
 
67
59
  // Act
68
- await run('FooBar', { input: true, story: true });
60
+ await GenerateComponentCommand.run('FooBar', { input: true, story: true });
69
61
 
70
62
  // Assert
71
63
  FileMock.expectCreated('src/components/FooBar.vue').toContain('<AGHeadlessInputInput v-bind="attrs" />');
@@ -86,10 +78,12 @@ describe('Generate Component command', () => {
86
78
  );
87
79
 
88
80
  // Act
89
- await run('FooBar', { button: true, story: true });
81
+ await GenerateComponentCommand.run('FooBar', { button: true, story: true });
90
82
 
91
83
  // Assert
92
- FileMock.expectCreated('src/components/FooBar.vue').toContain('<AGHeadlessButton :class="colorClasses">');
84
+ FileMock.expectCreated('src/components/FooBar.vue').toContain(
85
+ '<AGHeadlessButton :class="variantClasses" :disabled="disabled">',
86
+ );
93
87
  FileMock.expectCreated('src/components/FooBar.story.vue').toContain('.story-foobar .variant-playground');
94
88
  FileMock.expectCreated('src/components/FooBar.story.vue').toContain('<FooBar :color="color">');
95
89
  });
@@ -82,7 +82,7 @@ export class GenerateComponentCommand extends Command {
82
82
  if (!File.contains('package.json', '"histoire"') && !File.contains('package.json', '"@aerogel/histoire"')) {
83
83
  Log.fail(`
84
84
  Histoire is not installed yet! You can install it running:
85
- npx ag install histoire
85
+ npx gel install histoire
86
86
  `);
87
87
  }
88
88
  }
@@ -1,20 +1,12 @@
1
- import { beforeEach, describe, it } from 'vitest';
1
+ import { describe, it } from 'vitest';
2
2
  import { formatCodeBlock } from '@noeldemartin/utils';
3
3
 
4
4
  import FileMock from '@/lib/File.mock';
5
- import { stubCommandRunner } from '@/testing/utils';
6
- import type { StubCommandRunner } from '@/testing/utils';
7
5
 
8
6
  import { GenerateModelCommand } from './generate-model';
9
7
 
10
8
  describe('Generate Model command', () => {
11
9
 
12
- let run: StubCommandRunner<typeof GenerateModelCommand>;
13
-
14
- beforeEach(() => {
15
- run = stubCommandRunner(GenerateModelCommand);
16
- });
17
-
18
10
  it('generates models', async () => {
19
11
  // Arrange
20
12
  FileMock.stub(
@@ -28,7 +20,7 @@ describe('Generate Model command', () => {
28
20
  );
29
21
 
30
22
  // Act
31
- await run('FooBar', {
23
+ await GenerateModelCommand.run('FooBar', {
32
24
  fields: 'name:string:required,age:number,birth:Date',
33
25
  });
34
26
 
@@ -90,7 +90,7 @@ export class GenerateModelCommand extends Command {
90
90
  if (!File.contains('package.json', '"soukai"') && !File.contains('package.json', '"@aerogel/plugin-soukai"')) {
91
91
  Log.fail(`
92
92
  Soukai is not installed yet! You can install it running:
93
- npx ag install soukai
93
+ npx gel install soukai
94
94
  `);
95
95
  }
96
96
  }
@@ -0,0 +1,85 @@
1
+ import { arrayFrom } from '@noeldemartin/utils';
2
+
3
+ import Command from '@/commands/Command';
4
+ import File from '@/lib/File';
5
+ import Log from '@/lib/Log';
6
+ import Template from '@/lib/Template';
7
+ import { templatePath } from '@/lib/utils/paths';
8
+ import type { CommandOptions } from '@/commands/Command';
9
+
10
+ export interface Options {
11
+ story?: boolean;
12
+ }
13
+
14
+ export class GenerateOverridesCommand extends Command {
15
+
16
+ protected static command: string = 'generate:overrides';
17
+ protected static description: string = 'Generate AerogelJS component overrides';
18
+
19
+ protected static options: CommandOptions = {
20
+ story: {
21
+ description: 'Create overrides story using Histoire',
22
+ type: 'boolean',
23
+ },
24
+ };
25
+
26
+ private options: Options;
27
+
28
+ constructor(options: Options = {}) {
29
+ super();
30
+
31
+ this.options = options;
32
+ }
33
+
34
+ protected async run(): Promise<void> {
35
+ this.assertAerogelOrDirectory('src/components');
36
+ this.assertHistoireInstalled();
37
+
38
+ const files = new Set<string>();
39
+
40
+ await this.createComponents(files);
41
+ await this.createStory(files);
42
+
43
+ const filesList = arrayFrom(files)
44
+ .map((file) => `- ${file}`)
45
+ .join('\n');
46
+
47
+ Log.info(`Overrides created successfully! The following files were created:\n\n${filesList}`);
48
+ Log.info('\nRemember to declare your components in main.ts and main.histoire.ts!');
49
+ }
50
+
51
+ protected assertHistoireInstalled(): void {
52
+ if (!this.options.story) {
53
+ return;
54
+ }
55
+
56
+ if (!File.contains('package.json', '"histoire"') && !File.contains('package.json', '"@aerogel/histoire"')) {
57
+ Log.fail(`
58
+ Histoire is not installed yet! You can install it running:
59
+ npx gel install histoire
60
+ `);
61
+ }
62
+ }
63
+
64
+ protected async createComponents(files: Set<string>): Promise<void> {
65
+ await Log.animate('Creating components', async () => {
66
+ if (File.exists('src/components/ModalWrapper.vue')) {
67
+ Log.fail('ModalWrapper component already exists!');
68
+ }
69
+
70
+ Template.instantiate(templatePath('overrides'), 'src').forEach((file) => files.add(file));
71
+ });
72
+ }
73
+
74
+ protected async createStory(files: Set<string>): Promise<void> {
75
+ if (!this.options.story) {
76
+ return;
77
+ }
78
+
79
+ await Log.animate('Creating story', async () => {
80
+ Template.instantiate(templatePath('overrides-story'), 'src/components/overrides/').forEach((file) =>
81
+ files.add(file));
82
+ });
83
+ }
84
+
85
+ }
@@ -1,29 +1,21 @@
1
- import { beforeEach, describe, it } from 'vitest';
1
+ import { describe, it } from 'vitest';
2
2
 
3
3
  import FileMock from '@/lib/File.mock';
4
- import { stubCommandRunner } from '@/testing/utils';
5
- import type { StubCommandRunner } from '@/testing/utils';
6
4
 
7
5
  import { GenerateServiceCommand } from './generate-service';
8
6
 
9
7
  describe('Generate Service command', () => {
10
8
 
11
- let run: StubCommandRunner<typeof GenerateServiceCommand>;
12
-
13
- beforeEach(() => {
14
- run = stubCommandRunner(GenerateServiceCommand);
15
- });
16
-
17
9
  it('generates services', async () => {
18
10
  // Arrange
19
11
  FileMock.stub('package.json', '@aerogel/core');
20
12
 
21
13
  // Act
22
- await run('FooBar');
14
+ await GenerateServiceCommand.run('FooBar');
23
15
 
24
16
  // Assert
25
17
  FileMock.expectCreated('src/services/FooBar.ts').toContain('class FooBarService extends Service');
26
- FileMock.expectCreated('src/services/FooBar.ts').toContain('export default facade(new FooBarService());');
18
+ FileMock.expectCreated('src/services/FooBar.ts').toContain('export default facade(FooBarService);');
27
19
  });
28
20
 
29
21
  });
@@ -122,7 +122,7 @@ export class GenerateServiceCommand extends Command {
122
122
  protected getBootstrapOptions(mainConfig: SourceFile): ObjectLiteralExpression | null {
123
123
  const bootstrapAppCall = findDescendant(mainConfig, {
124
124
  guard: Node.isCallExpression,
125
- validate: (callExpression) => callExpression.getExpression().getText() === 'bootstrapApplication',
125
+ validate: (callExpression) => callExpression.getExpression().getText() === 'bootstrap',
126
126
  skip: SyntaxKind.ImportDeclaration,
127
127
  });
128
128
  const bootstrapOptions = bootstrapAppCall?.getArguments()[1];
@@ -0,0 +1,14 @@
1
+ import Command from '@/commands/Command';
2
+ import Log from '@/lib/Log';
3
+
4
+ export class InfoCommand extends Command {
5
+
6
+ protected static command: string = 'info';
7
+ protected static description: string = 'Show debugging information about the CLI';
8
+
9
+ protected async run(): Promise<void> {
10
+ Log.info('[AerogelJS CLI info]');
11
+ Log.info('Installation directory: ' + __dirname);
12
+ }
13
+
14
+ }
@@ -1,23 +1,15 @@
1
- import { beforeEach, describe, it } from 'vitest';
1
+ import { describe, it } from 'vitest';
2
2
 
3
3
  import FileMock from '@/lib/File.mock';
4
4
  import ShellMock from '@/lib/Shell.mock';
5
- import { stubCommandRunner } from '@/testing/utils';
6
- import type { StubCommandRunner } from '@/testing/utils';
7
5
 
8
6
  import { InstallCommand } from './install';
9
7
 
10
8
  describe('Install plugin command', () => {
11
9
 
12
- let run: StubCommandRunner<typeof InstallCommand>;
13
-
14
- beforeEach(() => {
15
- run = stubCommandRunner(InstallCommand);
16
- });
17
-
18
10
  it('installs solid', async () => {
19
11
  // Act
20
- await run('solid');
12
+ await InstallCommand.run('solid');
21
13
 
22
14
  // Assert
23
15
  ShellMock.expectRan('npm install soukai-solid@next --save-exact');
@@ -26,7 +18,7 @@ describe('Install plugin command', () => {
26
18
 
27
19
  it('installs soukai', async () => {
28
20
  // Act
29
- await run('soukai');
21
+ await InstallCommand.run('soukai');
30
22
 
31
23
  // Assert
32
24
  ShellMock.expectRan('npm install soukai@next --save-exact');
@@ -38,7 +30,7 @@ describe('Install plugin command', () => {
38
30
  FileMock.stub('package.json', '"@aerogel/core"');
39
31
 
40
32
  // Act
41
- await run('histoire');
33
+ await InstallCommand.run('histoire');
42
34
 
43
35
  // Assert
44
36
  ShellMock.expectRan('npm install histoire@0.17.6 --save-dev');
@@ -41,10 +41,6 @@ export class FileMockService extends FileService {
41
41
  this.virtualFilesystem[path] = contents;
42
42
  }
43
43
 
44
- public reset(): void {
45
- this.virtualFilesystem = {};
46
- }
47
-
48
44
  public expectCreated(path: string, expectContent?: (contents: string) => void): Assertion<string> {
49
45
  expect(typeof this.virtualFilesystem[path] === 'string', `expected '${path}' file to have been created`).toBe(
50
46
  true,
@@ -63,4 +59,4 @@ export class FileMockService extends FileService {
63
59
 
64
60
  }
65
61
 
66
- export default facade(new FileMockService());
62
+ export default facade(FileMockService);
package/src/lib/File.ts CHANGED
@@ -73,4 +73,4 @@ export class FileService {
73
73
 
74
74
  }
75
75
 
76
- export default facade(new FileService());
76
+ export default facade(FileService);
@@ -24,14 +24,10 @@ export class LogServiceMock extends LogService {
24
24
  throw new Error(`Fail: ${message}`);
25
25
  }
26
26
 
27
- public reset(): void {
28
- this.logs = [];
29
- }
30
-
31
27
  protected stdout(): void {
32
28
  //
33
29
  }
34
30
 
35
31
  }
36
32
 
37
- export default facade(new LogServiceMock());
33
+ export default facade(LogServiceMock);
package/src/lib/Log.ts CHANGED
@@ -92,4 +92,4 @@ export class LogService {
92
92
 
93
93
  }
94
94
 
95
- export default facade(new LogService());
95
+ export default facade(LogService);
@@ -17,4 +17,4 @@ export class ShellServiceMock extends ShellService {
17
17
 
18
18
  }
19
19
 
20
- export default facade(new ShellServiceMock());
20
+ export default facade(ShellServiceMock);
package/src/lib/Shell.ts CHANGED
@@ -25,4 +25,4 @@ export class ShellService {
25
25
 
26
26
  }
27
27
 
28
- export default facade(new ShellService());
28
+ export default facade(ShellService);
@@ -123,7 +123,7 @@ export default abstract class Plugin {
123
123
  protected getBootstrapPluginsDeclaration(mainConfig: SourceFile): ArrayLiteralExpression | null {
124
124
  const bootstrapAppCall = findDescendant(mainConfig, {
125
125
  guard: Node.isCallExpression,
126
- validate: (callExpression) => callExpression.getExpression().getText() === 'bootstrapApplication',
126
+ validate: (callExpression) => callExpression.getExpression().getText() === 'bootstrap',
127
127
  skip: SyntaxKind.ImportDeclaration,
128
128
  });
129
129
  const bootstrapOptions = bootstrapAppCall?.getArguments()[1];
@@ -26,6 +26,7 @@ export class Solid extends Plugin {
26
26
 
27
27
  protected async installNpmDependencies(): Promise<void> {
28
28
  await Shell.run('npm install soukai-solid@next --save-exact');
29
+ await Shell.run('npm install @noeldemartin/solid-utils@next --save-exact');
29
30
  await Shell.run('npm install @solid/community-server@7 --save');
30
31
  await super.installNpmDependencies();
31
32
  }
@@ -50,17 +51,16 @@ export class Solid extends Plugin {
50
51
  .replace(
51
52
  '"cy:test": "start-server-and-test test:serve-app http-get://localhost:5001 cy:run",',
52
53
  '"cy:test": "start-server-and-test ' +
53
- 'test:serve-app http-get://localhost:5001 test:serve-pod http-get://localhost:4000 cy:run",',
54
+ 'test:serve-app http-get://localhost:5001 test:serve-pod http-get://localhost:3000 cy:run",',
54
55
  )
55
56
  .replace(
56
57
  '"dev": "vite",',
57
58
  '"dev": "vite",\n' +
58
- '"dev:serve-pod": "community-solid-server -c @css:config/file.json -p 4000 -f ./solid-data",',
59
+ '"dev:serve-pod": "community-solid-server -c @css:config/file.json -f ./solid-data",',
59
60
  )
60
61
  .replace(
61
62
  '"test:serve-app": "vite --port 5001"',
62
- '"test:serve-app": "vite --port 5001",\n' +
63
- '"test:serve-pod": "community-solid-server -p 4000 -l warn"',
63
+ '"test:serve-app": "vite --port 5001",\n"test:serve-pod": "community-solid-server -l warn"',
64
64
  ),
65
65
  );
66
66
 
@@ -11,14 +11,11 @@ import ShellMock from '@/lib/Shell.mock';
11
11
 
12
12
  setTestingNamespace(vi);
13
13
 
14
- File.setMockInstance(FileMock);
15
- Log.setMockInstance(LogMock);
16
- Shell.setMockInstance(ShellMock);
14
+ File.setMockFacade(FileMock);
15
+ Log.setMockFacade(LogMock);
16
+ Shell.setMockFacade(ShellMock);
17
17
 
18
18
  beforeEach(() => {
19
- FileMock.reset();
20
- LogMock.reset();
21
-
22
19
  File.mock();
23
20
  Log.mock();
24
21
  Shell.mock();
@@ -6,8 +6,8 @@ jobs:
6
6
  ci:
7
7
  runs-on: ubuntu-latest
8
8
  steps:
9
- - uses: actions/checkout@v3
10
- - uses: actions/setup-node@v3
9
+ - uses: actions/checkout@v4
10
+ - uses: actions/setup-node@v4
11
11
  with:
12
12
  node-version-file: '.nvmrc'
13
13
  - run: npm ci
@@ -16,13 +16,13 @@ jobs:
16
16
  - run: npm run test:ci
17
17
  - run: npm run cy:test-snapshots:ci
18
18
  - name: Upload Cypress screenshots
19
- uses: actions/upload-artifact@v3
19
+ uses: actions/upload-artifact@v4
20
20
  if: ${{ failure() }}
21
21
  with:
22
22
  name: cypress_screenshots
23
23
  path: cypress/screenshots
24
24
  - name: Upload Cypress snapshots
25
- uses: actions/upload-artifact@v3
25
+ uses: actions/upload-artifact@v4
26
26
  if: ${{ failure() }}
27
27
  with:
28
28
  name: cypress_snapshots
@@ -1,4 +1,4 @@
1
- import install from '@aerogel/cypress/dist/plugin';
1
+ import { setupAerogelNodeEvents } from '@aerogel/cypress/config';
2
2
  import { defineConfig } from 'cypress';
3
3
 
4
4
  export default defineConfig({
@@ -9,8 +9,6 @@ export default defineConfig({
9
9
  runMode: 3,
10
10
  openMode: 0,
11
11
  },
12
- setupNodeEvents(on) {
13
- install(on);
14
- },
12
+ setupNodeEvents: setupAerogelNodeEvents,
15
13
  },
16
14
  });
@@ -1,3 +1 @@
1
- import install from '@aerogel/cypress';
2
-
3
- install();
1
+ import '@aerogel/cypress/support';
@@ -11,7 +11,7 @@
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\"",
13
13
  "dev": "vite",
14
- "lint": "noeldemartin-lint src",
14
+ "lint": "noeldemartin-lint src cypress",
15
15
  "test": "vitest --run",
16
16
  "test:ci": "vitest --run --reporter verbose",
17
17
  "test:serve-app": "vite --port 5001"
@@ -1,13 +1,13 @@
1
1
  import i18n from '@aerogel/plugin-i18n';
2
2
  import soukai from '@aerogel/plugin-soukai';
3
- import { bootstrapApplication } from '@aerogel/core';
3
+ import { bootstrap } from '@aerogel/core';
4
4
 
5
5
  import './assets/css/styles.css';
6
6
  import App from './App.vue';
7
7
 
8
- bootstrapApplication(App, {
8
+ bootstrap(App, {
9
9
  plugins: [
10
10
  i18n({ messages: import.meta.glob('@/lang/*.yaml') }),
11
- soukai({ models: import.meta.glob('@/models/*', { eager: true }) }),
11
+ soukai({ models: import.meta.glob(['@/models/*', '!**/*.test.ts'], { eager: true }) }),
12
12
  ],
13
13
  });
@@ -1,15 +1,16 @@
1
1
  <template>
2
- <AGHeadlessButton :class="colorClasses">
2
+ <AGHeadlessButton :class="variantClasses" :disabled="disabled">
3
3
  <slot />
4
4
  </AGHeadlessButton>
5
5
  </template>
6
6
 
7
7
  <script setup lang="ts">
8
- import { Colors, enumProp } from '@aerogel/core';
8
+ import { Colors, booleanProp, enumProp, removeInteractiveClasses } from '@aerogel/core';
9
9
  import { computed } from 'vue';
10
10
 
11
11
  const props = defineProps({
12
12
  color: enumProp(Colors, Colors.Primary),
13
+ disabled: booleanProp(),
13
14
  });
14
15
 
15
16
  const colorClasses = computed(() => {
@@ -29,4 +30,13 @@ const colorClasses = computed(() => {
29
30
  return '';
30
31
  }
31
32
  });
33
+
34
+ const variantClasses = computed(() => {
35
+ if (props.disabled) {
36
+ // Add additional classes for disabled state here.
37
+ return removeInteractiveClasses(colorClasses.value);
38
+ }
39
+
40
+ return colorClasses.value;
41
+ });
32
42
  </script>