added script for installing local runtime

This commit is contained in:
williexu 2017-12-12 16:00:25 -08:00
Родитель 088c9d1312
Коммит d5ae9d01df
3 изменённых файлов: 73 добавлений и 2 удалений

43
package-lock.json сгенерированный
Просмотреть файл

@ -2575,6 +2575,25 @@
"integrity": "sha1-mC1ok6+RjnLQjeyehnP/K1qNat0=",
"dev": true
},
"fs-extra": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-5.0.0.tgz",
"integrity": "sha512-66Pm4RYbjzdyeuqudYqhFiNBbCIuI9kgRqLPSHIlXHidW8NIQtVdkM1yeZ4lXwuhbTETv3EUGMNHAAw6hiundQ==",
"dev": true,
"requires": {
"graceful-fs": "4.1.11",
"jsonfile": "4.0.0",
"universalify": "0.1.1"
},
"dependencies": {
"graceful-fs": {
"version": "4.1.11",
"resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.11.tgz",
"integrity": "sha1-Dovf5NHduIVNZOBOp8AOKgJuVlg=",
"dev": true
}
}
},
"fs.realpath": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz",
@ -3792,6 +3811,24 @@
"integrity": "sha1-PAQ0dD35Pi9cQq7nsZvLSDV19OE=",
"dev": true
},
"jsonfile": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz",
"integrity": "sha1-h3Gq4HmbZAdrdmQPygWPnBDjPss=",
"dev": true,
"requires": {
"graceful-fs": "4.1.11"
},
"dependencies": {
"graceful-fs": {
"version": "4.1.11",
"resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.11.tgz",
"integrity": "sha1-Dovf5NHduIVNZOBOp8AOKgJuVlg=",
"dev": true,
"optional": true
}
}
},
"jsonify": {
"version": "0.0.0",
"resolved": "https://registry.npmjs.org/jsonify/-/jsonify-0.0.0.tgz",
@ -7168,6 +7205,12 @@
"integrity": "sha1-1ZpKdUJ0R9mqbJHnAmP40mpLEEs=",
"dev": true
},
"universalify": {
"version": "0.1.1",
"resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.1.tgz",
"integrity": "sha1-+nG63UQ3r0wUiEHjs7Fl+enlkLc=",
"dev": true
},
"unpipe": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz",

Просмотреть файл

@ -128,6 +128,7 @@
},
"devDependencies": {
"adal-node": "^0.1.22",
"fs-extra": "^5.0.0",
"glob": "^7.1.1",
"grunt": "~0.4",
"grunt-contrib-connect": "^0.10.1",
@ -161,7 +162,7 @@
"url": "http://github.com/Azure/azure-sdk-for-node/issues"
},
"scripts": {
"test": "npm -s run-script jshint && npm -s run-script unit-msrestazure && npm -s run-script unit-arm && npm -s run-script unit && npm -s run-script unit-msrest",
"test": "npm -s run runtime-install && npm -s run jshint && npm -s run unit-msrestazure && npm -s run unit-arm && npm -s run unit && npm -s run unit-msrest",
"unit": "node scripts/unit.js testlist.txt",
"unit-arm": "node scripts/unit-arm.js testlistarm.txt",
"unit-msrest": "cd runtime/ms-rest && npm test",
@ -169,7 +170,8 @@
"setup": "node scripts/setup.js",
"jshint": "jshint lib --reporter=jslint",
"ci": "node scripts/unit.js testlist.txt",
"runtime-install": "node scripts/runtime-install.js",
"coverage": "node scripts/unit-coverage.js testlistarm.txt testlist.txt",
"debug": "node --inspect scripts/unit-arm.js testlistarm.txt"
}
}
}

Просмотреть файл

@ -0,0 +1,26 @@
const fs = require('fs-extra');
const path = require('path');
const msRestInstallPath = path.join(__dirname, '../node_modules/ms-rest');
const msRestRuntimePath = path.join(__dirname, '../runtime/ms-rest');
const msRestAzureInstallPath = path.join(__dirname, '../node_modules/ms-rest-azure');
const msRestAzureRuntimePath = path.join(__dirname, '../runtime/ms-rest-azure');
const filterFunc = (src, dest) => {
return src.match(/.*node_modules.*/i) === null;
}
fs.remove(msRestInstallPath, err => {
if (err) return console.error(err)
fs.copy(msRestRuntimePath, msRestInstallPath, { filter: filterFunc }, err => {
if (err) return console.error(err);
});
});
fs.remove(msRestAzureInstallPath, err => {
if (err) return console.error(err)
fs.copy(msRestAzureRuntimePath, msRestAzureInstallPath, { filter: filterFunc }, err => {
if (err) return console.error(err);
});
});