fix: Wrap entire createPackagesFolder in try-catch for mounted volumes
This commit is contained in:
@@ -61,31 +61,32 @@ if (!Config.values.public) {
|
||||
program.parse(argvWithoutOptions.operands.concat(argvWithoutOptions.unknown));
|
||||
|
||||
function createPackagesFolder() {
|
||||
const packagesPath = Config.getPackagesPath();
|
||||
const packagesConfig = path.join(packagesPath, "package.json");
|
||||
|
||||
// Create node_modules folder, otherwise yarn will start walking upwards to find one
|
||||
try {
|
||||
const packagesPath = Config.getPackagesPath();
|
||||
const packagesConfig = path.join(packagesPath, "package.json");
|
||||
|
||||
// Create node_modules folder, otherwise yarn will start walking upwards to find one
|
||||
fs.mkdirSync(path.join(packagesPath, "node_modules"), { recursive: true });
|
||||
|
||||
// Create package.json with private set to true, if it doesn't exist already
|
||||
if (!fs.existsSync(packagesConfig)) {
|
||||
fs.writeFileSync(
|
||||
packagesConfig,
|
||||
JSON.stringify(
|
||||
{
|
||||
private: true,
|
||||
description:
|
||||
"Packages for Hard Lounge. Use `thelounge install <package>` command to add a package.",
|
||||
dependencies: {},
|
||||
},
|
||||
null,
|
||||
"\t"
|
||||
)
|
||||
);
|
||||
}
|
||||
} catch (e) {
|
||||
// Ignore permission errors on mounted volumes
|
||||
}
|
||||
|
||||
// Create package.json with private set to true, if it doesn't exist already
|
||||
if (!fs.existsSync(packagesConfig)) {
|
||||
fs.writeFileSync(
|
||||
packagesConfig,
|
||||
JSON.stringify(
|
||||
{
|
||||
private: true,
|
||||
description:
|
||||
"Packages for Hard Lounge. Use `thelounge install <package>` command to add a package.",
|
||||
dependencies: {},
|
||||
},
|
||||
null,
|
||||
"\t"
|
||||
)
|
||||
);
|
||||
log.warn("Unable to create packages folder, package management may not work");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user