Skip to content
This repository was archived by the owner on Jun 24, 2025. It is now read-only.

Commit e5cdccc

Browse files
committed
build: Make copy-dist silent
1 parent ac4f902 commit e5cdccc

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

bin/copy-dist.ts

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,37 +5,45 @@ const DEST_DIR = "./dist";
55
const DEST_DIR_SRC = path.join(DEST_DIR, "src");
66
const DEST_DIR_NODE_MODULES = path.join(DEST_DIR, "node_modules");
77

8+
const VERBOSE = process.env.VERBOSE;
9+
10+
function log(...args) {
11+
if (VERBOSE) {
12+
console.log(args);
13+
}
14+
}
15+
816
async function copyNodeModuleFileOrFolder(source: string) {
917
const adjustedSource = source.substring(13);
1018
const destination = path.join(DEST_DIR_NODE_MODULES, adjustedSource);
1119

12-
console.log(`Copying ${source} to ${destination}`);
20+
log(`Copying ${source} to ${destination}`);
1321
await fs.ensureDir(path.dirname(destination));
1422
await fs.copy(source, destination);
1523
}
1624

1725
const copy = async () => {
1826
for (const srcFile of fs.readdirSync("build")) {
1927
const destFile = path.join(DEST_DIR, path.basename(srcFile));
20-
console.log(`Copying source ${srcFile} -> ${destFile}.`);
28+
log(`Copying source ${srcFile} -> ${destFile}.`);
2129
fs.copySync(path.join("build", srcFile), destFile, { recursive: true });
2230
}
2331

2432
const filesToCopy = ["config-sample.ini"];
2533
for (const file of filesToCopy) {
26-
console.log(`Copying ${file}`);
34+
log(`Copying ${file}`);
2735
await fs.copy(file, path.join(DEST_DIR, file));
2836
}
2937

3038
const dirsToCopy = ["images", "libraries", "db"];
3139
for (const dir of dirsToCopy) {
32-
console.log(`Copying ${dir}`);
40+
log(`Copying ${dir}`);
3341
await fs.copy(dir, path.join(DEST_DIR, dir));
3442
}
3543

3644
const srcDirsToCopy = ["./src/public", "./src/views", "./build"];
3745
for (const dir of srcDirsToCopy) {
38-
console.log(`Copying ${dir}`);
46+
log(`Copying ${dir}`);
3947
await fs.copy(dir, path.join(DEST_DIR_SRC, path.basename(dir)));
4048
}
4149

0 commit comments

Comments
 (0)