• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

Orckestra / orc-scripts / 90036

pending completion
90036

push

Azure Pipelines

orck-adrouin
1.7.0-dev.2

153 of 436 branches covered (35.09%)

Branch coverage included in aggregate %.

274 of 816 relevant lines covered (33.58%)

4.15 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/scripts/prep.js
1
const util = require("util");
×
2
const path = require("path");
×
3
const makeDir = require("make-dir");
×
4

5
const readdir = util.promisify(require("fs").readdir);
×
6
const copyFile = util.promisify(require("ncp").ncp);
×
7
const existsSync = require("fs").existsSync;
×
8
const stat = util.promisify(require("fs").stat);
×
9

10
const distDir = path.resolve(process.cwd(), "dist");
×
11
const contentDir = path.resolve(process.cwd(), "src/content");
×
12
const staticDir = path.resolve(process.cwd(), "src/static");
×
13
const mockDir = path.resolve(process.cwd(), "src/__mocks__");
×
14
const projectSpecificPrep = path.resolve(process.cwd(), "src/project-prep.json");
×
15

16
async function prep() {
17
        await makeDir("dist");
×
18
        try {
×
19
                await Promise.all([
×
20
                        copyFile(contentDir, path.resolve(distDir, "content")),
21
                        copyFile(mockDir, path.resolve(distDir, "__mocks__")),
22
                ]);
23
        } catch (_) {}
24

25
        if (process.env.NODE_ENV === "production") {
×
26
                // production build will not copy the static files
27
        } else {
28
                try {
×
29
                        const files = await readdir(staticDir);
×
30
                        await Promise.all(files.map(file => copyFile(path.resolve(staticDir, file), path.resolve(distDir, file))));
×
31
                } catch (_) {}
32
        }
33

34
        if (existsSync(projectSpecificPrep)) {
×
35
                const additionalFiles = require(projectSpecificPrep);
×
36

37
                if (additionalFiles && additionalFiles.length > 0) {
×
38
                        additionalFiles.forEach(async fileInfo => {
×
39
                                const sourceFile = path.resolve(process.cwd(), fileInfo.src);
×
40
                                const fileStat = await stat(sourceFile);
×
41

42
                                if (fileStat.isDirectory()) {
×
43
                                        const files = await readdir(sourceFile);
×
44
                                        await makeDir(path.resolve(distDir, fileInfo.dest));
×
45
                                        await Promise.all(
×
46
                                                files.map(file => copyFile(path.resolve(sourceFile, file), path.resolve(distDir, fileInfo.dest, file))),
×
47
                                        );
48
                                } else {
49
                                        const destFile = path.resolve(distDir, fileInfo.dest, path.basename(fileInfo.src));
×
50
                                        const destDir = path.dirname(destFile);
×
51
                                        await makeDir(destDir);
×
52
                                        await copyFile(sourceFile, destFile);
×
53
                                }
54
                        });
55
                }
56
        } else {
57
                console.log("nay");
×
58
        }
59
}
60

61
prep();
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc