11'use strict'
22
33const electronInstaller = require ( 'electron-winstaller' )
4- const fs = require ( 'fs-extra ' )
4+ const fs = require ( 'fs' )
55const glob = require ( 'glob' )
66const path = require ( 'path' )
77
@@ -17,16 +17,30 @@ module.exports = (packagedAppPath) => {
1717 outputDirectory : CONFIG . buildOutputPath ,
1818 noMsi : true ,
1919 remoteReleases : `https://atom.io/api/updates${ archSuffix } ?version=${ CONFIG . appMetadata . version } ` ,
20+ setupExe : `AtomSetup${ process . arch === 'x64' ? '-x64' : '' } .exe` ,
2021 setupIcon : path . join ( CONFIG . repositoryRootPath , 'resources' , 'app-icons' , CONFIG . channel , 'atom.ico' )
2122 }
2223
2324 const cleanUp = ( ) => {
24- for ( let nupkgPath of glob . sync ( `${ CONFIG . buildOutputPath } /*.nupkg` ) ) {
25+ const releasesPath = `${ CONFIG . buildOutputPath } /RELEASES`
26+ if ( process . arch === 'x64' && fs . existsSync ( releasesPath ) ) {
27+ fs . renameSync ( releasesPath , `${ releasesPath } -x64` )
28+ }
29+
30+ for ( let nupkgPath of glob . sync ( `${ CONFIG . buildOutputPath } /atom-*.nupkg` ) ) {
2531 if ( ! nupkgPath . includes ( CONFIG . appMetadata . version ) ) {
2632 console . log ( `Deleting downloaded nupkg for previous version at ${ nupkgPath } to prevent it from being stored as an artifact` )
27- fs . removeSync ( nupkgPath )
33+ fs . unlinkSync ( nupkgPath )
34+ } else {
35+ if ( process . arch === 'x64' ) {
36+ // Use the original .nupkg filename to generate the `atom-x64` name by inserting `-x64` after `atom`
37+ const newNupkgPath = nupkgPath . replace ( 'atom-' , 'atom-x64-' )
38+ fs . renameSync ( nupkgPath , newNupkgPath )
39+ }
2840 }
2941 }
42+
43+ return `${ CONFIG . buildOutputPath } /${ options . setupExe } `
3044 }
3145
3246 console . log ( `Creating Windows Installer for ${ packagedAppPath } ` )
0 commit comments