@aerogel/cli 0.0.0-next.7b6199e0666e235c949739bdbc7cca2d54c8636e → 0.0.0-next.7f369b50c025aaa1a8024b6e53c659a6d7d617b5

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 (39) hide show
  1. package/dist/aerogel-cli.js +184 -228
  2. package/dist/aerogel-cli.js.map +1 -1
  3. package/package.json +2 -1
  4. package/src/commands/create.test.ts +0 -23
  5. package/src/commands/create.ts +4 -8
  6. package/src/commands/generate-component.test.ts +0 -60
  7. package/src/commands/generate-component.ts +3 -79
  8. package/src/lib/App.ts +35 -42
  9. package/src/lib/File.ts +12 -1
  10. package/src/testing/setup.ts +6 -0
  11. package/templates/app/.github/workflows/ci.yml +0 -29
  12. package/templates/app/.gitignore.template +0 -2
  13. package/templates/app/.nvmrc +0 -1
  14. package/templates/app/.vscode/launch.json +0 -17
  15. package/templates/app/.vscode/settings.json +0 -10
  16. package/templates/app/cypress/cypress.config.ts +0 -14
  17. package/templates/app/cypress/e2e/app.cy.ts +0 -9
  18. package/templates/app/cypress/support/e2e.ts +0 -1
  19. package/templates/app/cypress/tsconfig.json +0 -11
  20. package/templates/app/index.html +0 -13
  21. package/templates/app/package.json +0 -67
  22. package/templates/app/src/App.vue +0 -12
  23. package/templates/app/src/assets/css/main.css +0 -4
  24. package/templates/app/src/assets/public/robots.txt +0 -2
  25. package/templates/app/src/lang/en.yaml +0 -3
  26. package/templates/app/src/main.test.ts +0 -9
  27. package/templates/app/src/main.ts +0 -13
  28. package/templates/app/src/types/globals.d.ts +0 -2
  29. package/templates/app/src/types/shims.d.ts +0 -7
  30. package/templates/app/src/types/ts-reset.d.ts +0 -1
  31. package/templates/app/tsconfig.json +0 -12
  32. package/templates/app/vite.config.ts +0 -31
  33. package/templates/component-button/[component.name].vue +0 -42
  34. package/templates/component-button-story/[component.name].story.vue +0 -77
  35. package/templates/component-checkbox/[component.name].vue +0 -34
  36. package/templates/component-checkbox-story/[component.name].story.vue +0 -63
  37. package/templates/component-input/[component.name].vue +0 -17
  38. package/templates/component-input-story/[component.name].story.vue +0 -63
  39. package/templates/component-story/[component.name].story.vue +0 -7
