зеркало из https://github.com/Azure/ms-rest-js.git
Коммит
c4dd6f3211
|
@ -0,0 +1,44 @@
|
|||
const fs = require("fs");
|
||||
const path = require("path");
|
||||
|
||||
/**
|
||||
* Get the absolute path to the package.json in this repository.
|
||||
* @returns {string} The absolute path to the package.json.
|
||||
*/
|
||||
function getPackageJsonFilePath() {
|
||||
return path.resolve(__dirname, "../package.json");
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the package.json file contents parsed as a JSON object.
|
||||
* @param {string=} packageJsonFilePath The path to the package.json file to read. If this is not
|
||||
* provided, then the package.json file at the root of this repository will be used.
|
||||
* @returns {{}} The parsed package.json file contents.
|
||||
*/
|
||||
function getPackageJson(packageJsonFilePath) {
|
||||
if (!packageJsonFilePath) {
|
||||
packageJsonFilePath = getPackageJsonFilePath();
|
||||
}
|
||||
return JSON.parse(fs.readFileSync(packageJsonFilePath));
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the package.json property values for "main".
|
||||
* @param {string} mainValue The value that will be used for "main".
|
||||
* @returns {void}
|
||||
*/
|
||||
function updatePackageJsonMain(mainValue) {
|
||||
const packageJsonFilePath = getPackageJsonFilePath();
|
||||
|
||||
const packageJson = getPackageJson(packageJsonFilePath);
|
||||
|
||||
if (packageJson.main == mainValue) {
|
||||
console.log(`"main" is already set to "${mainValue}" in "${packageJsonFilePath}".`);
|
||||
} else {
|
||||
console.log(`Changing "main" to "${mainValue}" in "${packageJsonFilePath}"`)
|
||||
packageJson.main = mainValue;
|
||||
|
||||
fs.writeFileSync(packageJsonFilePath, JSON.stringify(packageJson, undefined, " "));
|
||||
}
|
||||
}
|
||||
exports.updatePackageJsonMain = updatePackageJsonMain;
|
|
@ -0,0 +1,3 @@
|
|||
const dependencies = require("./dependencies");
|
||||
|
||||
dependencies.updatePackageJsonMain("./dist/lib/msRest.js")
|
|
@ -0,0 +1,3 @@
|
|||
const dependencies = require("./dependencies");
|
||||
|
||||
dependencies.updatePackageJsonMain("./lib/msRest.ts");
|
|
@ -0,0 +1,3 @@
|
|||
const dependencies = require("./dependencies");
|
||||
|
||||
dependencies.updatePackageJsonMain("./dist/lib/msRest.js")
|
|
@ -89,6 +89,9 @@
|
|||
"test:mocha-chrome": "sleep 0.5 && mocha-chrome http://localhost:3001",
|
||||
"test:chrome-unit": "run-p -r test:server test:mocha-chrome",
|
||||
"prepare": "npm run build",
|
||||
"publish-preview": "npm test && shx rm -rf dist/test && node ./.scripts/publish"
|
||||
"publish-preview": "npm test && shx rm -rf dist/test && node ./.scripts/publish",
|
||||
"local": "node ./.scripts/local.js",
|
||||
"preview": "node ./.scripts/preview.js",
|
||||
"latest": "node ./.scripts/latest.js"
|
||||
}
|
||||
}
|
||||
}
|
Загрузка…
Ссылка в новой задаче