@@ -3,8 +3,8 @@ import { Promise as BluebirdPromise } from "bluebird"
3
3
import { PlatformPackager , BuildInfo } from "./platformPackager"
4
4
import { Platform , WinBuildOptions } from "./metadata"
5
5
import * as path from "path"
6
- import { log , statOrNull } from "./util"
7
- import { readFile , deleteFile , rename , copy , emptyDir , writeFile , open , close , read , move } from "fs-extra-p"
6
+ import { log , statOrNull , warn } from "./util"
7
+ import { deleteFile , rename , emptyDir , open , close , read , move } from "fs-extra-p"
8
8
import { sign } from "signcode-tf"
9
9
import ElectronPackagerOptions = ElectronPackager . ElectronPackagerOptions
10
10
@@ -52,6 +52,10 @@ export class WinPackager extends PlatformPackager<WinBuildOptions> {
52
52
}
53
53
54
54
async pack ( outDir : string , arch : string , postAsyncTasks : Array < Promise < any > > ) : Promise < any > {
55
+ if ( arch === "ia32" ) {
56
+ warn ( "For windows consider only distributing 64-bit, see https://github.com/electron-userland/electron-builder/issues/359#issuecomment-214851130" )
57
+ }
58
+
55
59
// we must check icon before pack because electron-packager uses icon and it leads to cryptic error message "spawn wine ENOENT"
56
60
await this . iconPath
57
61
@@ -64,7 +68,7 @@ export class WinPackager extends PlatformPackager<WinBuildOptions> {
64
68
}
65
69
66
70
const unpackedDir = path . join ( outDir , `win${ arch === "x64" ? "" : `-${ arch } ` } -unpacked` )
67
- const finalAppOut = path . join ( outDir , `win ${ arch === "x64" ? "" : `- ${ arch } ` } -unpacked` , "lib" , "net45" )
71
+ const finalAppOut = path . join ( unpackedDir , "lib" , "net45" )
68
72
const installerOut = computeDistOut ( outDir , arch )
69
73
log ( "Removing %s and %s" , path . relative ( this . projectDir , installerOut ) , path . relative ( this . projectDir , unpackedDir ) )
70
74
await BluebirdPromise . all ( [
@@ -166,38 +170,13 @@ export class WinPackager extends PlatformPackager<WinBuildOptions> {
166
170
167
171
const version = this . metadata . version
168
172
const archSuffix = arch === "x64" ? "" : ( "-" + arch )
169
- const releasesFile = path . join ( installerOutDir , "RELEASES" )
170
- const nupkgVersion = winstaller . convertVersion ( version )
171
- const nupkgPathOriginal = `${ this . metadata . name } -${ nupkgVersion } -full.nupkg`
172
- const nupkgPathWithArch = `${ this . metadata . name } -${ nupkgVersion } ${ archSuffix } -full.nupkg`
173
-
174
- async function changeFileNameInTheReleasesFile ( ) : Promise < void > {
175
- const data = ( await readFile ( releasesFile , "utf8" ) ) . replace ( new RegExp ( " " + nupkgPathOriginal + " " , "g" ) , " " + nupkgPathWithArch + " " )
176
- await writeFile ( releasesFile , data )
177
- }
178
-
179
- const promises : Array < Promise < any > > = [
180
- rename ( path . join ( installerOutDir , "Setup.exe" ) , path . join ( installerOutDir , `${ this . appName } Setup ${ version } ${ archSuffix } .exe` ) )
181
- . then ( it => this . dispatchArtifactCreated ( it , `${ this . metadata . name } -Setup-${ version } ${ archSuffix } .exe` ) ) ,
182
- ]
173
+ const nupkgPath = `${ this . metadata . name } -${ winstaller . convertVersion ( version ) } -full.nupkg`
183
174
184
- if ( archSuffix === "" ) {
185
- this . dispatchArtifactCreated ( path . join ( installerOutDir , nupkgPathOriginal ) )
186
- this . dispatchArtifactCreated ( path . join ( installerOutDir , "RELEASES" ) )
187
- }
188
- else {
189
- promises . push (
190
- rename ( path . join ( installerOutDir , nupkgPathOriginal ) , path . join ( installerOutDir , nupkgPathWithArch ) )
191
- . then ( it => this . dispatchArtifactCreated ( it ) )
192
- )
193
- promises . push (
194
- changeFileNameInTheReleasesFile ( )
195
- . then ( ( ) => copy ( releasesFile , path . join ( installerOutDir , "RELEASES-ia32" ) ) )
196
- . then ( it => this . dispatchArtifactCreated ( it ) )
197
- )
198
- }
175
+ this . dispatchArtifactCreated ( path . join ( installerOutDir , nupkgPath ) )
176
+ this . dispatchArtifactCreated ( path . join ( installerOutDir , "RELEASES" ) )
199
177
200
- await BluebirdPromise . all ( promises )
178
+ await rename ( path . join ( installerOutDir , "Setup.exe" ) , path . join ( installerOutDir , `${ this . appName } Setup ${ version } ${ archSuffix } .exe` ) )
179
+ . then ( it => this . dispatchArtifactCreated ( it , `${ this . metadata . name } -Setup-${ version } ${ archSuffix } .exe` ) )
201
180
}
202
181
}
203
182
0 commit comments