Electron Build Should Copy Lock File
See original GitHub issueIs your feature request related to a problem? Please describe. Currently the Electron build process copies the project package.json to the build directory and performs a production install from that. If the package.json doesn’t specify exact versions of all dependencies, this can lead to the build using different versions of dependencies than dev.
In my case, one of my dependencies introduced a breaking change in a minor version (poor form, I know). My package.json specified “^2.8.0”. Running “quasar dev -m electron” resulted in using 2.8.0 from the version controlled package-lock.json and worked fine, but “quasar build -m electron” installed the latest 2.x.0 release, which produced a non-functional build.
Describe the solution you’d like Prior to the Electron package installation step, the project package-lock.json or yarn.lock, as determined by the nodePackager variable, should be copied into the electron UnPackaged build directory. I’ve verified that this results in installing just production dependencies at the locked versions for npm. I believe this should be true for yarn as well, but have not confirmed.
Describe alternatives you’ve considered If introducing the behavior specified above might cause issues I haven’t considered, the behavior could be added to the Electron documentation, perhaps with a slightly more polished version of this work around that I have successfully added to the build property in quasar.conf.js:
async beforeBuild() {
const unpackagedPath = `${__dirname}/dist/electron/UnPackaged`;
mkdirp.sync(unpackagedPath);
fs.copyFileSync(`${__dirname}/package-lock.json`, `${unpackagedPath}/package-lock.json`);
},
Additional context I’m willing to try to familiarize my self a bit more with the Quasar code base and put together a PR if this feature gets a green light. If somebody already familiar can immediately point out what method would be most appropriate to extend for this, that would be helpful. I assume the method that copies package.json currently, but I haven’t tracked that down yet.
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (5 by maintainers)
Top GitHub Comments
And it seems some cool new Vite goodness on the horizon. Yep… 100% agree we can leave this to folks to figure out. For posterity two easy ways that I know of right off the bat…
script
to yourpackage.json
like this:with whatever path you want relative to
package.json
. The post prefix there causes thepostbuild
script to run immediately after thebuild
script automatically. or (probably better) 2) modifyquasar.conf
with a pre-build or post-build trigger. https://quasar.dev/app-extensions/development-guide/index-api#api-beforebuildEnhancement will be available in “@quasar/app” v3.2.5