cleanup, docs, etc.
This commit is contained in:
parent
ab671c2782
commit
743e917733
8 changed files with 174 additions and 23 deletions
|
@ -5,7 +5,7 @@
|
|||
"type": "module",
|
||||
"scripts": {
|
||||
"start": "vite",
|
||||
"build": "vue-tsc && vite-ssg build",
|
||||
"build": "vue-tsc && vite-ssg build && node post-build.js",
|
||||
"preview": "vite preview"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
|
10
projects/frontend/post-build.js
Normal file
10
projects/frontend/post-build.js
Normal file
|
@ -0,0 +1,10 @@
|
|||
import { existsSync } from 'fs';
|
||||
import { readFile } from 'fs/promises';
|
||||
import { setCurrent } from '../sites/src/set-current.js'
|
||||
|
||||
(async () => {
|
||||
if (existsSync('../sites/sites/current.txt')) {
|
||||
const site = await readFile('../sites/sites/current.txt', { encoding: 'utf-8' });
|
||||
setCurrent(site);
|
||||
}
|
||||
})();
|
|
@ -22,6 +22,10 @@ type DisplayedEntries = { [key: string]: {
|
|||
hiddenByTags?: boolean
|
||||
}}
|
||||
|
||||
const emits = defineEmits<{
|
||||
(e: 'loaded'): void
|
||||
}>()
|
||||
|
||||
const ready = ref(false)
|
||||
const currentRoute = getCurrentRoute()
|
||||
const routeStore = useRouteStore()
|
||||
|
@ -88,6 +92,7 @@ onMounted(async () => {
|
|||
document.title = routeConfig.fullTitle
|
||||
ready.value = true
|
||||
hasWarnings.value = !!(await Promise.all(Object.values(list.entries))).find(other => !!other.warnings)
|
||||
emits('loaded')
|
||||
})
|
||||
</script>
|
||||
|
||||
|
|
|
@ -130,6 +130,7 @@ const mapStrapiResponseToMackenzii = async (inVal) => {
|
|||
};
|
||||
|
||||
(async () => {
|
||||
console.log('NOTE: This is currently only built to support gallery lists. Article lists and other content are not supported');
|
||||
const rl = readlinePromises.createInterface(process.stdin, process.stdout);
|
||||
let fetchUrl = '';
|
||||
try {
|
||||
|
|
|
@ -1,17 +1,3 @@
|
|||
import symlinkDir from 'symlink-dir';
|
||||
import { existsSync } from 'fs';
|
||||
import { mkdir } from 'fs/promises';
|
||||
import { setCurrent } from '../src/set-current.js';
|
||||
|
||||
(async () => {
|
||||
const site = process.env.npm_config_site;
|
||||
if (!!site) {
|
||||
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!');
|
||||
}
|
||||
})();
|
||||
setCurrent(process.env.npm_config_site);
|
||||
|
|
24
projects/sites/src/set-current.js
Normal file
24
projects/sites/src/set-current.js
Normal file
|
@ -0,0 +1,24 @@
|
|||
import symlinkDir from 'symlink-dir';
|
||||
import { existsSync } from 'fs';
|
||||
import { mkdir, unlink, writeFile } from 'fs/promises';
|
||||
|
||||
export const setCurrent = async (site, ctx) => {
|
||||
const managerPath = ctx?.managerPath || '../sites';
|
||||
const frontendPath = ctx?.frontendPath || '../frontend';
|
||||
if (!!site) {
|
||||
await symlinkDir(`${managerPath}/sites/${site}`, `${frontendPath}/content`);
|
||||
if (!existsSync(`${frontendPath}/dist`)) {
|
||||
await mkdir(`${frontendPath}/dist`);
|
||||
}
|
||||
await symlinkDir(`${managerPath}/sites/${site}`, `${frontendPath}/dist/content`);
|
||||
|
||||
if (existsSync(`${managerPath}/sites/current.txt`)) {
|
||||
await unlink(`${managerPath}/sites/current.txt`);
|
||||
}
|
||||
await writeFile(`${managerPath}/sites/current.txt`, site, { encoding: 'utf-8' });
|
||||
|
||||
console.log('done');
|
||||
} else {
|
||||
console.error('Parameter "site" was not provided!');
|
||||
}
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue