Set yarn cache folder in the packages folder
Fixes thelounge/thelounge-docker#71
This commit is contained in:
parent
589e846b73
commit
6937e6e772
@ -55,13 +55,8 @@ program
|
|||||||
|
|
||||||
return Utils.executeYarnCommand(
|
return Utils.executeYarnCommand(
|
||||||
"add",
|
"add",
|
||||||
"--json",
|
|
||||||
"--exact",
|
|
||||||
"--production",
|
"--production",
|
||||||
"--ignore-scripts",
|
"--exact",
|
||||||
"--non-interactive",
|
|
||||||
"--cwd",
|
|
||||||
packagesPath,
|
|
||||||
`${json.name}@${json.version}`
|
`${json.name}@${json.version}`
|
||||||
).then(() => {
|
).then(() => {
|
||||||
log.info(`${colors.green(json.name + " v" + json.version)} has been successfully installed.`);
|
log.info(`${colors.green(json.name + " v" + json.version)} has been successfully installed.`);
|
||||||
|
@ -39,11 +39,6 @@ program
|
|||||||
|
|
||||||
return Utils.executeYarnCommand(
|
return Utils.executeYarnCommand(
|
||||||
"remove",
|
"remove",
|
||||||
"--json",
|
|
||||||
"--ignore-scripts",
|
|
||||||
"--non-interactive",
|
|
||||||
"--cwd",
|
|
||||||
packagesPath,
|
|
||||||
packageName
|
packageName
|
||||||
).then(() => {
|
).then(() => {
|
||||||
log.info(`${colors.green(packageName)} has been successfully uninstalled.`);
|
log.info(`${colors.green(packageName)} has been successfully uninstalled.`);
|
||||||
|
@ -20,13 +20,8 @@ program
|
|||||||
const packagesList = JSON.parse(fs.readFileSync(packagesConfig)).dependencies;
|
const packagesList = JSON.parse(fs.readFileSync(packagesConfig)).dependencies;
|
||||||
const argsList = [
|
const argsList = [
|
||||||
"upgrade",
|
"upgrade",
|
||||||
"--latest",
|
|
||||||
"--json",
|
|
||||||
"--production",
|
"--production",
|
||||||
"--ignore-scripts",
|
"--latest",
|
||||||
"--non-interactive",
|
|
||||||
"--cwd",
|
|
||||||
packagesPath,
|
|
||||||
];
|
];
|
||||||
|
|
||||||
let count = 0;
|
let count = 0;
|
||||||
@ -44,7 +39,7 @@ program
|
|||||||
log.info(`- ${colors.green(p)}`);
|
log.info(`- ${colors.green(p)}`);
|
||||||
|
|
||||||
if (packagesList.hasOwnProperty(p)) {
|
if (packagesList.hasOwnProperty(p)) {
|
||||||
argsList.splice(1, 0, p);
|
argsList.push(p);
|
||||||
count++;
|
count++;
|
||||||
} else {
|
} else {
|
||||||
log.error(`${colors.green(p)} is not installed.`);
|
log.error(`${colors.green(p)} is not installed.`);
|
||||||
|
@ -107,7 +107,7 @@ class Utils {
|
|||||||
return memo;
|
return memo;
|
||||||
}
|
}
|
||||||
|
|
||||||
static executeYarnCommand(...parameters) {
|
static executeYarnCommand(command, ...parameters) {
|
||||||
// First off, try to find yarn inside of The Lounge
|
// First off, try to find yarn inside of The Lounge
|
||||||
let yarn = path.join(
|
let yarn = path.join(
|
||||||
__dirname, "..", "..", "node_modules",
|
__dirname, "..", "..", "node_modules",
|
||||||
@ -127,9 +127,27 @@ class Utils {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const packagesPath = Helper.getPackagesPath();
|
||||||
|
const cachePath = path.join(packagesPath, "package_manager_cache");
|
||||||
|
|
||||||
|
const staticParameters = [
|
||||||
|
"--cache-folder",
|
||||||
|
cachePath,
|
||||||
|
"--cwd",
|
||||||
|
packagesPath,
|
||||||
|
"--json",
|
||||||
|
"--ignore-scripts",
|
||||||
|
"--non-interactive",
|
||||||
|
];
|
||||||
|
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
let success = false;
|
let success = false;
|
||||||
const add = require("child_process").spawn(process.execPath, [yarn, ...parameters]);
|
const add = require("child_process").spawn(process.execPath, [
|
||||||
|
yarn,
|
||||||
|
command,
|
||||||
|
...staticParameters,
|
||||||
|
...parameters,
|
||||||
|
]);
|
||||||
|
|
||||||
add.stdout.on("data", (data) => {
|
add.stdout.on("data", (data) => {
|
||||||
data.toString().trim().split("\n").forEach((line) => {
|
data.toString().trim().split("\n").forEach((line) => {
|
||||||
|
Loading…
Reference in New Issue
Block a user