@aerogel/cli 0.0.0-next.5953e1862a7c89a8fc80da087467d67d4f4e8c73 → 0.0.0-next.6c02970f90d4e979a72530f1fa0c650785d6538f

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/.prettierignore +1 -0
  2. package/dist/aerogel-cli.cjs.js +1 -1
  3. package/dist/aerogel-cli.cjs.js.map +1 -1
  4. package/dist/aerogel-cli.d.ts +2 -2
  5. package/dist/aerogel-cli.esm.js +1 -1
  6. package/dist/aerogel-cli.esm.js.map +1 -1
  7. package/package.json +3 -3
  8. package/src/cli.ts +23 -3
  9. package/src/commands/Command.ts +11 -6
  10. package/src/commands/create.ts +5 -5
  11. package/src/commands/generate-component.test.ts +21 -0
  12. package/src/commands/generate-component.ts +42 -12
  13. package/src/commands/generate-model.ts +6 -6
  14. package/src/commands/generate-overrides.ts +85 -0
  15. package/src/commands/generate-service.test.ts +1 -1
  16. package/src/commands/generate-service.ts +5 -5
  17. package/src/commands/info.ts +14 -0
  18. package/src/commands/install.ts +4 -4
  19. package/src/lib/File.mock.ts +1 -5
  20. package/src/lib/File.ts +1 -1
  21. package/src/lib/Log.mock.ts +1 -5
  22. package/src/lib/Log.ts +1 -1
  23. package/src/lib/Shell.mock.ts +1 -1
  24. package/src/lib/Shell.ts +1 -1
  25. package/src/plugins/Histoire.ts +23 -3
  26. package/src/plugins/Plugin.ts +1 -1
  27. package/src/plugins/Solid.ts +6 -5
  28. package/src/testing/setup.ts +3 -6
  29. package/templates/app/.github/workflows/ci.yml +4 -4
  30. package/templates/app/cypress/cypress.config.ts +2 -4
  31. package/templates/app/cypress/support/e2e.ts +1 -3
  32. package/templates/app/cypress/tsconfig.json +3 -1
  33. package/templates/app/package.json +3 -2
  34. package/templates/app/src/main.ts +3 -3
  35. package/templates/component-button/[component.name].vue +42 -0
  36. package/templates/component-button-story/[component.name].story.vue +77 -0
  37. package/templates/component-checkbox/[component.name].vue +34 -0
  38. package/templates/component-checkbox-story/[component.name].story.vue +63 -0
  39. package/templates/component-input/[component.name].vue +1 -0
  40. package/templates/overrides/components/index.ts +15 -0
  41. package/templates/overrides/components/overrides/AlertModal.vue +11 -0
  42. package/templates/overrides/components/overrides/ConfirmModal.vue +20 -0
  43. package/templates/overrides/components/overrides/ErrorReportModal.vue +35 -0
  44. package/templates/overrides/components/overrides/LoadingModal.vue +12 -0
  45. package/templates/overrides/components/overrides/ModalWrapper.vue +22 -0
  46. package/templates/overrides/components/overrides/SnackbarNotification.vue +34 -0
  47. package/templates/overrides-story/Overrides.story.vue +86 -0
  48. package/templates/postcss-pseudo-classes/postcss.config.js +15 -0
  49. package/templates/service/[service.name].ts +1 -1
  50. /package/bin/{ag → gel} +0 -0
package/src/cli.ts CHANGED
@@ -1,9 +1,14 @@
1
1
  import { Command } from 'commander';
2
+ import { facade, fail } from '@noeldemartin/utils';
3
+ import { resolve } from 'path';
4
+ import { existsSync, readFileSync } from 'fs';
5
+
2
6
  import { CreateCommand } from '@/commands/create';
3
- import { facade } from '@noeldemartin/utils';
4
7
  import { GenerateComponentCommand } from '@/commands/generate-component';
5
8
  import { GenerateModelCommand } from '@/commands/generate-model';
9
+ import { GenerateOverridesCommand } from '@/commands/generate-overrides';
6
10
  import { GenerateServiceCommand } from '@/commands/generate-service';
11
+ import { InfoCommand } from '@/commands/info';
7
12
  import { InstallCommand } from '@/commands/install';
8
13
 
9
14
  export class CLIService {
@@ -11,17 +16,32 @@ export class CLIService {
11
16
  public run(argv?: string[]): void {
12
17
  const program = new Command();
13
18
 
14
- program.name('ag').description('AerogelJS CLI').version('0.0.0');
19
+ program.name('gel').description('AerogelJS CLI').version(this.getVersion());
15
20
 
16
21
  CreateCommand.define(program);
17
22
  GenerateComponentCommand.define(program);
18
23
  GenerateModelCommand.define(program);
24
+ GenerateOverridesCommand.define(program);
19
25
  GenerateServiceCommand.define(program);
26
+ InfoCommand.define(program);
20
27
  InstallCommand.define(program);
21
28
 
22
29
  program.parse(argv);
23
30
  }
24
31
 
32
+ public getVersion(): string {
33
+ const errorMessage = 'Could not find CLI\'s version, please report this bug.';
34
+ const packageJsonPath = resolve(__dirname, '../package.json');
35
+
36
+ if (!existsSync(packageJsonPath)) {
37
+ throw new Error(errorMessage);
38
+ }
39
+
40
+ const packageJson = JSON.parse(readFileSync(packageJsonPath).toString()) as { version?: string };
41
+
42
+ return packageJson.version ?? fail(errorMessage);
43
+ }
44
+
25
45
  }
26
46
 
27
- export default facade(new CLIService());
47
+ export default facade(CLIService);
@@ -8,10 +8,10 @@ export type CommandOptions = Record<string, string | { description: string; type
8
8
 
9
9
  export default class Command {
10
10
 
11
- public static command: string = '';
12
- public static description: string = '';
13
- public static parameters: [string, string][] = [];
14
- public static options: CommandOptions = {};
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
- public async run(): Promise<void> {
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 {
@@ -15,10 +15,10 @@ export interface Options {
15
15
 
16
16
  export class CreateCommand extends Command {
17
17
 
18
- public static command: string = 'create';
19
- public static description: string = 'Create AerogelJS app';
20
- public static parameters: [string, string][] = [['path', 'Application path']];
21
- public static options: CommandOptions = {
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
- public async run(): Promise<void> {
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
  });
@@ -1,4 +1,4 @@
1
- import { arrayFrom, stringToSlug } from '@noeldemartin/utils';
1
+ import { arrayFilter, arrayFrom, stringToSlug } from '@noeldemartin/utils';
2
2
  import { Node, SyntaxKind } from 'ts-morph';
3
3
  import type { ArrayLiteralExpression, CallExpression, SourceFile } from 'ts-morph';
4
4
 
@@ -12,27 +12,37 @@ import { templatePath } from '@/lib/utils/paths';
12
12
  import type { CommandOptions } from '@/commands/Command';
13
13
 
14
14
  export interface Options {
15
- story?: boolean;
15
+ button?: boolean;
16
+ checkbox?: boolean;
16
17
  input?: boolean;
18
+ story?: boolean;
17
19
  }
18
20
 
19
21
  export class GenerateComponentCommand extends Command {
20
22
 
21
- public static command: string = 'generate:component';
22
- public static description: string = 'Generate an AerogelJS Component';
23
- public static parameters: [string, string][] = [
23
+ protected static command: string = 'generate:component';
24
+ protected static description: string = 'Generate an AerogelJS Component';
25
+ protected static parameters: [string, string][] = [
24
26
  ['path', 'Component path (relative to components folder; extension not necessary)'],
25
27
  ];
26
28
 
27
- public static options: CommandOptions = {
28
- story: {
29
- description: 'Create component story using Histoire',
29
+ protected static options: CommandOptions = {
30
+ button: {
31
+ description: 'Create a custom button',
32
+ type: 'boolean',
33
+ },
34
+ checkbox: {
35
+ description: 'Create a custom checkbox',
30
36
  type: 'boolean',
31
37
  },
32
38
  input: {
33
39
  description: 'Create a custom input',
34
40
  type: 'boolean',
35
41
  },
42
+ story: {
43
+ description: 'Create component story using Histoire',
44
+ type: 'boolean',
45
+ },
36
46
  };
37
47
 
38
48
  private path: string;
@@ -45,7 +55,15 @@ export class GenerateComponentCommand extends Command {
45
55
  this.options = options;
46
56
  }
47
57
 
48
- public async run(): Promise<void> {
58
+ protected async validate(): Promise<void> {
59
+ const components = arrayFilter([this.options.button, this.options.input, this.options.checkbox]).length;
60
+
61
+ if (components > 1) {
62
+ Log.fail('Can only use one of \'button\', \'input\', or \'checkbox\' flags!');
63
+ }
64
+ }
65
+
66
+ protected async run(): Promise<void> {
49
67
  this.assertAerogelOrDirectory('src/components');
50
68
  this.assertHistoireInstalled();
51
69
 
@@ -71,7 +89,7 @@ export class GenerateComponentCommand extends Command {
71
89
  if (!File.contains('package.json', '"histoire"') && !File.contains('package.json', '"@aerogel/histoire"')) {
72
90
  Log.fail(`
73
91
  Histoire is not installed yet! You can install it running:
74
- npx ag install histoire
92
+ npx gel install histoire
75
93
  `);
76
94
  }
77
95
  }
@@ -82,7 +100,13 @@ export class GenerateComponentCommand extends Command {
82
100
  Log.fail(`${this.path} component already exists!`);
83
101
  }
84
102
 
85
- const templateName = this.options.input ? 'component-input' : 'component';
103
+ const templateName = this.options.input
104
+ ? 'component-input'
105
+ : this.options.button
106
+ ? 'component-button'
107
+ : this.options.checkbox
108
+ ? 'component-checkbox'
109
+ : 'component';
86
110
  const componentFiles = Template.instantiate(templatePath(templateName), `src/components/${directoryName}`, {
87
111
  component: {
88
112
  name: componentName,
@@ -100,7 +124,13 @@ export class GenerateComponentCommand extends Command {
100
124
  }
101
125
 
102
126
  await Log.animate('Creating story', async () => {
103
- const templateName = this.options.input ? 'component-input-story' : 'component-story';
127
+ const templateName = this.options.input
128
+ ? 'component-input-story'
129
+ : this.options.button
130
+ ? 'component-button-story'
131
+ : this.options.checkbox
132
+ ? 'component-checkbox-story'
133
+ : 'component-story';
104
134
  const storyFiles = Template.instantiate(templatePath(templateName), `src/components/${directoryName}`, {
105
135
  component: {
106
136
  name: componentName,
@@ -13,10 +13,10 @@ interface Options {
13
13
 
14
14
  export class GenerateModelCommand extends Command {
15
15
 
16
- public static command: string = 'generate:model';
17
- public static description: string = 'Generate an AerogelJS Model';
18
- public static parameters: [string, string][] = [['name', 'Model name']];
19
- public static options: CommandOptions = {
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
- public async run(): Promise<void> {
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 ag install soukai
93
+ npx gel install soukai
94
94
  `);
95
95
  }
96
96
  }
@@ -0,0 +1,85 @@
1
+ import { arrayFrom } from '@noeldemartin/utils';
2
+
3
+ import Command from '@/commands/Command';
4
+ import File from '@/lib/File';
5
+ import Log from '@/lib/Log';
6
+ import Template from '@/lib/Template';
7
+ import { templatePath } from '@/lib/utils/paths';
8
+ import type { CommandOptions } from '@/commands/Command';
9
+
10
+ export interface Options {
11
+ story?: boolean;
12
+ }
13
+
14
+ export class GenerateOverridesCommand extends Command {
15
+
16
+ protected static command: string = 'generate:overrides';
17
+ protected static description: string = 'Generate AerogelJS component overrides';
18
+
19
+ protected static options: CommandOptions = {
20
+ story: {
21
+ description: 'Create overrides story using Histoire',
22
+ type: 'boolean',
23
+ },
24
+ };
25
+
26
+ private options: Options;
27
+
28
+ constructor(options: Options = {}) {
29
+ super();
30
+
31
+ this.options = options;
32
+ }
33
+
34
+ protected async run(): Promise<void> {
35
+ this.assertAerogelOrDirectory('src/components');
36
+ this.assertHistoireInstalled();
37
+
38
+ const files = new Set<string>();
39
+
40
+ await this.createComponents(files);
41
+ await this.createStory(files);
42
+
43
+ const filesList = arrayFrom(files)
44
+ .map((file) => `- ${file}`)
45
+ .join('\n');
46
+
47
+ Log.info(`Overrides created successfully! The following files were created:\n\n${filesList}`);
48
+ Log.info('\nRemember to declare your components in main.ts and main.histoire.ts!');
49
+ }
50
+
51
+ protected assertHistoireInstalled(): void {
52
+ if (!this.options.story) {
53
+ return;
54
+ }
55
+
56
+ if (!File.contains('package.json', '"histoire"') && !File.contains('package.json', '"@aerogel/histoire"')) {
57
+ Log.fail(`
58
+ Histoire is not installed yet! You can install it running:
59
+ npx gel install histoire
60
+ `);
61
+ }
62
+ }
63
+
64
+ protected async createComponents(files: Set<string>): Promise<void> {
65
+ await Log.animate('Creating components', async () => {
66
+ if (File.exists('src/components/ModalWrapper.vue')) {
67
+ Log.fail('ModalWrapper component already exists!');
68
+ }
69
+
70
+ Template.instantiate(templatePath('overrides'), 'src').forEach((file) => files.add(file));
71
+ });
72
+ }
73
+
74
+ protected async createStory(files: Set<string>): Promise<void> {
75
+ if (!this.options.story) {
76
+ return;
77
+ }
78
+
79
+ await Log.animate('Creating story', async () => {
80
+ Template.instantiate(templatePath('overrides-story'), 'src/components/overrides/').forEach((file) =>
81
+ files.add(file));
82
+ });
83
+ }
84
+
85
+ }
@@ -15,7 +15,7 @@ describe('Generate Service command', () => {
15
15
 
16
16
  // Assert
17
17
  FileMock.expectCreated('src/services/FooBar.ts').toContain('class FooBarService extends Service');
18
- FileMock.expectCreated('src/services/FooBar.ts').toContain('export default facade(new FooBarService());');
18
+ FileMock.expectCreated('src/services/FooBar.ts').toContain('export default facade(FooBarService);');
19
19
  });
20
20
 
21
21
  });
@@ -13,9 +13,9 @@ import type { Editor } from '@/lib/Editor';
13
13
 
14
14
  export class GenerateServiceCommand extends Command {
15
15
 
16
- public static command: string = 'generate:service';
17
- public static description: string = 'Generate an AerogelJS Service';
18
- public static parameters: [string, string][] = [['name', 'Service name']];
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
- public async run(): Promise<void> {
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() === 'bootstrapApplication',
125
+ validate: (callExpression) => callExpression.getExpression().getText() === 'bootstrap',
126
126
  skip: SyntaxKind.ImportDeclaration,
127
127
  });
128
128
  const bootstrapOptions = bootstrapAppCall?.getArguments()[1];
@@ -0,0 +1,14 @@
1
+ import Command from '@/commands/Command';
2
+ import Log from '@/lib/Log';
3
+
4
+ export class InfoCommand extends Command {
5
+
6
+ protected static command: string = 'info';
7
+ protected static description: string = 'Show debugging information about the CLI';
8
+
9
+ protected async run(): Promise<void> {
10
+ Log.info('[AerogelJS CLI info]');
11
+ Log.info('Installation directory: ' + __dirname);
12
+ }
13
+
14
+ }
@@ -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
- public static command: string = 'install';
16
- public static description: string = 'Install an AerogelJS plugin';
17
- public static parameters: [string, string][] = [['plugin', 'Plugin to install']];
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
- public async run(): Promise<void> {
29
+ protected async run(): Promise<void> {
30
30
  await this.plugin.install();
31
31
  }
32
32
 
@@ -41,10 +41,6 @@ export class FileMockService extends FileService {
41
41
  this.virtualFilesystem[path] = contents;
42
42
  }
43
43
 
44
- public reset(): void {
45
- this.virtualFilesystem = {};
46
- }
47
-
48
44
  public expectCreated(path: string, expectContent?: (contents: string) => void): Assertion<string> {
49
45
  expect(typeof this.virtualFilesystem[path] === 'string', `expected '${path}' file to have been created`).toBe(
50
46
  true,
@@ -63,4 +59,4 @@ export class FileMockService extends FileService {
63
59
 
64
60
  }
65
61
 
66
- export default facade(new FileMockService());
62
+ export default facade(FileMockService);
package/src/lib/File.ts CHANGED
@@ -73,4 +73,4 @@ export class FileService {
73
73
 
74
74
  }
75
75
 
76
- export default facade(new FileService());
76
+ export default facade(FileService);
@@ -24,14 +24,10 @@ export class LogServiceMock extends LogService {
24
24
  throw new Error(`Fail: ${message}`);
25
25
  }
26
26
 
27
- public reset(): void {
28
- this.logs = [];
29
- }
30
-
31
27
  protected stdout(): void {
32
28
  //
33
29
  }
34
30
 
35
31
  }
36
32
 
37
- export default facade(new LogServiceMock());
33
+ export default facade(LogServiceMock);
package/src/lib/Log.ts CHANGED
@@ -92,4 +92,4 @@ export class LogService {
92
92
 
93
93
  }
94
94
 
95
- export default facade(new LogService());
95
+ export default facade(LogService);
@@ -17,4 +17,4 @@ export class ShellServiceMock extends ShellService {
17
17
 
18
18
  }
19
19
 
20
- export default facade(new ShellServiceMock());
20
+ export default facade(ShellServiceMock);
package/src/lib/Shell.ts CHANGED
@@ -25,4 +25,4 @@ export class ShellService {
25
25
 
26
26
  }
27
27
 
28
- export default facade(new ShellService());
28
+ export default facade(ShellService);
@@ -6,10 +6,12 @@ import Template from '@/lib/Template';
6
6
  import { isLinkedLocalApp } from '@/lib/utils/app';
7
7
  import { packagePath, templatePath } from '@/lib/utils/paths';
8
8
  import type { Editor } from '@/lib/Editor';
9
+ import { formatCodeBlock } from '@noeldemartin/utils';
9
10
 
10
11
  export class Histoire extends Plugin {
11
12
 
12
13
  private installedPatchPackage: boolean = false;
14
+ private installedPostCSSPseudoClasses: boolean = false;
13
15
 
14
16
  constructor() {
15
17
  super('histoire');
@@ -17,6 +19,7 @@ export class Histoire extends Plugin {
17
19
 
18
20
  public async beforeInstall(): Promise<void> {
19
21
  this.installedPatchPackage = false;
22
+ this.installedPostCSSPseudoClasses = false;
20
23
  }
21
24
 
22
25
  protected async afterInstall(): Promise<void> {
@@ -51,6 +54,12 @@ export class Histoire extends Plugin {
51
54
  this.installedPatchPackage = true;
52
55
  }
53
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
+
54
63
  await super.installNpmDependencies();
55
64
  }
56
65
 
@@ -70,10 +79,17 @@ export class Histoire extends Plugin {
70
79
  File.write(
71
80
  'package.json',
72
81
  packageJson.replace(
73
- '"lint": "noeldemartin-lint src",',
82
+ '"lint": "noeldemartin-lint src cypress",',
74
83
  this.installedPatchPackage
75
- ? '"histoire": "histoire dev", "lint": "noeldemartin-lint src", "postinstall": "patch-package",'
76
- : '"histoire": "histoire dev", "lint": "noeldemartin-lint src",',
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
+ `),
77
93
  ),
78
94
  );
79
95
 
@@ -84,6 +100,10 @@ export class Histoire extends Plugin {
84
100
  Log.info('Creating config files...');
85
101
 
86
102
  Template.instantiate(templatePath('histoire'));
103
+
104
+ if (this.installedPostCSSPseudoClasses) {
105
+ Template.instantiate(templatePath('postcss-pseudo-classes'));
106
+ }
87
107
  }
88
108
 
89
109
  protected isForDevelopment(): boolean {
@@ -123,7 +123,7 @@ export default abstract class Plugin {
123
123
  protected getBootstrapPluginsDeclaration(mainConfig: SourceFile): ArrayLiteralExpression | null {
124
124
  const bootstrapAppCall = findDescendant(mainConfig, {
125
125
  guard: Node.isCallExpression,
126
- validate: (callExpression) => callExpression.getExpression().getText() === 'bootstrapApplication',
126
+ validate: (callExpression) => callExpression.getExpression().getText() === 'bootstrap',
127
127
  skip: SyntaxKind.ImportDeclaration,
128
128
  });
129
129
  const bootstrapOptions = bootstrapAppCall?.getArguments()[1];
@@ -26,6 +26,7 @@ export class Solid extends Plugin {
26
26
 
27
27
  protected async installNpmDependencies(): Promise<void> {
28
28
  await Shell.run('npm install soukai-solid@next --save-exact');
29
+ await Shell.run('npm install @noeldemartin/solid-utils@next --save-exact');
29
30
  await Shell.run('npm install @solid/community-server@7 --save');
30
31
  await super.installNpmDependencies();
31
32
  }
@@ -50,17 +51,17 @@ export class Solid extends Plugin {
50
51
  .replace(
51
52
  '"cy:test": "start-server-and-test test:serve-app http-get://localhost:5001 cy:run",',
52
53
  '"cy:test": "start-server-and-test ' +
53
- 'test:serve-app http-get://localhost:5001 test:serve-pod http-get://localhost:4000 cy:run",',
54
+ 'test:serve-app http-get://localhost:5001 test:serve-pod http-get://localhost:3000 cy:run",',
54
55
  )
55
56
  .replace(
56
57
  '"dev": "vite",',
57
58
  '"dev": "vite",\n' +
58
- '"dev:serve-pod": "community-solid-server -c @css:config/file.json -p 4000 -f ./solid-data",',
59
+ '"dev:serve-pod": "community-solid-server -c @css:config/file.json -f ./solid-data",',
59
60
  )
60
61
  .replace(
61
- '"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"',
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"',
64
65
  ),
65
66
  );
66
67
 
@@ -11,14 +11,11 @@ import ShellMock from '@/lib/Shell.mock';
11
11
 
12
12
  setTestingNamespace(vi);
13
13
 
14
- File.setMockInstance(FileMock);
15
- Log.setMockInstance(LogMock);
16
- Shell.setMockInstance(ShellMock);
14
+ File.setMockFacade(FileMock);
15
+ Log.setMockFacade(LogMock);
16
+ Shell.setMockFacade(ShellMock);
17
17
 
18
18
  beforeEach(() => {
19
- FileMock.reset();
20
- LogMock.reset();
21
-
22
19
  File.mock();
23
20
  Log.mock();
24
21
  Shell.mock();
@@ -6,8 +6,8 @@ jobs:
6
6
  ci:
7
7
  runs-on: ubuntu-latest
8
8
  steps:
9
- - uses: actions/checkout@v3
10
- - uses: actions/setup-node@v3
9
+ - uses: actions/checkout@v4
10
+ - uses: actions/setup-node@v4
11
11
  with:
12
12
  node-version-file: '.nvmrc'
13
13
  - run: npm ci
@@ -16,13 +16,13 @@ jobs:
16
16
  - run: npm run test:ci
17
17
  - run: npm run cy:test-snapshots:ci
18
18
  - name: Upload Cypress screenshots
19
- uses: actions/upload-artifact@v3
19
+ uses: actions/upload-artifact@v4
20
20
  if: ${{ failure() }}
21
21
  with:
22
22
  name: cypress_screenshots
23
23
  path: cypress/screenshots
24
24
  - name: Upload Cypress snapshots
25
- uses: actions/upload-artifact@v3
25
+ uses: actions/upload-artifact@v4
26
26
  if: ${{ failure() }}
27
27
  with:
28
28
  name: cypress_snapshots