@aerogel/cli 0.0.0-next.4d82ed613002ee486648f88f720678424e7263f1 → 0.0.0-next.5953e1862a7c89a8fc80da087467d67d4f4e8c73

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.cjs.js +1 -1
  2. package/dist/aerogel-cli.cjs.js.map +1 -1
  3. package/dist/aerogel-cli.esm.js +1 -1
  4. package/dist/aerogel-cli.esm.js.map +1 -1
  5. package/package.json +9 -3
  6. package/src/commands/create.test.ts +1 -2
  7. package/src/commands/generate-component.test.ts +28 -2
  8. package/src/commands/generate-component.ts +25 -9
  9. package/src/commands/generate-model.test.ts +1 -1
  10. package/src/commands/generate-model.ts +1 -2
  11. package/src/commands/generate-service.ts +1 -2
  12. package/src/commands/install.test.ts +24 -1
  13. package/src/commands/install.ts +2 -1
  14. package/src/lib/Editor.ts +9 -7
  15. package/src/lib/Shell.mock.ts +1 -1
  16. package/src/lib/Template.ts +5 -1
  17. package/src/lib/utils/app.ts +1 -1
  18. package/src/lib/utils/paths.ts +1 -1
  19. package/src/plugins/Histoire.ts +93 -0
  20. package/src/plugins/Plugin.ts +57 -4
  21. package/src/plugins/Solid.ts +6 -42
  22. package/templates/app/index.html +3 -2
  23. package/templates/app/package.json +13 -2
  24. package/templates/app/src/App.vue +2 -2
  25. package/templates/app/src/assets/public/robots.txt +2 -0
  26. package/templates/app/src/main.ts +1 -1
  27. package/templates/app/vite.config.ts +2 -1
  28. package/templates/component-input/[component.name].vue +16 -0
  29. package/templates/component-input-story/[component.name].story.vue +63 -0
  30. package/templates/histoire/histoire.config.ts +7 -0
  31. package/templates/histoire/patches/histoire+0.17.6.patch +13 -0
  32. package/templates/histoire/src/main.histoire.ts +8 -0
  33. package/.eslintrc.js +0 -7
  34. package/src/lib/utils/format.test.ts +0 -33
  35. package/src/lib/utils/format.ts +0 -38
  36. package/templates/app/.eslintrc.js +0 -3
  37. package/templates/app/prettier.config.js +0 -5
  38. /package/templates/app/{cypress.config.ts → cypress/cypress.config.ts} +0 -0
  39. /package/templates/app/src/assets/{styles.css → css/styles.css} +0 -0
