@aerogel/cli 0.0.0-next.b58141fee5d2fe7d25debdbca6b1d2bf1c13e48e → 0.0.0-next.bf95405357e75d2e8b0268a5e8ce7b2b7dd0c895
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/bin/gel +4 -0
- package/dist/aerogel-cli.d.ts +2 -2
- package/dist/aerogel-cli.js +833 -0
- package/dist/aerogel-cli.js.map +1 -0
- package/package.json +25 -32
- package/src/cli.ts +28 -8
- package/src/commands/Command.ts +14 -9
- package/src/commands/create.test.ts +3 -4
- package/src/commands/create.ts +11 -11
- package/src/commands/generate-component.test.ts +50 -3
- package/src/commands/generate-component.ts +68 -22
- package/src/commands/generate-model.test.ts +2 -2
- package/src/commands/generate-model.ts +13 -14
- package/src/commands/generate-overrides.ts +85 -0
- package/src/commands/generate-service.test.ts +2 -2
- package/src/commands/generate-service.ts +16 -17
- package/src/commands/info.ts +15 -0
- package/src/commands/install.test.ts +11 -2
- package/src/commands/install.ts +9 -9
- package/src/lib/App.ts +9 -6
- package/src/lib/Editor.ts +12 -11
- package/src/lib/File.mock.ts +7 -11
- package/src/lib/File.ts +3 -3
- package/src/lib/Log.mock.ts +4 -8
- package/src/lib/Log.test.ts +4 -4
- package/src/lib/Log.ts +7 -7
- package/src/lib/Shell.mock.ts +3 -3
- package/src/lib/Shell.ts +2 -2
- package/src/lib/Template.ts +24 -17
- package/src/lib/utils/app.ts +3 -3
- package/src/lib/utils/edit.ts +2 -2
- package/src/lib/utils/paths.ts +16 -8
- package/src/plugins/Plugin.ts +46 -12
- package/src/plugins/Solid.ts +15 -58
- package/src/plugins/Soukai.ts +4 -4
- package/src/testing/setup.ts +30 -31
- package/templates/app/.github/workflows/ci.yml +4 -4
- package/templates/app/.nvmrc +1 -1
- package/templates/app/.vscode/launch.json +1 -0
- package/templates/app/{cypress.config.ts → cypress/cypress.config.ts} +2 -4
- package/templates/app/cypress/support/e2e.ts +1 -3
- package/templates/app/cypress/tsconfig.json +7 -8
- package/templates/app/index.html +5 -4
- package/templates/app/package.json +27 -15
- package/templates/app/src/App.vue +2 -2
- package/templates/app/src/assets/css/main.css +4 -0
- package/templates/app/src/assets/public/robots.txt +2 -0
- package/templates/app/src/main.ts +4 -4
- package/templates/app/tsconfig.json +3 -10
- package/templates/app/vite.config.ts +7 -4
- 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/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/service/[service.name].ts +1 -1
- package/.eslintrc.js +0 -7
- package/bin/ag +0 -4
- package/dist/aerogel-cli.cjs.js +0 -2
- package/dist/aerogel-cli.cjs.js.map +0 -1
- package/dist/aerogel-cli.esm.js +0 -2
- package/dist/aerogel-cli.esm.js.map +0 -1
- 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/postcss.config.js +0 -6
- package/templates/app/prettier.config.js +0 -5
- package/templates/app/src/assets/styles.css +0 -3
- package/templates/app/tailwind.config.js +0 -5
- package/tsconfig.json +0 -11
- package/vite.config.ts +0 -14
- /package/src/{main.ts → index.ts} +0 -0
package/src/lib/Log.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
+
import chalk from 'chalk';
|
|
2
|
+
import { clearLine, cursorTo } from 'node:readline';
|
|
1
3
|
import { facade, stringMatchAll } from '@noeldemartin/utils';
|
|
2
|
-
import { bold, hex } from 'chalk';
|
|
3
|
-
import { clearLine, cursorTo } from 'readline';
|
|
4
4
|
|
|
5
5
|
export class LogService {
|
|
6
6
|
|
|
7
|
-
protected renderInfo = hex('#00ffff');
|
|
8
|
-
protected renderSuccess = hex('#00ff00');
|
|
9
|
-
protected renderError = hex('#ff0000');
|
|
7
|
+
protected renderInfo = chalk.hex('#00ffff');
|
|
8
|
+
protected renderSuccess = chalk.hex('#00ff00');
|
|
9
|
+
protected renderError = chalk.hex('#ff0000');
|
|
10
10
|
|
|
11
11
|
public async animate<T>(message: string, operation: () => Promise<T>): Promise<T> {
|
|
12
12
|
const updateStdout = (end: string = '', done: boolean = false) => {
|
|
@@ -52,7 +52,7 @@ export class LogService {
|
|
|
52
52
|
const matches = stringMatchAll<2>(message, /\*\*(.*)\*\*/g);
|
|
53
53
|
|
|
54
54
|
for (const match of matches) {
|
|
55
|
-
message = message.replace(match[0], bold(match[1]));
|
|
55
|
+
message = message.replace(match[0], chalk.bold(match[1]));
|
|
56
56
|
}
|
|
57
57
|
|
|
58
58
|
return message;
|
|
@@ -92,4 +92,4 @@ export class LogService {
|
|
|
92
92
|
|
|
93
93
|
}
|
|
94
94
|
|
|
95
|
-
export default facade(
|
|
95
|
+
export default facade(LogService);
|
package/src/lib/Shell.mock.ts
CHANGED
|
@@ -7,8 +7,8 @@ export class ShellServiceMock extends ShellService {
|
|
|
7
7
|
|
|
8
8
|
private history: string[] = [];
|
|
9
9
|
|
|
10
|
-
public async run(command: string): Promise<void> {
|
|
11
|
-
this.history.push(command);
|
|
10
|
+
public override async run(command: string): Promise<void> {
|
|
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
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { exec } from 'child_process';
|
|
1
|
+
import { exec } from 'node:child_process';
|
|
2
2
|
import { facade } from '@noeldemartin/utils';
|
|
3
3
|
|
|
4
4
|
export class ShellService {
|
|
@@ -25,4 +25,4 @@ export class ShellService {
|
|
|
25
25
|
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
export default facade(
|
|
28
|
+
export default facade(ShellService);
|
package/src/lib/Template.ts
CHANGED
|
@@ -1,12 +1,16 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
1
|
+
import Mustache from 'mustache';
|
|
2
|
+
import { readFileSync } from 'node:fs';
|
|
3
3
|
import { toString } from '@noeldemartin/utils';
|
|
4
4
|
|
|
5
|
-
import File from '
|
|
5
|
+
import File from '@aerogel/cli/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);
|
|
@@ -28,7 +32,7 @@ export default class Template {
|
|
|
28
32
|
const filePath =
|
|
29
33
|
destination + (relativePath.endsWith('.template') ? relativePath.slice(0, -9) : relativePath);
|
|
30
34
|
|
|
31
|
-
File.write(filePath, render(fileContents, replacements, undefined, ['<%', '%>']));
|
|
35
|
+
File.write(filePath, Mustache.render(fileContents, replacements, undefined, ['<%', '%>']));
|
|
32
36
|
files.push(filePath);
|
|
33
37
|
}
|
|
34
38
|
|
|
@@ -39,18 +43,21 @@ export default class Template {
|
|
|
39
43
|
replacements: Record<string, unknown>,
|
|
40
44
|
prefix: string = '',
|
|
41
45
|
): Record<string, string> {
|
|
42
|
-
return Object.entries(replacements).reduce(
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
46
|
+
return Object.entries(replacements).reduce(
|
|
47
|
+
(filenameReplacements, [key, value]) => {
|
|
48
|
+
if (typeof value === 'object') {
|
|
49
|
+
Object.assign(
|
|
50
|
+
filenameReplacements,
|
|
51
|
+
this.getFilenameReplacements(value as Record<string, unknown>, `${key}.`),
|
|
52
|
+
);
|
|
53
|
+
} else {
|
|
54
|
+
filenameReplacements[`[${prefix}${key}]`] = toString(value);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
return filenameReplacements;
|
|
58
|
+
},
|
|
59
|
+
{} as Record<string, string>,
|
|
60
|
+
);
|
|
54
61
|
}
|
|
55
62
|
|
|
56
63
|
}
|
package/src/lib/utils/app.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import App from '
|
|
2
|
-
import File from '
|
|
1
|
+
import App from '@aerogel/cli/lib/App';
|
|
2
|
+
import File from '@aerogel/cli/lib/File';
|
|
3
3
|
|
|
4
4
|
export function app(): App {
|
|
5
5
|
// TODO parse app name
|
|
@@ -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 {
|
package/src/lib/utils/edit.ts
CHANGED
|
@@ -23,8 +23,8 @@ export function findDescendant<T extends Node>(
|
|
|
23
23
|
const skipKinds = arrayFrom(options.skip ?? []);
|
|
24
24
|
|
|
25
25
|
return node.forEachDescendant((descendant, traversal) => {
|
|
26
|
-
if (guard(descendant) && validate(descendant)) {
|
|
27
|
-
return descendant;
|
|
26
|
+
if (guard(descendant) && validate(descendant as T)) {
|
|
27
|
+
return descendant as T;
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
const descendantKind = descendant.getKind();
|
package/src/lib/utils/paths.ts
CHANGED
|
@@ -1,16 +1,24 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { URL, fileURLToPath } from 'node:url';
|
|
2
2
|
import { stringMatch } from '@noeldemartin/utils';
|
|
3
|
+
import { resolve } from 'node:path';
|
|
3
4
|
|
|
4
|
-
import File from '
|
|
5
|
-
import Log from '
|
|
5
|
+
import File from '@aerogel/cli/lib/File';
|
|
6
|
+
import Log from '@aerogel/cli/lib/Log';
|
|
6
7
|
|
|
7
8
|
export function basePath(path: string = ''): string {
|
|
8
|
-
if (
|
|
9
|
-
|
|
9
|
+
if (
|
|
10
|
+
File.contains(
|
|
11
|
+
fileURLToPath(new URL(/* @vite-ignore */ '../../../package.json', import.meta.url)),
|
|
12
|
+
'"packages/create-aerogel"',
|
|
13
|
+
)
|
|
14
|
+
) {
|
|
15
|
+
return resolve(fileURLToPath(new URL(/* @vite-ignore */ '../', import.meta.url)), path);
|
|
10
16
|
}
|
|
11
17
|
|
|
12
|
-
const packageJson = File.read(
|
|
13
|
-
|
|
18
|
+
const packageJson = File.read(
|
|
19
|
+
fileURLToPath(new URL(/* @vite-ignore */ '../../../../package.json', import.meta.url)),
|
|
20
|
+
);
|
|
21
|
+
const matches = stringMatch<2>(packageJson ?? '', /"@aerogel\/core": "file:(.*)\/aerogel-core-[\d.]*\.tgz"/);
|
|
14
22
|
const cliPath = matches?.[1] ?? Log.fail<string>('Could not determine base path');
|
|
15
23
|
|
|
16
24
|
return resolve(cliPath, path);
|
|
@@ -30,5 +38,5 @@ export function packagePath(packageName: string): string {
|
|
|
30
38
|
}
|
|
31
39
|
|
|
32
40
|
export function templatePath(name: string): string {
|
|
33
|
-
return
|
|
41
|
+
return fileURLToPath(new URL(/* @vite-ignore */ `../templates/${name}`, import.meta.url));
|
|
34
42
|
}
|
package/src/plugins/Plugin.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { Node, SyntaxKind } from 'ts-morph';
|
|
2
2
|
import type { ArrayLiteralExpression, ImportDeclarationStructure, OptionalKind, SourceFile } from 'ts-morph';
|
|
3
3
|
|
|
4
|
-
import Log from '
|
|
5
|
-
import Shell from '
|
|
6
|
-
import File from '
|
|
7
|
-
import { app, isLinkedLocalApp, isLocalApp } from '
|
|
8
|
-
import { editFiles, findDescendant, when } from '
|
|
9
|
-
import { packNotFound, packagePackPath, packagePath } from '
|
|
10
|
-
import type { Editor } from '
|
|
4
|
+
import Log from '@aerogel/cli/lib/Log';
|
|
5
|
+
import Shell from '@aerogel/cli/lib/Shell';
|
|
6
|
+
import File from '@aerogel/cli/lib/File';
|
|
7
|
+
import { app, isLinkedLocalApp, isLocalApp } from '@aerogel/cli/lib/utils/app';
|
|
8
|
+
import { editFiles, findDescendant, when } from '@aerogel/cli/lib/utils/edit';
|
|
9
|
+
import { packNotFound, packagePackPath, packagePath } from '@aerogel/cli/lib/utils/paths';
|
|
10
|
+
import type { Editor } from '@aerogel/cli/lib/Editor';
|
|
11
11
|
|
|
12
12
|
export default abstract class Plugin {
|
|
13
13
|
|
|
@@ -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> {
|
|
@@ -89,7 +104,7 @@ export default abstract class Plugin {
|
|
|
89
104
|
protected getBootstrapPluginsDeclaration(mainConfig: SourceFile): ArrayLiteralExpression | null {
|
|
90
105
|
const bootstrapAppCall = findDescendant(mainConfig, {
|
|
91
106
|
guard: Node.isCallExpression,
|
|
92
|
-
validate: (callExpression) => callExpression.getExpression().getText() === '
|
|
107
|
+
validate: (callExpression) => callExpression.getExpression().getText() === 'bootstrap',
|
|
93
108
|
skip: SyntaxKind.ImportDeclaration,
|
|
94
109
|
});
|
|
95
110
|
const bootstrapOptions = bootstrapAppCall?.getArguments()[1];
|
|
@@ -103,6 +118,21 @@ export default abstract class Plugin {
|
|
|
103
118
|
return pluginsArray;
|
|
104
119
|
}
|
|
105
120
|
|
|
121
|
+
protected getTailwindContentArray(tailwindConfig: SourceFile): ArrayLiteralExpression | null {
|
|
122
|
+
const contentAssignment = findDescendant(tailwindConfig, {
|
|
123
|
+
guard: Node.isPropertyAssignment,
|
|
124
|
+
validate: (propertyAssignment) => propertyAssignment.getName() === 'content',
|
|
125
|
+
skip: SyntaxKind.JSDoc,
|
|
126
|
+
});
|
|
127
|
+
const contentArray = contentAssignment?.getInitializer();
|
|
128
|
+
|
|
129
|
+
if (!Node.isArrayLiteralExpression(contentArray)) {
|
|
130
|
+
return null;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
return contentArray;
|
|
134
|
+
}
|
|
135
|
+
|
|
106
136
|
protected getBootstrapImport(): OptionalKind<ImportDeclarationStructure> {
|
|
107
137
|
return {
|
|
108
138
|
defaultImport: this.name,
|
|
@@ -118,6 +148,10 @@ export default abstract class Plugin {
|
|
|
118
148
|
return `plugin-${this.name}`;
|
|
119
149
|
}
|
|
120
150
|
|
|
151
|
+
protected isForDevelopment(): boolean {
|
|
152
|
+
return false;
|
|
153
|
+
}
|
|
154
|
+
|
|
121
155
|
protected getBootstrapConfig(): string {
|
|
122
156
|
return `${this.name}()`;
|
|
123
157
|
}
|
package/src/plugins/Solid.ts
CHANGED
|
@@ -1,14 +1,8 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import Plugin from '@/plugins/Plugin';
|
|
7
|
-
import Shell from '@/lib/Shell';
|
|
8
|
-
import { findDescendant } from '@/lib/utils/edit';
|
|
9
|
-
import { isLinkedLocalApp } from '@/lib/utils/app';
|
|
10
|
-
import { packagePath } from '@/lib/utils/paths';
|
|
11
|
-
import type { Editor } from '@/lib/Editor';
|
|
1
|
+
import File from '@aerogel/cli/lib/File';
|
|
2
|
+
import Log from '@aerogel/cli/lib/Log';
|
|
3
|
+
import Plugin from '@aerogel/cli/plugins/Plugin';
|
|
4
|
+
import Shell from '@aerogel/cli/lib/Shell';
|
|
5
|
+
import type { Editor } from '@aerogel/cli/lib/Editor';
|
|
12
6
|
|
|
13
7
|
export class Solid extends Plugin {
|
|
14
8
|
|
|
@@ -16,41 +10,19 @@ export class Solid extends Plugin {
|
|
|
16
10
|
super('solid');
|
|
17
11
|
}
|
|
18
12
|
|
|
19
|
-
protected async updateFiles(editor: Editor): Promise<void> {
|
|
20
|
-
await this.updateTailwindConfig(editor);
|
|
13
|
+
protected override async updateFiles(editor: Editor): Promise<void> {
|
|
21
14
|
await this.updateNpmScripts(editor);
|
|
22
15
|
await this.updateGitIgnore();
|
|
23
16
|
await super.updateFiles(editor);
|
|
24
17
|
}
|
|
25
18
|
|
|
26
|
-
protected async installNpmDependencies(): Promise<void> {
|
|
19
|
+
protected override async installNpmDependencies(): Promise<void> {
|
|
27
20
|
await Shell.run('npm install soukai-solid@next --save-exact');
|
|
28
|
-
await Shell.run('npm install @solid
|
|
21
|
+
await Shell.run('npm install @noeldemartin/solid-utils@next --save-exact');
|
|
22
|
+
await Shell.run('npm install @solid/community-server@7.1.6 --save-dev -E');
|
|
29
23
|
await super.installNpmDependencies();
|
|
30
24
|
}
|
|
31
25
|
|
|
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
26
|
protected async updateNpmScripts(editor: Editor): Promise<void> {
|
|
55
27
|
Log.info('Updating npm scripts...');
|
|
56
28
|
|
|
@@ -71,17 +43,17 @@ export class Solid extends Plugin {
|
|
|
71
43
|
.replace(
|
|
72
44
|
'"cy:test": "start-server-and-test test:serve-app http-get://localhost:5001 cy:run",',
|
|
73
45
|
'"cy:test": "start-server-and-test ' +
|
|
74
|
-
'test:serve-app http-get://localhost:5001 test:serve-pod http-get://localhost:
|
|
46
|
+
'test:serve-app http-get://localhost:5001 test:serve-pod http-get://localhost:3000 cy:run",',
|
|
75
47
|
)
|
|
76
48
|
.replace(
|
|
77
49
|
'"dev": "vite",',
|
|
78
50
|
'"dev": "vite",\n' +
|
|
79
|
-
'"dev:serve-pod": "community-solid-server -c @css:config/file.json -
|
|
51
|
+
'"dev:serve-pod": "community-solid-server -c @css:config/file.json -f ./solid",',
|
|
80
52
|
)
|
|
81
53
|
.replace(
|
|
82
|
-
'"test:serve-app": "vite --port 5001"',
|
|
83
|
-
'"test:serve-app": "vite --port 5001",\n' +
|
|
84
|
-
'"test:serve-pod": "community-solid-server -
|
|
54
|
+
'"test:serve-app": "vite --port 5001 --mode testing"',
|
|
55
|
+
'"test:serve-app": "vite --port 5001 --mode testing",\n' +
|
|
56
|
+
'"test:serve-pod": "community-solid-server -l warn"',
|
|
85
57
|
),
|
|
86
58
|
);
|
|
87
59
|
|
|
@@ -93,22 +65,7 @@ export class Solid extends Plugin {
|
|
|
93
65
|
|
|
94
66
|
const gitignore = File.read('.gitignore') ?? '';
|
|
95
67
|
|
|
96
|
-
File.write('.gitignore', `${gitignore}/solid
|
|
97
|
-
}
|
|
98
|
-
|
|
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;
|
|
68
|
+
File.write('.gitignore', `${gitignore}/solid\n`);
|
|
112
69
|
}
|
|
113
70
|
|
|
114
71
|
}
|
package/src/plugins/Soukai.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import Plugin from '
|
|
2
|
-
import Shell from '
|
|
1
|
+
import Plugin from '@aerogel/cli/plugins/Plugin';
|
|
2
|
+
import Shell from '@aerogel/cli/lib/Shell';
|
|
3
3
|
|
|
4
4
|
export class Soukai extends Plugin {
|
|
5
5
|
|
|
@@ -7,12 +7,12 @@ export class Soukai extends Plugin {
|
|
|
7
7
|
super('soukai');
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
-
protected async installNpmDependencies(): Promise<void> {
|
|
10
|
+
protected override async installNpmDependencies(): Promise<void> {
|
|
11
11
|
await Shell.run('npm install soukai@next --save-exact');
|
|
12
12
|
await super.installNpmDependencies();
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
protected getBootstrapConfig(): string {
|
|
15
|
+
protected override getBootstrapConfig(): string {
|
|
16
16
|
return 'soukai({ models: import.meta.glob(\'@/models/*\', { eager: true }) })';
|
|
17
17
|
}
|
|
18
18
|
|
package/src/testing/setup.ts
CHANGED
|
@@ -1,31 +1,36 @@
|
|
|
1
|
-
import { beforeEach, vi } from 'vitest';
|
|
2
|
-
import { resolve } from 'path';
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
1
|
+
import { beforeAll, beforeEach, vi } from 'vitest';
|
|
2
|
+
import { resolve } from 'node:path';
|
|
3
|
+
import { setupFacadeMocks } from '@noeldemartin/testing';
|
|
4
|
+
|
|
5
|
+
import ShellMock from '@aerogel/cli/lib/Shell.mock';
|
|
6
|
+
import File from '@aerogel/cli/lib/File';
|
|
7
|
+
import FileMock from '@aerogel/cli/lib/File.mock';
|
|
8
|
+
import Log from '@aerogel/cli/lib/Log';
|
|
9
|
+
import LogMock from '@aerogel/cli/lib/Log.mock';
|
|
10
|
+
import Shell from '@aerogel/cli/lib/Shell';
|
|
11
|
+
|
|
12
|
+
beforeAll(() => {
|
|
13
|
+
File.setMockFacade(FileMock);
|
|
14
|
+
Log.setMockFacade(LogMock);
|
|
15
|
+
Shell.setMockFacade(ShellMock);
|
|
16
|
+
});
|
|
17
17
|
|
|
18
18
|
beforeEach(() => {
|
|
19
|
-
FileMock.reset();
|
|
20
|
-
LogMock.reset();
|
|
21
|
-
|
|
22
19
|
File.mock();
|
|
23
20
|
Log.mock();
|
|
24
21
|
Shell.mock();
|
|
25
22
|
});
|
|
26
23
|
|
|
27
|
-
vi.mock('
|
|
28
|
-
const original = (await vi.importActual('
|
|
24
|
+
vi.mock('@noeldemartin/utils', async () => {
|
|
25
|
+
const original = (await vi.importActual('@noeldemartin/utils')) as object;
|
|
26
|
+
|
|
27
|
+
setupFacadeMocks();
|
|
28
|
+
|
|
29
|
+
return original;
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
vi.mock('@aerogel/cli/lib/utils/app', async () => {
|
|
33
|
+
const original = (await vi.importActual('@aerogel/cli/lib/utils/app')) as object;
|
|
29
34
|
|
|
30
35
|
return {
|
|
31
36
|
...original,
|
|
@@ -34,8 +39,8 @@ vi.mock('@/lib/utils/app', async () => {
|
|
|
34
39
|
};
|
|
35
40
|
});
|
|
36
41
|
|
|
37
|
-
vi.mock('
|
|
38
|
-
const original = (await vi.importActual('
|
|
42
|
+
vi.mock('@aerogel/cli/lib/utils/edit', async () => {
|
|
43
|
+
const original = (await vi.importActual('@aerogel/cli/lib/utils/edit')) as object;
|
|
39
44
|
|
|
40
45
|
return {
|
|
41
46
|
...original,
|
|
@@ -44,8 +49,8 @@ vi.mock('@/lib/utils/edit', async () => {
|
|
|
44
49
|
});
|
|
45
50
|
|
|
46
51
|
// TODO find out why these need to be mocked
|
|
47
|
-
vi.mock('
|
|
48
|
-
const original = (await vi.importActual('
|
|
52
|
+
vi.mock('@aerogel/cli/lib/utils/paths', async () => {
|
|
53
|
+
const original = (await vi.importActual('@aerogel/cli/lib/utils/paths')) as object;
|
|
49
54
|
|
|
50
55
|
function basePath(path: string = '') {
|
|
51
56
|
return resolve(__dirname, '../../', path);
|
|
@@ -66,9 +71,3 @@ vi.mock('@/lib/utils/paths', async () => {
|
|
|
66
71
|
templatePath,
|
|
67
72
|
};
|
|
68
73
|
});
|
|
69
|
-
|
|
70
|
-
vi.mock('mustache', async () => {
|
|
71
|
-
const mustache = (await vi.importActual('mustache')) as { default: unknown };
|
|
72
|
-
|
|
73
|
-
return mustache.default;
|
|
74
|
-
});
|
|
@@ -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
|
package/templates/app/.nvmrc
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
v22.9.0
|
|
@@ -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,12 +1,11 @@
|
|
|
1
1
|
{
|
|
2
|
+
"extends": "@tsconfig/node22/tsconfig.json",
|
|
3
|
+
"include": ["**/*.ts"],
|
|
2
4
|
"compilerOptions": {
|
|
3
|
-
"target": "es5",
|
|
4
|
-
"lib": ["es5", "dom"],
|
|
5
|
-
"types": ["cypress", "node"],
|
|
6
5
|
"baseUrl": ".",
|
|
7
|
-
"
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
6
|
+
"module": "ESNext",
|
|
7
|
+
"moduleResolution": "Bundler",
|
|
8
|
+
"lib": ["DOM"],
|
|
9
|
+
"types": ["node", "cypress"]
|
|
10
|
+
}
|
|
12
11
|
}
|
package/templates/app/index.html
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
<!DOCTYPE html>
|
|
2
|
-
<html lang="en" class="
|
|
2
|
+
<html lang="en" class="size-full">
|
|
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
|
-
<body class="
|
|
9
|
-
<div id="app" class="h-full"></div>
|
|
9
|
+
<body class="size-full text-base font-normal leading-tight text-gray-900 antialiased">
|
|
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>
|