@aerogel/cli 0.0.0-next.13b88f634a31caf3669d61e53e7d3fa95e20488c → 0.0.0-next.24ed4c26fdb36195386fee4a81543fb84f51c979
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 +1 -1
- package/dist/aerogel-cli.d.ts +1 -1
- package/dist/aerogel-cli.js +847 -0
- package/dist/aerogel-cli.js.map +1 -0
- package/package.json +19 -33
- package/src/cli.ts +10 -10
- package/src/commands/Command.ts +3 -3
- package/src/commands/create.test.ts +2 -2
- package/src/commands/create.ts +11 -11
- package/src/commands/generate-component.test.ts +1 -1
- package/src/commands/generate-component.ts +14 -14
- package/src/commands/generate-model.test.ts +1 -1
- package/src/commands/generate-model.ts +11 -11
- package/src/commands/generate-overrides.ts +10 -10
- package/src/commands/generate-service.test.ts +1 -1
- package/src/commands/generate-service.ts +14 -14
- package/src/commands/info.ts +7 -6
- package/src/commands/install.test.ts +1 -15
- package/src/commands/install.ts +11 -12
- package/src/lib/App.ts +9 -6
- package/src/lib/Editor.ts +3 -3
- package/src/lib/File.mock.ts +6 -6
- package/src/lib/File.ts +2 -2
- package/src/lib/Log.mock.ts +3 -3
- package/src/lib/Log.test.ts +4 -4
- package/src/lib/Log.ts +6 -6
- package/src/lib/Shell.mock.ts +1 -1
- package/src/lib/Shell.ts +1 -1
- package/src/lib/Template.ts +19 -16
- package/src/lib/utils/app.ts +2 -2
- package/src/lib/utils/edit.ts +2 -2
- package/src/lib/utils/paths.ts +15 -7
- package/src/plugins/Plugin.ts +7 -7
- package/src/plugins/Solid.ts +12 -12
- package/src/plugins/Soukai.ts +4 -4
- package/src/testing/setup.ts +28 -26
- package/.prettierignore +0 -1
- 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/plugins/Histoire.ts +0 -113
- package/templates/app/.github/workflows/ci.yml +0 -29
- package/templates/app/.gitignore.template +0 -2
- package/templates/app/.nvmrc +0 -1
- package/templates/app/.vscode/launch.json +0 -16
- package/templates/app/.vscode/settings.json +0 -10
- package/templates/app/README.md +0 -3
- package/templates/app/cypress/cypress.config.ts +0 -14
- package/templates/app/cypress/e2e/app.cy.ts +0 -9
- package/templates/app/cypress/support/e2e.ts +0 -1
- package/templates/app/cypress/tsconfig.json +0 -14
- package/templates/app/index.html +0 -13
- package/templates/app/package.json +0 -67
- package/templates/app/postcss.config.js +0 -6
- package/templates/app/src/App.vue +0 -12
- package/templates/app/src/assets/css/styles.css +0 -3
- package/templates/app/src/assets/public/robots.txt +0 -2
- package/templates/app/src/lang/en.yaml +0 -3
- package/templates/app/src/main.test.ts +0 -9
- package/templates/app/src/main.ts +0 -13
- package/templates/app/src/types/globals.d.ts +0 -2
- package/templates/app/src/types/shims.d.ts +0 -7
- package/templates/app/src/types/ts-reset.d.ts +0 -1
- package/templates/app/tailwind.config.js +0 -5
- package/templates/app/tsconfig.json +0 -19
- package/templates/app/vite.config.ts +0 -30
- package/templates/component/[component.name].vue +0 -3
- package/templates/component-button/[component.name].vue +0 -42
- package/templates/component-button-story/[component.name].story.vue +0 -77
- package/templates/component-checkbox/[component.name].vue +0 -34
- package/templates/component-checkbox-story/[component.name].story.vue +0 -63
- package/templates/component-input/[component.name].vue +0 -17
- package/templates/component-input-story/[component.name].story.vue +0 -63
- package/templates/component-story/[component.name].story.vue +0 -7
- package/templates/histoire/histoire.config.ts +0 -7
- package/templates/histoire/patches/histoire+0.17.6.patch +0 -13
- package/templates/histoire/src/main.histoire.ts +0 -8
- package/templates/model/[model.name].schema.ts +0 -7
- package/templates/model/[model.name].ts +0 -3
- package/templates/overrides/components/index.ts +0 -15
- package/templates/overrides/components/overrides/AlertModal.vue +0 -11
- package/templates/overrides/components/overrides/ConfirmModal.vue +0 -20
- package/templates/overrides/components/overrides/ErrorReportModal.vue +0 -35
- package/templates/overrides/components/overrides/LoadingModal.vue +0 -12
- package/templates/overrides/components/overrides/ModalWrapper.vue +0 -22
- package/templates/overrides/components/overrides/SnackbarNotification.vue +0 -34
- package/templates/overrides-story/Overrides.story.vue +0 -86
- package/templates/postcss-pseudo-classes/postcss.config.js +0 -15
- package/templates/service/[service.name].ts +0 -8
- package/tsconfig.json +0 -11
- package/vite.config.ts +0 -14
- /package/src/{main.ts → index.ts} +0 -0
package/src/commands/info.ts
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
import
|
|
2
|
-
import Log from '@/lib/Log';
|
|
1
|
+
import { URL, fileURLToPath } from 'node:url';
|
|
3
2
|
|
|
3
|
+
import Command from '@aerogel/cli/commands/Command';
|
|
4
|
+
import Log from '@aerogel/cli/lib/Log';
|
|
4
5
|
export class InfoCommand extends Command {
|
|
5
6
|
|
|
6
|
-
protected static command: string = 'info';
|
|
7
|
-
protected static description: string = 'Show debugging information about the CLI';
|
|
7
|
+
protected static override command: string = 'info';
|
|
8
|
+
protected static override description: string = 'Show debugging information about the CLI';
|
|
8
9
|
|
|
9
|
-
protected async run(): Promise<void> {
|
|
10
|
+
protected override async run(): Promise<void> {
|
|
10
11
|
Log.info('[AerogelJS CLI info]');
|
|
11
|
-
Log.info('Installation directory: ' +
|
|
12
|
+
Log.info('Installation directory: ' + fileURLToPath(new URL(/* @vite-ignore */ './', import.meta.url)));
|
|
12
13
|
}
|
|
13
14
|
|
|
14
15
|
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { describe, it } from 'vitest';
|
|
2
2
|
|
|
3
|
-
import
|
|
4
|
-
import ShellMock from '@/lib/Shell.mock';
|
|
3
|
+
import ShellMock from '@aerogel/cli/lib/Shell.mock';
|
|
5
4
|
|
|
6
5
|
import { InstallCommand } from './install';
|
|
7
6
|
|
|
@@ -25,17 +24,4 @@ describe('Install plugin command', () => {
|
|
|
25
24
|
ShellMock.expectRan('npm install @aerogel/plugin-soukai@next --save-exact');
|
|
26
25
|
});
|
|
27
26
|
|
|
28
|
-
it('installs histoire', async () => {
|
|
29
|
-
// Arrange
|
|
30
|
-
FileMock.stub('package.json', '"@aerogel/core"');
|
|
31
|
-
|
|
32
|
-
// Act
|
|
33
|
-
await InstallCommand.run('histoire');
|
|
34
|
-
|
|
35
|
-
// Assert
|
|
36
|
-
ShellMock.expectRan('npm install histoire@0.17.6 --save-dev');
|
|
37
|
-
ShellMock.expectRan('npm install @aerogel/histoire@next --save-exact --save-dev');
|
|
38
|
-
ShellMock.expectRan('npm install patch-package --save-dev');
|
|
39
|
-
});
|
|
40
|
-
|
|
41
27
|
});
|
package/src/commands/install.ts
CHANGED
|
@@ -1,20 +1,19 @@
|
|
|
1
|
-
import Command from '
|
|
2
|
-
import Log from '
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
const plugins = [new Soukai(), new Solid(), new Histoire()].reduce(
|
|
1
|
+
import Command from '@aerogel/cli/commands/Command';
|
|
2
|
+
import Log from '@aerogel/cli/lib/Log';
|
|
3
|
+
import { Solid } from '@aerogel/cli/plugins/Solid';
|
|
4
|
+
import { Soukai } from '@aerogel/cli/plugins/Soukai';
|
|
5
|
+
import type Plugin from '@aerogel/cli/plugins/Plugin';
|
|
6
|
+
|
|
7
|
+
const plugins = [new Soukai(), new Solid()].reduce(
|
|
9
8
|
(pluginsObject, plugin) => Object.assign(pluginsObject, { [plugin.name]: plugin }),
|
|
10
9
|
{} as Record<string, Plugin>,
|
|
11
10
|
);
|
|
12
11
|
|
|
13
12
|
export class InstallCommand extends Command {
|
|
14
13
|
|
|
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']];
|
|
14
|
+
protected static override command: string = 'install';
|
|
15
|
+
protected static override description: string = 'Install an AerogelJS plugin';
|
|
16
|
+
protected static override parameters: [string, string][] = [['plugin', 'Plugin to install']];
|
|
18
17
|
|
|
19
18
|
private plugin: Plugin;
|
|
20
19
|
|
|
@@ -26,7 +25,7 @@ export class InstallCommand extends Command {
|
|
|
26
25
|
Log.fail(`Plugin '${plugin}' doesn't exist. Available plugins: ${Object.keys(plugins).join(', ')}`);
|
|
27
26
|
}
|
|
28
27
|
|
|
29
|
-
protected async run(): Promise<void> {
|
|
28
|
+
protected override async run(): Promise<void> {
|
|
30
29
|
await this.plugin.install();
|
|
31
30
|
}
|
|
32
31
|
|
package/src/lib/App.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { stringToSlug } from '@noeldemartin/utils';
|
|
2
2
|
|
|
3
|
-
import File from '
|
|
4
|
-
import Log from '
|
|
5
|
-
import Template from '
|
|
6
|
-
import { packNotFound, packagePackPath, packagePath, templatePath } from '
|
|
7
|
-
import { Editor } from '
|
|
3
|
+
import File from '@aerogel/cli/lib/File';
|
|
4
|
+
import Log from '@aerogel/cli/lib/Log';
|
|
5
|
+
import Template from '@aerogel/cli/lib/Template';
|
|
6
|
+
import { packNotFound, packagePackPath, packagePath, templatePath } from '@aerogel/cli/lib/utils/paths';
|
|
7
|
+
import { Editor } from '@aerogel/cli/lib/Editor';
|
|
8
8
|
|
|
9
9
|
interface Dependencies {
|
|
10
10
|
aerogelCli: string;
|
|
@@ -22,7 +22,10 @@ export interface Options {
|
|
|
22
22
|
|
|
23
23
|
export default class App {
|
|
24
24
|
|
|
25
|
-
constructor(
|
|
25
|
+
constructor(
|
|
26
|
+
protected name: string,
|
|
27
|
+
protected options: Options = {},
|
|
28
|
+
) {}
|
|
26
29
|
|
|
27
30
|
public create(path: string): void {
|
|
28
31
|
if (File.exists(path) && (!File.isDirectory(path) || !File.isEmptyDirectory(path))) {
|
package/src/lib/Editor.ts
CHANGED
|
@@ -2,9 +2,9 @@ import { arrayFrom } from '@noeldemartin/utils';
|
|
|
2
2
|
import { Project } from 'ts-morph';
|
|
3
3
|
import type { SourceFile } from 'ts-morph';
|
|
4
4
|
|
|
5
|
-
import File from '
|
|
6
|
-
import Log from '
|
|
7
|
-
import Shell from '
|
|
5
|
+
import File from '@aerogel/cli/lib/File';
|
|
6
|
+
import Log from '@aerogel/cli/lib/Log';
|
|
7
|
+
import Shell from '@aerogel/cli/lib/Shell';
|
|
8
8
|
|
|
9
9
|
export class Editor {
|
|
10
10
|
|
package/src/lib/File.mock.ts
CHANGED
|
@@ -8,28 +8,28 @@ export class FileMockService extends FileService {
|
|
|
8
8
|
|
|
9
9
|
private virtualFilesystem: Record<string, string | { directory: true }> = {};
|
|
10
10
|
|
|
11
|
-
public exists(path: string): boolean {
|
|
11
|
+
public override exists(path: string): boolean {
|
|
12
12
|
return super.exists(path) || path in this.virtualFilesystem;
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
public isDirectory(path: string): boolean {
|
|
15
|
+
public override isDirectory(path: string): boolean {
|
|
16
16
|
return (
|
|
17
17
|
super.isDirectory(path) ||
|
|
18
18
|
(path in this.virtualFilesystem && typeof this.virtualFilesystem[path] === 'object')
|
|
19
19
|
);
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
public isFile(path: string): boolean {
|
|
22
|
+
public override isFile(path: string): boolean {
|
|
23
23
|
return (
|
|
24
24
|
super.isFile(path) || (path in this.virtualFilesystem && typeof this.virtualFilesystem[path] === 'string')
|
|
25
25
|
);
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
public makeDirectory(path: string): void {
|
|
28
|
+
public override makeDirectory(path: string): void {
|
|
29
29
|
this.virtualFilesystem[path] = { directory: true };
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
public read(path: string): string | null {
|
|
32
|
+
public override read(path: string): string | null {
|
|
33
33
|
if (path in this.virtualFilesystem && typeof this.virtualFilesystem[path] === 'string') {
|
|
34
34
|
return this.virtualFilesystem[path] as string;
|
|
35
35
|
}
|
|
@@ -37,7 +37,7 @@ export class FileMockService extends FileService {
|
|
|
37
37
|
return super.read(path);
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
-
public write(path: string, contents: string): void {
|
|
40
|
+
public override write(path: string, contents: string): void {
|
|
41
41
|
this.virtualFilesystem[path] = contents;
|
|
42
42
|
}
|
|
43
43
|
|
package/src/lib/File.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { existsSync, lstatSync, mkdirSync, readFileSync, readdirSync, writeFileSync } from 'fs';
|
|
1
|
+
import { existsSync, lstatSync, mkdirSync, readFileSync, readdirSync, writeFileSync } from 'node:fs';
|
|
2
2
|
import { facade } from '@noeldemartin/utils';
|
|
3
|
-
import { dirname, resolve } from 'path';
|
|
3
|
+
import { dirname, resolve } from 'node:path';
|
|
4
4
|
|
|
5
5
|
export class FileService {
|
|
6
6
|
|
package/src/lib/Log.mock.ts
CHANGED
|
@@ -15,16 +15,16 @@ export class LogServiceMock extends LogService {
|
|
|
15
15
|
expect(this.logs, `Expected log to have length ${count}`).toHaveLength(count);
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
protected logLine(message: string): void {
|
|
18
|
+
protected override logLine(message: string): void {
|
|
19
19
|
this.logs.push(message);
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
23
|
-
public fail<T = any>(message: string): T {
|
|
23
|
+
public override fail<T = any>(message: string): T {
|
|
24
24
|
throw new Error(`Fail: ${message}`);
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
-
protected stdout(): void {
|
|
27
|
+
protected override stdout(): void {
|
|
28
28
|
//
|
|
29
29
|
}
|
|
30
30
|
|
package/src/lib/Log.test.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import
|
|
1
|
+
import chalk from 'chalk';
|
|
2
2
|
import { describe, it } from 'vitest';
|
|
3
3
|
|
|
4
|
-
import LogMock from '
|
|
4
|
+
import LogMock from '@aerogel/cli/lib/Log.mock';
|
|
5
5
|
|
|
6
6
|
import Log from './Log';
|
|
7
7
|
|
|
8
|
-
const info = hex('#00ffff');
|
|
8
|
+
const info = chalk.hex('#00ffff');
|
|
9
9
|
|
|
10
10
|
describe('Log', () => {
|
|
11
11
|
|
|
@@ -14,7 +14,7 @@ describe('Log', () => {
|
|
|
14
14
|
Log.info('Foo **bar**');
|
|
15
15
|
|
|
16
16
|
// Assert
|
|
17
|
-
LogMock.expectLogged(info(`Foo ${bold('bar')}`));
|
|
17
|
+
LogMock.expectLogged(info(`Foo ${chalk.bold('bar')}`));
|
|
18
18
|
});
|
|
19
19
|
|
|
20
20
|
it('renders multiline messages', () => {
|
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;
|
package/src/lib/Shell.mock.ts
CHANGED
package/src/lib/Shell.ts
CHANGED
package/src/lib/Template.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
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
|
|
|
@@ -32,7 +32,7 @@ export default class Template {
|
|
|
32
32
|
const filePath =
|
|
33
33
|
destination + (relativePath.endsWith('.template') ? relativePath.slice(0, -9) : relativePath);
|
|
34
34
|
|
|
35
|
-
File.write(filePath, render(fileContents, replacements, undefined, ['<%', '%>']));
|
|
35
|
+
File.write(filePath, Mustache.render(fileContents, replacements, undefined, ['<%', '%>']));
|
|
36
36
|
files.push(filePath);
|
|
37
37
|
}
|
|
38
38
|
|
|
@@ -43,18 +43,21 @@ export default class Template {
|
|
|
43
43
|
replacements: Record<string, unknown>,
|
|
44
44
|
prefix: string = '',
|
|
45
45
|
): Record<string, string> {
|
|
46
|
-
return Object.entries(replacements).reduce(
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
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
|
+
);
|
|
58
61
|
}
|
|
59
62
|
|
|
60
63
|
}
|
package/src/lib/utils/app.ts
CHANGED
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,15 +1,23 @@
|
|
|
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(
|
|
18
|
+
const packageJson = File.read(
|
|
19
|
+
fileURLToPath(new URL(/* @vite-ignore */ '../../../../package.json', import.meta.url)),
|
|
20
|
+
);
|
|
13
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
|
|
|
@@ -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
|
|
package/src/plugins/Solid.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import File from '
|
|
2
|
-
import Log from '
|
|
3
|
-
import Plugin from '
|
|
4
|
-
import Shell from '
|
|
5
|
-
import { isLinkedLocalApp } from '
|
|
6
|
-
import { packagePath } from '
|
|
7
|
-
import type { Editor } from '
|
|
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 { isLinkedLocalApp } from '@aerogel/cli/lib/utils/app';
|
|
6
|
+
import { packagePath } from '@aerogel/cli/lib/utils/paths';
|
|
7
|
+
import type { Editor } from '@aerogel/cli/lib/Editor';
|
|
8
8
|
|
|
9
9
|
export class Solid extends Plugin {
|
|
10
10
|
|
|
@@ -12,7 +12,7 @@ export class Solid extends Plugin {
|
|
|
12
12
|
super('solid');
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
protected async updateFiles(editor: Editor): Promise<void> {
|
|
15
|
+
protected override async updateFiles(editor: Editor): Promise<void> {
|
|
16
16
|
await this.updateTailwindConfig(editor, {
|
|
17
17
|
content: isLinkedLocalApp()
|
|
18
18
|
? `'${packagePath('plugin-solid')}/dist/**/*.js'`
|
|
@@ -24,10 +24,10 @@ export class Solid extends Plugin {
|
|
|
24
24
|
await super.updateFiles(editor);
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
-
protected async installNpmDependencies(): Promise<void> {
|
|
27
|
+
protected override async installNpmDependencies(): Promise<void> {
|
|
28
28
|
await Shell.run('npm install soukai-solid@next --save-exact');
|
|
29
29
|
await Shell.run('npm install @noeldemartin/solid-utils@next --save-exact');
|
|
30
|
-
await Shell.run('npm install @solid/community-server
|
|
30
|
+
await Shell.run('npm install @solid/community-server@7.1.6 --save-dev -E');
|
|
31
31
|
await super.installNpmDependencies();
|
|
32
32
|
}
|
|
33
33
|
|
|
@@ -56,7 +56,7 @@ export class Solid extends Plugin {
|
|
|
56
56
|
.replace(
|
|
57
57
|
'"dev": "vite",',
|
|
58
58
|
'"dev": "vite",\n' +
|
|
59
|
-
'"dev:serve-pod": "community-solid-server -c @css:config/file.json -f ./solid
|
|
59
|
+
'"dev:serve-pod": "community-solid-server -c @css:config/file.json -f ./solid",',
|
|
60
60
|
)
|
|
61
61
|
.replace(
|
|
62
62
|
'"test:serve-app": "vite --port 5001 --mode testing"',
|
|
@@ -73,7 +73,7 @@ export class Solid extends Plugin {
|
|
|
73
73
|
|
|
74
74
|
const gitignore = File.read('.gitignore') ?? '';
|
|
75
75
|
|
|
76
|
-
File.write('.gitignore', `${gitignore}/solid
|
|
76
|
+
File.write('.gitignore', `${gitignore}/solid\n`);
|
|
77
77
|
}
|
|
78
78
|
|
|
79
79
|
}
|
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,19 +1,19 @@
|
|
|
1
|
-
import { beforeEach, vi } from 'vitest';
|
|
2
|
-
import { resolve } from 'path';
|
|
3
|
-
import {
|
|
1
|
+
import { beforeAll, beforeEach, vi } from 'vitest';
|
|
2
|
+
import { resolve } from 'node:path';
|
|
3
|
+
import { setupFacadeMocks } from '@noeldemartin/testing';
|
|
4
4
|
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
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
11
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
12
|
+
beforeAll(() => {
|
|
13
|
+
File.setMockFacade(FileMock);
|
|
14
|
+
Log.setMockFacade(LogMock);
|
|
15
|
+
Shell.setMockFacade(ShellMock);
|
|
16
|
+
});
|
|
17
17
|
|
|
18
18
|
beforeEach(() => {
|
|
19
19
|
File.mock();
|
|
@@ -21,8 +21,16 @@ beforeEach(() => {
|
|
|
21
21
|
Shell.mock();
|
|
22
22
|
});
|
|
23
23
|
|
|
24
|
-
vi.mock('
|
|
25
|
-
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;
|
|
26
34
|
|
|
27
35
|
return {
|
|
28
36
|
...original,
|
|
@@ -31,8 +39,8 @@ vi.mock('@/lib/utils/app', async () => {
|
|
|
31
39
|
};
|
|
32
40
|
});
|
|
33
41
|
|
|
34
|
-
vi.mock('
|
|
35
|
-
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;
|
|
36
44
|
|
|
37
45
|
return {
|
|
38
46
|
...original,
|
|
@@ -41,8 +49,8 @@ vi.mock('@/lib/utils/edit', async () => {
|
|
|
41
49
|
});
|
|
42
50
|
|
|
43
51
|
// TODO find out why these need to be mocked
|
|
44
|
-
vi.mock('
|
|
45
|
-
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;
|
|
46
54
|
|
|
47
55
|
function basePath(path: string = '') {
|
|
48
56
|
return resolve(__dirname, '../../', path);
|
|
@@ -63,9 +71,3 @@ vi.mock('@/lib/utils/paths', async () => {
|
|
|
63
71
|
templatePath,
|
|
64
72
|
};
|
|
65
73
|
});
|
|
66
|
-
|
|
67
|
-
vi.mock('mustache', async () => {
|
|
68
|
-
const mustache = (await vi.importActual('mustache')) as { default: unknown };
|
|
69
|
-
|
|
70
|
-
return mustache.default;
|
|
71
|
-
});
|
package/.prettierignore
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
templates
|