Compare commits
2 Commits
dd1d8e0947
...
6bfcb3642d
Author | SHA1 | Date | |
---|---|---|---|
|
6bfcb3642d | ||
|
66b430ac90 |
@ -1,5 +1,6 @@
|
|||||||
import { Colors, Path, FS, Compress, Base64 } from "../deps.ts";
|
import { Colors, Path, FS, Compress, Base64 } from "../deps.ts";
|
||||||
import { getMeta, IMeta, log, getConfig } from "../global.ts";
|
import { getMeta, IMeta, log, getConfig } from "../global.ts";
|
||||||
|
import { ServerError } from "../helper/server_error.ts";
|
||||||
|
|
||||||
async function runScript(script: string) {
|
async function runScript(script: string) {
|
||||||
console.log(Colors.bold(Colors.blue("Running script:")), script);
|
console.log(Colors.bold(Colors.blue("Running script:")), script);
|
||||||
@ -104,17 +105,20 @@ export default async function publish(options: { dry: boolean }) {
|
|||||||
.then((res) =>
|
.then((res) =>
|
||||||
res.status === 200
|
res.status === 200
|
||||||
? res.json()
|
? res.json()
|
||||||
: Promise.reject(new Error(res.statusText))
|
: Promise.reject(new ServerError(res.statusText))
|
||||||
)
|
)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
if (!res.success) {
|
if (!res.success) {
|
||||||
throw new Error(res.message);
|
throw new ServerError(res.message);
|
||||||
} else {
|
} else {
|
||||||
console.log(Colors.green("Upload successfull"));
|
console.log(Colors.green("Upload successfull"));
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
console.log(Colors.red("Error: " + err.message));
|
//import { ServerError } from "../helper/server_error.ts";
|
||||||
|
if (err instanceof ServerError)
|
||||||
|
console.log(Colors.red("Server Error: " + err.message));
|
||||||
|
else console.log(Colors.red("Error: " + err.message));
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
console.log(Colors.yellow("Dry run. Skipping upload"));
|
console.log(Colors.yellow("Dry run. Skipping upload"));
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
export * as Compress from "https://deno.hibas123.de/raw/@denreg-tar/mod.ts";
|
export * as Compress from "https://deno.hibas123.de/raw/@denreg-tar/mod.ts";
|
||||||
export * as Ini from "https://deno.land/x/ini/mod.ts";
|
export * as Ini from "https://deno.land/x/ini@v2.1.0/mod.ts";
|
||||||
export * as Cliffy from "https://deno.land/x/cliffy/mod.ts";
|
export * as Cliffy from "https://deno.land/x/cliffy@v0.14.1/mod.ts";
|
||||||
export * as Base64 from "https://deno.land/std@0.65.0/encoding/base64.ts";
|
export * as Base64 from "https://deno.land/std@0.65.0/encoding/base64.ts";
|
||||||
export * as FS from "https://deno.land/std@0.65.0/fs/mod.ts";
|
export * as FS from "https://deno.land/std@0.65.0/fs/mod.ts";
|
||||||
export * as Colors from "https://deno.land/std@0.65.0/fmt/colors.ts";
|
export * as Colors from "https://deno.land/std@0.65.0/fmt/colors.ts";
|
||||||
|
5
cli/helper/server_error.ts
Normal file
5
cli/helper/server_error.ts
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
export class ServerError extends Error {
|
||||||
|
constructor(message: string) {
|
||||||
|
super(message);
|
||||||
|
}
|
||||||
|
}
|
@ -1,14 +1,10 @@
|
|||||||
{
|
{
|
||||||
"name": "@denreg-cli",
|
"name": "@denreg-cli",
|
||||||
"version": "0.2.4",
|
"version": "0.2.5",
|
||||||
"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": [
|
"files": ["**/*.ts", "**/*.js", "README.md"],
|
||||||
"**/*.ts",
|
|
||||||
"**/*.js",
|
|
||||||
"README.md"
|
|
||||||
],
|
|
||||||
"hooks": {
|
"hooks": {
|
||||||
"prepublish": "pre.ts"
|
"prepublish": "pre.ts"
|
||||||
}
|
}
|
||||||
|
@ -1 +1 @@
|
|||||||
export const version = "0.2.4"
|
export const version = "0.2.5"
|
Loading…
Reference in New Issue
Block a user