Merge pull request #1986 from thelounge/astorije/fix-deleting-package

Make sure existing packages (and themes) are not deleted when installing a new one on Node.js v8
This commit is contained in:
Jérémie Astori 2018-01-18 01:30:17 -05:00 committed by GitHub
commit 25d69438b8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -41,18 +41,22 @@ program
// Create node_modules folder, otherwise npm will start walking upwards to find one // Create node_modules folder, otherwise npm will start walking upwards to find one
fsextra.ensureDirSync(packagesPath); fsextra.ensureDirSync(packagesPath);
// Create package.json with private set to true to avoid npm warnings // Create package.json with private set to true to avoid npm warnings, if
fs.writeFileSync(packagesConfig, JSON.stringify({ // it doesn't exist already
private: true, if (!fs.existsSync(packagesConfig)) {
description: "Packages for The Lounge. All packages in node_modules directory will be automatically loaded.", fs.writeFileSync(packagesConfig, JSON.stringify({
}, null, "\t")); private: true,
description: "Packages for The Lounge. All packages in node_modules directory will be automatically loaded.",
}, null, "\t"));
}
const npm = child.spawn( const npm = child.spawn(
process.platform === "win32" ? "npm.cmd" : "npm", process.platform === "win32" ? "npm.cmd" : "npm",
[ [
"install", "install",
"--production", "--production",
"--no-save", "--save",
"--save-exact",
"--no-bin-links", "--no-bin-links",
"--no-package-lock", "--no-package-lock",
"--no-progress", "--no-progress",