Skip to content

Commit

Permalink
feat(app-vite): (backport from v2 beta) create .npmrc in dist/electro…
Browse files Browse the repository at this point in the history
…n/UnPackaged even if the project doesn't have one #17504
  • Loading branch information
rstoenescu committed Sep 19, 2024
1 parent 352e539 commit 99a8ec8
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions app-vite/lib/modes/electron/electron-builder.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,23 +88,23 @@ class ElectronBuilder extends AppBuilder {

// handle .npmrc separately
const npmrc = appPaths.resolve.app('.npmrc')
if (existsSync(npmrc)) {
let content = this.readFile(npmrc)
let content = existsSync(npmrc)
? this.readFile(npmrc)
: ''

if (content.indexOf('shamefully-hoist') === -1) {
content += '\n# needed by pnpm\nshamefully-hoist=true'
}
// very important, otherwise PNPM creates symlinks which is NOT
// what we want for an Electron app that should run cross-platform
if (content.indexOf('node-linker') === -1) {
content += '\n# pnpm needs this otherwise it creates symlinks\nnode-linker=hoisted'
}

this.writeFile(
join(this.quasarConf.build.distDir, 'UnPackaged/.npmrc'),
content
)
if (content.indexOf('shamefully-hoist') === -1) {
content += '\n# needed by pnpm\nshamefully-hoist=true'
}
// very important, otherwise PNPM creates symlinks which is NOT
// what we want for an Electron app that should run cross-platform
if (content.indexOf('node-linker') === -1) {
content += '\n# pnpm needs this otherwise it creates symlinks\nnode-linker=hoisted'
}

this.writeFile(
join(this.quasarConf.build.distDir, 'UnPackaged/.npmrc'),
content
)
}

async #packageFiles () {
Expand Down

0 comments on commit 99a8ec8

Please sign in to comment.