mackenzii/projects/sites/scripts/set-current.js
2024-05-17 18:20:20 -04:00

17 lines
504 B
JavaScript

import symlinkDir from 'symlink-dir';
import { existsSync } from 'fs';
import { mkdir } from 'fs/promises';
(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!');
}
})();