@aerogel/cli 0.0.0-next.47ed8ee3c048720794026e45140e9b700cb428b9 → 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.
- package/dist/aerogel-cli.cjs.js +1 -1
- package/dist/aerogel-cli.cjs.js.map +1 -1
- package/dist/aerogel-cli.esm.js +1 -1
- package/dist/aerogel-cli.esm.js.map +1 -1
- package/package.json +11 -4
- package/src/cli.ts +4 -0
- package/src/commands/create.test.ts +22 -5
- package/src/commands/create.ts +30 -12
- package/src/commands/generate-component.test.ts +40 -3
- package/src/commands/generate-component.ts +143 -20
- package/src/commands/generate-model.test.ts +7 -4
- package/src/commands/generate-model.ts +32 -15
- package/src/commands/generate-service.test.ts +21 -0
- package/src/commands/generate-service.ts +151 -0
- package/src/commands/install.test.ts +41 -0
- package/src/commands/install.ts +33 -0
- package/src/lib/App.ts +65 -3
- package/src/lib/Editor.ts +58 -0
- package/src/lib/File.ts +6 -0
- package/src/lib/Log.mock.ts +13 -4
- package/src/lib/Log.test.ts +19 -3
- package/src/lib/Log.ts +36 -20
- package/src/lib/Shell.mock.ts +1 -1
- package/src/lib/Template.ts +5 -1
- package/src/lib/utils/app.ts +15 -0
- package/src/lib/utils/edit.ts +44 -0
- package/src/lib/utils/paths.ts +34 -0
- package/src/plugins/Histoire.ts +93 -0
- package/src/plugins/Plugin.ts +178 -0
- package/src/plugins/Solid.ts +78 -0
- package/src/plugins/Soukai.ts +19 -0
- package/src/testing/setup.ts +38 -6
- package/templates/app/.github/workflows/ci.yml +14 -2
- package/templates/app/.vscode/launch.json +16 -0
- package/templates/app/.vscode/settings.json +10 -0
- package/templates/app/README.md +3 -0
- package/templates/app/cypress/cypress.config.ts +16 -0
- package/templates/app/index.html +4 -3
- package/templates/app/package.json +34 -12
- package/templates/app/src/App.vue +5 -3
- package/templates/app/src/assets/public/robots.txt +2 -0
- package/templates/app/src/main.ts +6 -2
- package/templates/app/src/types/globals.d.ts +0 -1
- package/templates/app/tailwind.config.js +1 -1
- package/templates/app/tsconfig.json +1 -0
- package/templates/app/vite.config.ts +14 -6
- package/templates/component-input/[component.name].vue +16 -0
- package/templates/component-input-story/[component.name].story.vue +63 -0
- package/templates/histoire/histoire.config.ts +7 -0
- package/templates/histoire/patches/histoire+0.17.6.patch +13 -0
- package/templates/histoire/src/main.histoire.ts +8 -0
- package/templates/service/[service.name].ts +8 -0
- package/.eslintrc.js +0 -7
- package/noeldemartin.config.js +0 -4
- package/src/lib/utils.test.ts +0 -33
- package/src/lib/utils.ts +0 -44
- package/templates/app/cypress.config.ts +0 -8
- /package/templates/app/src/assets/{styles.css → css/styles.css} +0 -0
|
@@ -1,16 +1,24 @@
|
|
|
1
1
|
import Aerogel, { AerogelResolver } from '@aerogel/vite';
|
|
2
2
|
import Components from 'unplugin-vue-components/vite';
|
|
3
3
|
import I18n from '@intlify/unplugin-vue-i18n/vite';
|
|
4
|
+
import Icons from 'unplugin-icons/vite';
|
|
5
|
+
import IconsResolver from 'unplugin-icons/resolver';
|
|
6
|
+
import { defineConfig } from 'vitest/config';
|
|
4
7
|
import { resolve } from 'path';
|
|
5
8
|
|
|
6
|
-
export default {
|
|
9
|
+
export default defineConfig({
|
|
10
|
+
publicDir: resolve(__dirname, './src/assets/public/'),
|
|
7
11
|
plugins: [
|
|
8
|
-
|
|
9
|
-
Aerogel(),
|
|
12
|
+
Aerogel({ name: '<% app.name %>' }),
|
|
10
13
|
Components({
|
|
11
|
-
dirs: ['src/pages'],
|
|
12
14
|
dts: false,
|
|
13
|
-
resolvers: [AerogelResolver()],
|
|
15
|
+
resolvers: [AerogelResolver(), IconsResolver()],
|
|
16
|
+
}),
|
|
17
|
+
I18n({ include: resolve(__dirname, './src/lang/**/*.yaml') }),
|
|
18
|
+
Icons({
|
|
19
|
+
iconCustomizer(_, __, props) {
|
|
20
|
+
props['aria-hidden'] = 'true';
|
|
21
|
+
},
|
|
14
22
|
}),
|
|
15
23
|
],
|
|
16
24
|
resolve: {
|
|
@@ -18,4 +26,4 @@ export default {
|
|
|
18
26
|
'@': resolve(__dirname, './src'),
|
|
19
27
|
},
|
|
20
28
|
},
|
|
21
|
-
};
|
|
29
|
+
});
|
|
@@ -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,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
|
+
});
|
package/.eslintrc.js
DELETED
package/noeldemartin.config.js
DELETED
package/src/lib/utils.test.ts
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { describe, expect, it } from 'vitest';
|
|
2
|
-
|
|
3
|
-
import { formatCodeBlock } from './utils';
|
|
4
|
-
|
|
5
|
-
describe('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
|
-
});
|
package/src/lib/utils.ts
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { resolve } from 'path';
|
|
2
|
-
|
|
3
|
-
export interface FormatCodeBlockOptions {
|
|
4
|
-
indent?: number;
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
export function basePath(path: string): string {
|
|
8
|
-
return resolve(__dirname, '../', path);
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export function formatCodeBlock(code: string, options: FormatCodeBlockOptions = {}): string {
|
|
12
|
-
const lines = code.split('\n');
|
|
13
|
-
const indent = options.indent ?? 0;
|
|
14
|
-
let originalIndent = 0;
|
|
15
|
-
let formatted = '';
|
|
16
|
-
|
|
17
|
-
for (const line of lines) {
|
|
18
|
-
const trimmedLine = line.trim();
|
|
19
|
-
const isEmptyLine = trimmedLine.length === 0;
|
|
20
|
-
|
|
21
|
-
if (formatted.length === 0) {
|
|
22
|
-
if (isEmptyLine) {
|
|
23
|
-
continue;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
originalIndent = line.indexOf(trimmedLine[0] ?? '');
|
|
27
|
-
formatted += `${' '.repeat(indent)}${trimmedLine}\n`;
|
|
28
|
-
|
|
29
|
-
continue;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
if (isEmptyLine) {
|
|
33
|
-
formatted += '\n';
|
|
34
|
-
|
|
35
|
-
continue;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
const lineIndent = line.indexOf(trimmedLine[0] ?? '');
|
|
39
|
-
|
|
40
|
-
formatted += `${' '.repeat(indent + lineIndent - originalIndent)}${trimmedLine}\n`;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
return formatted.trimEnd();
|
|
44
|
-
}
|
|
File without changes
|