Skip to content
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

fix npm download for windows #33

Merged
merged 1 commit into from
Dec 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 18 additions & 18 deletions npm/binary.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,63 +3,63 @@ const os = require("os");
const { join } = require("path");
const cTable = require("console.table");

const error = msg => {
const error = (msg) => {
console.error(msg);
process.exit(1);
};

const { version, repository } = require("./package.json");

const name = 'safebox';
const name = "safebox";

const supportedPlatforms = [
{
TYPE: "Darwin",
ARCHITECTURE: "x64",
TARGET: "darwin_amd64",
NAME: name
NAME: name,
},
{
TYPE: "Darwin",
ARCHITECTURE: "arm64",
TARGET: "darwin_arm64",
NAME: name
NAME: name,
},
{
TYPE: "Windows_NT",
ARCHITECTURE: "x64",
TARGET: "windows_amd64.exe",
NAME: `${name}.exe`
TARGET: "windows_amd64",
NAME: `${name}.exe`,
},
{
TYPE: "Windows_NT",
ARCHITECTURE: "arm64",
TARGET: "windows_arm64.exe",
NAME: `${name}.exe`
TARGET: "windows_arm64",
NAME: `${name}.exe`,
},
{
TYPE: "Windows_NT",
ARCHITECTURE: "ia32",
TARGET: "windows_386.exe",
NAME: `${name}.exe`
TARGET: "windows_386",
NAME: `${name}.exe`,
},
{
TYPE: "Linux",
ARCHITECTURE: "ia32",
TARGET: "linux_386",
NAME: name
NAME: name,
},
{
TYPE: "Linux",
ARCHITECTURE: "x64",
TARGET: "linux_amd64",
NAME: name
NAME: name,
},
{
TYPE: "Linux",
ARCHITECTURE: "arm64",
TARGET: "linux_arm64",
NAME: name
NAME: name,
},
];

Expand All @@ -78,16 +78,16 @@ const getPlatform = () => {

error(
`Platform with type "${type}" and architecture "${architecture}" is not supported by ${name}.\nYour system must be one of the following:\n\n${cTable.getTable(
supportedPlatforms
)}`
supportedPlatforms,
)}`,
);
};

const getBinary = () => {
const platform = getPlatform();

const url = `${repository.url}/releases/download/v${version}/${name}_${version}_${platform.TARGET}.tar.gz`;

return new Binary(platform.NAME, url);
};

Expand All @@ -103,5 +103,5 @@ const install = (supressLogs = false) => {

module.exports = {
install,
run
run,
};
4 changes: 2 additions & 2 deletions npm/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion npm/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@adikari/safebox",
"version": "1.3.11",
"version": "1.3.12",
"description": "A Fast and Flexible secret manager built with love by adikari in Go",
"main": "index.js",
"bin": "./run.js",
Expand Down