-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
43 lines (26 loc) · 1.01 KB
/
index.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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
const fs = require('fs-extra');
const path = require('path');
const readDir = require('./lib/read-dir.js')
const getUpdate = require('./lib/get-update.js');
const overwrite = require('./lib/overwrite.js');
const YAML = require('yaml')
const config = YAML.parse(fs.readFileSync(path.resolve(process.cwd()+'/config.yaml'), 'utf8'))
updateVnjson(config);
async function updateVnjson(configGlobal){
const config = {
url: configGlobal.updateSrc?.url||'https://github.com/vnjson/mcap/archive/refs/heads/main.zip',
zip: '.vnjson',
update: '.vnjson/' + configGlobal.updateSrc?.dir||'mcap-main',
local: 'src'
}
await getUpdate(config);
console.log('[ extract zip ]');
const _update = await readDir(config.update);
const dirs = configGlobal.updateDirs||['src'];
for (const localDir of dirs) {
await overwrite(_update, config.update, localDir );
console.log(`[ + ] ${localDir}`);
}
fs.remove(config.zip);
console.log('Обновление установлено');
}