@aerogel/cli 0.0.0-next.5953e1862a7c89a8fc80da087467d67d4f4e8c73 → 0.0.0-next.702e17f12493b62feba1d0af54d7c3b1d07f934c
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.
- package/.prettierignore +1 -0
- package/dist/aerogel-cli.cjs.js +1 -1
- package/dist/aerogel-cli.cjs.js.map +1 -1
- package/dist/aerogel-cli.d.ts +1 -0
- package/dist/aerogel-cli.esm.js +1 -1
- package/dist/aerogel-cli.esm.js.map +1 -1
- package/package.json +2 -2
- package/src/cli.ts +20 -2
- package/src/commands/Command.ts +11 -6
- package/src/commands/create.ts +5 -5
- package/src/commands/generate-component.test.ts +21 -0
- package/src/commands/generate-component.ts +30 -11
- package/src/commands/generate-model.ts +6 -6
- package/src/commands/generate-overrides.ts +85 -0
- package/src/commands/generate-service.ts +5 -5
- package/src/commands/install.ts +4 -4
- package/src/plugins/Histoire.ts +12 -0
- package/src/plugins/Plugin.ts +1 -1
- package/src/plugins/Solid.ts +4 -4
- package/templates/app/cypress/cypress.config.ts +2 -4
- package/templates/app/cypress/support/e2e.ts +1 -3
- package/templates/app/src/main.ts +3 -3
- package/templates/component-button/[component.name].vue +42 -0
- package/templates/component-button-story/[component.name].story.vue +77 -0
- package/templates/overrides/components/index.ts +15 -0
- package/templates/overrides/components/overrides/AlertModal.vue +11 -0
- package/templates/overrides/components/overrides/ConfirmModal.vue +20 -0
- package/templates/overrides/components/overrides/ErrorReportModal.vue +35 -0
- package/templates/overrides/components/overrides/LoadingModal.vue +12 -0
- package/templates/overrides/components/overrides/ModalWrapper.vue +22 -0
- package/templates/overrides/components/overrides/SnackbarNotification.vue +34 -0
- package/templates/overrides-story/Overrides.story.vue +86 -0
- package/templates/postcss-pseudo-classes/postcss.config.js +15 -0
- /package/bin/{ag → gel} +0 -0
package/src/cli.ts
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
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';
|
|
7
11
|
import { InstallCommand } from '@/commands/install';
|
|
8
12
|
|
|
@@ -11,17 +15,31 @@ export class CLIService {
|
|
|
11
15
|
public run(argv?: string[]): void {
|
|
12
16
|
const program = new Command();
|
|
13
17
|
|
|
14
|
-
program.name('
|
|
18
|
+
program.name('gel').description('AerogelJS CLI').version(this.getVersion());
|
|
15
19
|
|
|
16
20
|
CreateCommand.define(program);
|
|
17
21
|
GenerateComponentCommand.define(program);
|
|
18
22
|
GenerateModelCommand.define(program);
|
|
23
|
+
GenerateOverridesCommand.define(program);
|
|
19
24
|
GenerateServiceCommand.define(program);
|
|
20
25
|
InstallCommand.define(program);
|
|
21
26
|
|
|
22
27
|
program.parse(argv);
|
|
23
28
|
}
|
|
24
29
|
|
|
30
|
+
public getVersion(): string {
|
|
31
|
+
const errorMessage = 'Could not find CLI\'s version, please report this bug.';
|
|
32
|
+
const packageJsonPath = resolve(__dirname, '../package.json');
|
|
33
|
+
|
|
34
|
+
if (!existsSync(packageJsonPath)) {
|
|
35
|
+
throw new Error(errorMessage);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
const packageJson = JSON.parse(readFileSync(packageJsonPath).toString()) as { version?: string };
|
|
39
|
+
|
|
40
|
+
return packageJson.version ?? fail(errorMessage);
|
|
41
|
+
}
|
|
42
|
+
|
|
25
43
|
}
|
|
26
44
|
|
|
27
45
|
export default facade(new CLIService());
|
package/src/commands/Command.ts
CHANGED
|
@@ -8,10 +8,10 @@ export type CommandOptions = Record<string, string | { description: string; type
|
|
|
8
8
|
|
|
9
9
|
export default class Command {
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
protected static command: string = '';
|
|
12
|
+
protected static description: string = '';
|
|
13
|
+
protected static parameters: [string, string][] = [];
|
|
14
|
+
protected static options: CommandOptions = {};
|
|
15
15
|
|
|
16
16
|
public static define(program: CommanderCommand): void {
|
|
17
17
|
program = program.command(this.command).description(this.description);
|
|
@@ -33,11 +33,16 @@ export default class Command {
|
|
|
33
33
|
public static async run<T extends CommandConstructor>(this: T, ...args: ConstructorParameters<T>): Promise<void> {
|
|
34
34
|
const instance = new this(...args);
|
|
35
35
|
|
|
36
|
+
await instance.validate();
|
|
36
37
|
await instance.run();
|
|
37
38
|
}
|
|
38
39
|
|
|
39
|
-
|
|
40
|
-
//
|
|
40
|
+
protected async validate(): Promise<void> {
|
|
41
|
+
// Placeholder for overrides, don't place any functionality here.
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
protected async run(): Promise<void> {
|
|
45
|
+
// Placeholder for overrides, don't place any functionality here.
|
|
41
46
|
}
|
|
42
47
|
|
|
43
48
|
protected assertAerogelOrDirectory(path?: string): void {
|
package/src/commands/create.ts
CHANGED
|
@@ -15,10 +15,10 @@ export interface Options {
|
|
|
15
15
|
|
|
16
16
|
export class CreateCommand extends Command {
|
|
17
17
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
18
|
+
protected static command: string = 'create';
|
|
19
|
+
protected static description: string = 'Create AerogelJS app';
|
|
20
|
+
protected static parameters: [string, string][] = [['path', 'Application path']];
|
|
21
|
+
protected static options: CommandOptions = {
|
|
22
22
|
name: 'Application name',
|
|
23
23
|
local: {
|
|
24
24
|
type: 'boolean',
|
|
@@ -40,7 +40,7 @@ export class CreateCommand extends Command {
|
|
|
40
40
|
this.options = options;
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
-
|
|
43
|
+
protected async run(): Promise<void> {
|
|
44
44
|
const path = this.path;
|
|
45
45
|
const name = this.options.name ?? stringToTitleCase(basename(path));
|
|
46
46
|
|
|
@@ -67,4 +67,25 @@ describe('Generate Component command', () => {
|
|
|
67
67
|
);
|
|
68
68
|
});
|
|
69
69
|
|
|
70
|
+
it('generates button components with stories', async () => {
|
|
71
|
+
// Arrange
|
|
72
|
+
FileMock.stub(
|
|
73
|
+
'package.json',
|
|
74
|
+
`
|
|
75
|
+
"@aerogel/core": "*",
|
|
76
|
+
"histoire": "*"
|
|
77
|
+
`,
|
|
78
|
+
);
|
|
79
|
+
|
|
80
|
+
// Act
|
|
81
|
+
await GenerateComponentCommand.run('FooBar', { button: true, story: true });
|
|
82
|
+
|
|
83
|
+
// Assert
|
|
84
|
+
FileMock.expectCreated('src/components/FooBar.vue').toContain(
|
|
85
|
+
'<AGHeadlessButton :class="variantClasses" :disabled="disabled">',
|
|
86
|
+
);
|
|
87
|
+
FileMock.expectCreated('src/components/FooBar.story.vue').toContain('.story-foobar .variant-playground');
|
|
88
|
+
FileMock.expectCreated('src/components/FooBar.story.vue').toContain('<FooBar :color="color">');
|
|
89
|
+
});
|
|
90
|
+
|
|
70
91
|
});
|
|
@@ -12,27 +12,32 @@ import { templatePath } from '@/lib/utils/paths';
|
|
|
12
12
|
import type { CommandOptions } from '@/commands/Command';
|
|
13
13
|
|
|
14
14
|
export interface Options {
|
|
15
|
-
|
|
15
|
+
button?: boolean;
|
|
16
16
|
input?: boolean;
|
|
17
|
+
story?: boolean;
|
|
17
18
|
}
|
|
18
19
|
|
|
19
20
|
export class GenerateComponentCommand extends Command {
|
|
20
21
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
protected static command: string = 'generate:component';
|
|
23
|
+
protected static description: string = 'Generate an AerogelJS Component';
|
|
24
|
+
protected static parameters: [string, string][] = [
|
|
24
25
|
['path', 'Component path (relative to components folder; extension not necessary)'],
|
|
25
26
|
];
|
|
26
27
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
description: 'Create
|
|
28
|
+
protected static options: CommandOptions = {
|
|
29
|
+
button: {
|
|
30
|
+
description: 'Create a custom button',
|
|
30
31
|
type: 'boolean',
|
|
31
32
|
},
|
|
32
33
|
input: {
|
|
33
34
|
description: 'Create a custom input',
|
|
34
35
|
type: 'boolean',
|
|
35
36
|
},
|
|
37
|
+
story: {
|
|
38
|
+
description: 'Create component story using Histoire',
|
|
39
|
+
type: 'boolean',
|
|
40
|
+
},
|
|
36
41
|
};
|
|
37
42
|
|
|
38
43
|
private path: string;
|
|
@@ -45,7 +50,13 @@ export class GenerateComponentCommand extends Command {
|
|
|
45
50
|
this.options = options;
|
|
46
51
|
}
|
|
47
52
|
|
|
48
|
-
|
|
53
|
+
protected async validate(): Promise<void> {
|
|
54
|
+
if (this.options.button && this.options.input) {
|
|
55
|
+
Log.fail('Cannot use both \'button\' and \'input\' flags!');
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
protected async run(): Promise<void> {
|
|
49
60
|
this.assertAerogelOrDirectory('src/components');
|
|
50
61
|
this.assertHistoireInstalled();
|
|
51
62
|
|
|
@@ -71,7 +82,7 @@ export class GenerateComponentCommand extends Command {
|
|
|
71
82
|
if (!File.contains('package.json', '"histoire"') && !File.contains('package.json', '"@aerogel/histoire"')) {
|
|
72
83
|
Log.fail(`
|
|
73
84
|
Histoire is not installed yet! You can install it running:
|
|
74
|
-
npx
|
|
85
|
+
npx gel install histoire
|
|
75
86
|
`);
|
|
76
87
|
}
|
|
77
88
|
}
|
|
@@ -82,7 +93,11 @@ export class GenerateComponentCommand extends Command {
|
|
|
82
93
|
Log.fail(`${this.path} component already exists!`);
|
|
83
94
|
}
|
|
84
95
|
|
|
85
|
-
const templateName = this.options.input
|
|
96
|
+
const templateName = this.options.input
|
|
97
|
+
? 'component-input'
|
|
98
|
+
: this.options.button
|
|
99
|
+
? 'component-button'
|
|
100
|
+
: 'component';
|
|
86
101
|
const componentFiles = Template.instantiate(templatePath(templateName), `src/components/${directoryName}`, {
|
|
87
102
|
component: {
|
|
88
103
|
name: componentName,
|
|
@@ -100,7 +115,11 @@ export class GenerateComponentCommand extends Command {
|
|
|
100
115
|
}
|
|
101
116
|
|
|
102
117
|
await Log.animate('Creating story', async () => {
|
|
103
|
-
const templateName = this.options.input
|
|
118
|
+
const templateName = this.options.input
|
|
119
|
+
? 'component-input-story'
|
|
120
|
+
: this.options.button
|
|
121
|
+
? 'component-button-story'
|
|
122
|
+
: 'component-story';
|
|
104
123
|
const storyFiles = Template.instantiate(templatePath(templateName), `src/components/${directoryName}`, {
|
|
105
124
|
component: {
|
|
106
125
|
name: componentName,
|
|
@@ -13,10 +13,10 @@ interface Options {
|
|
|
13
13
|
|
|
14
14
|
export class GenerateModelCommand extends Command {
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
16
|
+
protected static command: string = 'generate:model';
|
|
17
|
+
protected static description: string = 'Generate an AerogelJS Model';
|
|
18
|
+
protected static parameters: [string, string][] = [['name', 'Model name']];
|
|
19
|
+
protected static options: CommandOptions = {
|
|
20
20
|
fields: 'Create model with the given fields',
|
|
21
21
|
};
|
|
22
22
|
|
|
@@ -30,7 +30,7 @@ export class GenerateModelCommand extends Command {
|
|
|
30
30
|
this.options = options;
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
|
|
33
|
+
protected async run(): Promise<void> {
|
|
34
34
|
this.assertAerogelOrDirectory('src/models');
|
|
35
35
|
|
|
36
36
|
if (File.exists(`src/models/${this.name}.ts`)) {
|
|
@@ -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
|
|
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
|
+
}
|
|
@@ -13,9 +13,9 @@ import type { Editor } from '@/lib/Editor';
|
|
|
13
13
|
|
|
14
14
|
export class GenerateServiceCommand extends Command {
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
protected static command: string = 'generate:service';
|
|
17
|
+
protected static description: string = 'Generate an AerogelJS Service';
|
|
18
|
+
protected static parameters: [string, string][] = [['name', 'Service name']];
|
|
19
19
|
|
|
20
20
|
private name: string;
|
|
21
21
|
|
|
@@ -25,7 +25,7 @@ export class GenerateServiceCommand extends Command {
|
|
|
25
25
|
this.name = name;
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
|
|
28
|
+
protected async run(): Promise<void> {
|
|
29
29
|
this.assertAerogelOrDirectory('src/services');
|
|
30
30
|
|
|
31
31
|
const files = new Set<string>();
|
|
@@ -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() === '
|
|
125
|
+
validate: (callExpression) => callExpression.getExpression().getText() === 'bootstrap',
|
|
126
126
|
skip: SyntaxKind.ImportDeclaration,
|
|
127
127
|
});
|
|
128
128
|
const bootstrapOptions = bootstrapAppCall?.getArguments()[1];
|
package/src/commands/install.ts
CHANGED
|
@@ -12,9 +12,9 @@ const plugins = [new Soukai(), new Solid(), new Histoire()].reduce(
|
|
|
12
12
|
|
|
13
13
|
export class InstallCommand extends Command {
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
protected static command: string = 'install';
|
|
16
|
+
protected static description: string = 'Install an AerogelJS plugin';
|
|
17
|
+
protected static parameters: [string, string][] = [['plugin', 'Plugin to install']];
|
|
18
18
|
|
|
19
19
|
private plugin: Plugin;
|
|
20
20
|
|
|
@@ -26,7 +26,7 @@ export class InstallCommand extends Command {
|
|
|
26
26
|
Log.fail(`Plugin '${plugin}' doesn't exist. Available plugins: ${Object.keys(plugins).join(', ')}`);
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
|
|
29
|
+
protected async run(): Promise<void> {
|
|
30
30
|
await this.plugin.install();
|
|
31
31
|
}
|
|
32
32
|
|
package/src/plugins/Histoire.ts
CHANGED
|
@@ -10,6 +10,7 @@ import type { Editor } from '@/lib/Editor';
|
|
|
10
10
|
export class Histoire extends Plugin {
|
|
11
11
|
|
|
12
12
|
private installedPatchPackage: boolean = false;
|
|
13
|
+
private installedPostCSSPseudoClasses: boolean = false;
|
|
13
14
|
|
|
14
15
|
constructor() {
|
|
15
16
|
super('histoire');
|
|
@@ -17,6 +18,7 @@ export class Histoire extends Plugin {
|
|
|
17
18
|
|
|
18
19
|
public async beforeInstall(): Promise<void> {
|
|
19
20
|
this.installedPatchPackage = false;
|
|
21
|
+
this.installedPostCSSPseudoClasses = false;
|
|
20
22
|
}
|
|
21
23
|
|
|
22
24
|
protected async afterInstall(): Promise<void> {
|
|
@@ -51,6 +53,12 @@ export class Histoire extends Plugin {
|
|
|
51
53
|
this.installedPatchPackage = true;
|
|
52
54
|
}
|
|
53
55
|
|
|
56
|
+
if (!File.contains('package.json', '"postcss-pseudo-classes"')) {
|
|
57
|
+
await Shell.run('npm install postcss-pseudo-classes --save-dev');
|
|
58
|
+
|
|
59
|
+
this.installedPostCSSPseudoClasses = true;
|
|
60
|
+
}
|
|
61
|
+
|
|
54
62
|
await super.installNpmDependencies();
|
|
55
63
|
}
|
|
56
64
|
|
|
@@ -84,6 +92,10 @@ export class Histoire extends Plugin {
|
|
|
84
92
|
Log.info('Creating config files...');
|
|
85
93
|
|
|
86
94
|
Template.instantiate(templatePath('histoire'));
|
|
95
|
+
|
|
96
|
+
if (this.installedPostCSSPseudoClasses) {
|
|
97
|
+
Template.instantiate(templatePath('postcss-pseudo-classes'));
|
|
98
|
+
}
|
|
87
99
|
}
|
|
88
100
|
|
|
89
101
|
protected isForDevelopment(): boolean {
|
package/src/plugins/Plugin.ts
CHANGED
|
@@ -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() === '
|
|
126
|
+
validate: (callExpression) => callExpression.getExpression().getText() === 'bootstrap',
|
|
127
127
|
skip: SyntaxKind.ImportDeclaration,
|
|
128
128
|
});
|
|
129
129
|
const bootstrapOptions = bootstrapAppCall?.getArguments()[1];
|
package/src/plugins/Solid.ts
CHANGED
|
@@ -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:
|
|
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 -
|
|
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
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
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
|
|
13
|
-
install(on);
|
|
14
|
-
},
|
|
12
|
+
setupNodeEvents: setupAerogelNodeEvents,
|
|
15
13
|
},
|
|
16
14
|
});
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import i18n from '@aerogel/plugin-i18n';
|
|
2
2
|
import soukai from '@aerogel/plugin-soukai';
|
|
3
|
-
import {
|
|
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
|
-
|
|
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
|
});
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<AGHeadlessButton :class="variantClasses" :disabled="disabled">
|
|
3
|
+
<slot />
|
|
4
|
+
</AGHeadlessButton>
|
|
5
|
+
</template>
|
|
6
|
+
|
|
7
|
+
<script setup lang="ts">
|
|
8
|
+
import { Colors, booleanProp, enumProp, removeInteractiveClasses } from '@aerogel/core';
|
|
9
|
+
import { computed } from 'vue';
|
|
10
|
+
|
|
11
|
+
const props = defineProps({
|
|
12
|
+
color: enumProp(Colors, Colors.Primary),
|
|
13
|
+
disabled: booleanProp(),
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
const colorClasses = computed(() => {
|
|
17
|
+
switch (props.color) {
|
|
18
|
+
case Colors.Secondary:
|
|
19
|
+
// Add your custom color classes here.
|
|
20
|
+
return '';
|
|
21
|
+
case Colors.Clear:
|
|
22
|
+
// Add your custom color classes here.
|
|
23
|
+
return '';
|
|
24
|
+
case Colors.Danger:
|
|
25
|
+
// Add your custom color classes here.
|
|
26
|
+
return '';
|
|
27
|
+
case Colors.Primary:
|
|
28
|
+
default:
|
|
29
|
+
// Add your custom color classes here.
|
|
30
|
+
return '';
|
|
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
|
+
});
|
|
42
|
+
</script>
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<Story :layout="{ type: 'grid' }">
|
|
3
|
+
<Variant title="Playground">
|
|
4
|
+
<<% component.name %> :color="color">
|
|
5
|
+
{{ content }}
|
|
6
|
+
</<% component.name %>>
|
|
7
|
+
|
|
8
|
+
<template #controls>
|
|
9
|
+
<HstText v-model="content" title="Content" />
|
|
10
|
+
<HstSelect v-model="color" title="Color" :options="colorOptions" />
|
|
11
|
+
</template>
|
|
12
|
+
</Variant>
|
|
13
|
+
|
|
14
|
+
<Variant title="Default">
|
|
15
|
+
<<% component.name %>>
|
|
16
|
+
Click me!
|
|
17
|
+
</<% component.name %>>
|
|
18
|
+
</Variant>
|
|
19
|
+
|
|
20
|
+
<Variant title="Hover">
|
|
21
|
+
<<% component.name %> class=":hover">
|
|
22
|
+
Click me!
|
|
23
|
+
</<% component.name %>>
|
|
24
|
+
</Variant>
|
|
25
|
+
|
|
26
|
+
<Variant title="Focus">
|
|
27
|
+
<<% component.name %> class=":focus :focus-visible">
|
|
28
|
+
Click me!
|
|
29
|
+
</<% component.name %>>
|
|
30
|
+
</Variant>
|
|
31
|
+
|
|
32
|
+
<Variant title="Disabled">
|
|
33
|
+
<<% component.name %> disabled>
|
|
34
|
+
You can't click me
|
|
35
|
+
</<% component.name %>>
|
|
36
|
+
</Variant>
|
|
37
|
+
|
|
38
|
+
<Variant title="Colors" :layout="{ width: '300px' }">
|
|
39
|
+
<div class="flex items-center gap-2">
|
|
40
|
+
<<% component.name %> color="primary">
|
|
41
|
+
Primary
|
|
42
|
+
</<% component.name %>>
|
|
43
|
+
<<% component.name %> color="secondary">
|
|
44
|
+
Secondary
|
|
45
|
+
</<% component.name %>>
|
|
46
|
+
<<% component.name %> color="danger">
|
|
47
|
+
Danger
|
|
48
|
+
</<% component.name %>>
|
|
49
|
+
<<% component.name %> color="clear">
|
|
50
|
+
Clear
|
|
51
|
+
</<% component.name %>>
|
|
52
|
+
</div>
|
|
53
|
+
</Variant>
|
|
54
|
+
</Story>
|
|
55
|
+
</template>
|
|
56
|
+
|
|
57
|
+
<script setup lang="ts">
|
|
58
|
+
import { Colors } from '@aerogel/core';
|
|
59
|
+
import { invert } from '@noeldemartin/utils';
|
|
60
|
+
import { ref } from 'vue';
|
|
61
|
+
import type { Color } from '@aerogel/core';
|
|
62
|
+
|
|
63
|
+
const content = ref('Click me!');
|
|
64
|
+
const color = ref<Color>(Colors.Primary);
|
|
65
|
+
const colorOptions = invert(Colors);
|
|
66
|
+
</script>
|
|
67
|
+
|
|
68
|
+
<style>
|
|
69
|
+
.story-<% component.slug %> {
|
|
70
|
+
grid-template-columns: repeat(2, 300px) !important;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.story-<% component.slug %> .variant-playground,
|
|
74
|
+
.story-<% component.slug %> .variant-colors{
|
|
75
|
+
grid-column: 1 / -1;
|
|
76
|
+
}
|
|
77
|
+
</style>
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { UIComponents } from '@aerogel/core';
|
|
2
|
+
|
|
3
|
+
import AlertModal from './overrides/AlertModal.vue';
|
|
4
|
+
import ConfirmModal from './overrides/ConfirmModal.vue';
|
|
5
|
+
import ErrorReportModal from './overrides/ErrorReportModal.vue';
|
|
6
|
+
import LoadingModal from './overrides/LoadingModal.vue';
|
|
7
|
+
import SnackbarNotification from './overrides/SnackbarNotification.vue';
|
|
8
|
+
|
|
9
|
+
export const components = {
|
|
10
|
+
[UIComponents.AlertModal]: AlertModal,
|
|
11
|
+
[UIComponents.ConfirmModal]: ConfirmModal,
|
|
12
|
+
[UIComponents.ErrorReportModal]: ErrorReportModal,
|
|
13
|
+
[UIComponents.LoadingModal]: LoadingModal,
|
|
14
|
+
[UIComponents.Snackbar]: SnackbarNotification,
|
|
15
|
+
};
|