@aerogel/cli 0.0.0-next.f8cdd39997c56dcd46e07c26af8a84d04d610fce → 0.0.0-next.f9394854509d71d644498ac087706a2f8f8eea1c
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 +2 -2
- package/dist/aerogel-cli.esm.js +1 -1
- package/dist/aerogel-cli.esm.js.map +1 -1
- package/package.json +10 -4
- package/src/cli.ts +23 -3
- package/src/commands/Command.ts +11 -6
- package/src/commands/create.test.ts +1 -2
- package/src/commands/create.ts +5 -5
- package/src/commands/generate-component.test.ts +49 -2
- package/src/commands/generate-component.ts +60 -14
- package/src/commands/generate-model.test.ts +1 -1
- package/src/commands/generate-model.ts +7 -8
- package/src/commands/generate-overrides.ts +85 -0
- package/src/commands/generate-service.test.ts +1 -1
- package/src/commands/generate-service.ts +6 -7
- package/src/commands/info.ts +14 -0
- package/src/commands/install.test.ts +24 -1
- package/src/commands/install.ts +6 -5
- package/src/lib/Editor.ts +9 -7
- package/src/lib/File.mock.ts +1 -5
- package/src/lib/File.ts +1 -1
- package/src/lib/Log.mock.ts +1 -5
- package/src/lib/Log.ts +1 -1
- package/src/lib/Shell.mock.ts +2 -2
- package/src/lib/Shell.ts +1 -1
- package/src/lib/Template.ts +5 -1
- package/src/lib/utils/app.ts +1 -1
- package/src/lib/utils/paths.ts +1 -1
- package/src/plugins/Histoire.ts +113 -0
- package/src/plugins/Plugin.ts +58 -5
- package/src/plugins/Solid.ts +15 -48
- package/src/testing/setup.ts +3 -6
- package/templates/app/.github/workflows/ci.yml +4 -4
- package/templates/app/cypress/cypress.config.ts +14 -0
- package/templates/app/cypress/support/e2e.ts +1 -3
- package/templates/app/cypress/tsconfig.json +3 -1
- package/templates/app/index.html +3 -2
- package/templates/app/package.json +16 -4
- package/templates/app/src/App.vue +2 -2
- package/templates/app/src/assets/public/robots.txt +2 -0
- package/templates/app/src/main.ts +4 -4
- package/templates/app/vite.config.ts +3 -1
- package/templates/component-button/[component.name].vue +42 -0
- package/templates/component-button-story/[component.name].story.vue +77 -0
- package/templates/component-checkbox/[component.name].vue +34 -0
- package/templates/component-checkbox-story/[component.name].story.vue +63 -0
- package/templates/component-input/[component.name].vue +17 -0
- package/templates/component-input-story/[component.name].story.vue +63 -0
- package/templates/histoire/histoire.config.ts +7 -0
- package/templates/histoire/patches/histoire+0.17.6.patch +13 -0
- package/templates/histoire/src/main.histoire.ts +8 -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/templates/service/[service.name].ts +1 -1
- package/.eslintrc.js +0 -7
- package/src/lib/utils/format.test.ts +0 -33
- package/src/lib/utils/format.ts +0 -38
- package/templates/app/.eslintrc.js +0 -3
- package/templates/app/cypress.config.ts +0 -12
- package/templates/app/prettier.config.js +0 -5
- /package/bin/{ag → gel} +0 -0
- /package/templates/app/src/assets/{styles.css → css/main.css} +0 -0
package/src/lib/Log.mock.ts
CHANGED
|
@@ -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(
|
|
33
|
+
export default facade(LogServiceMock);
|
package/src/lib/Log.ts
CHANGED
package/src/lib/Shell.mock.ts
CHANGED
|
@@ -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 {
|
|
@@ -17,4 +17,4 @@ export class ShellServiceMock extends ShellService {
|
|
|
17
17
|
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
export default facade(
|
|
20
|
+
export default facade(ShellServiceMock);
|
package/src/lib/Shell.ts
CHANGED
package/src/lib/Template.ts
CHANGED
|
@@ -6,7 +6,11 @@ import File from '@/lib/File';
|
|
|
6
6
|
|
|
7
7
|
export default class Template {
|
|
8
8
|
|
|
9
|
-
public static instantiate(
|
|
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);
|
package/src/lib/utils/app.ts
CHANGED
package/src/lib/utils/paths.ts
CHANGED
|
@@ -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\/
|
|
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,113 @@
|
|
|
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
|
+
import { formatCodeBlock } from '@noeldemartin/utils';
|
|
10
|
+
|
|
11
|
+
export class Histoire extends Plugin {
|
|
12
|
+
|
|
13
|
+
private installedPatchPackage: boolean = false;
|
|
14
|
+
private installedPostCSSPseudoClasses: boolean = false;
|
|
15
|
+
|
|
16
|
+
constructor() {
|
|
17
|
+
super('histoire');
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
public async beforeInstall(): Promise<void> {
|
|
21
|
+
this.installedPatchPackage = false;
|
|
22
|
+
this.installedPostCSSPseudoClasses = false;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
protected async afterInstall(): Promise<void> {
|
|
26
|
+
if (!this.installedPatchPackage) {
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
await Log.animate('Patching dependencies', async () => {
|
|
31
|
+
await Shell.run('npx patch-package');
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
protected async updateFiles(editor: Editor): Promise<void> {
|
|
36
|
+
await this.updateTailwindConfig(editor, {
|
|
37
|
+
content: isLinkedLocalApp()
|
|
38
|
+
? `'${packagePath('histoire')}/dist/**/*.js'`
|
|
39
|
+
: '\'./node_modules/@aerogel/histoire/dist/**/*.js\'',
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
await this.updateNpmScripts(editor);
|
|
43
|
+
await this.createConfigFiles();
|
|
44
|
+
await super.updateFiles(editor);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
protected async installNpmDependencies(): Promise<void> {
|
|
48
|
+
// We need this specific version because we're patching it using patch-package
|
|
49
|
+
await Shell.run('npm install histoire@0.17.6 --save-dev');
|
|
50
|
+
|
|
51
|
+
if (!File.contains('package.json', '"patch-package"')) {
|
|
52
|
+
await Shell.run('npm install patch-package --save-dev');
|
|
53
|
+
|
|
54
|
+
this.installedPatchPackage = true;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
if (!File.contains('package.json', '"postcss-pseudo-classes"')) {
|
|
58
|
+
await Shell.run('npm install postcss-pseudo-classes --save-dev');
|
|
59
|
+
|
|
60
|
+
this.installedPostCSSPseudoClasses = true;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
await super.installNpmDependencies();
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
protected getLocalPackageName(): string {
|
|
67
|
+
return this.name;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
protected async updateNpmScripts(editor: Editor): Promise<void> {
|
|
71
|
+
Log.info('Updating npm scripts...');
|
|
72
|
+
|
|
73
|
+
const packageJson = File.read('package.json');
|
|
74
|
+
|
|
75
|
+
if (!packageJson) {
|
|
76
|
+
return Log.fail('Could not find package.json file');
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
File.write(
|
|
80
|
+
'package.json',
|
|
81
|
+
packageJson.replace(
|
|
82
|
+
'"lint": "noeldemartin-lint src cypress",',
|
|
83
|
+
this.installedPatchPackage
|
|
84
|
+
? formatCodeBlock(`
|
|
85
|
+
"histoire": "histoire dev",
|
|
86
|
+
"lint": "noeldemartin-lint cypress src",
|
|
87
|
+
"postinstall": "patch-package",
|
|
88
|
+
`)
|
|
89
|
+
: formatCodeBlock(`
|
|
90
|
+
"histoire": "histoire dev",
|
|
91
|
+
"lint": "noeldemartin-lint cypress src",
|
|
92
|
+
`),
|
|
93
|
+
),
|
|
94
|
+
);
|
|
95
|
+
|
|
96
|
+
editor.addModifiedFile('package.json');
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
protected async createConfigFiles(): Promise<void> {
|
|
100
|
+
Log.info('Creating config files...');
|
|
101
|
+
|
|
102
|
+
Template.instantiate(templatePath('histoire'));
|
|
103
|
+
|
|
104
|
+
if (this.installedPostCSSPseudoClasses) {
|
|
105
|
+
Template.instantiate(templatePath('postcss-pseudo-classes'));
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
protected isForDevelopment(): boolean {
|
|
110
|
+
return true;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
}
|
package/src/plugins/Plugin.ts
CHANGED
|
@@ -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
|
-
|
|
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,10 +101,29 @@ 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,
|
|
92
|
-
validate: (callExpression) => callExpression.getExpression().getText() === '
|
|
126
|
+
validate: (callExpression) => callExpression.getExpression().getText() === 'bootstrap',
|
|
93
127
|
skip: SyntaxKind.ImportDeclaration,
|
|
94
128
|
});
|
|
95
129
|
const bootstrapOptions = bootstrapAppCall?.getArguments()[1];
|
|
@@ -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
|
}
|
package/src/plugins/Solid.ts
CHANGED
|
@@ -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);
|
|
@@ -25,32 +26,11 @@ export class Solid extends Plugin {
|
|
|
25
26
|
|
|
26
27
|
protected async installNpmDependencies(): Promise<void> {
|
|
27
28
|
await Shell.run('npm install soukai-solid@next --save-exact');
|
|
28
|
-
await Shell.run('npm install @solid
|
|
29
|
+
await Shell.run('npm install @noeldemartin/solid-utils@next --save-exact');
|
|
30
|
+
await Shell.run('npm install @solid/community-server@~7.0 --save-dev');
|
|
29
31
|
await super.installNpmDependencies();
|
|
30
32
|
}
|
|
31
33
|
|
|
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
34
|
protected async updateNpmScripts(editor: Editor): Promise<void> {
|
|
55
35
|
Log.info('Updating npm scripts...');
|
|
56
36
|
|
|
@@ -71,17 +51,17 @@ export class Solid extends Plugin {
|
|
|
71
51
|
.replace(
|
|
72
52
|
'"cy:test": "start-server-and-test test:serve-app http-get://localhost:5001 cy:run",',
|
|
73
53
|
'"cy:test": "start-server-and-test ' +
|
|
74
|
-
'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",',
|
|
75
55
|
)
|
|
76
56
|
.replace(
|
|
77
57
|
'"dev": "vite",',
|
|
78
58
|
'"dev": "vite",\n' +
|
|
79
|
-
'"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",',
|
|
80
60
|
)
|
|
81
61
|
.replace(
|
|
82
|
-
'"test:serve-app": "vite --port 5001"',
|
|
83
|
-
'"test:serve-app": "vite --port 5001",\n' +
|
|
84
|
-
'"test:serve-pod": "community-solid-server -
|
|
62
|
+
'"test:serve-app": "vite --port 5001 --mode testing"',
|
|
63
|
+
'"test:serve-app": "vite --port 5001 --mode testing",\n' +
|
|
64
|
+
'"test:serve-pod": "community-solid-server -l warn"',
|
|
85
65
|
),
|
|
86
66
|
);
|
|
87
67
|
|
|
@@ -91,22 +71,9 @@ export class Solid extends Plugin {
|
|
|
91
71
|
protected async updateGitIgnore(): Promise<void> {
|
|
92
72
|
Log.info('Updating .gitignore');
|
|
93
73
|
|
|
94
|
-
File.
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
protected getTailwindContentArray(tailwindConfig: SourceFile): ArrayLiteralExpression | null {
|
|
98
|
-
const contentAssignment = findDescendant(tailwindConfig, {
|
|
99
|
-
guard: Node.isPropertyAssignment,
|
|
100
|
-
validate: (propertyAssignment) => propertyAssignment.getName() === 'content',
|
|
101
|
-
skip: SyntaxKind.JSDoc,
|
|
102
|
-
});
|
|
103
|
-
const contentArray = contentAssignment?.getInitializer();
|
|
104
|
-
|
|
105
|
-
if (!Node.isArrayLiteralExpression(contentArray)) {
|
|
106
|
-
return null;
|
|
107
|
-
}
|
|
74
|
+
const gitignore = File.read('.gitignore') ?? '';
|
|
108
75
|
|
|
109
|
-
|
|
76
|
+
File.write('.gitignore', `${gitignore}/solid-data\n`);
|
|
110
77
|
}
|
|
111
78
|
|
|
112
79
|
}
|
package/src/testing/setup.ts
CHANGED
|
@@ -11,14 +11,11 @@ import ShellMock from '@/lib/Shell.mock';
|
|
|
11
11
|
|
|
12
12
|
setTestingNamespace(vi);
|
|
13
13
|
|
|
14
|
-
File.
|
|
15
|
-
Log.
|
|
16
|
-
Shell.
|
|
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@
|
|
10
|
-
- uses: actions/setup-node@
|
|
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@
|
|
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@
|
|
25
|
+
uses: actions/upload-artifact@v4
|
|
26
26
|
if: ${{ failure() }}
|
|
27
27
|
with:
|
|
28
28
|
name: cypress_snapshots
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { setupAerogelNodeEvents } from '@aerogel/cypress/config';
|
|
2
|
+
import { defineConfig } from 'cypress';
|
|
3
|
+
|
|
4
|
+
export default defineConfig({
|
|
5
|
+
e2e: {
|
|
6
|
+
baseUrl: 'http://localhost:5001',
|
|
7
|
+
video: false,
|
|
8
|
+
retries: {
|
|
9
|
+
runMode: 3,
|
|
10
|
+
openMode: 0,
|
|
11
|
+
},
|
|
12
|
+
setupNodeEvents: setupAerogelNodeEvents,
|
|
13
|
+
},
|
|
14
|
+
});
|
package/templates/app/index.html
CHANGED
|
@@ -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
|
|
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,16 +5,16 @@
|
|
|
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\"",
|
|
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
|
-
"test:serve-app": "vite --port 5001"
|
|
17
|
+
"test:serve-app": "vite --port 5001 --mode testing"
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
20
|
"@aerogel/core": "<% &dependencies.aerogelCore %>",
|
|
@@ -46,10 +46,22 @@
|
|
|
46
46
|
"prettier-eslint-cli": "^7.1.0",
|
|
47
47
|
"prettier-plugin-tailwindcss": "^0.2.8",
|
|
48
48
|
"start-server-and-test": "^2.0.0",
|
|
49
|
+
"typescript": "~5.4",
|
|
49
50
|
"unplugin-icons": "^0.16.3",
|
|
50
51
|
"unplugin-vue-components": "^0.24.1",
|
|
51
52
|
"vite": "^4.3.0",
|
|
52
53
|
"vitest": "^0.33.0",
|
|
53
54
|
"vue-tsc": "^1.8.15"
|
|
55
|
+
},
|
|
56
|
+
"eslintConfig": {
|
|
57
|
+
"extends": [
|
|
58
|
+
"@noeldemartin/eslint-config-vue"
|
|
59
|
+
]
|
|
60
|
+
},
|
|
61
|
+
"prettier": {
|
|
62
|
+
"plugins": [
|
|
63
|
+
"prettier-plugin-tailwindcss"
|
|
64
|
+
],
|
|
65
|
+
"printWidth": 120
|
|
54
66
|
}
|
|
55
67
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<AGAppLayout>
|
|
3
|
-
<main class="flex flex-grow flex-col items-center justify-center
|
|
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>
|
|
@@ -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
|
-
import './assets/
|
|
5
|
+
import './assets/css/main.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
|
});
|
|
@@ -7,8 +7,10 @@ import { defineConfig } from 'vitest/config';
|
|
|
7
7
|
import { resolve } from 'path';
|
|
8
8
|
|
|
9
9
|
export default defineConfig({
|
|
10
|
+
build: { sourcemap: true },
|
|
11
|
+
publicDir: resolve(__dirname, './src/assets/public/'),
|
|
10
12
|
plugins: [
|
|
11
|
-
Aerogel(),
|
|
13
|
+
Aerogel({ name: '<% app.name %>' }),
|
|
12
14
|
Components({
|
|
13
15
|
dts: false,
|
|
14
16
|
resolvers: [AerogelResolver(), IconsResolver()],
|
|
@@ -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>
|