forked from webpack-contrib/copy-webpack-plugin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathglobalSetup.js
26 lines (19 loc) · 804 Bytes
/
globalSetup.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
const path = require("path");
const fs = require("fs");
// eslint-disable-next-line import/no-extraneous-dependencies
const mkdirp = require("mkdirp");
const removeIllegalCharacterForWindows = require("./test/helpers/removeIllegalCharacterForWindows");
const baseDir = path.resolve(__dirname, "test/fixtures");
const specialFiles = {
"[special$directory]/nested/nestedfile.txt": "",
"[special$directory]/(special-*file).txt": "special",
"[special$directory]/directoryfile.txt": "new",
};
module.exports = () => {
Object.keys(specialFiles).forEach((originFile) => {
const file = removeIllegalCharacterForWindows(originFile);
const dir = path.dirname(file);
mkdirp.sync(path.join(baseDir, dir));
fs.writeFileSync(path.join(baseDir, file), specialFiles[originFile]);
});
};