ci010 / electron-vue-next

A starter template for using vue-next with the electron.
https://ci010.github.io/electron-vue-next/
191 stars 27 forks source link

Why renameFiles function is needed? #6

Closed cawa-93 closed 3 years ago

cawa-93 commented 3 years ago

I do not understand why this function is needed.

https://github.com/ci010/electron-vue-next/blob/a304825fac4dd32609a69ce35aab661de1673c3b/scripts/build.js#L64-L72

I tried to comment on it and nothing broke. On the contrary. I had received an error before:

Build electron
  • electron-builder  version=22.9.1 os=10.0.19042
....

Error: dest already exists.
    at C:\Users\kozac\Dev\electron-vue-next\node_modules\fs-extra\lib\move\move.js:41:31
    at C:\Users\kozac\Dev\electron-vue-next\node_modules\universalify\index.js:23:46

But removing the file renaming fixed the error.

ci010 commented 3 years ago

The electron-builder build the latest.yml with the url replacing the ` (space) into-` .

version: 0.0.0
files:
  - url: electron-vue-next-Setup-0.0.0.exe
    sha512: GXn5QdYUBhCTDyzohkzo0LE+qxKeJH6OQXL8J/TX3c6wmCG7c+JaZLsOpTfYHx4BnP1V/K9JCUulZeO24XDiig==
    size: 54854767
path: electron-vue-next-Setup-0.0.0.exe
sha512: GXn5QdYUBhCTDyzohkzo0LE+qxKeJH6OQXL8J/TX3c6wmCG7c+JaZLsOpTfYHx4BnP1V/K9JCUulZeO24XDiig==
releaseDate: '2020-11-08T04:19:43.773Z'

And if it uploads to github it will not replace the ` (space) into-. So thelatest.yml` url will mismatch.

Current move code has bug... I just fix it in 3dcf0fd7d9146fea0f217278ad411e2d57d0bbe7.

cawa-93 commented 3 years ago

if it uploads to github it will not replace the (space) into -.

It seems that it is not. I don't know exactly why, but in my case all the files were renamed correctly. I've done a few releases. And I believed the names of the downloaded files from the volumes specified in latest.yml.

Check: https://github.com/cawa-93/electron-vue-next/releases

cawa-93 commented 3 years ago

OK. A little more information: When building locally or in the cloud, files are created with spaces. This can be verified by downloading build Artifacts.

But after uploading into the release, the spaces are replaced by -

cawa-93 commented 3 years ago

Maybe it would be easier to just use the artifactName parameter to specify the name of the artifacts without spaces, instead of renaming them after?

ci010 commented 3 years ago

if it uploads to github it will not replace the (space) into -.

It seems that it is not. I don't know exactly why, but in my case all the files were renamed correctly. I've done a few releases. And I believed the names of the downloaded files from the volumes specified in latest.yml.

Check: https://github.com/cawa-93/electron-vue-next/releases

I just check the release link above. I found it's using the - url: electron-vue-next-Setup-0.2.0.exe in latest.yml, whereas the github release artifact url is https://github.com/cawa-93/electron-vue-next/releases/download/v0.2.0/electron-vue-next-Setup.0.2.0.exe.

Notice that it's the electron-vue-next-Setup.0.2.0.exe but not the electron-vue-next-Setup-0.2.0.exe (github artifact replace space into dot/period sign), and it might break the autoUpdater of the electron builder... if I remember correctly (I found it broke my updater in the past, I'm not sure if electron builder fix this now or not).

Maybe it would be easier to just use the artifactName parameter to specify the name of the artifacts without spaces, instead of renaming them after?

Yes, that's the better way to do this. I'll fix this in next patch. Thanks a lot!