@aerogel/cli 0.0.0-next.b85327579d32f21c6a9fa21142f0165cdd320d7e → 0.0.0-next.d4e50d20bf4c270c2068f0a4398e9304ee4a062e

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 (67) 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 +1 -0
  5. package/dist/aerogel-cli.esm.js +1 -1
  6. package/dist/aerogel-cli.esm.js.map +1 -1
  7. package/package.json +10 -4
  8. package/src/cli.ts +22 -2
  9. package/src/commands/Command.ts +11 -6
  10. package/src/commands/create.test.ts +10 -1
  11. package/src/commands/create.ts +10 -7
  12. package/src/commands/generate-component.test.ts +49 -2
  13. package/src/commands/generate-component.ts +51 -18
  14. package/src/commands/generate-model.test.ts +1 -1
  15. package/src/commands/generate-model.ts +9 -10
  16. package/src/commands/generate-overrides.ts +85 -0
  17. package/src/commands/generate-service.ts +8 -9
  18. package/src/commands/info.ts +14 -0
  19. package/src/commands/install.test.ts +26 -3
  20. package/src/commands/install.ts +6 -5
  21. package/src/lib/App.ts +2 -2
  22. package/src/lib/Editor.ts +16 -9
  23. package/src/lib/Shell.mock.ts +1 -1
  24. package/src/lib/Template.ts +5 -1
  25. package/src/lib/utils/app.ts +1 -1
  26. package/src/lib/utils/paths.ts +5 -1
  27. package/src/plugins/Histoire.ts +105 -0
  28. package/src/plugins/Plugin.ts +58 -5
  29. package/src/plugins/Solid.ts +47 -34
  30. package/src/plugins/Soukai.ts +1 -1
  31. package/src/testing/setup.ts +5 -0
  32. package/templates/app/.github/workflows/ci.yml +14 -2
  33. package/templates/app/README.md +3 -0
  34. package/templates/app/cypress/cypress.config.ts +14 -0
  35. package/templates/app/cypress/support/e2e.ts +1 -3
  36. package/templates/app/index.html +3 -2
  37. package/templates/app/package.json +14 -2
  38. package/templates/app/src/App.vue +2 -2
  39. package/templates/app/src/assets/public/robots.txt +2 -0
  40. package/templates/app/src/main.ts +4 -4
  41. package/templates/app/tsconfig.json +1 -0
  42. package/templates/app/vite.config.ts +10 -4
  43. package/templates/component-button/[component.name].vue +42 -0
  44. package/templates/component-button-story/[component.name].story.vue +77 -0
  45. package/templates/component-input/[component.name].vue +16 -0
  46. package/templates/component-input-story/[component.name].story.vue +63 -0
  47. package/templates/histoire/histoire.config.ts +7 -0
  48. package/templates/histoire/patches/histoire+0.17.6.patch +13 -0
  49. package/templates/histoire/src/main.histoire.ts +8 -0
  50. package/templates/overrides/components/index.ts +15 -0
  51. package/templates/overrides/components/overrides/AlertModal.vue +11 -0
  52. package/templates/overrides/components/overrides/ConfirmModal.vue +20 -0
  53. package/templates/overrides/components/overrides/ErrorReportModal.vue +35 -0
  54. package/templates/overrides/components/overrides/LoadingModal.vue +12 -0
  55. package/templates/overrides/components/overrides/ModalWrapper.vue +22 -0
  56. package/templates/overrides/components/overrides/SnackbarNotification.vue +34 -0
  57. package/templates/overrides-story/Overrides.story.vue +86 -0
  58. package/templates/postcss-pseudo-classes/postcss.config.js +15 -0
  59. package/.eslintrc.js +0 -7
  60. package/noeldemartin.config.js +0 -14
  61. package/src/lib/utils/format.test.ts +0 -33
  62. package/src/lib/utils/format.ts +0 -38
  63. package/templates/app/.eslintrc.js +0 -3
  64. package/templates/app/cypress.config.ts +0 -12
  65. package/templates/app/prettier.config.js +0 -5
  66. /package/bin/{ag → gel} +0 -0
  67. /package/templates/app/src/assets/{styles.css → css/styles.css} +0 -0
@@ -0,0 +1,22 @@
1
+ <template>
2
+ <AGHeadlessModal ref="$modal" v-slot="{ close }" v-bind="props">
3
+ <AGHeadlessModalPanel>
4
+ <AGHeadlessModalTitle v-if="title">
5
+ <AGMarkdown :text="title" inline />
6
+ </AGHeadlessModalTitle>
7
+ <slot :close="close" />
8
+ </AGHeadlessModalPanel>
9
+ </AGHeadlessModal>
10
+ </template>
11
+
12
+ <script setup lang="ts">
13
+ import { ref } from 'vue';
14
+ import { useModalExpose, useModalProps } from '@aerogel/core';
15
+ import type { IAGHeadlessModal, IAGModal } from '@aerogel/core';
16
+
17
+ const props = defineProps(useModalProps());
18
+ const $modal = ref<IAGHeadlessModal>();
19
+
20
+ defineOptions({ inheritAttrs: false });
21
+ defineExpose<IAGModal>(useModalExpose($modal));
22
+ </script>
@@ -0,0 +1,34 @@
1
+ <template>
2
+ <AGHeadlessSnackbar :class="colorClasses">
3
+ <AGMarkdown :text="message" inline />
4
+
5
+ <AGButton
6
+ v-for="(action, i) of actions"
7
+ :key="i"
8
+ :color="color"
9
+ @click="activate(action)"
10
+ >
11
+ {{ action.text }}
12
+ </AGButton>
13
+ </AGHeadlessSnackbar>
14
+ </template>
15
+
16
+ <script setup lang="ts">
17
+ import { computed } from 'vue';
18
+ import { Colors, useSnackbar, useSnackbarProps } from '@aerogel/core';
19
+
20
+ const props = defineProps(useSnackbarProps());
21
+ const { activate } = useSnackbar(props);
22
+
23
+ const colorClasses = computed(() => {
24
+ switch (props.color) {
25
+ case Colors.Danger:
26
+ // Add your custom color classes here.
27
+ return '';
28
+ case Colors.Secondary:
29
+ default:
30
+ // Add your custom color classes here.
31
+ return '';
32
+ }
33
+ });
34
+ </script>
@@ -0,0 +1,86 @@
1
+ <template>
2
+ <Story :layout="{ type: 'grid', width: '90%' }">
3
+ <Variant title="Playground">
4
+ <div class="flex space-x-3">
5
+ <AGButton @click="$ui.alert(alertTitle, alertMessage)">
6
+ Alert
7
+ </AGButton>
8
+ <AGButton @click="$ui.confirm(confirmTitle, confirmMessage)">
9
+ Confirm
10
+ </AGButton>
11
+ <AGButton @click="$ui.loading(loadingMessage, after({ seconds: loadingDuration }))">
12
+ Loading
13
+ </AGButton>
14
+ <AGButton @click="$ui.showSnackbar(snackbarMessage, snackbarOptions)">
15
+ Snackbar
16
+ </AGButton>
17
+ <AGButton @click="$errors.inspect(errorReports)">
18
+ Error Report
19
+ </AGButton>
20
+ </div>
21
+
22
+ <AGAppOverlays />
23
+
24
+ <template #controls>
25
+ <HstText v-model="alertTitle" title="Alert Title" />
26
+ <HstText v-model="alertMessage" title="Alert Message" />
27
+ <HstText v-model="confirmTitle" title="Confirm Title" />
28
+ <HstText v-model="confirmMessage" title="Confirm Message" />
29
+ <HstText v-model="loadingMessage" title="Loading Message" />
30
+ <HstNumber v-model="loadingDuration" title="Loading Duration" />
31
+ <HstText v-model="snackbarMessage" title="Snackbar Message" />
32
+ <HstSelect v-model="snackbarColor" title="Snackbar Color" :options="snackbarColors" />
33
+ <HstText v-model="snackbarAction" title="Snackbar Action" />
34
+ <HstText v-model="errorReportTitle" title="Error Report Title" />
35
+ <HstText v-model="errorReportDescription" title="Error Report Description" />
36
+ </template>
37
+ </Variant>
38
+ </Story>
39
+ </template>
40
+
41
+ <script setup lang="ts">
42
+ import { computed, ref } from 'vue';
43
+ import { after, invert } from '@noeldemartin/utils';
44
+ import { Colors, SnackbarColors } from '@aerogel/core';
45
+ import type { ErrorReport, ShowSnackbarOptions } from '@aerogel/core';
46
+
47
+ const alertTitle = ref('Something important happened');
48
+ const alertMessage = ref('And here you can read the details...');
49
+ const confirmTitle = ref('Confirmation');
50
+ const confirmMessage = ref('Are you sure?');
51
+ const loadingMessage = ref('Loading...');
52
+ const loadingDuration = ref(3);
53
+ const snackbarMessage = ref('Something happened');
54
+ const snackbarColor = ref(Colors.Secondary);
55
+ const snackbarColors = invert(SnackbarColors);
56
+ const snackbarAction = ref('Ok');
57
+ const snackbarOptions = computed((): ShowSnackbarOptions => {
58
+ if (!snackbarAction.value) {
59
+ return {};
60
+ }
61
+
62
+ return {
63
+ color: snackbarColor.value,
64
+ actions: [
65
+ {
66
+ text: snackbarAction.value,
67
+ dismiss: true,
68
+ },
69
+ ],
70
+ };
71
+ });
72
+ const errorReportTitle = ref('Error');
73
+ const errorReportDescription = ref('Something went wrong!');
74
+ const errorReports = computed((): ErrorReport[] => [
75
+ {
76
+ title: errorReportTitle.value,
77
+ description: errorReportDescription.value,
78
+ details: new Error().stack,
79
+ },
80
+ {
81
+ title: errorReportTitle.value,
82
+ description: errorReportDescription.value,
83
+ details: new Error().stack,
84
+ },
85
+ ]);
86
+ </script>
@@ -0,0 +1,15 @@
1
+ const plugins = {
2
+ tailwindcss: {},
3
+ autoprefixer: {},
4
+ };
5
+
6
+ if (process.env.NODE_ENV === 'development') {
7
+ plugins['postcss-pseudo-classes'] = {
8
+ blacklist: [],
9
+ restrictTo: ['hover', 'focus-visible', 'focus'],
10
+ allCombinations: true,
11
+ preserveBeforeAfter: false,
12
+ };
13
+ }
14
+
15
+ module.exports = { plugins };
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,14 +0,0 @@
1
- /** @type {import('@noeldemartin/scripts').Config} */
2
- module.exports = {
3
- external: [
4
- '@noeldemartin/utils',
5
- 'chalk',
6
- 'child_process',
7
- 'commander',
8
- 'fs',
9
- 'mustache',
10
- 'path',
11
- 'readline',
12
- 'ts-morph',
13
- ],
14
- };
@@ -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,12 +0,0 @@
1
- import install from '@aerogel/cypress/dist/plugin';
2
- import { defineConfig } from 'cypress';
3
-
4
- export default defineConfig({
5
- e2e: {
6
- baseUrl: 'http://localhost:5001',
7
- video: false,
8
- setupNodeEvents(on) {
9
- install(on);
10
- },
11
- },
12
- });
@@ -1,5 +0,0 @@
1
- /** @type {import('prettier').Config} */
2
- module.exports = {
3
- plugins: [require('prettier-plugin-tailwindcss')],
4
- printWidth: 120,
5
- };
/package/bin/{ag → gel} RENAMED
File without changes