Feat: Support macOS and Windows, migrate JavaScript to TypeScript (#32)
- Support macOS and Windows (Close #24 ) - Refactoring - Error handling - TypeScript - Prettier (Close #29 ) - GHA: Add upload-artifact step for test coverage - deps: Install husky
This commit is contained in:
parent
4d54b90c0e
commit
dc8541739a
24 changed files with 924 additions and 168 deletions
27
lib/get-url.js
Normal file
27
lib/get-url.js
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
function getURL(os, extended, version) {
|
||||
const extendedStr = (extended) => {
|
||||
if (extended === 'true') {
|
||||
return 'extended_';
|
||||
}
|
||||
else {
|
||||
return '';
|
||||
// } else {
|
||||
// throw new Error(`Invalid input (extended): ${extended}`);
|
||||
}
|
||||
};
|
||||
const ext = (os) => {
|
||||
if (os === 'Windows') {
|
||||
return 'zip';
|
||||
}
|
||||
else {
|
||||
return 'tar.gz';
|
||||
}
|
||||
};
|
||||
const hugoName = `hugo_${extendedStr(extended)}${version}_${os}-64bit`;
|
||||
const baseURL = 'https://github.com/gohugoio/hugo/releases/download';
|
||||
const url = `${baseURL}/v${version}/${hugoName}.${ext(os)}`;
|
||||
return url;
|
||||
}
|
||||
exports.default = getURL;
|
||||
Loading…
Add table
Add a link
Reference in a new issue