Adding better output of publish command
Some checks failed
continuous-integration/drone/push Build is failing
Some checks failed
continuous-integration/drone/push Build is failing
This commit is contained in:
parent
7fcdf2c383
commit
ef4ce98ebb
@ -44,7 +44,7 @@ export default async function publish() {
|
||||
|
||||
log("Uploading new package version");
|
||||
|
||||
const res = await fetch(url, {
|
||||
await fetch(url, {
|
||||
method: "POST",
|
||||
body: await Deno.readFile(packedFile),
|
||||
headers: {
|
||||
@ -54,19 +54,22 @@ export default async function publish() {
|
||||
getConfig("username") + ":" + getConfig("password")
|
||||
),
|
||||
},
|
||||
}).then((res) => (res.status === 200 ? res.json() : res.statusText));
|
||||
|
||||
log("Upload finished. Result:", res);
|
||||
|
||||
if (typeof res === "string" || res.error) {
|
||||
console.log(
|
||||
Colors.red("Error: " + (typeof res == "string" ? res : res.error))
|
||||
);
|
||||
} else {
|
||||
if (res.success) {
|
||||
console.log(Colors.green("Upload successfull"));
|
||||
}
|
||||
}
|
||||
})
|
||||
.then((res) =>
|
||||
res.status === 200
|
||||
? res.json()
|
||||
: Promise.reject(new Error("res.statusText"))
|
||||
)
|
||||
.then((res) => {
|
||||
if (!res.success) {
|
||||
throw new Error(res.message);
|
||||
} else {
|
||||
console.log(Colors.green("Upload successfull"));
|
||||
}
|
||||
})
|
||||
.catch((err) => {
|
||||
console.log(Colors.red("Error: " + err.message));
|
||||
});
|
||||
} finally {
|
||||
await Deno.remove(tmpDir, { recursive: true });
|
||||
await Deno.remove(packedFile);
|
||||
|
@ -1,8 +1,12 @@
|
||||
{
|
||||
"name": "@denreg-cli",
|
||||
"version": "0.1.2",
|
||||
"version": "0.1.4",
|
||||
"description": "CLI for the DenReg package registry",
|
||||
"author": "Fabian Stamm <dev@fabianstamm.de>",
|
||||
"contributors": [],
|
||||
"files": ["**/*.ts", "**/*.js", "README.md"]
|
||||
"files": [
|
||||
"**/*.ts",
|
||||
"**/*.js",
|
||||
"README.md"
|
||||
]
|
||||
}
|
Loading…
Reference in New Issue
Block a user