From 2240c77ed4e76a35f37a4dfb111a318c95f60488 Mon Sep 17 00:00:00 2001 From: Lightling Date: Fri, 17 May 2024 18:20:20 -0400 Subject: [PATCH] fix build errors --- projects/frontend/src/main.ts | 11 +++++++---- projects/sites/scripts/set-current.js | 13 +++++++++---- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/projects/frontend/src/main.ts b/projects/frontend/src/main.ts index 2147e76..b7f8a3a 100644 --- a/projects/frontend/src/main.ts +++ b/projects/frontend/src/main.ts @@ -5,7 +5,6 @@ import { marked } from 'marked' import { markedHighlight } from 'marked-highlight' import type { RoutedWindow } from '@goldenwere/mackenzii-types' -import { registerLinkEmbed } from '@goldenwere/mackenzii-embeds' import main from './main.vue' import './main.sass' @@ -31,9 +30,13 @@ export const createApp = ViteSSG( // vue-router options { routes: createRoutes() }, // function to have custom setups - ({ app, router, routes, isClient, initialState }) => { - registerLinkEmbed() - window.router = router + async ({ app, router, routes, isClient, initialState }) => { + if (isClient) { + import('@goldenwere/mackenzii-embeds').then(({ registerLinkEmbed }) => { + registerLinkEmbed() + }) + window.router = router + } app.use(createPinia()) initializeRouteStore(routes) }, diff --git a/projects/sites/scripts/set-current.js b/projects/sites/scripts/set-current.js index a682e94..92472e6 100644 --- a/projects/sites/scripts/set-current.js +++ b/projects/sites/scripts/set-current.js @@ -1,11 +1,16 @@ import symlinkDir from 'symlink-dir'; +import { existsSync } from 'fs'; +import { mkdir } from 'fs/promises'; -(() => { +(async () => { const site = process.env.npm_config_site; if (!!site) { - symlinkDir(`sites/${site}`, '../frontend/content').then((res) => { - console.log('Done'); - }) + await symlinkDir(`sites/${site}`, '../frontend/content'); + if (!existsSync('../frontend/dist')) { + await mkdir('../frontend/dist'); + } + await symlinkDir(`sites/${site}`, '../frontend/dist/content'); + console.log('done'); } else { console.error('Parameter "site" was not provided!'); }