@@ -1,4 +1,4 @@
1
- import { arrayFilter, arrayFrom, stringToSlug } from '@noeldemartin/utils';
1
+ import { 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
 
@@ -9,7 +9,6 @@ import Template from '@aerogel/cli/lib/Template';
9
9
  import { app } from '@aerogel/cli/lib/utils/app';
10
10
  import { editFiles, findDescendant } from '@aerogel/cli/lib/utils/edit';
11
11
  import { templatePath } from '@aerogel/cli/lib/utils/paths';
12
- import type { CommandOptions } from '@aerogel/cli/commands/Command';
13
12
 
14
13
  export interface Options {
15
14
  button?: boolean;
@@ -26,52 +25,21 @@ export class GenerateComponentCommand extends Command {
26
25
  ['path', 'Component path (relative to components folder; extension not necessary)'],
27
26
  ];
28
27
 
29
- protected static override options: CommandOptions = {
30
- button: {
31
- description: 'Create a custom button',
32
- type: 'boolean',
33
- },
34
- checkbox: {
35
- description: 'Create a custom checkbox',
36
- type: 'boolean',
37
- },
38
- input: {
39
- description: 'Create a custom input',
40
- type: 'boolean',
41
- },
42
- story: {
43
- description: 'Create component story using Histoire',
44
- type: 'boolean',
45
- },
46
- };
47
-
48
28
  private path: string;
49
- private options: Options;
50
29
 
51
- constructor(path: string, options: Options = {}) {
30
+ constructor(path: string) {
52
31
  super();
53
32
 
54
33
  this.path = path;
55
- this.options = options;
56
- }
57
-
58
- protected override 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
34
  }
65
35
 
66
36
  protected override async run(): Promise<void> {
67
37
  this.assertAerogelOrDirectory('src/components');
68
- this.assertHistoireInstalled();
69
38
 
70
39
  const files = new Set<string>();
71
40
  const [directoryName, componentName] = this.parsePathComponents();
72
41
 
73
42
  await this.createComponent(directoryName, componentName, files);
74
- await this.createStory(directoryName, componentName, files);
75
43
  await this.declareComponents();
76
44
 
77
45
  const filesList = arrayFrom(files)
@@ -81,33 +49,13 @@ export class GenerateComponentCommand extends Command {
81
49
  Log.info(`${componentName} component created successfully! The following files were created:\n\n${filesList}`);
82
50
  }
83
51
 
84
- protected assertHistoireInstalled(): void {
85
- if (!this.options.story) {
86
- return;
87
- }
88
-
89
- if (!File.contains('package.json', '"histoire"') && !File.contains('package.json', '"@aerogel/histoire"')) {
90
- Log.fail(`
91
- Histoire is not installed yet! You can install it running:
92
- npx gel install histoire
93
- `);
94
- }
95
- }
96
-
97
52
  protected async createComponent(directoryName: string, componentName: string, files: Set<string>): Promise<void> {
98
53
  await Log.animate('Creating component', async () => {
99
54
  if (File.exists(`src/components/${this.path}.vue`)) {
100
55
  Log.fail(`${this.path} component already exists!`);
101
56
  }
102
57
 
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';
110
- const componentFiles = Template.instantiate(templatePath(templateName), `src/components/${directoryName}`, {
58
+ const componentFiles = Template.instantiate(templatePath('component'), `src/components/${directoryName}`, {
111
59
  component: {
112
60
  name: componentName,
113
61
  slug: stringToSlug(componentName),
@@ -118,30 +66,6 @@ export class GenerateComponentCommand extends Command {
118
66
  });
119
67
  }
120
68
 
121
- protected async createStory(directoryName: string, componentName: string, files: Set<string>): Promise<void> {
122
- if (!this.options.story) {
123
- return;
124
- }
125
-
126
- await Log.animate('Creating story', async () => {
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';
134
- const storyFiles = Template.instantiate(templatePath(templateName), `src/components/${directoryName}`, {
135
- component: {
136
- name: componentName,
137
- slug: stringToSlug(componentName),
138
- },
139
- });
140
-
141
- storyFiles.forEach((file) => files.add(file));
142
- });
143
- }
144
-
145
69
  protected async declareComponents(): Promise<void> {
146
70
  if (!editFiles()) {
147
71
  return;
package/src/lib/App.ts CHANGED
@@ -1,19 +1,11 @@
1
- import { stringToSlug } from '@noeldemartin/utils';
1
+ import { resolve } from 'node:path';
2
2
 
3
3
  import File from '@aerogel/cli/lib/File';
4
4
  import Log from '@aerogel/cli/lib/Log';
5
5
  import Template from '@aerogel/cli/lib/Template';
6
6
  import { packNotFound, packagePackPath, packagePath, templatePath } from '@aerogel/cli/lib/utils/paths';
7
7
  import { Editor } from '@aerogel/cli/lib/Editor';
8
-
9
- interface Dependencies {
10
- aerogelCli: string;
11
- aerogelCore: string;
12
- aerogelCypress: string;
13
- aerogelPluginI18n: string;
14
- aerogelPluginSoukai: string;
15
- aerogelVite: string;
16
- }
8
+ import { simpleGit } from 'simple-git';
17
9
 
18
10
  export interface Options {
19
11
  local?: boolean;
@@ -27,28 +19,36 @@ export default class App {
27
19
  protected options: Options = {},
28
20
  ) {}
29
21
 
30
- public create(path: string): void {
22
+ public async create(path: string): Promise<void> {
31
23
  if (File.exists(path) && (!File.isDirectory(path) || !File.isEmptyDirectory(path))) {
32
24
  Log.fail(`Folder at '${path}' already exists!`);
33
25
  }
34
26
 
35
- Template.instantiate(templatePath('app'), path, {
36
- app: {
37
- name: this.name,
38
- slug: stringToSlug(this.name),
39
- },
40
- dependencies: this.getDependencies(),
41
- contentPath: this.options.linkedLocal
42
- ? `${packagePath('core')}/dist/**/*.js`
43
- : './node_modules/@aerogel/core/dist/**/*.js',
44
- });
27
+ // Clone repository
28
+ await simpleGit().clone('https://github.com/NoelDeMartin/aerogel-template.git', path);
29
+
30
+ // Apply replacements
31
+ const dependencies = this.getDependencies();
32
+
33
+ File.replace(
34
+ resolve(path, 'vite.config.ts'),
35
+ 'Aerogel({ name: \'Aerogel\' })',
36
+ `Aerogel({ name: '${this.name}' })`,
37
+ );
38
+
39
+ for (const [name, version] of Object.entries(dependencies)) {
40
+ File.replace(resolve(path, 'package.json'), new RegExp(`"${name}": ".*?"`, 'g'), `"${name}": "${version}"`);
41
+ }
42
+
43
+ // Copy template
44
+ Template.instantiate(templatePath('app'), path, { app: { name: this.name } });
45
45
  }
46
46
 
47
47
  public edit(): Editor {
48
48
  return new Editor();
49
49
  }
50
50
 
51
- protected getDependencies(): Dependencies {
51
+ protected getDependencies(): Record<string, string> {
52
52
  const withFilePrefix = <T extends Record<string, string>>(paths: T) =>
53
53
  Object.entries(paths).reduce(
54
54
  (pathsWithFile, [name, path]) => Object.assign(pathsWithFile, { [name]: `file:${path}` }) as T,
@@ -57,34 +57,27 @@ export default class App {
57
57
 
58
58
  if (this.options.linkedLocal) {
59
59
  return withFilePrefix({
60
- aerogelCli: packagePath('cli'),
61
- aerogelCore: packagePath('core'),
62
- aerogelCypress: packagePath('cypress'),
63
- aerogelPluginI18n: packagePath('plugin-i18n'),
64
- aerogelPluginSoukai: packagePath('plugin-soukai'),
65
- aerogelVite: packagePath('vite'),
60
+ '@aerogel/cli': packagePath('cli'),
61
+ '@aerogel/core': packagePath('core'),
62
+ '@aerogel/cypress': packagePath('cypress'),
63
+ '@aerogel/plugin-i18n': packagePath('plugin-i18n'),
64
+ '@aerogel/plugin-soukai': packagePath('plugin-soukai'),
65
+ '@aerogel/vite': packagePath('vite'),
66
66
  });
67
67
  }
68
68
 
69
69
  if (this.options.local) {
70
70
  return withFilePrefix({
71
- aerogelCli: packagePackPath('cli') ?? packNotFound('cli'),
72
- aerogelCore: packagePackPath('core') ?? packNotFound('core'),
73
- aerogelCypress: packagePackPath('cypress') ?? packNotFound('cypress'),
74
- aerogelPluginI18n: packagePackPath('plugin-i18n') ?? packNotFound('plugin-i18n'),
75
- aerogelPluginSoukai: packagePackPath('plugin-soukai') ?? packNotFound('plugin-soukai'),
76
- aerogelVite: packagePackPath('vite') ?? packNotFound('vite'),
71
+ '@aerogel/cli': packagePackPath('cli') ?? packNotFound('cli'),
72
+ '@aerogel/core': packagePackPath('core') ?? packNotFound('core'),
73
+ '@aerogel/cypress': packagePackPath('cypress') ?? packNotFound('cypress'),
74
+ '@aerogel/plugin-i18n': packagePackPath('plugin-i18n') ?? packNotFound('plugin-i18n'),
75
+ '@aerogel/plugin-soukai': packagePackPath('plugin-soukai') ?? packNotFound('plugin-soukai'),
76
+ '@aerogel/vite': packagePackPath('vite') ?? packNotFound('vite'),
77
77
  });
78
78
  }
79
79
 
80
- return {
81
- aerogelCli: 'next',
82
- aerogelCore: 'next',
83
- aerogelCypress: 'next',
84
- aerogelPluginI18n: 'next',
85
- aerogelPluginSoukai: 'next',
86
- aerogelVite: 'next',
87
- };
80
+ return {};
88
81
  }
89
82
 
90
83
  }
package/src/lib/File.ts CHANGED
@@ -1,7 +1,8 @@
1
1
  import { existsSync, lstatSync, mkdirSync, readFileSync, readdirSync, writeFileSync } from 'node:fs';
2
- import { facade } from '@noeldemartin/utils';
3
2
  import { dirname, resolve } from 'node:path';
4
3
 
4
+ import { facade } from '@noeldemartin/utils';
5
+
5
6
  export class FileService {
6
7
 
7
8
  public contains(path: string, contents: string): boolean {
@@ -26,6 +27,16 @@ export class FileService {
26
27
  return readFileSync(path).toString();
27
28
  }
28
29
 
30
+ public replace(path: string, search: string | RegExp, replacement: string): void {
31
+ const contents = this.read(path);
32
+
33
+ if (!contents) {
34
+ return;
35
+ }
36
+
37
+ this.write(path, contents.replaceAll(search, replacement));
38
+ }
39
+
29
40
  public getFiles(directoryPath: string): string[] {
30
41
  const children = readdirSync(directoryPath, { withFileTypes: true });
31
42
  const files: string[] = [];
@@ -48,6 +48,12 @@ vi.mock('@aerogel/cli/lib/utils/edit', async () => {
48
48
  };
49
49
  });
50
50
 
51
+ vi.mock('simple-git', () => ({
52
+ simpleGit: () => ({
53
+ clone: () => Promise.resolve(),
54
+ }),
55
+ }));
56
+
51
57
  // TODO find out why these need to be mocked
52
58
  vi.mock('@aerogel/cli/lib/utils/paths', async () => {
53
59
  const original = (await vi.importActual('@aerogel/cli/lib/utils/paths')) as object;
@@ -1,29 +0,0 @@
1
- name: CI
2
-
3
- on: [push, pull_request]
4
-
5
- jobs:
6
- ci:
7
- runs-on: ubuntu-latest
8
- steps:
9
- - uses: actions/checkout@v4
10
- - uses: actions/setup-node@v4
11
- with:
12
- node-version-file: '.nvmrc'
13
- - run: npm ci
14
- - run: npm run lint
15
- - run: npm run build
16
- - run: npm run test:ci
17
- - run: npm run cy:test-snapshots:ci
18
- - name: Upload Cypress screenshots
19
- uses: actions/upload-artifact@v4
20
- if: ${{ failure() }}
21
- with:
22
- name: cypress_screenshots
23
- path: cypress/screenshots
24
- - name: Upload Cypress snapshots
25
- uses: actions/upload-artifact@v4
26
- if: ${{ failure() }}
27
- with:
28
- name: cypress_snapshots
29
- path: cypress/snapshots
@@ -1,2 +0,0 @@
1
- /dist
2
- /node_modules
@@ -1 +0,0 @@
1
- v22.9.0
@@ -1,17 +0,0 @@
1
- {
2
- "version": "0.2.0",
3
- "configurations": [
4
- {
5
- "type": "node",
6
- "runtimeVersion": "22.14.0",
7
- "request": "launch",
8
- "name": "Debug Current Test File",
9
- "autoAttachChildProcesses": true,
10
- "skipFiles": ["<node_internals>/**", "**/node_modules/**"],
11
- "program": "${workspaceRoot}/node_modules/vitest/vitest.mjs",
12
- "args": ["run", "${fileBasenameNoExtension}"],
13
- "smartStep": true,
14
- "console": "integratedTerminal"
15
- }
16
- ]
17
- }
@@ -1,10 +0,0 @@
1
- {
2
- "emeraldwalk.runonsave": {
3
- "commands": [
4
- {
5
- "match": ".*",
6
- "cmd": "npx prettier-eslint ${file} --write"
7
- }
8
- ]
9
- }
10
- }
@@ -1,14 +0,0 @@
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
- });
@@ -1,9 +0,0 @@
1
- describe('App', () => {
2
-
3
- beforeEach(() => cy.visit('/'));
4
-
5
- it('Shows get started link', () => {
6
- cy.see('Get started');
7
- });
8
-
9
- });
@@ -1 +0,0 @@
1
- import '@aerogel/cypress/support';
@@ -1,11 +0,0 @@
1
- {
2
- "extends": "@tsconfig/node22/tsconfig.json",
3
- "include": ["**/*.ts"],
4
- "compilerOptions": {
5
- "baseUrl": ".",
6
- "module": "ESNext",
7
- "moduleResolution": "Bundler",
8
- "lib": ["DOM"],
9
- "types": ["node", "cypress"]
10
- }
11
- }
@@ -1,13 +0,0 @@
1
- <!DOCTYPE html>
2
- <html lang="en" class="size-full">
3
- <head>
4
- <meta charset="UTF-8" />
5
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
- <title>{{ app.name }}</title>
7
- {{ socialMeta() }}
8
- </head>
9
- <body class="size-full text-base font-normal leading-tight text-gray-900 antialiased">
10
- <div id="app" class="loading h-full"></div>
11
- <script type="module" src="./src/main.ts"></script>
12
- </body>
13
- </html>
@@ -1,67 +0,0 @@
1
- {
2
- "name": "<% app.slug %>",
3
- "version": "0.0.0",
4
- "private": true,
5
- "type": "module",
6
- "scripts": {
7
- "build": "vite build",
8
- "cy:dev": "concurrently --kill-others \"npm run test:serve-app\" \"npm run cy:open\"",
9
- "cy:open": "cypress open --config-file ./cypress/cypress.config.ts --e2e --browser chromium",
10
- "cy:run": "cypress run --config-file ./cypress/cypress.config.ts",
11
- "cy:test": "start-server-and-test test:serve-app http-get://localhost:5001 cy:run",
12
- "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\"",
13
- "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\"",
14
- "dev": "vite",
15
- "lint": "noeldemartin-lint src cypress",
16
- "test": "vitest --run",
17
- "test:ci": "vitest --run --reporter verbose",
18
- "test:serve-app": "vite --port 5001 --mode testing"
19
- },
20
- "dependencies": {
21
- "@aerogel/core": "<% &dependencies.aerogelCore %>",
22
- "@aerogel/plugin-i18n": "<% &dependencies.aerogelPluginI18n %>",
23
- "@aerogel/plugin-soukai": "<% &dependencies.aerogelPluginSoukai %>",
24
- "@intlify/unplugin-vue-i18n": "^6.0.5",
25
- "@noeldemartin/utils": "next",
26
- "@tailwindcss/forms": "^0.5.10",
27
- "@tailwindcss/typography": "^0.5.16",
28
- "soukai": "next",
29
- "tailwindcss": "^4.1.1",
30
- "vue": "^3.5.13",
31
- "vue-i18n": "^11.1.2"
32
- },
33
- "devDependencies": {
34
- "@aerogel/cli": "<% &dependencies.aerogelCli %>",
35
- "@aerogel/cypress": "<% &dependencies.aerogelCypress %>",
36
- "@aerogel/vite": "<% &dependencies.aerogelVite %>",
37
- "@iconify/json": "^2.2.134",
38
- "@noeldemartin/eslint-config-vue": "next",
39
- "@noeldemartin/scripts": "next",
40
- "@total-typescript/ts-reset": "^0.4.2",
41
- "@tsconfig/node22": "^22.0.1",
42
- "@types/node": "^20.3.1",
43
- "@vue/tsconfig": "^0.7.0",
44
- "autoprefixer": "^10.4.14",
45
- "concurrently": "^8.2.0",
46
- "cypress": "^14.2.0",
47
- "prettier-plugin-tailwindcss": "^0.6.11",
48
- "start-server-and-test": "^2.0.0",
49
- "typescript": "^5.8.2",
50
- "unplugin-icons": "^0.16.3",
51
- "unplugin-vue-components": "^0.24.1",
52
- "vite": "^6.2.2",
53
- "vitest": "^3.0.9",
54
- "vue-tsc": "^2.2.8"
55
- },
56
- "eslintConfig": {
57
- "extends": [
58
- "@noeldemartin/eslint-config-vue"
59
- ]
60
- },
61
- "prettier": {
62
- "printWidth": 120,
63
- "plugins": [
64
- "prettier-plugin-tailwindcss"
65
- ]
66
- }
67
- }
@@ -1,12 +0,0 @@
1
- <template>
2
- <AppLayout class="bg-blue-50">
3
- <main class="flex grow flex-col items-center justify-center">
4
- <h1 class="text-4xl font-semibold">
5
- {{ $t('home.title') }}
6
- </h1>
7
- <a href="https://aerogel.js.org" target="_blank" class="mt-2 underline opacity-75 hover:opacity-100">
8
- {{ $t('home.getStarted') }}
9
- </a>
10
- </main>
11
- </AppLayout>
12
- </template>
@@ -1,4 +0,0 @@
1
- @import 'tailwindcss';
2
- @import '@aerogel/core';
3
- @plugin '@tailwindcss/forms';
4
- @plugin '@tailwindcss/typography';
@@ -1,2 +0,0 @@
1
- User-agent: *
2
- Disallow:
@@ -1,3 +0,0 @@
1
- home:
2
- title: Aerogel
3
- getStarted: Get started
@@ -1,9 +0,0 @@
1
- import { describe, expect, it } from 'vitest';
2
-
3
- describe('App', () => {
4
-
5
- it('works', () => {
6
- expect(true).toBe(true);
7
- });
8
-
9
- });
@@ -1,13 +0,0 @@
1
- import i18n from '@aerogel/plugin-i18n';
2
- import soukai from '@aerogel/plugin-soukai';
3
- import { bootstrap } from '@aerogel/core';
4
-
5
- import './assets/css/main.css';
6
- import App from './App.vue';
7
-
8
- bootstrap(App, {
9
- plugins: [
10
- i18n({ messages: import.meta.glob('@/lang/*.yaml') }),
11
- soukai({ models: import.meta.glob(['@/models/*', '!**/*.test.ts'], { eager: true }) }),
12
- ],
13
- });
@@ -1,2 +0,0 @@
1
- /// <reference types="vite/client" />
2
- /// <reference types="vue-i18n" />
@@ -1,7 +0,0 @@
1
- declare module '*.vue' {
2
- import type { ComponentOptions } from 'vue';
3
-
4
- const component: ComponentOptions;
5
-
6
- export default component;
7
- }
@@ -1 +0,0 @@
1
- /// <reference types="@total-typescript/ts-reset" />
@@ -1,12 +0,0 @@
1
- {
2
- "extends": "@vue/tsconfig/tsconfig.dom.json",
3
- "compilerOptions": {
4
- "baseUrl": ".",
5
- "module": "ESNext",
6
- "moduleResolution": "Bundler",
7
- "paths": {
8
- "@/*": ["./src/*"]
9
- }
10
- },
11
- "include": ["src/**/*.ts", "src/**/*.vue"]
12
- }
@@ -1,31 +0,0 @@
1
- import { URL, fileURLToPath } from 'node:url';
2
-
3
- import Aerogel, { AerogelResolver } from '@aerogel/vite';
4
- import Components from 'unplugin-vue-components/vite';
5
- import I18n from '@intlify/unplugin-vue-i18n/vite';
6
- import Icons from 'unplugin-icons/vite';
7
- import IconsResolver from 'unplugin-icons/resolver';
8
- import { defineConfig } from 'vitest/config';
9
-
10
- export default defineConfig({
11
- build: { sourcemap: true },
12
- publicDir: fileURLToPath(new URL('./src/assets/public/', import.meta.url)),
13
- plugins: [
14
- Aerogel({ name: '<% app.name %>' }),
15
- Components({
16
- dts: false,
17
- resolvers: [AerogelResolver(), IconsResolver()],
18
- }),
19
- I18n({ include: fileURLToPath(new URL('./src/lang/**/*.yaml', import.meta.url)) }),
20
- Icons({
21
- iconCustomizer(_, __, props) {
22
- props['aria-hidden'] = 'true';
23
- },
24
- }),
25
- ],
26
- resolve: {
27
- alias: {
28
- '@': fileURLToPath(new URL('./src', import.meta.url)),
29
- },
30
- },
31
- });
@@ -1,42 +0,0 @@
1
- <template>
2
- <HeadlessButton :class="variantClasses" :disabled="disabled">
3
- <slot />
4
- </HeadlessButton>
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>