test: fix histoire configuration

Nearly

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel 2023-11-14 18:59:28 +01:00
parent 2e72f6faf4
commit bfbc299f37
No known key found for this signature in database
GPG key ID: A061B9DDE0CA0773
8 changed files with 71 additions and 44 deletions

2
.gitignore vendored
View file

@ -55,3 +55,5 @@ node_modules
stats.html stats.html
/coverage /coverage
/playwright-report/ /playwright-report/
.histoire

View file

@ -8,6 +8,7 @@ export default defineConfig({
plugins: [HstVue()], plugins: [HstVue()],
setupFile: path.resolve(__dirname, "./src/histoire.setup.ts"), setupFile: path.resolve(__dirname, "./src/histoire.setup.ts"),
viteNodeInlineDeps: [/date-fns/], viteNodeInlineDeps: [/date-fns/],
// viteIgnorePlugins: ['vite-plugin-pwa', 'vite-plugin-pwa:build', 'vite-plugin-pwa:info'],
tree: { tree: {
groups: [ groups: [
{ {

View file

@ -5,9 +5,9 @@
:comment="comment" :comment="comment"
:event="event" :event="event"
:currentActor="baseActor" :currentActor="baseActor"
@create-comment="hstEvent('Create comment', $event)" @create-comment="logEvent('Create comment', $event)"
@delete-comment="hstEvent('Delete comment', $event)" @delete-comment="logEvent('Delete comment', $event)"
@report-comment="hstEvent('Report comment', $event)" @report-comment="logEvent('Report comment', $event)"
/> />
</Variant> </Variant>
<Variant title="Announcement"> <Variant title="Announcement">
@ -15,9 +15,9 @@
:comment="{ ...comment, isAnnouncement: true }" :comment="{ ...comment, isAnnouncement: true }"
:event="event" :event="event"
:currentActor="baseActor" :currentActor="baseActor"
@create-comment="hstEvent('Create comment', $event)" @create-comment="logEvent('Create comment', $event)"
@delete-comment="hstEvent('Delete comment', $event)" @delete-comment="logEvent('Delete comment', $event)"
@report-comment="hstEvent('Report comment', $event)" @report-comment="logEvent('Report comment', $event)"
/> />
</Variant> </Variant>
</Story> </Story>
@ -37,10 +37,23 @@ import { reactive } from "vue";
import Comment from "./EventComment.vue"; import Comment from "./EventComment.vue";
import FloatingVue from "floating-vue"; import FloatingVue from "floating-vue";
import "floating-vue/dist/style.css"; import "floating-vue/dist/style.css";
import { hstEvent } from "histoire/client"; import { logEvent } from "histoire/client";
import { createMemoryHistory, createRouter } from "vue-router";
function setupApp({ app }) { function setupApp({ app }) {
app.use(FloatingVue); app.use(FloatingVue);
app.use(
createRouter({
history: createMemoryHistory(),
routes: [
{
path: "/event/:uuid",
name: "Event",
component: { render: () => null },
},
],
})
);
} }
const baseActorAvatar = { const baseActorAvatar = {
@ -64,7 +77,7 @@ const baseActor: IPerson = {
}; };
const baseEvent: IEvent = { const baseEvent: IEvent = {
uuid: "", uuid: "an-uuid",
title: "A very interesting event", title: "A very interesting event",
description: "Things happen", description: "Things happen",
beginsOn: new Date().toISOString(), beginsOn: new Date().toISOString(),

View file

@ -7,8 +7,8 @@
v-model:actor-filter="actorFilter" v-model:actor-filter="actorFilter"
:groupMemberships="[]" :groupMemberships="[]"
:current-actor="currentActor" :current-actor="currentActor"
@update:actor-filter="hstEvent('Actor Filter updated', $event)" @update:actor-filter="logEvent('Actor Filter updated', $event)"
@update:model-value="hstEvent('Selected actor updated', $event)" @update:model-value="logEvent('Selected actor updated', $event)"
/> />
</Variant> </Variant>
</Story> </Story>
@ -18,7 +18,7 @@ import OrganizerPicker from "./OrganizerPicker.vue";
import { createMemoryHistory, createRouter } from "vue-router"; import { createMemoryHistory, createRouter } from "vue-router";
import { reactive, ref } from "vue"; import { reactive, ref } from "vue";
import { ActorType } from "@/types/enums"; import { ActorType } from "@/types/enums";
import { hstEvent } from "histoire/client"; import { logEvent } from "histoire/client";
const currentActor = reactive({ const currentActor = reactive({
id: "59", id: "59",

View file

@ -3,8 +3,8 @@
<Variant> <Variant>
<OrganizerPickerWrapper <OrganizerPickerWrapper
v-model="actor" v-model="actor"
@update:model-value="hstEvent('Value', $event)" @update:model-value="logEvent('Value', $event)"
@update:contacts="hstEvent('Contacts', $event)" @update:contacts="logEvent('Contacts', $event)"
/> />
</Variant> </Variant>
</Story> </Story>
@ -19,7 +19,7 @@ import { PERSON_GROUP_MEMBERSHIPS } from "@/graphql/actor";
import { createMemoryHistory, createRouter } from "vue-router"; import { createMemoryHistory, createRouter } from "vue-router";
import { IDENTITIES } from "@/graphql/actor"; import { IDENTITIES } from "@/graphql/actor";
import { reactive } from "vue"; import { reactive } from "vue";
import { hstEvent } from "histoire/client"; import { logEvent } from "histoire/client";
const actor = reactive({ const actor = reactive({
id: "5", id: "5",

View file

@ -14,9 +14,9 @@
:current-actor="currentActor" :current-actor="currentActor"
:participation="undefined" :participation="undefined"
:identities="identities" :identities="identities"
@join-event="hstEvent('Join event', $event)" @join-event="logEvent('Join event', $event)"
@join-modal="hstEvent('Join modal', $event)" @join-modal="logEvent('Join modal', $event)"
@confirm-leave="hstEvent('Confirm leave', $event)" @confirm-leave="logEvent('Confirm leave', $event)"
/> />
</Variant> </Variant>
<Variant title="Basic with confirmation"> <Variant title="Basic with confirmation">
@ -26,9 +26,9 @@
:participation="undefined" :participation="undefined"
:identities="identities" :identities="identities"
@join-event-with-confirmation=" @join-event-with-confirmation="
hstEvent('Join Event with confirmation', $event) logEvent('Join Event with confirmation', $event)
" "
@join-modal="hstEvent('Join modal', $event)" @join-modal="logEvent('Join modal', $event)"
/> />
</Variant> </Variant>
<Variant title="Participating"> <Variant title="Participating">
@ -37,7 +37,7 @@
:current-actor="currentActor" :current-actor="currentActor"
:participation="participation" :participation="participation"
:identities="identities" :identities="identities"
@confirm-leave="hstEvent('Confirm leave', $event)" @confirm-leave="logEvent('Confirm leave', $event)"
/> />
</Variant> </Variant>
<Variant title="Pending approval"> <Variant title="Pending approval">
@ -49,7 +49,7 @@
role: ParticipantRole.NOT_APPROVED, role: ParticipantRole.NOT_APPROVED,
}" }"
:identities="identities" :identities="identities"
@confirm-leave="hstEvent('Confirm leave', $event)" @confirm-leave="logEvent('Confirm leave', $event)"
/> />
</Variant> </Variant>
<Variant title="Rejected"> <Variant title="Rejected">
@ -61,7 +61,7 @@
role: ParticipantRole.REJECTED, role: ParticipantRole.REJECTED,
}" }"
:identities="identities" :identities="identities"
@confirm-leave="hstEvent('Confirm leave', $event)" @confirm-leave="logEvent('Confirm leave', $event)"
/> />
</Variant> </Variant>
</Story> </Story>
@ -72,7 +72,7 @@ import { IPerson } from "@/types/actor";
import { EventJoinOptions, ParticipantRole } from "@/types/enums"; import { EventJoinOptions, ParticipantRole } from "@/types/enums";
import { IEvent } from "@/types/event.model"; import { IEvent } from "@/types/event.model";
import ParticipationButton from "./ParticipationButton.vue"; import ParticipationButton from "./ParticipationButton.vue";
import { hstEvent } from "histoire/client"; import { logEvent } from "histoire/client";
import { IParticipant } from "@/types/participant.model"; import { IParticipant } from "@/types/participant.model";
const emptyCurrentActor: IPerson = {}; const emptyCurrentActor: IPerson = {};

View file

@ -4,8 +4,8 @@
<SearchFields <SearchFields
:search="''" :search="''"
:location="{}" :location="{}"
@update:location="hstEvent('update location', $event)" @update:location="logEvent('update location', $event)"
@update:search="hstEvent('update search', $event)" @update:search="logEvent('update search', $event)"
/> />
</Variant> </Variant>
</Story> </Story>
@ -14,7 +14,7 @@
import { apolloClient } from "@/vue-apollo"; import { apolloClient } from "@/vue-apollo";
import { DefaultApolloClient } from "@vue/apollo-composable"; import { DefaultApolloClient } from "@vue/apollo-composable";
import SearchFields from "./SearchFields.vue"; import SearchFields from "./SearchFields.vue";
import { hstEvent } from "histoire/client"; import { logEvent } from "histoire/client";
function setupApp({ app }) { function setupApp({ app }) {
app.provide(DefaultApolloClient, apolloClient); app.provide(DefaultApolloClient, apolloClient);

View file

@ -15,9 +15,12 @@ export default defineConfig(({ command }) => {
process.stdin.resume(); process.stdin.resume();
} }
return { const isStory = Boolean(process.env.HISTOIRE);
plugins: [
vue(), const plugins = [vue(), visualizer()];
if (!isStory) {
plugins.push(
VitePWA({ VitePWA({
registerType: "autoUpdate", registerType: "autoUpdate",
strategies: "injectManifest", strategies: "injectManifest",
@ -57,21 +60,29 @@ export default defineConfig(({ command }) => {
}, },
], ],
}, },
}), })
visualizer(), );
], }
build: {
manifest: true, const build = {
outDir: path.resolve(__dirname, "priv/static"), manifest: true,
emptyOutDir: true, outDir: path.resolve(__dirname, "priv/static"),
sourcemap: true, emptyOutDir: true,
rollupOptions: { sourcemap: true,
// overwrite default .html entry };
input: {
main: "src/main.ts", if (!isStory) {
}, // overwrite default .html entry
build.rollupOptions = {
input: {
main: "src/main.ts",
}, },
}, };
}
return {
plugins,
build,
resolve: { resolve: {
alias: { alias: {
"@": path.resolve(__dirname, "./src"), "@": path.resolve(__dirname, "./src"),