@dcl/sdk 7.0.6-4086929545.commit-0292186 → 7.0.6-4087883663.commit-054d424

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/cli/utils/log.ts CHANGED
@@ -1,27 +1,39 @@
1
- export function raw(message: string) {
2
- console.log(message)
1
+ import { createColors } from 'colorette'
2
+
3
+ /**
4
+ * This file imitates "cargo" logs. The words are aligned with the colon like this:
5
+ * V
6
+ * Error: some text provided as argumen
7
+ * Info: some text provided as argumen
8
+ * Success: some text provided as argumen
9
+ * Warning: some text provided as argumen
10
+ * ^
11
+ */
12
+
13
+ const stderr = (...parameters: readonly unknown[]) => process.stderr.write(`${parameters.join('')}\n`)
14
+
15
+ // @see https://no-color.org
16
+ // @see https://www.npmjs.com/package/chalk
17
+ const colors = createColors({
18
+ useColor: process.env.FORCE_COLOR !== '0' && !process.env.NO_COLOR
19
+ })
20
+
21
+ export function log(message: string) {
22
+ stderr(message)
3
23
  }
4
24
 
5
25
  export function fail(message: string) {
6
- console.log(`🔴 ${message}`)
26
+ stderr(colors.redBright(' Error: '), message)
7
27
  }
8
28
 
9
29
  export function warn(message: string) {
10
- console.log(`🟠 ${message}`)
30
+ stderr(colors.yellow('Warning: '), message)
11
31
  }
12
32
 
13
33
  export function info(message: string) {
14
- console.log(`🔵 ${message}`)
34
+ stderr(colors.blueBright(' Info: '), message)
15
35
  }
16
36
 
17
37
  export function succeed(message: string) {
18
- console.log(`🟢 ${message}`)
19
- }
20
-
21
- export default {
22
- raw,
23
- fail,
24
- warn,
25
- info,
26
- succeed
38
+ stderr(colors.green('Success: '), message)
27
39
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dcl/sdk",
3
- "version": "7.0.6-4086929545.commit-0292186",
3
+ "version": "7.0.6-4087883663.commit-054d424",
4
4
  "description": "",
5
5
  "main": "./index.js",
6
6
  "typings": "./index.d.ts",
@@ -20,13 +20,13 @@
20
20
  "author": "Decentraland",
21
21
  "license": "Apache-2.0",
22
22
  "dependencies": {
23
- "@dcl/dcl-rollup": "7.0.6-4086929545.commit-0292186",
24
- "@dcl/ecs": "7.0.6-4086929545.commit-0292186",
23
+ "@dcl/dcl-rollup": "7.0.6-4087883663.commit-054d424",
24
+ "@dcl/ecs": "7.0.6-4087883663.commit-054d424",
25
25
  "@dcl/ecs-math": "2.0.1-20221129185242.commit-40495c1",
26
- "@dcl/explorer": "1.0.74928-20230130201703.commit-6da8317",
27
- "@dcl/js-runtime": "7.0.6-4086929545.commit-0292186",
26
+ "@dcl/explorer": "1.0.76945-20230203192753.commit-55553af",
27
+ "@dcl/js-runtime": "7.0.6-4087883663.commit-054d424",
28
28
  "@dcl/mini-comms": "1.0.0",
29
- "@dcl/react-ecs": "7.0.6-4086929545.commit-0292186",
29
+ "@dcl/react-ecs": "7.0.6-4087883663.commit-054d424",
30
30
  "@dcl/schemas": "6.6.0",
31
31
  "@types/inquirer": "^8.2.5",
32
32
  "@well-known-components/env-config-provider": "^1.1.2-20220801195549.commit-101c273",
@@ -34,7 +34,9 @@
34
34
  "@well-known-components/logger": "^3.0.0",
35
35
  "@well-known-components/metrics": "^2.0.1-20220909150423.commit-8f7e5bc",
36
36
  "arg": "5.0.2",
37
+ "colorette": "^2.0.19",
37
38
  "extract-zip": "2.0.1",
39
+ "ignore": "^5.2.4",
38
40
  "inquirer": "^8.2.5",
39
41
  "node-fetch": "^2.6.8",
40
42
  "open": "^8.4.0",
@@ -53,5 +55,5 @@
53
55
  "displayName": "SDK",
54
56
  "tsconfig": "./tsconfig.json"
55
57
  },
56
- "commit": "029218605ffb8e959701a4f954189e04d9851089"
58
+ "commit": "054d424646fc6082e7a29ebf4cc5903454205935"
57
59
  }
@@ -1,6 +0,0 @@
1
- import { CliError } from './error';
2
- type Args = {
3
- [key: string]: any;
4
- };
5
- export declare function main<T extends Args>(handlerFn: (args: T) => Promise<void>, errorFn?: (error: CliError) => Promise<void>): (args: T) => Promise<void>;
6
- export {};
@@ -1,19 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.main = void 0;
4
- const error_1 = require("./error");
5
- function main(handlerFn, errorFn) {
6
- return async function handler(args) {
7
- try {
8
- await handlerFn(args);
9
- }
10
- catch (e) {
11
- if (typeof errorFn === 'function') {
12
- await errorFn(e);
13
- }
14
- throw new error_1.CliError(e.message);
15
- }
16
- };
17
- }
18
- exports.main = main;
19
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaGFuZGxlci5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImhhbmRsZXIudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7O0FBQUEsbUNBQWtDO0FBSWxDLFNBQWdCLElBQUksQ0FDbEIsU0FBcUMsRUFDckMsT0FBNEM7SUFFNUMsT0FBTyxLQUFLLFVBQVUsT0FBTyxDQUFDLElBQU87UUFDbkMsSUFBSTtZQUNGLE1BQU0sU0FBUyxDQUFDLElBQUksQ0FBQyxDQUFBO1NBQ3RCO1FBQUMsT0FBTyxDQUFNLEVBQUU7WUFFZixJQUFJLE9BQU8sT0FBTyxLQUFLLFVBQVUsRUFBRTtnQkFDakMsTUFBTSxPQUFPLENBQUMsQ0FBQyxDQUFDLENBQUE7YUFDakI7WUFJRCxNQUFNLElBQUksZ0JBQVEsQ0FBQyxDQUFDLENBQUMsT0FBTyxDQUFDLENBQUE7U0FDOUI7SUFDSCxDQUFDLENBQUE7QUFDSCxDQUFDO0FBbEJELG9CQWtCQyIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB7IENsaUVycm9yIH0gZnJvbSAnLi9lcnJvcidcblxudHlwZSBBcmdzID0geyBba2V5OiBzdHJpbmddOiBhbnkgfVxuXG5leHBvcnQgZnVuY3Rpb24gbWFpbjxUIGV4dGVuZHMgQXJncz4oXG4gIGhhbmRsZXJGbjogKGFyZ3M6IFQpID0+IFByb21pc2U8dm9pZD4sXG4gIGVycm9yRm4/OiAoZXJyb3I6IENsaUVycm9yKSA9PiBQcm9taXNlPHZvaWQ+XG4pIHtcbiAgcmV0dXJuIGFzeW5jIGZ1bmN0aW9uIGhhbmRsZXIoYXJnczogVCkge1xuICAgIHRyeSB7XG4gICAgICBhd2FpdCBoYW5kbGVyRm4oYXJncylcbiAgICB9IGNhdGNoIChlOiBhbnkpIHtcbiAgICAgIC8vIGRvIHNvbWUgc3R1ZmYgd2l0aCB0aGUgQ2xpRXJyb3IgY2xhc3MuLi5cbiAgICAgIGlmICh0eXBlb2YgZXJyb3JGbiA9PT0gJ2Z1bmN0aW9uJykge1xuICAgICAgICBhd2FpdCBlcnJvckZuKGUpXG4gICAgICB9XG5cbiAgICAgIC8vIHRyYWNrIHNvbWV0aGluZz9cblxuICAgICAgdGhyb3cgbmV3IENsaUVycm9yKGUubWVzc2FnZSlcbiAgICB9XG4gIH1cbn1cbiJdfQ==
@@ -1,23 +0,0 @@
1
- import { CliError } from './error'
2
-
3
- type Args = { [key: string]: any }
4
-
5
- export function main<T extends Args>(
6
- handlerFn: (args: T) => Promise<void>,
7
- errorFn?: (error: CliError) => Promise<void>
8
- ) {
9
- return async function handler(args: T) {
10
- try {
11
- await handlerFn(args)
12
- } catch (e: any) {
13
- // do some stuff with the CliError class...
14
- if (typeof errorFn === 'function') {
15
- await errorFn(e)
16
- }
17
-
18
- // track something?
19
-
20
- throw new CliError(e.message)
21
- }
22
- }
23
- }