-
Notifications
You must be signed in to change notification settings - Fork 43
/
sync-repo.js
42 lines (35 loc) · 1.17 KB
/
sync-repo.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
const fs = require("fs");
const path = require("path");
console.log('Syncing private repo to this public repo...');
const publicEntries = fs.readdirSync(__dirname);
for (const entry of publicEntries) {
// Skip git content
if (entry === ".git" || entry === ".github" || entry === "sync-repo.js") {
continue;
}
console.log('Cleaning up public repo:', entry);
fs.rmSync(path.join(__dirname, entry), {
recursive: true,
});
}
const privateNodeboxRoot = path.join(__dirname, "../nodebox");
const privateEntries = fs.readdirSync(privateNodeboxRoot);
for (const entry of privateEntries) {
// Skip git content
if (entry === ".git" || entry === ".github" || entry === "sync-repo.js" || entry === "node_modules") {
continue;
}
console.log('Copying to public repo:', entry);
fs.cpSync(path.join(privateNodeboxRoot, entry), path.join(__dirname, entry), {
recursive: true,
force: true,
});
}
console.log('Removing internal/closed-source code...');
const INTERNAL_ENTRIES = ['packages/runtime', 'documentation'];
for (const entry of INTERNAL_ENTRIES) {
fs.rmSync(path.join(__dirname, entry), {
recursive: true,
});
}
console.log('Sync completed! :D');