Skip to content

Commit 05121df

Browse files
committed
fix: Cannot upload prerelease version
Closes #395
1 parent 6977557 commit 05121df

File tree

6 files changed

+32
-7
lines changed

6 files changed

+32
-7
lines changed

.idea/dictionaries/develar.xml

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@
6666
"deep-assign": "^2.0.0",
6767
"electron-osx-sign-tf": "0.4.0-beta.0",
6868
"electron-packager-tf": "^7.0.2-beta.0",
69-
"electron-winstaller-fixed": "~2.7.0",
69+
"electron-winstaller-fixed": "~2.7.1",
7070
"fs-extra-p": "^1.0.1",
7171
"globby": "^4.0.0",
7272
"hosted-git-info": "^2.1.4",

src/winPackager.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -161,13 +161,15 @@ export class WinPackager extends PlatformPackager<WinBuildOptions> {
161161

162162
async packageInDistributableFormat(outDir: string, appOutDir: string, arch: string, packOptions: ElectronPackagerOptions): Promise<any> {
163163
const installerOutDir = computeDistOut(outDir, arch)
164-
await require("electron-winstaller-fixed").createWindowsInstaller(await this.computeEffectiveDistOptions(appOutDir, installerOutDir, packOptions))
164+
const winstaller = require("electron-winstaller-fixed")
165+
await winstaller.createWindowsInstaller(await this.computeEffectiveDistOptions(appOutDir, installerOutDir, packOptions))
165166

166167
const version = this.metadata.version
167168
const archSuffix = arch === "x64" ? "" : ("-" + arch)
168169
const releasesFile = path.join(installerOutDir, "RELEASES")
169-
const nupkgPathOriginal = this.metadata.name + "-" + version + "-full.nupkg"
170-
const nupkgPathWithArch = this.metadata.name + "-" + version + archSuffix + "-full.nupkg"
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`
171173

172174
async function changeFileNameInTheReleasesFile(): Promise<void> {
173175
const data = (await readFile(releasesFile, "utf8")).replace(new RegExp(" " + nupkgPathOriginal + " ", "g"), " " + nupkgPathWithArch + " ")

test/src/BuildTest.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,6 @@ test("copy extra resource", async () => {
166166
"lib/net45/bar/x64.txt",
167167
"lib/net45/foo/nameWithoutDot",
168168
"lib/net45/platformSpecific",
169-
"lib/net45/win/",
170169
"lib/net45/win/x64.txt"
171170
)) : null,
172171
})

test/src/helpers/packTester.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ interface AssertPackOptions {
2727
readonly tempDirCreated?: (projectDir: string) => Promise<any>
2828
readonly packed?: (projectDir: string) => Promise<any>
2929
readonly expectedContents?: Array<string>
30+
readonly expectedArtifacts?: Array<string>
3031
}
3132

3233
export async function assertPack(fixtureName: string, packagerOptions: PackagerOptions, checkOptions?: AssertPackOptions): Promise<void> {
@@ -210,13 +211,16 @@ async function checkWindowsResult(packager: Packager, packagerOptions: PackagerO
210211
`TestApp-1.1.0${archSuffix}-full.nupkg`,
211212
]
212213
}
213-
214214
const archSuffix = (packagerOptions.arch || process.arch) === "x64" ? "" : "-ia32"
215-
const expected = archSuffix == "" ? getWinExpected(archSuffix) : getWinExpected(archSuffix).concat(getWinExpected(""))
215+
const expected = checkOptions == null || checkOptions.expectedArtifacts == null ? (archSuffix == "" ? getWinExpected(archSuffix) : getWinExpected(archSuffix).concat(getWinExpected(""))) : checkOptions.expectedArtifacts
216216

217217
const filenames = artifacts.map(it => path.basename(it.file))
218218
assertThat(filenames.slice().sort()).deepEqual(expected.slice().sort())
219219

220+
if (checkOptions != null && checkOptions.expectedArtifacts != null) {
221+
return
222+
}
223+
220224
let i = filenames.indexOf("RELEASES-ia32")
221225
if (i !== -1) {
222226
assertThat((await readFile(artifacts[i].file, "utf8")).indexOf("ia32")).not.equal(-1)

test/src/winPackagerTest.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,25 @@ test.ifNotCiOsx("win", () => assertPack("test-app-one", platform(Platform.WINDOW
2222
}
2323
))
2424

25+
test.ifNotCiOsx("win f", () => {
26+
const metadata: any = {
27+
version: "3.0.0-beta.2"
28+
}
29+
30+
return assertPack("test-app-one", {
31+
platform: [Platform.WINDOWS],
32+
cscLink: null,
33+
cscInstallerLink: null,
34+
devMetadata: metadata
35+
}, {
36+
expectedArtifacts: [
37+
"RELEASES",
38+
"TestApp Setup 3.0.0-beta.2.exe",
39+
"TestApp-3.0.0-beta2-full.nupkg"
40+
]
41+
})
42+
})
43+
2544
test.ifNotCiOsx("noMsi as string", t => t.throws(assertPack("test-app-one", platform(Platform.WINDOWS),
2645
{
2746
tempDirCreated: it => modifyPackageJson(it, data => {

0 commit comments

Comments
 (0)