@aerogel/cli 0.0.0-next.702e17f12493b62feba1d0af54d7c3b1d07f934c → 0.0.0-next.7b6199e0666e235c949739bdbc7cca2d54c8636e

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 (78) hide show
  1. package/bin/gel +1 -1
  2. package/dist/aerogel-cli.d.ts +1 -2
  3. package/dist/aerogel-cli.js +798 -0
  4. package/dist/aerogel-cli.js.map +1 -0
  5. package/package.json +20 -33
  6. package/src/cli.ts +11 -11
  7. package/src/commands/Command.ts +3 -3
  8. package/src/commands/create.test.ts +2 -2
  9. package/src/commands/create.ts +11 -11
  10. package/src/commands/generate-component.test.ts +3 -3
  11. package/src/commands/generate-component.ts +30 -19
  12. package/src/commands/generate-model.test.ts +1 -1
  13. package/src/commands/generate-model.ts +11 -11
  14. package/src/commands/generate-service.test.ts +2 -2
  15. package/src/commands/generate-service.ts +14 -14
  16. package/src/commands/info.ts +15 -0
  17. package/src/commands/install.test.ts +4 -10
  18. package/src/commands/install.ts +12 -12
  19. package/src/lib/App.ts +9 -6
  20. package/src/lib/Editor.ts +3 -4
  21. package/src/lib/File.mock.ts +7 -11
  22. package/src/lib/File.ts +3 -3
  23. package/src/lib/Log.mock.ts +4 -8
  24. package/src/lib/Log.test.ts +4 -4
  25. package/src/lib/Log.ts +7 -7
  26. package/src/lib/Shell.mock.ts +2 -2
  27. package/src/lib/Shell.ts +2 -2
  28. package/src/lib/Template.ts +19 -16
  29. package/src/lib/utils/app.ts +2 -2
  30. package/src/lib/utils/edit.ts +2 -2
  31. package/src/lib/utils/paths.ts +15 -7
  32. package/src/plugins/LocalFirst.ts +9 -0
  33. package/src/plugins/Plugin.ts +10 -28
  34. package/src/plugins/Solid.ts +14 -21
  35. package/src/plugins/Soukai.ts +5 -5
  36. package/src/testing/setup.ts +30 -31
  37. package/templates/app/.github/workflows/ci.yml +4 -4
  38. package/templates/app/.nvmrc +1 -1
  39. package/templates/app/.vscode/launch.json +1 -0
  40. package/templates/app/cypress/tsconfig.json +7 -8
  41. package/templates/app/index.html +2 -2
  42. package/templates/app/package.json +19 -18
  43. package/templates/app/src/App.vue +3 -3
  44. package/templates/app/src/assets/css/main.css +4 -0
  45. package/templates/app/src/main.ts +1 -1
  46. package/templates/app/tsconfig.json +3 -10
  47. package/templates/app/vite.config.ts +6 -4
  48. package/templates/component-button/[component.name].vue +2 -2
  49. package/templates/component-checkbox/[component.name].vue +34 -0
  50. package/templates/component-checkbox-story/[component.name].story.vue +63 -0
  51. package/templates/component-input/[component.name].vue +6 -5
  52. package/templates/component-input-story/[component.name].story.vue +4 -4
  53. package/templates/service/[service.name].ts +1 -1
  54. package/.prettierignore +0 -1
  55. package/dist/aerogel-cli.cjs.js +0 -2
  56. package/dist/aerogel-cli.cjs.js.map +0 -1
  57. package/dist/aerogel-cli.esm.js +0 -2
  58. package/dist/aerogel-cli.esm.js.map +0 -1
  59. package/src/commands/generate-overrides.ts +0 -85
  60. package/src/plugins/Histoire.ts +0 -105
  61. package/templates/app/postcss.config.js +0 -6
  62. package/templates/app/src/assets/css/styles.css +0 -3
  63. package/templates/app/tailwind.config.js +0 -5
  64. package/templates/histoire/histoire.config.ts +0 -7
  65. package/templates/histoire/patches/histoire+0.17.6.patch +0 -13
  66. package/templates/histoire/src/main.histoire.ts +0 -8
  67. package/templates/overrides/components/index.ts +0 -15
  68. package/templates/overrides/components/overrides/AlertModal.vue +0 -11
  69. package/templates/overrides/components/overrides/ConfirmModal.vue +0 -20
  70. package/templates/overrides/components/overrides/ErrorReportModal.vue +0 -35
  71. package/templates/overrides/components/overrides/LoadingModal.vue +0 -12
  72. package/templates/overrides/components/overrides/ModalWrapper.vue +0 -22
  73. package/templates/overrides/components/overrides/SnackbarNotification.vue +0 -34
  74. package/templates/overrides-story/Overrides.story.vue +0 -86
  75. package/templates/postcss-pseudo-classes/postcss.config.js +0 -15
  76. package/tsconfig.json +0 -11
  77. package/vite.config.ts +0 -14
  78. /package/src/{main.ts → index.ts} +0 -0
