Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,8 @@ jobs:
matrix:
node-version:
- '22.11'
- '20.18'
- '18.20'
os:
- macos-latest
- ubuntu-latest
- windows-latest
runs-on: '${{ matrix.os }}'
steps:
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"@types/jest": "^29.5.14",
"@types/ms": "^0.7.31",
"@types/node": "^22.10.1",
"electron": "^35.7.5",
"electron": "^41.1.1",
"eslint": "^9.15.0",
"eslint-config-prettier": "^9.1.0",
"globals": "^15.13.0",
Expand Down
3 changes: 2 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -166,9 +166,10 @@ function initUpdater(opts: ReturnType<typeof validateInput>) {
let serverType: 'default' | 'json' = 'default';
switch (updateSource.type) {
case UpdateSourceType.ElectronPublicUpdateService: {
const formatSegment = process.windowsStore ? '/msix' : '';
feedURL = `${updateSource.host}/${updateSource.repo}/${process.platform}-${
process.arch
}/${app.getVersion()}`;
}${formatSegment}/${app.getVersion()}`;
break;
}
case UpdateSourceType.StaticStorage: {
Expand Down
32 changes: 32 additions & 0 deletions test/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,38 @@ describe('updateElectronApp', () => {
});
});

describe('updateFormat', () => {
it('includes /msix/ in feed URL when process.windowsStore is true', () => {
const original = process.windowsStore;
Object.defineProperty(process, 'windowsStore', { value: true, configurable: true });
const logSpy = jest.spyOn(console, 'log');
updateElectronApp({
updateSource: {
type: UpdateSourceType.ElectronPublicUpdateService,
repo,
},
});
expect(logSpy).toHaveBeenCalledWith('feedURL', expect.stringContaining('/msix/'));
logSpy.mockRestore();
Object.defineProperty(process, 'windowsStore', { value: original, configurable: true });
});

it('omits format from feed URL when process.windowsStore is falsy', () => {
const original = process.windowsStore;
Object.defineProperty(process, 'windowsStore', { value: undefined, configurable: true });
const logSpy = jest.spyOn(console, 'log');
updateElectronApp({
updateSource: {
type: UpdateSourceType.ElectronPublicUpdateService,
repo,
},
});
expect(logSpy).toHaveBeenCalledWith('feedURL', expect.not.stringContaining('/msix/'));
logSpy.mockRestore();
Object.defineProperty(process, 'windowsStore', { value: original, configurable: true });
});
});

describe('updateInterval', () => {
it('must be 5 minutes or more', () => {
expect(() => {
Expand Down
30 changes: 23 additions & 7 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1319,7 +1319,7 @@ __metadata:
languageName: node
linkType: hard

"@types/node@npm:*, @types/node@npm:^22.10.1, @types/node@npm:^22.7.7":
"@types/node@npm:*, @types/node@npm:^22.10.1":
version: 22.18.0
resolution: "@types/node@npm:22.18.0"
dependencies:
Expand All @@ -1328,6 +1328,15 @@ __metadata:
languageName: node
linkType: hard

"@types/node@npm:^24.9.0":
version: 24.12.0
resolution: "@types/node@npm:24.12.0"
dependencies:
undici-types: "npm:~7.16.0"
checksum: 10c0/8b31c0af5b5474f13048a4e77c57f22cd4f8fe6e58c4b6fde9456b0c13f46a5bfaf5744ff88fd089581de9f0d6e99c584e022681de7acb26a58d258c654c4843
languageName: node
linkType: hard

"@types/prettier@npm:^2.1.5":
version: 2.7.1
resolution: "@types/prettier@npm:2.7.1"
Expand Down Expand Up @@ -2212,16 +2221,16 @@ __metadata:
languageName: node
linkType: hard

"electron@npm:^35.7.5":
version: 35.7.5
resolution: "electron@npm:35.7.5"
"electron@npm:^41.1.1":
version: 41.1.1
resolution: "electron@npm:41.1.1"
dependencies:
"@electron/get": "npm:^2.0.0"
"@types/node": "npm:^22.7.7"
"@types/node": "npm:^24.9.0"
extract-zip: "npm:^2.0.1"
bin:
electron: cli.js
checksum: 10c0/2c331e438b655b25a8b49ce038878cdc61a42481fcdf464ecb5648585a2c83f1edc5d8e0a8de582713f8e3dc8a3b35aaa136735ad68f8009ee2369f3b2e79c15
checksum: 10c0/b52df5c263ee612e62b7d804bf97d739f2876b5b16cf46cf99ec338d59093cb066bf85d1ad77115d4839a5ea64bba66ecb27111696a409cbe64eb81c3e71449e
languageName: node
linkType: hard

Expand Down Expand Up @@ -5345,6 +5354,13 @@ __metadata:
languageName: node
linkType: hard

"undici-types@npm:~7.16.0":
version: 7.16.0
resolution: "undici-types@npm:7.16.0"
checksum: 10c0/3033e2f2b5c9f1504bdc5934646cb54e37ecaca0f9249c983f7b1fc2e87c6d18399ebb05dc7fd5419e02b2e915f734d872a65da2e3eeed1813951c427d33cc9a
languageName: node
linkType: hard

"unique-filename@npm:^4.0.0":
version: 4.0.0
resolution: "unique-filename@npm:4.0.0"
Expand Down Expand Up @@ -5393,7 +5409,7 @@ __metadata:
"@types/jest": "npm:^29.5.14"
"@types/ms": "npm:^0.7.31"
"@types/node": "npm:^22.10.1"
electron: "npm:^35.7.5"
electron: "npm:^41.1.1"
eslint: "npm:^9.15.0"
eslint-config-prettier: "npm:^9.1.0"
github-url-to-object: "npm:^4.0.4"
Expand Down