@aerogel/cli 0.0.0-next.a5b6ecb68fdca29d00c8b8906d00aa5bf64a9d7c → 0.0.0-next.b3caf219a503ce9b8c65ef1463132c9507f56c0a
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/bin/gel +1 -1
- package/dist/aerogel-cli.d.ts +2 -2
- package/dist/aerogel-cli.js +833 -0
- package/dist/aerogel-cli.js.map +1 -0
- package/package.json +20 -33
- package/src/cli.ts +28 -8
- package/src/commands/Command.ts +4 -7
- package/src/commands/create.test.ts +6 -14
- package/src/commands/create.ts +11 -11
- package/src/commands/generate-component.test.ts +11 -17
- package/src/commands/generate-component.ts +31 -20
- package/src/commands/generate-model.test.ts +3 -11
- package/src/commands/generate-model.ts +12 -12
- package/src/commands/generate-overrides.ts +85 -0
- package/src/commands/generate-service.test.ts +4 -12
- package/src/commands/generate-service.ts +15 -15
- package/src/commands/info.ts +15 -0
- package/src/commands/install.test.ts +4 -26
- package/src/commands/install.ts +11 -12
- package/src/lib/App.ts +9 -6
- package/src/lib/Editor.ts +3 -4
- package/src/lib/File.mock.ts +7 -11
- package/src/lib/File.ts +3 -3
- package/src/lib/Log.mock.ts +4 -8
- package/src/lib/Log.test.ts +4 -4
- package/src/lib/Log.ts +7 -7
- package/src/lib/Shell.mock.ts +2 -2
- package/src/lib/Shell.ts +2 -2
- package/src/lib/Template.ts +19 -16
- package/src/lib/utils/app.ts +2 -2
- package/src/lib/utils/edit.ts +2 -2
- package/src/lib/utils/paths.ts +15 -7
- package/src/plugins/Plugin.ts +8 -27
- package/src/plugins/Solid.ts +15 -22
- package/src/plugins/Soukai.ts +4 -4
- package/src/testing/setup.ts +30 -31
- package/templates/app/.github/workflows/ci.yml +4 -4
- package/templates/app/.nvmrc +1 -1
- package/templates/app/.vscode/launch.json +1 -0
- package/templates/app/cypress/cypress.config.ts +2 -4
- package/templates/app/cypress/support/e2e.ts +1 -3
- package/templates/app/cypress/tsconfig.json +7 -8
- package/templates/app/index.html +2 -2
- package/templates/app/package.json +19 -18
- package/templates/app/src/App.vue +3 -3
- package/templates/app/src/assets/css/main.css +4 -0
- package/templates/app/src/main.ts +4 -4
- package/templates/app/tsconfig.json +3 -10
- package/templates/app/vite.config.ts +6 -4
- package/templates/component-button/[component.name].vue +13 -3
- package/templates/component-button-story/[component.name].story.vue +7 -1
- package/templates/component-checkbox/[component.name].vue +34 -0
- package/templates/component-checkbox-story/[component.name].story.vue +63 -0
- package/templates/component-input/[component.name].vue +6 -5
- package/templates/component-input-story/[component.name].story.vue +4 -4
- package/templates/overrides/components/index.ts +15 -0
- package/templates/overrides/components/overrides/AlertModal.vue +11 -0
- package/templates/overrides/components/overrides/ConfirmModal.vue +20 -0
- package/templates/overrides/components/overrides/LoadingModal.vue +12 -0
- package/templates/overrides/components/overrides/ModalWrapper.vue +22 -0
- package/templates/overrides/components/overrides/SnackbarNotification.vue +34 -0
- package/templates/overrides-story/Overrides.story.vue +86 -0
- package/templates/service/[service.name].ts +1 -1
- package/dist/aerogel-cli.cjs.js +0 -2
- package/dist/aerogel-cli.cjs.js.map +0 -1
- package/dist/aerogel-cli.esm.js +0 -2
- package/dist/aerogel-cli.esm.js.map +0 -1
- package/src/plugins/Histoire.ts +0 -105
- package/src/testing/stubs/ProgramStub.ts +0 -35
- package/src/testing/utils.ts +0 -14
- package/templates/app/postcss.config.js +0 -6
- package/templates/app/src/assets/css/styles.css +0 -3
- package/templates/app/tailwind.config.js +0 -5
- package/templates/histoire/histoire.config.ts +0 -7
- package/templates/histoire/patches/histoire+0.17.6.patch +0 -13
- package/templates/histoire/src/main.histoire.ts +0 -8
- package/templates/postcss-pseudo-classes/postcss.config.js +0 -15
- package/tsconfig.json +0 -11
- package/vite.config.ts +0 -14
- /package/src/{main.ts → index.ts} +0 -0
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
2
|
+
<HeadlessButton :class="variantClasses" :disabled="disabled">
|
|
3
3
|
<slot />
|
|
4
|
-
</
|
|
4
|
+
</HeadlessButton>
|
|
5
5
|
</template>
|
|
6
6
|
|
|
7
7
|
<script setup lang="ts">
|
|
8
|
-
import { Colors, enumProp } from '@aerogel/core';
|
|
8
|
+
import { Colors, booleanProp, enumProp, removeInteractiveClasses } from '@aerogel/core';
|
|
9
9
|
import { computed } from 'vue';
|
|
10
10
|
|
|
11
11
|
const props = defineProps({
|
|
12
12
|
color: enumProp(Colors, Colors.Primary),
|
|
13
|
+
disabled: booleanProp(),
|
|
13
14
|
});
|
|
14
15
|
|
|
15
16
|
const colorClasses = computed(() => {
|
|
@@ -29,4 +30,13 @@ const colorClasses = computed(() => {
|
|
|
29
30
|
return '';
|
|
30
31
|
}
|
|
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
|
+
});
|
|
32
42
|
</script>
|
|
@@ -29,6 +29,12 @@
|
|
|
29
29
|
</<% component.name %>>
|
|
30
30
|
</Variant>
|
|
31
31
|
|
|
32
|
+
<Variant title="Disabled">
|
|
33
|
+
<<% component.name %> disabled>
|
|
34
|
+
You can't click me
|
|
35
|
+
</<% component.name %>>
|
|
36
|
+
</Variant>
|
|
37
|
+
|
|
32
38
|
<Variant title="Colors" :layout="{ width: '300px' }">
|
|
33
39
|
<div class="flex items-center gap-2">
|
|
34
40
|
<<% component.name %> color="primary">
|
|
@@ -61,7 +67,7 @@ const colorOptions = invert(Colors);
|
|
|
61
67
|
|
|
62
68
|
<style>
|
|
63
69
|
.story-<% component.slug %> {
|
|
64
|
-
grid-template-columns: repeat(
|
|
70
|
+
grid-template-columns: repeat(2, 300px) !important;
|
|
65
71
|
}
|
|
66
72
|
|
|
67
73
|
.story-<% component.slug %> .variant-playground,
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<HeadlessInput
|
|
3
|
+
ref="$input"
|
|
4
|
+
:name="name"
|
|
5
|
+
:class="className"
|
|
6
|
+
:label="label"
|
|
7
|
+
>
|
|
8
|
+
<HeadlessInputInput
|
|
9
|
+
v-bind="attrs"
|
|
10
|
+
type="checkbox"
|
|
11
|
+
/>
|
|
12
|
+
<div v-if="$slots.default">
|
|
13
|
+
<HeadlessInputLabel>
|
|
14
|
+
<slot />
|
|
15
|
+
</HeadlessInputLabel>
|
|
16
|
+
<HeadlessInputError />
|
|
17
|
+
</div>
|
|
18
|
+
</HeadlessInput>
|
|
19
|
+
</template>
|
|
20
|
+
|
|
21
|
+
<script setup lang="ts">
|
|
22
|
+
import { HeadlessInputLabel, componentRef, stringProp, useInputAttrs } from '@aerogel/core';
|
|
23
|
+
import type { IHeadlessInput } from '@aerogel/core';
|
|
24
|
+
|
|
25
|
+
defineOptions({ inheritAttrs: false });
|
|
26
|
+
defineProps({
|
|
27
|
+
name: stringProp(),
|
|
28
|
+
label: stringProp(),
|
|
29
|
+
inputClass: stringProp(''),
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
const $input = componentRef<IHeadlessInput>();
|
|
33
|
+
const [attrs, className] = useInputAttrs();
|
|
34
|
+
</script>
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<Story group="base" :layout="{ type: 'grid' }">
|
|
3
|
+
<Variant title="Playground">
|
|
4
|
+
<Form :form="form" class="m-1">
|
|
5
|
+
<<% component.name %> name="accept" :form="form">
|
|
6
|
+
{{ label }}
|
|
7
|
+
</<% component.name %>>
|
|
8
|
+
</Form>
|
|
9
|
+
|
|
10
|
+
<template #controls>
|
|
11
|
+
<HstText v-model="label" title="Label" />
|
|
12
|
+
</template>
|
|
13
|
+
</Variant>
|
|
14
|
+
|
|
15
|
+
<Variant title="Default">
|
|
16
|
+
<<% component.name %> class="m-1">
|
|
17
|
+
Accept Terms & Conditions
|
|
18
|
+
</<% component.name %>>
|
|
19
|
+
</Variant>
|
|
20
|
+
|
|
21
|
+
<Variant title="Hover">
|
|
22
|
+
<<% component.name %> class="m-1" input-class=":hover">
|
|
23
|
+
Accept Terms & Conditions
|
|
24
|
+
</<% component.name %>>
|
|
25
|
+
</Variant>
|
|
26
|
+
|
|
27
|
+
<Variant title="Focus">
|
|
28
|
+
<<% component.name %> class="m-1" input-class=":focus :focus-visible">
|
|
29
|
+
Accept Terms & Conditions
|
|
30
|
+
</<% component.name %>>
|
|
31
|
+
</Variant>
|
|
32
|
+
|
|
33
|
+
<Variant title="Error">
|
|
34
|
+
<Form :form="errorForm" class="m-1">
|
|
35
|
+
<<% component.name %> name="accept">
|
|
36
|
+
Accept Terms & Conditions
|
|
37
|
+
</<% component.name %>>
|
|
38
|
+
</Form>
|
|
39
|
+
</Variant>
|
|
40
|
+
</Story>
|
|
41
|
+
</template>
|
|
42
|
+
|
|
43
|
+
<script setup lang="ts">
|
|
44
|
+
import { requiredBooleanInput, useForm } from '@aerogel/core';
|
|
45
|
+
import { ref } from 'vue';
|
|
46
|
+
|
|
47
|
+
const form = useForm({ accept: requiredBooleanInput(true) });
|
|
48
|
+
const errorForm = useForm({ accept: requiredBooleanInput() });
|
|
49
|
+
const label = ref('Accept Terms & Conditions');
|
|
50
|
+
|
|
51
|
+
form.submit();
|
|
52
|
+
errorForm.submit();
|
|
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>
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
3
|
-
<
|
|
4
|
-
<
|
|
5
|
-
<
|
|
6
|
-
|
|
2
|
+
<HeadlessInput v-bind="props">
|
|
3
|
+
<HeadlessInputLabel />
|
|
4
|
+
<HeadlessInputInput v-bind="attrs" />
|
|
5
|
+
<HeadlessInputDescription />
|
|
6
|
+
<HeadlessInputError />
|
|
7
|
+
</HeadlessInput>
|
|
7
8
|
</template>
|
|
8
9
|
|
|
9
10
|
<script setup lang="ts">
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<Story :layout="{ type: 'grid' }">
|
|
3
3
|
<Variant title="Playground">
|
|
4
|
-
<
|
|
4
|
+
<Form :form="form">
|
|
5
5
|
<<% component.name %> name="food" :label="label" :placeholder="placeholder" />
|
|
6
|
-
</
|
|
6
|
+
</Form>
|
|
7
7
|
|
|
8
8
|
<template #controls>
|
|
9
9
|
<HstText v-model="label" title="Label" />
|
|
@@ -25,14 +25,14 @@
|
|
|
25
25
|
</Variant>
|
|
26
26
|
|
|
27
27
|
<Variant title="Error">
|
|
28
|
-
<
|
|
28
|
+
<Form :form="errorForm">
|
|
29
29
|
<<% component.name %>
|
|
30
30
|
name="food"
|
|
31
31
|
label="What's the best food?"
|
|
32
32
|
placeholder="Ramen"
|
|
33
33
|
class=":focus :focus-visible"
|
|
34
34
|
/>
|
|
35
|
-
</
|
|
35
|
+
</Form>
|
|
36
36
|
</Variant>
|
|
37
37
|
</Story>
|
|
38
38
|
</template>
|
|
@@ -0,0 +1,15 @@
|
|
|
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
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<ModalWrapper v-slot="{ close }" :title="title" persistent>
|
|
3
|
+
<AGMarkdown :text="message" :actions="actions" />
|
|
4
|
+
<div class="mt-4 flex flex-row-reverse">
|
|
5
|
+
<Button :variant="acceptColor" @click="close(true)">
|
|
6
|
+
{{ renderedAcceptText }}
|
|
7
|
+
</Button>
|
|
8
|
+
<Button v-if="!required" :variant="cancelColor" class="mr-2" @click="close(false)">
|
|
9
|
+
{{ renderedCancelText }}
|
|
10
|
+
</Button>
|
|
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>
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<ModalWrapper persistent>
|
|
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>
|
|
@@ -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 { modalExpose, modalProps } from '@aerogel/core';
|
|
15
|
+
import type { IAGHeadlessModal, IAGModal } from '@aerogel/core';
|
|
16
|
+
|
|
17
|
+
const props = defineProps(modalProps());
|
|
18
|
+
const $modal = ref<IAGHeadlessModal>();
|
|
19
|
+
|
|
20
|
+
defineOptions({ inheritAttrs: false });
|
|
21
|
+
defineExpose(modalExpose($modal));
|
|
22
|
+
</script>
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<AGHeadlessSnackbar :class="colorClasses">
|
|
3
|
+
<AGMarkdown :text="message" inline />
|
|
4
|
+
|
|
5
|
+
<Button
|
|
6
|
+
v-for="(action, i) of actions"
|
|
7
|
+
:key="i"
|
|
8
|
+
:variant="color"
|
|
9
|
+
@click="activate(action)"
|
|
10
|
+
>
|
|
11
|
+
{{ action.text }}
|
|
12
|
+
</Button>
|
|
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
|
+
<Button @click="$ui.alert(alertTitle, alertMessage)">
|
|
6
|
+
Alert
|
|
7
|
+
</Button>
|
|
8
|
+
<Button @click="$ui.confirm(confirmTitle, confirmMessage)">
|
|
9
|
+
Confirm
|
|
10
|
+
</Button>
|
|
11
|
+
<Button @click="$ui.loading(loadingMessage, after({ seconds: loadingDuration }))">
|
|
12
|
+
Loading
|
|
13
|
+
</Button>
|
|
14
|
+
<Button @click="$ui.showSnackbar(snackbarMessage, snackbarOptions)">
|
|
15
|
+
Snackbar
|
|
16
|
+
</Button>
|
|
17
|
+
<Button @click="$errors.inspect(errorReports)">
|
|
18
|
+
Error Report
|
|
19
|
+
</Button>
|
|
20
|
+
</div>
|
|
21
|
+
|
|
22
|
+
<AppOverlays />
|
|
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>
|
package/dist/aerogel-cli.cjs.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("commander"),t=require("@babel/runtime/helpers/defineProperty"),s=require("path"),i=require("@noeldemartin/utils");require("core-js/modules/esnext.async-iterator.reduce.js"),require("core-js/modules/esnext.iterator.constructor.js"),require("core-js/modules/esnext.iterator.reduce.js");var n=require("fs");require("core-js/modules/esnext.async-iterator.for-each.js"),require("core-js/modules/esnext.iterator.for-each.js"),require("core-js/modules/esnext.async-iterator.find.js"),require("core-js/modules/esnext.iterator.find.js"),require("core-js/modules/esnext.async-iterator.map.js"),require("core-js/modules/esnext.iterator.map.js");var a=require("chalk"),r=require("readline"),o=require("mustache");require("core-js/modules/esnext.set.add-all.js"),require("core-js/modules/esnext.set.delete-all.js"),require("core-js/modules/esnext.set.difference.js"),require("core-js/modules/esnext.set.every.js"),require("core-js/modules/esnext.set.filter.js"),require("core-js/modules/esnext.set.find.js"),require("core-js/modules/esnext.set.intersection.js"),require("core-js/modules/esnext.set.is-disjoint-from.js"),require("core-js/modules/esnext.set.is-subset-of.js"),require("core-js/modules/esnext.set.is-superset-of.js"),require("core-js/modules/esnext.set.join.js"),require("core-js/modules/esnext.set.map.js"),require("core-js/modules/esnext.set.reduce.js"),require("core-js/modules/esnext.set.some.js"),require("core-js/modules/esnext.set.symmetric-difference.js"),require("core-js/modules/esnext.set.union.js");var l=require("ts-morph"),c=require("child_process");function d(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}require("core-js/modules/esnext.async-iterator.some.js"),require("core-js/modules/esnext.iterator.some.js");var p=d(t);var u=i.facade(new class{contains(e,t){return!!this.read(e)?.includes(t)}exists(e){return n.existsSync(e)}isSymlink(e){return n.lstatSync(e).isSymbolicLink()}read(e){return this.isFile(e)?n.readFileSync(e).toString():null}getFiles(e){const t=n.readdirSync(e,{withFileTypes:!0}),i=[];for(const n of t){const t=s.resolve(e,n.name);n.isDirectory()?i.push(...this.getFiles(t)):i.push(t)}return i}isDirectory(e){return this.exists(e)&&n.lstatSync(e).isDirectory()}isFile(e){return this.exists(e)&&n.lstatSync(e).isFile()}isEmptyDirectory(e){return!!this.isDirectory(e)&&0===this.getFiles(e).length}makeDirectory(e){n.mkdirSync(e,{recursive:!0})}write(e,t){n.existsSync(s.dirname(e))||n.mkdirSync(s.dirname(e),{recursive:!0}),n.writeFileSync(e,t)}});var m=i.facade(new class{constructor(){p.default(this,"renderInfo",a.hex("#00ffff")),p.default(this,"renderSuccess",a.hex("#00ff00")),p.default(this,"renderError",a.hex("#ff0000"))}async animate(e,t){var s=this;const i=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",i=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const a=s.renderInfo(s.renderMarkdown(e)+(i?"...":".".repeat(n%4)))+t;s.stdout(a)};let n=0;i();const a=setInterval((()=>(n++,i())),1e3),r=await t();return clearInterval(a),i("\n",!0),r}info(e){this.log(this.renderMarkdown(e),this.renderInfo)}error(e){this.log(this.renderMarkdown(e),this.renderError)}fail(e){this.error(e),process.exit(1)}success(e){this.log(this.renderMarkdown(e),this.renderSuccess)}renderMarkdown(e){const t=i.stringMatchAll(e,/\*\*(.*)\*\*/g);for(const s of t)e=e.replace(s[0],a.bold(s[1]));return e}log(e,t){this.formatMessage(e).forEach((e=>{this.logLine(t?t(e):e)}))}formatMessage(e){if("\n"===e[0]){const t=(e=e.slice(1).trimEnd()).split("\n"),s=e.trim()[0]??"",i=t.find((e=>e.trim().length>0))?.indexOf(s)??0;return t.map((e=>e.slice(i)))}return[e]}logLine(e){console.log(e)}stdout(e){r.cursorTo(process.stdout,0),r.clearLine(process.stdout,0),process.stdout.write(e)}});class g{static instantiate(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"./",s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return new g(e).instantiate(t,s)}constructor(e){p.default(this,"path",void 0),this.path=e}instantiate(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const s=this.getFilenameReplacements(t),i=[];e=`${e}/`.replace(/\/\//,"/");for(const a of u.getFiles(this.path)){const r=Object.entries(s).reduce(((e,t)=>{let[s,i]=t;return e.replaceAll(s,i)}),a.substring(this.path.length+1)),l=n.readFileSync(a).toString(),c=e+(r.endsWith(".template")?r.slice(0,-9):r);u.write(c,o.render(l,t,void 0,["<%","%>"])),i.push(c)}return i}getFilenameReplacements(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";return Object.entries(e).reduce(((e,s)=>{let[n,a]=s;return"object"==typeof a?Object.assign(e,this.getFilenameReplacements(a,`${n}.`)):e[`[${t}${n}]`]=i.toString(a),e}),{})}}function h(e){return m.fail(`Could not find ${e} pack file, did you run 'npm pack'?`)}function f(e){return u.getFiles(y(e)).find((e=>e.endsWith(".tgz")))??null}function y(e){return function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";if(u.contains(s.resolve(__dirname,"../../../package.json"),'"name": "aerogel"'))return s.resolve(__dirname,"../",e);const t=u.read(s.resolve(__dirname,"../../../../package.json")),n=i.stringMatch(t??"",/"@aerogel\/core": "file:(.*)\/aerogel-core-[\d.]*\.tgz"/),a=n?.[1]??m.fail("Could not determine base path");return s.resolve(a,e)}(`../${e}`)}function v(e){return s.resolve(__dirname,`../templates/${e}`)}var w=i.facade(new class{constructor(){p.default(this,"cwd",null)}setWorkingDirectory(e){this.cwd=e}async run(e){await new Promise(((t,s)=>{c.exec(e,{cwd:this.cwd??void 0},(e=>{e?s(e):t()}))}))}});class j{constructor(){p.default(this,"project",void 0),p.default(this,"modifiedFiles",void 0),this.project=new l.Project({tsConfigFilePath:"tsconfig.json"}),this.modifiedFiles=new Set,this.project.addSourceFilesAtPaths("src/**/*.ts"),this.project.addSourceFilesAtPaths("tailwind.config.js"),this.project.addSourceFilesAtPaths("vite.config.ts"),this.project.addSourceFilesAtPaths("package.json")}addSourceFile(e){this.project.addSourceFilesAtPaths(e)}requireSourceFile(e){return this.project.getSourceFileOrThrow(e)}async format(){await m.animate("Formatting modified files",(async()=>{const e=u.exists("prettier.config.js")||u.contains("package.json",'"prettier": {'),t=u.exists(".eslintrc.js")||u.contains("package.json",'"eslintConfig"'),s=u.contains("package.json",'"prettier-eslint-cli"')?e=>w.run(`npx prettier-eslint ${e} --write`):async s=>{e&&await w.run(`npx prettier ${s} --write`),s.match(/\.(ts|js|vue)$/)&&t&&await w.run(`npx eslint ${s} --fix`)};await Promise.all(i.arrayFrom(this.modifiedFiles).map((async e=>s(e))))}))}async save(e){await e.save(),this.addModifiedFile(e.getFilePath())}addModifiedFile(e){this.modifiedFiles.add(e)}}class x{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};p.default(this,"name",void 0),p.default(this,"options",void 0),this.name=e,this.options=t}create(e){!u.exists(e)||u.isDirectory(e)&&u.isEmptyDirectory(e)||m.fail(`Folder at '${e}' already exists!`),g.instantiate(v("app"),e,{app:{name:this.name,slug:i.stringToSlug(this.name)},dependencies:this.getDependencies(),contentPath:this.options.linkedLocal?`${y("core")}/dist/**/*.js`:"./node_modules/@aerogel/core/dist/**/*.js"})}edit(){return new j}getDependencies(){const e=e=>Object.entries(e).reduce(((e,t)=>{let[s,i]=t;return Object.assign(e,{[s]:`file:${i}`})}),{});return this.options.linkedLocal?e({aerogelCli:y("cli"),aerogelCore:y("core"),aerogelCypress:y("cypress"),aerogelPluginI18n:y("plugin-i18n"),aerogelPluginSoukai:y("plugin-soukai"),aerogelVite:y("vite")}):this.options.local?e({aerogelCli:f("cli")??h("cli"),aerogelCore:f("core")??h("core"),aerogelCypress:f("cypress")??h("cypress"),aerogelPluginI18n:f("plugin-i18n")??h("plugin-i18n"),aerogelPluginSoukai:f("plugin-soukai")??h("plugin-soukai"),aerogelVite:f("vite")??h("vite")}):{aerogelCli:"next",aerogelCore:"next",aerogelCypress:"next",aerogelPluginI18n:"next",aerogelPluginSoukai:"next",aerogelVite:"next"}}}class k{static define(e){var t=this;e=e.command(this.command).description(this.description);for(const[t,s]of this.parameters)e=e.argument(`<${t}>`,s);for(const[t,s]of Object.entries(this.options)){const i="string"==typeof s?s:s.description,n="string"==typeof s?"string":s.type??"string";e=e.option("boolean"===n?`--${t}`:`--${t} <${n}>`,i)}e=e.action((function(){for(var e=arguments.length,s=new Array(e),i=0;i<e;i++)s[i]=arguments[i];return t.run.call(t,...s)}))}static async run(){for(var e=arguments.length,t=new Array(e),s=0;s<e;s++)t[s]=arguments[s];const i=new this(...t);await i.validate(),await i.run()}async validate(){}async run(){}assertAerogelOrDirectory(e){const t=u.read("package.json");if(t?.includes("@aerogel/core"))return;if(e&&u.isDirectory(e))return;const s=e?`${e} folder does not exist.`:"package.json does not contain @aerogel/core.";m.fail(`${s} Are you sure this is an Aerogel app?`)}}p.default(k,"command",""),p.default(k,"description",""),p.default(k,"parameters",[]),p.default(k,"options",{});class S extends k{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};super(),p.default(this,"path",void 0),p.default(this,"options",void 0),this.path=e,this.options=t}async run(){const e=this.path,t=this.options.name??i.stringToTitleCase(s.basename(e));w.setWorkingDirectory(e),await this.createApp(t,e),await this.installDependencies(),await this.initializeGit(),m.success(`\n\n That's it! You can start working on **${t}** doing the following:\n\n cd ${e}\n npm run dev\n\n Have fun!\n `)}async createApp(e,t){m.info(`Creating **${e}**...`),new x(e,{local:this.options.local,linkedLocal:this.options.local&&!this.options.copy}).create(t)}async installDependencies(){await m.animate("Installing dependencies",(async()=>{await w.run("npm install")}))}async initializeGit(){await m.animate("Initializing git",(async()=>{await w.run("git init"),await w.run("git add ."),await w.run('git commit -m "Start"')}))}}function C(){return new x("")}function $(){return u.isSymlink("node_modules/@aerogel/core")}function F(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!e)return;const s=t.guard??(()=>!0),n=t.validate??(()=>!0),a=i.arrayFrom(t.skip??[]);return e.forEachDescendant(((e,t)=>{if(s(e)&&n(e))return e;const i=e.getKind();a.includes(i)&&t.skip()}))}function P(e,t){if(e&&t(e))return e}p.default(S,"command","create"),p.default(S,"description","Create AerogelJS app"),p.default(S,"parameters",[["path","Application path"]]),p.default(S,"options",{name:"Application name",local:{type:"boolean",description:"Whether to create an app using local Aerogel packages (used for core development)"},copy:{type:"boolean",description:"Whether to create an app linked to local Aerogel packages (used in CI)"}});class b extends k{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};super(),p.default(this,"path",void 0),p.default(this,"options",void 0),this.path=e,this.options=t}async validate(){this.options.button&&this.options.input&&m.fail("Cannot use both 'button' and 'input' flags!")}async run(){this.assertAerogelOrDirectory("src/components"),this.assertHistoireInstalled();const e=new Set,[t,s]=this.parsePathComponents();await this.createComponent(t,s,e),await this.createStory(t,s,e),await this.declareComponents();const n=i.arrayFrom(e).map((e=>`- ${e}`)).join("\n");m.info(`${s} component created successfully! The following files were created:\n\n${n}`)}assertHistoireInstalled(){this.options.story&&(u.contains("package.json",'"histoire"')||u.contains("package.json",'"@aerogel/histoire"')||m.fail("\n Histoire is not installed yet! You can install it running:\n npx ag install histoire\n "))}async createComponent(e,t,s){await m.animate("Creating component",(async()=>{u.exists(`src/components/${this.path}.vue`)&&m.fail(`${this.path} component already exists!`);const n=this.options.input?"component-input":this.options.button?"component-button":"component";g.instantiate(v(n),`src/components/${e}`,{component:{name:t,slug:i.stringToSlug(t)}}).forEach((e=>s.add(e)))}))}async createStory(e,t,s){this.options.story&&await m.animate("Creating story",(async()=>{const n=this.options.input?"component-input-story":this.options.button?"component-button-story":"component-story";g.instantiate(v(n),`src/components/${e}`,{component:{name:t,slug:i.stringToSlug(t)}}).forEach((e=>s.add(e)))}))}async declareComponents(){const e=C().edit(),t=e.requireSourceFile("vite.config.ts"),s=this.getComponentDirsArray(t);if(!s)return m.fail("Could not find component dirs declaration in vite config!");s.getDescendantsOfKind(l.SyntaxKind.StringLiteral).some((e=>"'src/components'"===e.getText()))||(await m.animate("Updating vite config",(async()=>{s.addElement("'src/components'"),await e.save(t)})),await e.format())}getComponentDirsArray(e){const t=F(e,{guard:l.Node.isCallExpression,validate:e=>e.getText().startsWith("Components("),skip:l.SyntaxKind.ImportDeclaration});if(!t)return null;const s=F(t,{guard:l.Node.isPropertyAssignment,validate:e=>"dirs"===e.getName()}),i=s?.getInitializer();return l.Node.isArrayLiteralExpression(i)?i:this.declareComponentDirsArray(t)}declareComponentDirsArray(e){const t=F(e,{guard:l.Node.isObjectLiteralExpression}),s=t?.addPropertyAssignment({name:"dirs",initializer:"[]"});return s?.getInitializer()??null}parsePathComponents(){const e=this.path.lastIndexOf("/");return-1===e?["",this.path]:[this.path.substring(0,e),this.path.substring(e+1)]}}p.default(b,"command","generate:component"),p.default(b,"description","Generate an AerogelJS Component"),p.default(b,"parameters",[["path","Component path (relative to components folder; extension not necessary)"]]),p.default(b,"options",{button:{description:"Create a custom button",type:"boolean"},input:{description:"Create a custom input",type:"boolean"},story:{description:"Create component story using Histoire",type:"boolean"}});class D extends k{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};super(),p.default(this,"name",void 0),p.default(this,"options",void 0),this.name=e,this.options=t}async run(){this.assertAerogelOrDirectory("src/models"),u.exists(`src/models/${this.name}.ts`)&&m.fail(`${this.name} model already exists!`),this.assertSoukaiInstalled();const e=await m.animate("Creating model",(async()=>g.instantiate(v("model"),"src/models",{model:{name:this.name,fieldsDefinition:this.getFieldsDefinition()},soukaiImports:this.options.fields?"FieldType, defineModelSchema":"defineModelSchema"}).map((e=>`- ${e}`)).join("\n")));m.info(`${this.name} model created successfully! The following files were created:\n\n${e}`)}getFieldsDefinition(){if(!this.options.fields)return" //";const e=this.options.fields.split(",").map((e=>{const[t,s,n]=e.split(":");return{name:t,type:i.stringToStudlyCase(s??"string"),required:"required"===n}})).reduce(((e,t)=>e+`\n${t.required?i.formatCodeBlock(`\n ${t.name}: {\n type: FieldType.${t.type},\n required: true,\n }\n `):`${t.name}: FieldType.${t.type}`},`),"");return i.formatCodeBlock(e,{indent:8})}assertSoukaiInstalled(){u.contains("package.json",'"soukai"')||u.contains("package.json",'"@aerogel/plugin-soukai"')||m.fail("\n Soukai is not installed yet! You can install it running:\n npx ag install soukai\n ")}}p.default(D,"command","generate:model"),p.default(D,"description","Generate an AerogelJS Model"),p.default(D,"parameters",[["name","Model name"]]),p.default(D,"options",{fields:"Create model with the given fields"});class I extends k{constructor(e){super(),p.default(this,"name",void 0),this.name=e}async run(){this.assertAerogelOrDirectory("src/services");const e=new Set,t=C().edit();await this.createService(e),await this.registerService(t),await t.format();const s=i.arrayFrom(e).map((e=>`- ${e}`)).join("\n");m.info(`${this.name} service created successfully! The following files were created:\n\n${s}`)}async createService(e){await m.animate("Creating service",(async()=>{u.exists(`src/services/${this.name}.ts`)&&m.fail(`${this.name} service already exists!`);g.instantiate(v("service"),"src/services",{service:{name:this.name}}).forEach((t=>e.add(t)))}))}async registerService(e){await m.animate("Registering service",(async()=>{u.exists("src/services/index.ts")||await this.createServicesIndex(e);const t=e.requireSourceFile("src/services/index.ts"),s=this.getServicesObject(t);if(!s)return m.fail("Could not find services object in services config, please add it manually.");t.addImportDeclaration({defaultImport:this.name,moduleSpecifier:`./${this.name}`}),s.addPropertyAssignment({name:`$${i.stringToCamelCase(this.name)}`,initializer:this.name}),await e.save(t)}))}async createServicesIndex(e){u.write("src/services/index.ts",i.formatCodeBlock("\n export const services = {};\n\n export type AppServices = typeof services;\n\n declare module '@vue/runtime-core' {\n interface ComponentCustomProperties extends AppServices {}\n }\n ")),e.addSourceFile("src/services/index.ts");const t=e.requireSourceFile("src/main.ts"),s=this.getBootstrapOptions(t);if(!s)return m.fail("Could not find options object in bootstrap config, please add the services manually.");s.insertShorthandPropertyAssignment(0,{name:"services"}),t.addImportDeclaration({namedImports:["services"],moduleSpecifier:"./services"}),await e.save(t)}getBootstrapOptions(e){const t=F(e,{guard:l.Node.isCallExpression,validate:e=>"bootstrapApplication"===e.getExpression().getText(),skip:l.SyntaxKind.ImportDeclaration}),s=t?.getArguments()[1];return l.Node.isObjectLiteralExpression(s)?s:null}getServicesObject(e){const t=F(e,{guard:l.Node.isVariableDeclaration,validate:e=>"services"===e.getName()}),s=t?.getInitializer();return l.Node.isObjectLiteralExpression(s)?s:null}}p.default(I,"command","generate:service"),p.default(I,"description","Generate an AerogelJS Service"),p.default(I,"parameters",[["name","Service name"]]);class A{constructor(e){p.default(this,"name",void 0),this.name=e}async install(){this.assertNotInstalled(),await this.beforeInstall(),await this.installDependencies();{const e=C().edit();await this.updateFiles(e),await e.format()}await this.afterInstall(),m.info(`Plugin ${this.name} installed!`)}assertNotInstalled(){u.contains("package.json",`"${this.getNpmPackageName()}"`)&&m.fail(`${this.name} is already installed!`)}async beforeInstall(){}async afterInstall(){}async installDependencies(){await m.animate("Installing plugin dependencies",(async()=>{await this.installNpmDependencies()}))}async updateFiles(e){this.isForDevelopment()||await this.updateBootstrapConfig(e)}async installNpmDependencies(){const e=this.isForDevelopment()?"--save-dev":"";if($())await w.run(`npm install file:${y(this.getLocalPackageName())} ${e}`);else if(u.contains("package.json",'"@aerogel/core": "file:')){const t=f(this.getLocalPackageName())??h(this.getLocalPackageName());await w.run(`npm install file:${t} ${e}`)}else await w.run(`npm install ${this.getNpmPackageName()}@next --save-exact ${e}`)}async updateBootstrapConfig(e){await m.animate("Injecting plugin in bootstrap configuration",(async()=>{const t=e.requireSourceFile("src/main.ts"),s=this.getBootstrapPluginsDeclaration(t);if(!s)return m.fail(`\n Could not find plugins array in bootstrap config, please add the following manually:\n\n ${this.getBootstrapConfig()}\n `);t.addImportDeclaration(this.getBootstrapImport()),s.addElement(this.getBootstrapConfig()),await e.save(t)}))}async updateTailwindConfig(e,t){await m.animate("Updating tailwind configuration",(async()=>{const s=e.requireSourceFile("tailwind.config.js"),i=this.getTailwindContentArray(s);if(!i)return m.fail(`\n Could not find content array in tailwind config, please add the following manually:\n\n ${t.content}\n `);i.addElement(t.content),await e.save(s)}))}getBootstrapPluginsDeclaration(e){const t=F(e,{guard:l.Node.isCallExpression,validate:e=>"bootstrapApplication"===e.getExpression().getText(),skip:l.SyntaxKind.ImportDeclaration}),s=t?.getArguments()[1],i=P(s,l.Node.isObjectLiteralExpression)?.getProperty("plugins"),n=P(i,l.Node.isPropertyAssignment)?.getInitializer();return l.Node.isArrayLiteralExpression(n)?n:null}getTailwindContentArray(e){const t=F(e,{guard:l.Node.isPropertyAssignment,validate:e=>"content"===e.getName(),skip:l.SyntaxKind.JSDoc}),s=t?.getInitializer();return l.Node.isArrayLiteralExpression(s)?s:null}getBootstrapImport(){return{defaultImport:this.name,moduleSpecifier:`@aerogel/plugin-${this.name}`}}getNpmPackageName(){return`@aerogel/${this.getLocalPackageName()}`}getLocalPackageName(){return`plugin-${this.name}`}isForDevelopment(){return!1}getBootstrapConfig(){return`${this.name}()`}}const q=[new class extends A{constructor(){super("soukai")}async installNpmDependencies(){await w.run("npm install soukai@next --save-exact"),await super.installNpmDependencies()}getBootstrapConfig(){return"soukai({ models: import.meta.glob('@/models/*', { eager: true }) })"}},new class extends A{constructor(){super("solid")}async updateFiles(e){await this.updateTailwindConfig(e,{content:$()?`'${y("plugin-solid")}/dist/**/*.js'`:"'./node_modules/@aerogel/plugin-solid/dist/**/*.js'"}),await this.updateNpmScripts(e),await this.updateGitIgnore(),await super.updateFiles(e)}async installNpmDependencies(){await w.run("npm install soukai-solid@next --save-exact"),await w.run("npm install @solid/community-server@7 --save"),await super.installNpmDependencies()}async updateNpmScripts(e){m.info("Updating npm scripts...");const t=u.read("package.json");if(!t)return m.fail("Could not find package.json file");u.write("package.json",t.replace('"cy:dev": "concurrently --kill-others \\"npm run test:serve-app\\" \\"npm run cy:open\\"",','"cy:dev": "concurrently --kill-others \\"npm run test:serve-app\\" \\"npm run test:serve-pod\\" \\"npm run cy:open\\"",').replace('"cy:test": "start-server-and-test test:serve-app http-get://localhost:5001 cy:run",','"cy:test": "start-server-and-test test:serve-app http-get://localhost:5001 test:serve-pod http-get://localhost:4000 cy:run",').replace('"dev": "vite",','"dev": "vite",\n"dev:serve-pod": "community-solid-server -c @css:config/file.json -p 4000 -f ./solid-data",').replace('"test:serve-app": "vite --port 5001"','"test:serve-app": "vite --port 5001",\n"test:serve-pod": "community-solid-server -p 4000 -l warn"')),e.addModifiedFile("package.json")}async updateGitIgnore(){m.info("Updating .gitignore");const e=u.read(".gitignore")??"";u.write(".gitignore",`${e}/solid-data\n`)}},new class extends A{constructor(){super("histoire"),p.default(this,"installedPatchPackage",!1),p.default(this,"installedPostCSSPseudoClasses",!1)}async beforeInstall(){this.installedPatchPackage=!1,this.installedPostCSSPseudoClasses=!1}async afterInstall(){this.installedPatchPackage&&await m.animate("Patching dependencies",(async()=>{await w.run("npx patch-package")}))}async updateFiles(e){await this.updateTailwindConfig(e,{content:$()?`'${y("histoire")}/dist/**/*.js'`:"'./node_modules/@aerogel/histoire/dist/**/*.js'"}),await this.updateNpmScripts(e),await this.createConfigFiles(),await super.updateFiles(e)}async installNpmDependencies(){await w.run("npm install histoire@0.17.6 --save-dev"),u.contains("package.json",'"patch-package"')||(await w.run("npm install patch-package --save-dev"),this.installedPatchPackage=!0),u.contains("package.json",'"postcss-pseudo-classes"')||(await w.run("npm install postcss-pseudo-classes --save-dev"),this.installedPostCSSPseudoClasses=!0),await super.installNpmDependencies()}getLocalPackageName(){return this.name}async updateNpmScripts(e){m.info("Updating npm scripts...");const t=u.read("package.json");if(!t)return m.fail("Could not find package.json file");u.write("package.json",t.replace('"lint": "noeldemartin-lint src",',this.installedPatchPackage?'"histoire": "histoire dev", "lint": "noeldemartin-lint src", "postinstall": "patch-package",':'"histoire": "histoire dev", "lint": "noeldemartin-lint src",')),e.addModifiedFile("package.json")}async createConfigFiles(){m.info("Creating config files..."),g.instantiate(v("histoire")),this.installedPostCSSPseudoClasses&&g.instantiate(v("postcss-pseudo-classes"))}isForDevelopment(){return!0}}].reduce(((e,t)=>Object.assign(e,{[t.name]:t})),{});class N extends k{constructor(e){super(),p.default(this,"plugin",void 0),this.plugin=q[e]??m.fail(`Plugin '${e}' doesn't exist. Available plugins: ${Object.keys(q).join(", ")}`)}async run(){await this.plugin.install()}}p.default(N,"command","install"),p.default(N,"description","Install an AerogelJS plugin"),p.default(N,"parameters",[["plugin","Plugin to install"]]);var T=i.facade(new class{run(t){const s=new e.Command;s.name("ag").description("AerogelJS CLI").version("0.0.0"),S.define(s),b.define(s),D.define(s),I.define(s),N.define(s),s.parse(t)}});exports.CLI=T;
|
|
2
|
-
//# sourceMappingURL=aerogel-cli.cjs.js.map
|