1 const childProcess
= require("child_process");
2 const fs
= require("fs");
4 if (process
.argv
.length
!== 3) {
5 throw new Error("Requires the base path as argument.");
8 const basePath
= process
.argv
[2];
9 if (!basePath
.match(/[\\\/]$/)) {
10 throw new Error("Path must end with a slash - any slash will do.");
12 else if (!fs
.existsSync(basePath
)) {
13 throw new Error(`Invalid path, '${basePath}' does not exist or is not readable.`);
16 fs
.readdirSync(basePath
)
17 .filter(directory
=> {
18 if (directory
.indexOf('.') !== 0 && fs
.statSync(basePath
+ directory
).isDirectory()) {
19 // filter by known repository name patterns
20 if (directory
=== "WCF" || directory
.indexOf("com.woltlab.") === 0) {
27 .forEach(directory
=> {
28 console
.log(`##### Building ${directory} #####\n`);
30 let path
= basePath
+ directory
;
31 if (directory
=== "WCF") {
32 childProcess
.execSync(`node _buildCore.js`, {
37 childProcess
.execSync(`node _buildExternal.js ${path}`, {
42 childProcess
.execSync(`ts-node syncTemplates.ts ${path}`, {