question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ELECTRON_CUSTOM_DIR="v{{ version }}" is not working

See original GitHub issue
  • Electron-Builder Version: ^22.14.13
  • Node Version: v14.18.1
  • Electron Version: v16.0.7
  • Electron Type (current, beta, nightly): current
  • Target: -mw

Problem

Input

ELECTRON_CUSTOM_DIR="v{{ version }}" npx electron-builder -mw

Output image

The "v{{ version }}" template string not been replaced correctly.

Related issue https://github.com/electron-userland/electron-builder/issues/6445

This bug has been more than a year, I tried to find the source code problem, but I can’t do anything, the code is too deep

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5

github_iconTop GitHub Comments

3reactions
iamyokicommented, Feb 17, 2022

Again, share another better solution

Create a config file electron-builder-config.js

const mirror =
  process.env.ELECTRON_MIRROR ?? 'https://npmmirror.com/mirrors/electron/';
const {version} = require('./package.json');

module.exports = /** @type {import('electron-builder').Configuration} */ ({
  productName: 'ONEUP Desktop',
  appId: 'com.iamyoki.oneup',
  copyright: 'ONEUP Desktop ©2021 Powered by Yoki',
  files: ['assets', 'build'],
  mac: {
    category: 'public.app-category.developer-tools',
    target: [
      {target: 'dmg', arch: ['arm64', 'x64']},
      {target: 'zip', arch: ['arm64', 'x64']},
    ],
    icon: './assets/logo.icns',
  },
  win: {
    target: [{target: 'nsis', arch: 'x64'}],
    icon: './assets/logo.ico',
  },
  electronDownload: {
    mirror,
    customDir: `v${version}`,
  },
});

Edit scripts in package.json

{
  "builder": "electron-builder -c ./electron-builder-config.js"
}

The idea is that electron-builder.json can be written in .js file, so it can access env by process.env object and we can customize the version format as we wish for, but be careful with the config filename image

2reactions
mmaiettacommented, Feb 16, 2022

It’s being used in a upstream library https://github.com/develar/app-builder/blob/c79345743b794ccef41493decafb0b5b2eece505/pkg/electron/electronDownloader.go#L107

AFAICT, it was never made to handle macros, so I don’t think this is really a bug… Regardless, the ticket should be opened against https://github.com/develar/app-builder

Read more comments on GitHub >

github_iconTop Results From Across the Web

ng is not recognized as an internal or external command
I solved this problem in accordance with the figure: run in cmd npm install -g @angular/cli. and then. ( open in Windows 10)...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found