-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathsetup.js
More file actions
48 lines (39 loc) · 1.38 KB
/
setup.js
File metadata and controls
48 lines (39 loc) · 1.38 KB
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
const fs = require('fs');
const fsExtra = require('fs-extra');
let dependencies = [
{ // ace-builds
source: 'node_modules/ace-builds/src-min-noconflict/',
destination: 'codetmp/assets/js/packages/ace-builds/src-min-noconflict/',
},
{ // @isomorphic-git/lightning-fs
source: 'node_modules/@isomorphic-git/lightning-fs/dist/',
destination: 'codetmp/assets/js/packages/@isomorphic-git/lightning-fs/',
},
{ // isomorphic-git
source: 'node_modules/isomorphic-git/',
destination: 'codetmp/assets/js/packages/isomorphic-git/',
files: [ 'index.umd.min.js' ],
}
];
for (let item of dependencies) {
// Copy files from source to destination directory
try {
fsExtra.removeSync(item.destination);
fs.mkdirSync(item.destination, { recursive: true });
if (item.files) {
// Copy specified files individually
for (let file of item.files) {
const sourcePath = `${item.source}${file}`;
const destinationPath = `${item.destination}${file}`;
fsExtra.copySync(sourcePath, destinationPath);
console.log(`File '${file}' copied successfully.`);
}
} else {
// Copy entire directory if no specific files are listed
fsExtra.copySync(item.source, item.destination);
console.log('Directory copied successfully.');
}
} catch (error) {
console.error(`Error copying directory: ${error}`);
}
}