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

Commit

Permalink
Feature/msi filetype
Browse files Browse the repository at this point in the history
  • Loading branch information
rastiqdev committed Jun 26, 2023
1 parent 212c1f4 commit e496c6f
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 4 deletions.
16 changes: 16 additions & 0 deletions __tests__/platforms.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ describe("Platforms", function () {
expect(platforms.detect("atom-1.0.9-delta.nupkg")).toEqual(
platforms.WINDOWS_32,
)
expect(platforms.detect("TestSetup.msi")).toEqual(platforms.WINDOWS_32)
expect(platforms.detect("RELEASES")).toEqual(platforms.WINDOWS_32)
})

Expand Down Expand Up @@ -205,6 +206,15 @@ describe("Platforms", function () {
"https://api.github.com/repos/atom/atom/releases/assets/825728",
download_count: 5612,
},
{
type: "windows_32",
filename: "TestSetup.msi",
size: 78675700,
content_type: "application/x-msi",
download_url:
"https://api.github.com/repos/test/test2/releases/assets/7938398",
download_count: 1,
},
],
}

Expand Down Expand Up @@ -248,6 +258,12 @@ describe("Platforms", function () {
filePreference: [".zip"],
}).filename,
).toEqual("test-3.3.1-darwin-x64.zip")

expect(
platforms.resolve(version, "win32", {
filePreference: [".msi"],
}).filename,
).toEqual("TestSetup.msi")
})

test("should resolve to best platform with a wanted filetype", function () {
Expand Down
4 changes: 2 additions & 2 deletions docs/assets.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ By default releases are tagged as 32-bits (except for OSX), but 64-bits will als
Filetype and usage will be detected from the extension:

| Platform | Extensions (sorted by priority) |
| -------- | ----------------------------------- |
| Windows | `.exe`, `.nupkg`, `.zip` |
|----------|-------------------------------------|
| Windows | `.exe`, `.nupkg`, `.zip`, `.msi` |
| OS X | `.dmg`, `.zip` |
| Linux | `.AppImage`, `.deb`, `.rpm`, `.zip` |

Expand Down
2 changes: 1 addition & 1 deletion docs/faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Since version 3.0.0, Nuts can works with [other backends](https://github.com/Git

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:)

- Windows: `.exe`, `.nupkg` etc
- Windows: `.exe`, `.nupkg`, `.msi` etc
- Linux: `.deb`, `.tar.gz`, etc
- OS X: `.dmg`, etc

Expand Down
7 changes: 6 additions & 1 deletion lib/utils/platforms.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,11 @@ function detectPlatform(platform) {
return platforms.WINDOWS_32

// Detect prefix: osx, widnows or linux
if (_.includes(name, "win") || hasSuffix(name, ".exe"))
if (
_.includes(name, "win") ||
hasSuffix(name, ".exe") ||
hasSuffix(name, ".msi")
)
prefix = platforms.WINDOWS

if (
Expand Down Expand Up @@ -127,6 +131,7 @@ function resolveForVersion(version, platformID, opts) {
// Order for filetype
filePreference: [
".exe",
".msi",
".dmg",
".AppImage",
".deb",
Expand Down

0 comments on commit e496c6f

Please sign in to comment.