blob: 411ade8cc6ee15387e6368496280861f9ef65508 (
plain)
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
|
module.exports = (pkg, tempDir) => {
const getAllDirs = function(dirPath, arrayOfFiles) {
files = fs.readdirSync(dirPath)
arrayOfFiles = arrayOfFiles || []
files.forEach(function(file) {
if (file !== ".git") {
if (fs.statSync(dirPath + "/" + file).isDirectory()) {
arrayOfFiles.push(dirPath + "/" + file)
arrayOfFiles = getAllDirs(dirPath + "/" + file, arrayOfFiles)
}
}
})
return arrayOfFiles
}
dirs = getAllDirs(home + "/packages/" + tempDir);
for (let dir of dirs) {
if (!fs.existsSync(home + "/packages/" + pkg + "/" + dir)) {
fs.mkdirSync(home + "/packages/" + pkg + "/" + dir);
}
}
files = require('./files')(tempDir);
for (let file of files) {
if (file.trim() !== "") {
fs.copyFileSync(home + "/packages/" + tempDir + "/" + file, home + "/packages/" + pkg + "/" + file);
}
}
}
|