@eik/cli 3.1.4 → 3.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +7 -0
- package/classes/alias.js +1 -1
- package/commands/alias.js +35 -69
- package/commands/init.js +75 -88
- package/commands/integrity.js +20 -33
- package/commands/login.js +51 -70
- package/commands/map-alias.js +41 -61
- package/commands/map.js +34 -48
- package/commands/meta.js +31 -47
- package/commands/npm-alias.js +32 -57
- package/commands/package-alias.js +35 -66
- package/commands/ping.js +17 -28
- package/commands/publish.js +50 -56
- package/commands/version.js +36 -42
- package/index.js +52 -48
- package/package.json +3 -3
- package/readme.md +1 -1
- package/types/classes/alias.d.ts +2 -2
- package/types/utils/defaults.d.ts +22 -0
- package/types/utils/error.d.ts +19 -0
- package/types/utils/index.d.ts +2 -2
- package/utils/command-handler.js +72 -0
- package/utils/defaults.js +79 -0
- package/utils/error.js +42 -0
- package/utils/index.js +3 -2
- package/commands/index.js +0 -27
package/utils/error.js
ADDED
@@ -0,0 +1,42 @@
|
|
1
|
+
export const errors = {
|
2
|
+
ERR_MISSING_CONFIG: "ERR_MISSING_CONFIG",
|
3
|
+
ERR_WRONG_TYPE: "ERR_WRONG_TYPE",
|
4
|
+
ERR_VERSION_EXISTS: "ERR_VERSION_EXISTS",
|
5
|
+
ERR_NOT_GIT: "ERR_NOT_GIT",
|
6
|
+
ERR_GIT_COMMIT: "ERR_GIT_COMMIT",
|
7
|
+
};
|
8
|
+
|
9
|
+
export class EikCliError extends Error {
|
10
|
+
#errorCode;
|
11
|
+
#exitCode;
|
12
|
+
|
13
|
+
/**
|
14
|
+
* @param {string} errorCode
|
15
|
+
* @param {string} message
|
16
|
+
* @param {Error} [cause]
|
17
|
+
*/
|
18
|
+
constructor(errorCode, message, cause) {
|
19
|
+
super(message);
|
20
|
+
|
21
|
+
this.name = "EikCliError";
|
22
|
+
this.cause = cause;
|
23
|
+
|
24
|
+
this.#errorCode = errorCode;
|
25
|
+
|
26
|
+
switch (errorCode) {
|
27
|
+
case errors.ERR_VERSION_EXISTS:
|
28
|
+
this.#exitCode = 0;
|
29
|
+
break;
|
30
|
+
default:
|
31
|
+
this.#exitCode = 1;
|
32
|
+
}
|
33
|
+
}
|
34
|
+
|
35
|
+
get errorCode() {
|
36
|
+
return this.#errorCode;
|
37
|
+
}
|
38
|
+
|
39
|
+
get exitCode() {
|
40
|
+
return this.#exitCode;
|
41
|
+
}
|
42
|
+
}
|
package/utils/index.js
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
import { helpers } from "@eik/common";
|
2
2
|
import logger from "./logger.js";
|
3
3
|
import typeTitle from "./type-title.js";
|
4
|
+
import { getArgsOrDefaults } from "./defaults.js";
|
4
5
|
|
5
|
-
const {
|
6
|
+
const { typeSlug } = helpers;
|
6
7
|
|
7
|
-
export { logger,
|
8
|
+
export { logger, getArgsOrDefaults, typeSlug, typeTitle };
|
package/commands/index.js
DELETED
@@ -1,27 +0,0 @@
|
|
1
|
-
import * as init from "./init.js";
|
2
|
-
import * as integrity from "./integrity.js";
|
3
|
-
import * as login from "./login.js";
|
4
|
-
import * as mapAlias from "./map-alias.js";
|
5
|
-
import * as map from "./map.js";
|
6
|
-
import * as meta from "./meta.js";
|
7
|
-
import * as npmAlias from "./npm-alias.js";
|
8
|
-
import * as packageAlias from "./package-alias.js";
|
9
|
-
import * as ping from "./ping.js";
|
10
|
-
import * as publish from "./publish.js";
|
11
|
-
import * as version from "./version.js";
|
12
|
-
import * as alias from "./alias.js";
|
13
|
-
|
14
|
-
export const commands = [
|
15
|
-
init,
|
16
|
-
integrity,
|
17
|
-
login,
|
18
|
-
mapAlias,
|
19
|
-
map,
|
20
|
-
meta,
|
21
|
-
npmAlias,
|
22
|
-
packageAlias,
|
23
|
-
ping,
|
24
|
-
publish,
|
25
|
-
version,
|
26
|
-
alias,
|
27
|
-
];
|