Skip to content
This repository was archived by the owner on Oct 21, 2024. It is now read-only.

Commit e496c6f

Browse files
committed
Feature/msi filetype
From GitbookIO#75
1 parent 212c1f4 commit e496c6f

File tree

4 files changed

+25
-4
lines changed

4 files changed

+25
-4
lines changed

__tests__/platforms.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ describe("Platforms", function () {
1717
expect(platforms.detect("atom-1.0.9-delta.nupkg")).toEqual(
1818
platforms.WINDOWS_32,
1919
)
20+
expect(platforms.detect("TestSetup.msi")).toEqual(platforms.WINDOWS_32)
2021
expect(platforms.detect("RELEASES")).toEqual(platforms.WINDOWS_32)
2122
})
2223

@@ -205,6 +206,15 @@ describe("Platforms", function () {
205206
"https://api.github.com/repos/atom/atom/releases/assets/825728",
206207
download_count: 5612,
207208
},
209+
{
210+
type: "windows_32",
211+
filename: "TestSetup.msi",
212+
size: 78675700,
213+
content_type: "application/x-msi",
214+
download_url:
215+
"https://api.github.com/repos/test/test2/releases/assets/7938398",
216+
download_count: 1,
217+
},
208218
],
209219
}
210220

@@ -248,6 +258,12 @@ describe("Platforms", function () {
248258
filePreference: [".zip"],
249259
}).filename,
250260
).toEqual("test-3.3.1-darwin-x64.zip")
261+
262+
expect(
263+
platforms.resolve(version, "win32", {
264+
filePreference: [".msi"],
265+
}).filename,
266+
).toEqual("TestSetup.msi")
251267
})
252268

253269
test("should resolve to best platform with a wanted filetype", function () {

docs/assets.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ By default releases are tagged as 32-bits (except for OSX), but 64-bits will als
1919
Filetype and usage will be detected from the extension:
2020

2121
| Platform | Extensions (sorted by priority) |
22-
| -------- | ----------------------------------- |
23-
| Windows | `.exe`, `.nupkg`, `.zip` |
22+
|----------|-------------------------------------|
23+
| Windows | `.exe`, `.nupkg`, `.zip`, `.msi` |
2424
| OS X | `.dmg`, `.zip` |
2525
| Linux | `.AppImage`, `.deb`, `.rpm`, `.zip` |
2626

docs/faq.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Since version 3.0.0, Nuts can works with [other backends](https://github.com/Git
2020

2121
Nuts can detect the type of file from its filename, there is no strict policy on file naming. Nuts tries to respect the filename/extension conventions for the different platforms. request:)
2222

23-
- Windows: `.exe`, `.nupkg` etc
23+
- Windows: `.exe`, `.nupkg`, `.msi` etc
2424
- Linux: `.deb`, `.tar.gz`, etc
2525
- OS X: `.dmg`, etc
2626

lib/utils/platforms.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,11 @@ function detectPlatform(platform) {
4141
return platforms.WINDOWS_32
4242

4343
// Detect prefix: osx, widnows or linux
44-
if (_.includes(name, "win") || hasSuffix(name, ".exe"))
44+
if (
45+
_.includes(name, "win") ||
46+
hasSuffix(name, ".exe") ||
47+
hasSuffix(name, ".msi")
48+
)
4549
prefix = platforms.WINDOWS
4650

4751
if (
@@ -127,6 +131,7 @@ function resolveForVersion(version, platformID, opts) {
127131
// Order for filetype
128132
filePreference: [
129133
".exe",
134+
".msi",
130135
".dmg",
131136
".AppImage",
132137
".deb",

0 commit comments

Comments
 (0)