@@ -0,0 +1,16 @@
1
+ <template>
2
+ <AGHeadlessInput v-bind="props">
3
+ <AGHeadlessInputLabel />
4
+ <AGHeadlessInputInput v-bind="attrs" />
5
+ <AGHeadlessInputError />
6
+ </AGHeadlessInput>
7
+ </template>
8
+
9
+ <script setup lang="ts">
10
+ import { useInputAttrs, useInputProps } from '@aerogel/core';
11
+
12
+ defineOptions({ inheritAttrs: false });
13
+
14
+ const props = defineProps(useInputProps());
15
+ const [attrs] = useInputAttrs();
16
+ </script>
@@ -0,0 +1,63 @@
1
+ <template>
2
+ <Story :layout="{ type: 'grid' }">
3
+ <Variant title="Playground">
4
+ <AGForm :form="form">
5
+ <<% component.name %> name="food" :label="label" :placeholder="placeholder" />
6
+ </AGForm>
7
+
8
+ <template #controls>
9
+ <HstText v-model="label" title="Label" />
10
+ <HstText v-model="placeholder" title="Placeholder" />
11
+ <HstCheckbox v-model="hasErrors" title="Errors" />
12
+ </template>
13
+ </Variant>
14
+
15
+ <Variant title="Default">
16
+ <<% component.name %> label="What's the best food?" placeholder="Ramen" />
17
+ </Variant>
18
+
19
+ <Variant title="Hover">
20
+ <<% component.name %> label="What's the best food?" placeholder="Ramen" input-class=":hover" />
21
+ </Variant>
22
+
23
+ <Variant title="Focus">
24
+ <<% component.name %> label="What's the best food?" placeholder="Ramen" input-class=":focus :focus-visible" />
25
+ </Variant>
26
+
27
+ <Variant title="Error">
28
+ <AGForm :form="errorForm">
29
+ <<% component.name %>
30
+ name="food"
31
+ label="What's the best food?"
32
+ placeholder="Ramen"
33
+ class=":focus :focus-visible"
34
+ />
35
+ </AGForm>
36
+ </Variant>
37
+ </Story>
38
+ </template>
39
+
40
+ <script setup lang="ts">
41
+ import { requiredStringInput, useForm } from '@aerogel/core';
42
+ import { ref, watchEffect } from 'vue';
43
+
44
+ const form = useForm({ food: requiredStringInput() });
45
+ const errorForm = useForm({ food: requiredStringInput() });
46
+ const label = ref('What\'s the best food?');
47
+ const placeholder = ref('Ramen');
48
+ const hasErrors = ref(false);
49
+
50
+ errorForm.submit();
51
+
52
+ watchEffect(() => (hasErrors.value ? form.submit() : form.reset()));
53
+ </script>
54
+
55
+ <style>
56
+ .story-<% component.slug %> {
57
+ grid-template-columns: repeat(2, 300px) !important;
58
+ }
59
+
60
+ .story-<% component.slug %> .variant-playground {
61
+ grid-column: 1 / -1;
62
+ }
63
+ </style>
@@ -0,0 +1,7 @@
1
+ import HstAerogel from '@aerogel/histoire/dist/plugin';
2
+ import { defineConfig } from 'histoire';
3
+
4
+ export default defineConfig({
5
+ setupFile: '/src/main.histoire.ts',
6
+ plugins: [HstAerogel()],
7
+ });
@@ -0,0 +1,13 @@
1
+ diff --git a/node_modules/histoire/dist/node/collect/index.js b/node_modules/histoire/dist/node/collect/index.js
2
+ index 8ffd507..37be43e 100644
3
+ --- a/node_modules/histoire/dist/node/collect/index.js
4
+ +++ b/node_modules/histoire/dist/node/collect/index.js
5
+ @@ -22,7 +22,7 @@ export function useCollectStories(options, ctx) {
6
+ /vite\w*\/dist\/client\/(client|env).mjs/,
7
+ ...ctx.config.viteNodeInlineDeps ?? [],
8
+ ],
9
+ - fallbackCJS: true,
10
+ + fallbackCJS: false,
11
+ },
12
+ transformMode: ctx.config.viteNodeTransformMode,
13
+ });
@@ -0,0 +1,8 @@
1
+ import '@aerogel/histoire/dist/styles.css';
2
+ import { defineSetupAerogel } from '@aerogel/histoire';
3
+
4
+ import './assets/css/styles.css';
5
+
6
+ export const setupVue3 = defineSetupAerogel({
7
+ messages: import.meta.glob('@/lang/*.yaml'),
8
+ });
package/.eslintrc.js DELETED
@@ -1,7 +0,0 @@
1
- module.exports = {
2
- env: {
3
- browser: true,
4
- es2021: true,
5
- },
6
- extends: ['@noeldemartin/eslint-config-typescript'],
7
- };
@@ -1,33 +0,0 @@
1
- import { describe, expect, it } from 'vitest';
2
-
3
- import { formatCodeBlock } from './format';
4
-
5
- describe('Format utils', () => {
6
-
7
- it('Formats code blocks', () => {
8
- // Arrange
9
- const raw = `
10
-
11
- const foo = 'bar';
12
-
13
- if (foo) {
14
- doSomething();
15
- }
16
-
17
- `;
18
- const formatted = [
19
- 'const foo = \'bar\';', //
20
- '', //
21
- 'if (foo) {', //
22
- ' doSomething();', //
23
- '}', //
24
- ].join('\n');
25
-
26
- // Act
27
- const actual = formatCodeBlock(raw);
28
-
29
- // Assert
30
- expect(actual).toEqual(formatted);
31
- });
32
-
33
- });
@@ -1,38 +0,0 @@
1
- export interface FormatCodeBlockOptions {
2
- indent?: number;
3
- }
4
-
5
- export function formatCodeBlock(code: string, options: FormatCodeBlockOptions = {}): string {
6
- const lines = code.split('\n');
7
- const indent = options.indent ?? 0;
8
- let originalIndent = 0;
9
- let formatted = '';
10
-
11
- for (const line of lines) {
12
- const trimmedLine = line.trim();
13
- const isEmptyLine = trimmedLine.length === 0;
14
-
15
- if (formatted.length === 0) {
16
- if (isEmptyLine) {
17
- continue;
18
- }
19
-
20
- originalIndent = line.indexOf(trimmedLine[0] ?? '');
21
- formatted += `${' '.repeat(indent)}${trimmedLine}\n`;
22
-
23
- continue;
24
- }
25
-
26
- if (isEmptyLine) {
27
- formatted += '\n';
28
-
29
- continue;
30
- }
31
-
32
- const lineIndent = line.indexOf(trimmedLine[0] ?? '');
33
-
34
- formatted += `${' '.repeat(indent + lineIndent - originalIndent)}${trimmedLine}\n`;
35
- }
36
-
37
- return formatted.trimEnd();
38
- }
@@ -1,3 +0,0 @@
1
- module.exports = {
2
- extends: ['@noeldemartin/eslint-config-vue'],
3
- };
@@ -1,5 +0,0 @@
1
- /** @type {import('prettier').Config} */
2
- module.exports = {
3
- plugins: [require('prettier-plugin-tailwindcss')],
4
- printWidth: 120,
5
- };