mirror of
https://github.com/ershisan99/go-npm.git
synced 2025-12-18 05:09:26 +00:00
ADD win_ext to URL template variables
This commit is contained in:
@@ -84,6 +84,7 @@ Following variables are available to customize the URL:
|
||||
* `{{version}}`: Version number read from `package.json` file. When you publish your package to NPM, it will use this version number. Ex: 0.0.1
|
||||
* `{{platform}}`: `$GOOS` value for the platform
|
||||
* `{{arch}}`: `$GOARCH` value for the architecture
|
||||
* `{{ win_ext }}`: optional `.exe` extension for windows assets.
|
||||
|
||||
If you use `goreleaser` to publish your modules, it will automatically set the right architecture & platform in your URL.
|
||||
|
||||
|
||||
@@ -129,7 +129,11 @@ function parsePackageJson() {
|
||||
|
||||
// Binary name on Windows has .exe suffix
|
||||
if (process.platform === "win32") {
|
||||
binName += ".exe"
|
||||
binName += ".exe";
|
||||
|
||||
url = url.replace(/{{win_ext}}/g, '.exe');
|
||||
} else {
|
||||
url = url.replace(/{{win_ext}}/g, '');
|
||||
}
|
||||
|
||||
// Interpolate variables in URL, if necessary
|
||||
@@ -143,7 +147,7 @@ function parsePackageJson() {
|
||||
binPath: binPath,
|
||||
url: url,
|
||||
version: version
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user