cleanup, docs, etc.

This commit is contained in:
lightling 2024-11-04 19:25:14 -05:00
parent ab671c2782
commit 743e917733
Signed by: lightling
GPG key ID: F1F29650D537C773
8 changed files with 174 additions and 23 deletions

View file

@ -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 {

View file

@ -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);

View 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!');
}
};