Skip to content

Commit

Permalink
feat(app-vite): create .npmrc in dist/electron/UnPackaged even if the…
Browse files Browse the repository at this point in the history
… project doesn't have one #17504
  • Loading branch information
rstoenescu committed Sep 16, 2024
1 parent 35e9993 commit fc23375
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 @@ -85,23 +85,23 @@ export class QuasarModeBuilder extends AppBuilder {

// handle .npmrc separately
const npmrc = this.ctx.appPaths.resolve.app('.npmrc')
if (fse.existsSync(npmrc)) {
let content = this.readFile(npmrc)
let content = fse.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 fc23375

Please sign in to comment.