Skip to content

Commit b4f6dd9

Browse files
fix: handle missing manifest in zip maker (#3405)
1 parent fd00d9a commit b4f6dd9

File tree

2 files changed

+27
-1
lines changed

2 files changed

+27
-1
lines changed

packages/maker/zip/src/MakerZIP.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,9 @@ export default class MakerZIP extends MakerBase<MakerZIPConfig> {
4848
if (targetPlatform === 'darwin' && this.config.macUpdateManifestBaseUrl) {
4949
const parsed = new URL(this.config.macUpdateManifestBaseUrl);
5050
parsed.pathname += '/RELEASES.json';
51-
const response = await got.get(parsed.toString());
51+
const response = await got.get(parsed.toString(), {
52+
throwHttpErrors: false,
53+
});
5254
let currentValue: SquirrelMacReleases = {
5355
currentRelease: '',
5456
releases: [],

packages/maker/zip/test/MakerZip_spec.ts

+24
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,30 @@ describe('MakerZip', () => {
143143
expect(foo.releases[0].updateTo).to.have.property('url');
144144
});
145145

146+
it('should generate a valid RELEASES.json manifest with no current file', async () => {
147+
maker.config = {
148+
macUpdateManifestBaseUrl: 'fake://test/foo',
149+
};
150+
getStub.returns(Promise.resolve({ statusCode: 404, body: 'GARBAGE' }));
151+
const output = await maker.make({
152+
dir: darwinDir,
153+
makeDir,
154+
appName,
155+
targetArch,
156+
targetPlatform: 'darwin',
157+
packageJSON,
158+
forgeConfig: null as any,
159+
});
160+
161+
const foo = await fs.readJson(output[1]);
162+
expect(foo).to.have.property('currentRelease', '1.2.3');
163+
expect(foo).to.have.property('releases');
164+
expect(foo.releases).to.be.an('array').with.lengthOf(1);
165+
expect(foo.releases[0]).to.have.property('version');
166+
expect(foo.releases[0]).to.have.property('updateTo');
167+
expect(foo.releases[0].updateTo).to.have.property('url');
168+
});
169+
146170
it('should extend the current RELEASES.json manifest if it exists', async () => {
147171
maker.config = {
148172
macUpdateManifestBaseUrl: 'fake://test/foo',

0 commit comments

Comments
 (0)