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