cleanup, docs, etc.
This commit is contained in:
parent
ab671c2782
commit
743e917733
8 changed files with 174 additions and 23 deletions
|
@ -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