@@ -1,105 +0,0 @@
1
- import File from '@/lib/File';
2
- import Log from '@/lib/Log';
3
- import Plugin from '@/plugins/Plugin';
4
- import Shell from '@/lib/Shell';
5
- import Template from '@/lib/Template';
6
- import { isLinkedLocalApp } from '@/lib/utils/app';
7
- import { packagePath, templatePath } from '@/lib/utils/paths';
8
- import type { Editor } from '@/lib/Editor';
9
-
10
- export class Histoire extends Plugin {
11
-
12
- private installedPatchPackage: boolean = false;
13
- private installedPostCSSPseudoClasses: boolean = false;
14
-
15
- constructor() {
16
- super('histoire');
17
- }
18
-
19
- public async beforeInstall(): Promise<void> {
20
- this.installedPatchPackage = false;
21
- this.installedPostCSSPseudoClasses = false;
22
- }
23
-
24
- protected async afterInstall(): Promise<void> {
25
- if (!this.installedPatchPackage) {
26
- return;
27
- }
28
-
29
- await Log.animate('Patching dependencies', async () => {
30
- await Shell.run('npx patch-package');
31
- });
32
- }
33
-
34
- protected async updateFiles(editor: Editor): Promise<void> {
35
- await this.updateTailwindConfig(editor, {
36
- content: isLinkedLocalApp()
37
- ? `'${packagePath('histoire')}/dist/**/*.js'`
38
- : '\'./node_modules/@aerogel/histoire/dist/**/*.js\'',
39
- });
40
-
41
- await this.updateNpmScripts(editor);
42
- await this.createConfigFiles();
43
- await super.updateFiles(editor);
44
- }
45
-
46
- protected async installNpmDependencies(): Promise<void> {
47
- // We need this specific version because we're patching it using patch-package
48
- await Shell.run('npm install histoire@0.17.6 --save-dev');
49
-
50
- if (!File.contains('package.json', '"patch-package"')) {
51
- await Shell.run('npm install patch-package --save-dev');
52
-
53
- this.installedPatchPackage = true;
54
- }
55
-
56
- if (!File.contains('package.json', '"postcss-pseudo-classes"')) {
57
- await Shell.run('npm install postcss-pseudo-classes --save-dev');
58
-
59
- this.installedPostCSSPseudoClasses = true;
60
- }
61
-
62
- await super.installNpmDependencies();
63
- }
64
-
65
- protected getLocalPackageName(): string {
66
- return this.name;
67
- }
68
-
69
- protected async updateNpmScripts(editor: Editor): Promise<void> {
70
- Log.info('Updating npm scripts...');
71
-
72
- const packageJson = File.read('package.json');
73
-
74
- if (!packageJson) {
75
- return Log.fail('Could not find package.json file');
76
- }
77
-
78
- File.write(
79
- 'package.json',
80
- packageJson.replace(
81
- '"lint": "noeldemartin-lint src",',
82
- this.installedPatchPackage
83
- ? '"histoire": "histoire dev", "lint": "noeldemartin-lint src", "postinstall": "patch-package",'
84
- : '"histoire": "histoire dev", "lint": "noeldemartin-lint src",',
85
- ),
86
- );
87
-
88
- editor.addModifiedFile('package.json');
89
- }
90
-
91
- protected async createConfigFiles(): Promise<void> {
92
- Log.info('Creating config files...');
93
-
94
- Template.instantiate(templatePath('histoire'));
95
-
96
- if (this.installedPostCSSPseudoClasses) {
97
- Template.instantiate(templatePath('postcss-pseudo-classes'));
98
- }
99
- }
100
-
101
- protected isForDevelopment(): boolean {
102
- return true;
103
- }
104
-
105
- }
@@ -1,6 +0,0 @@
1
- module.exports = {
2
- plugins: {
3
- tailwindcss: {},
4
- autoprefixer: {},
5
- },
6
- };
@@ -1,3 +0,0 @@
1
- @tailwind base;
2
- @tailwind components;
3
- @tailwind utilities;
@@ -1,5 +0,0 @@
1
- /** @type {import('tailwindcss').Config} */
2
- module.exports = {
3
- content: ['./index.html', './src/**/*.{vue,ts}', '<% &contentPath %>'],
4
- plugins: [require('@tailwindcss/forms'), require('@tailwindcss/typography')],
5
- };
@@ -1,7 +0,0 @@
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
- });
@@ -1,13 +0,0 @@
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
- });
@@ -1,8 +0,0 @@
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
- });
@@ -1,15 +0,0 @@
1
- import { UIComponents } from '@aerogel/core';
2
-
3
- import AlertModal from './overrides/AlertModal.vue';
4
- import ConfirmModal from './overrides/ConfirmModal.vue';
5
- import ErrorReportModal from './overrides/ErrorReportModal.vue';
6
- import LoadingModal from './overrides/LoadingModal.vue';
7
- import SnackbarNotification from './overrides/SnackbarNotification.vue';
8
-
9
- export const components = {
10
- [UIComponents.AlertModal]: AlertModal,
11
- [UIComponents.ConfirmModal]: ConfirmModal,
12
- [UIComponents.ErrorReportModal]: ErrorReportModal,
13
- [UIComponents.LoadingModal]: LoadingModal,
14
- [UIComponents.Snackbar]: SnackbarNotification,
15
- };
@@ -1,11 +0,0 @@
1
- <template>
2
- <ModalWrapper :title="title">
3
- <AGMarkdown :text="message" />
4
- </ModalWrapper>
5
- </template>
6
-
7
- <script setup lang="ts">
8
- import { useAlertModalProps } from '@aerogel/core';
9
-
10
- defineProps(useAlertModalProps());
11
- </script>
@@ -1,20 +0,0 @@
1
- <template>
2
- <ModalWrapper v-slot="{ close }" :title="title" :cancellable="false">
3
- <AGMarkdown :text="message" />
4
- <div class="mt-4 flex flex-row-reverse">
5
- <AGButton @click="close(true)">
6
- {{ renderedAcceptText }}
7
- </AGButton>
8
- <AGButton color="clear" class="mr-2" @click="close(false)">
9
- {{ renderedCancelText }}
10
- </AGButton>
11
- </div>
12
- </ModalWrapper>
13
- </template>
14
-
15
- <script setup lang="ts">
16
- import { useConfirmModal, useConfirmModalProps } from '@aerogel/core';
17
-
18
- const props = defineProps(useConfirmModalProps());
19
- const { renderedAcceptText, renderedCancelText } = useConfirmModal(props);
20
- </script>
@@ -1,35 +0,0 @@
1
- <template>
2
- <ModalWrapper>
3
- <AGErrorReportModalTitle
4
- :report="report"
5
- :current-report="activeReportIndex + 1"
6
- :total-reports="reports.length"
7
- />
8
- <AGButton color="clear" :disabled="activeReportIndex === 0" @click="activeReportIndex--">
9
- {{ previousReportText }}
10
- </AGButton>
11
- <AGButton color="clear" :disabled="activeReportIndex === reports.length - 1" @click="activeReportIndex++">
12
- {{ nextReportText }}
13
- </AGButton>
14
- <AGErrorReportModalButtons :report="report">
15
- <template
16
- #default="{ url, handler, iconComponent, description }: IAGErrorReportModalButtonsDefaultSlotProps"
17
- >
18
- <AGButton :url="url" :aria-label="description" @click="handler">
19
- <component :is="iconComponent" />
20
- {{ description }}
21
- </AGButton>
22
- </template>
23
- </AGErrorReportModalButtons>
24
- <AGMarkdown v-if="report.description" :text="report.description" />
25
- <pre v-text="details" />
26
- </ModalWrapper>
27
- </template>
28
-
29
- <script setup lang="ts">
30
- import { useErrorReportModal, useErrorReportModalProps } from '@aerogel/core';
31
- import type { IAGErrorReportModalButtonsDefaultSlotProps } from '@aerogel/core';
32
-
33
- const props = defineProps(useErrorReportModalProps());
34
- const { activeReportIndex, details, nextReportText, previousReportText, report } = useErrorReportModal(props);
35
- </script>
@@ -1,12 +0,0 @@
1
- <template>
2
- <ModalWrapper :cancellable="false">
3
- <AGMarkdown :text="renderedMessage" />
4
- </ModalWrapper>
5
- </template>
6
-
7
- <script setup lang="ts">
8
- import { useLoadingModal, useLoadingModalProps } from '@aerogel/core';
9
-
10
- const props = defineProps(useLoadingModalProps());
11
- const { renderedMessage } = useLoadingModal(props);
12
- </script>
@@ -1,22 +0,0 @@
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>
@@ -1,34 +0,0 @@
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>
@@ -1,86 +0,0 @@
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>
@@ -1,15 +0,0 @@
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/tsconfig.json DELETED
@@ -1,11 +0,0 @@
1
- {
2
- "extends": "../../tsconfig.json",
3
- "compilerOptions": {
4
- "types": ["node"],
5
- "baseUrl": ".",
6
- "paths": {
7
- "@/*": ["./src/*"]
8
- }
9
- },
10
- "include": ["src/**/*.ts"]
11
- }
package/vite.config.ts DELETED
@@ -1,14 +0,0 @@
1
- import { defineConfig } from 'vitest/config';
2
- import { resolve } from 'path';
3
-
4
- export default defineConfig({
5
- test: {
6
- clearMocks: true,
7
- setupFiles: ['./src/testing/setup.ts'],
8
- },
9
- resolve: {
10
- alias: {
11
- '@': resolve(__dirname, './src'),
12
- },
13
- },
14
- });
File without changes