Hopefully fix macos
This commit is contained in:
parent
e8f7c9e8c8
commit
bc753c91d9
2 changed files with 13 additions and 6 deletions
15
preload.js
15
preload.js
|
@ -12,9 +12,16 @@ contextBridge.exposeInMainWorld("installPackage", async (link) => {
|
||||||
cwd: packagesPath,
|
cwd: packagesPath,
|
||||||
})
|
})
|
||||||
|
|
||||||
await exec("pnpm i --production", {
|
await exec(
|
||||||
cwd: packagePath,
|
`${
|
||||||
})
|
process.platform == "darwin"
|
||||||
|
? path.join(process.env.HOME, "Library", "pnpm", "pnpm")
|
||||||
|
: "pnpm"
|
||||||
|
} i --production`,
|
||||||
|
{
|
||||||
|
cwd: packagePath,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await promises.access(join(packagePath, "main.js"), constants.F_OK)
|
await promises.access(join(packagePath, "main.js"), constants.F_OK)
|
||||||
|
@ -26,6 +33,6 @@ contextBridge.exposeInMainWorld("installPackage", async (link) => {
|
||||||
return { reloadMessage: "Please reload discord with Ctrl+R" }
|
return { reloadMessage: "Please reload discord with Ctrl+R" }
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
return { errorMessage: error }
|
return { error }
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
|
@ -61,7 +61,7 @@ export default new (class PackageDownloader {
|
||||||
onClick: async () => {
|
onClick: async () => {
|
||||||
setDisabled(true)
|
setDisabled(true)
|
||||||
|
|
||||||
const { reloadMessage, errorMessage } =
|
const { reloadMessage, error } =
|
||||||
await window.installPackage(gitURL)
|
await window.installPackage(gitURL)
|
||||||
|
|
||||||
if (reloadMessage) {
|
if (reloadMessage) {
|
||||||
|
@ -90,7 +90,7 @@ export default new (class PackageDownloader {
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
pluginLog(
|
pluginLog(
|
||||||
`Package installation failed: ${errorMessage}`,
|
`Package installation failed: ${error}`,
|
||||||
console.error
|
console.error
|
||||||
)
|
)
|
||||||
setDisabled(false)
|
setDisabled(false)
|
||||||
|
|
Reference in a new issue