-
Notifications
You must be signed in to change notification settings - Fork 0
/
post-install.js
22 lines (19 loc) · 809 Bytes
/
post-install.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import { symlink } from 'fs/promises';
import { join } from 'path';
import { fileURLToPath } from 'url';
import fs from "fs";
import path from 'path';
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
async function buildContentDirectory(source, dest, type) {
// Define the source and target folders for the symbolic link
const sourceFolder = __dirname+'/'+source;
const targetFolder = __dirname +'/content/'+dest;
// Create a symbolic link
const symlinkPath = join(targetFolder);
if (!fs.existsSync(symlinkPath)) {
await symlink(sourceFolder, symlinkPath, type);
}
}
// buildContentDirectory("legislation/constitution.md", "1.constitution.md", "file")
// buildContentDirectory("legislation/content", "2.legislation", "dir")