Partial import processing
This commit is contained in:
@@ -683,6 +683,48 @@ module.exports.getMissingDependencies = dependencies => {
|
||||
});
|
||||
};
|
||||
|
||||
module.exports.importSkylinks = (version, jsonArray) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
const repertoryExec = _getRepertoryExec(version);
|
||||
const processOptions = {
|
||||
cwd: repertoryExec.working,
|
||||
detached: true,
|
||||
shell: false,
|
||||
windowsHide: true,
|
||||
};
|
||||
|
||||
const args = _getDefaultRepertoryArgs('Skynet');
|
||||
args.push('-ij');
|
||||
args.push(JSON.stringify(jsonArray));
|
||||
|
||||
let result = '';
|
||||
const process = new spawn(repertoryExec.cmd, args, processOptions);
|
||||
|
||||
process.on('error', (err) => {
|
||||
reject(err);
|
||||
});
|
||||
|
||||
process.stdout.on('data', (d)=> {
|
||||
result += d;
|
||||
});
|
||||
|
||||
process.stderr.on('data', (d)=> {
|
||||
result += d;
|
||||
});
|
||||
|
||||
process.on('exit', code => {
|
||||
if (code === 0) {
|
||||
result = result.substr(result.indexOf('{'));
|
||||
resolve(JSON.parse(result));
|
||||
} else {
|
||||
reject(new Error('Failed to import: ' + code + ':' + result));
|
||||
}
|
||||
});
|
||||
|
||||
process.unref();
|
||||
});
|
||||
};
|
||||
|
||||
//https://stackoverflow.com/questions/31645738/how-to-create-full-path-with-nodes-fs-mkdirsync
|
||||
module.exports.mkDirByPathSync = (targetDir, { isRelativeToScript = false } = {}) => {
|
||||
const sep = path.sep;
|
||||
|
||||
Reference in New Issue
Block a user