-
-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[download-microservice] Refactor: Clarify Execution, make bin finding clearer #132
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
198ad6e
Clarify execution via comments and variables
confused-Techie 8c72a28
Make bin lookup more clear
confused-Techie a12f06f
Add safety check of string to `type` check
confused-Techie 552bf6d
download: Refactor index.js and add more error handling
DeeDeeG 21c353e
download: Refactor utils.js query_os and query_type
DeeDeeG da5d13c
download: Update query string cap to 100 chars instead of 36
DeeDeeG 2dea642
download: Use standard HTTP status numbers
DeeDeeG 5a86240
Merge pull request #133 from pulsar-edit/deedeeg/download/refactor
confused-Techie 9ef6797
Add back valid OS and TYPE lists that got lost
confused-Techie File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
// A module that defines the way we locate a specific binary file amid all possible | ||
// Pulsar Rolling Release binaries. | ||
// In order to do this the following keys are available: | ||
// - startsWith: Checks if the version string startsWith the value | ||
// - endsWith: Checks if the version string endsWith the value | ||
// - endsWithNot: Checks if the version string does not end with the value | ||
|
||
module.exports = { | ||
windows: { | ||
windows_setup: { | ||
startsWith: "Pulsar.Setup", | ||
endsWith: ".exe" | ||
}, | ||
windows_portable: { | ||
endsWith: "-win.zip" | ||
}, | ||
windows_blockmap: { | ||
startsWith: "Pulsar.Setup", | ||
endsWith: ".exe.blockmap" | ||
} | ||
}, | ||
|
||
silicon_mac: { | ||
mac_zip: { | ||
endsWith: "-arm64-mac.zip" | ||
}, | ||
mac_zip_blockmap: { | ||
endsWith: "-arm64-mac.zip.blockmap" | ||
}, | ||
mac_dmg: { | ||
endsWith: "-arm64.dmg" | ||
}, | ||
mac_dmg_blockmap: { | ||
endsWith: "-arm64.dmg.blockmap" | ||
} | ||
}, | ||
|
||
intel_mac: { | ||
mac_zip: { | ||
endsWith: "-mac.zip", | ||
endsWithNot: "-arm64-mac.zip" | ||
}, | ||
mac_zip_blockmap: { | ||
endsWith: "-mac.zip.blockmap", | ||
endsWithNot: "-arm64-mac.zip.blockmap" | ||
}, | ||
mac_dmg: { | ||
endsWith: ".dmg", | ||
endsWithNot: "-arm64.dmg" | ||
}, | ||
mac_dmg_blockmap: { | ||
endsWith: ".dmg.blockmap", | ||
endsWithNot: "-arm64.dmg.blockmap" | ||
} | ||
}, | ||
|
||
arm_linux: { | ||
linux_appimage: { | ||
endsWith: "-arm64.AppImage" | ||
}, | ||
linux_tar: { | ||
endsWith: "-arm64.tar.gz" | ||
}, | ||
linux_rpm: { | ||
endsWith: ".aarch64.rpm" | ||
}, | ||
linux_deb: { | ||
endsWith: "_arm64.deb" | ||
} | ||
}, | ||
|
||
linux: { | ||
linux_appimage: { | ||
endsWith: ".AppImage", | ||
endsWithNot: "-arm64.AppImage" | ||
}, | ||
linux_tar: { | ||
endsWith: ".tar.gz", | ||
endsWithNot: "-arm64.tar.gz" | ||
}, | ||
linux_rpm: { | ||
endsWith: ".x86_64.rpm" | ||
}, | ||
linux_deb: { | ||
endsWith: "_amd64.deb" | ||
} | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you want to keep these const definitions and otherwise meld my changes of
index.js
into this PR it should apply pretty cleanly in terms of like diff conflicts and such.Either this way or my branch are more readable than before, IMO. Your version here might be even slightly nicer, it's pretty subjective tho.
path
andqueryParams
seems very readable, IMO, as you have it on this branch already. 👍There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe too much thoughts on this, tl;dr I think your var names are better.
I ended up with this on my branch (snippet), which I wasn't in love with but couldn't think of how to get exactly the names I wanted and the readability I wanted:
The destructuring assignment on my branch, while concise, is IMO more confusing and less readable.
And not much point in reminding where these consts came from (
urlPath
andurlParams
) by keeping "url
" in their names, whenpath
andqueryParams
are so descriptive, without fluff and readable.So that's my thoughts why your variable names/assignment approach works better, IMO.
EDIT to add: I can draft a patch and offer it for your consideration to merge my favorite bits of the two versions of
index.js
if you haven't already done it?EDIT 2: We discussed it on Discord. This became #133 targeting for inclusion in this PR's branch directly.