mirror of
https://github.com/thelounge/thelounge
synced 2024-11-26 14:00:21 +00:00
Make sure existing packages (and themes) are not deleted when installing a new one on Node.js v8
- When installing a package on Node v8 (or whatever npm version ships with it - v5), all packages not listed in `package.json` are removed. Since we explicitly added `--no-save`, installing a theme would delete the previous one. I am now checking that the file already exists or not. This means that it will still happen to people the next time they run `thelounge install`, because the previous install did not save into `package.json` :/ - Adding `--save` to make sure that the same, correct behavior is done on Node v6 as well (npm v3) - Adding `--save-exact` for good measure.
This commit is contained in:
parent
33de4840c6
commit
432023fc7e
1 changed files with 10 additions and 6 deletions
|
@ -41,18 +41,22 @@ program
|
|||
// Create node_modules folder, otherwise npm will start walking upwards to find one
|
||||
fsextra.ensureDirSync(packagesPath);
|
||||
|
||||
// Create package.json with private set to true to avoid npm warnings
|
||||
fs.writeFileSync(packagesConfig, JSON.stringify({
|
||||
private: true,
|
||||
description: "Packages for The Lounge. All packages in node_modules directory will be automatically loaded.",
|
||||
}, null, "\t"));
|
||||
// Create package.json with private set to true to avoid npm warnings, if
|
||||
// it doesn't exist already
|
||||
if (!fs.existsSync(packagesConfig)) {
|
||||
fs.writeFileSync(packagesConfig, JSON.stringify({
|
||||
private: true,
|
||||
description: "Packages for The Lounge. All packages in node_modules directory will be automatically loaded.",
|
||||
}, null, "\t"));
|
||||
}
|
||||
|
||||
const npm = child.spawn(
|
||||
process.platform === "win32" ? "npm.cmd" : "npm",
|
||||
[
|
||||
"install",
|
||||
"--production",
|
||||
"--no-save",
|
||||
"--save",
|
||||
"--save-exact",
|
||||
"--no-bin-links",
|
||||
"--no-package-lock",
|
||||
"--no-progress",
|
||||
|
|
Loading…
Reference in a new issue