@dcl/sdk-commands 7.1.4-4492843881.commit-442dfb1 → 7.1.4-4502579506.commit-4147243
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/dist/commands/deploy/index.js +2 -3
- package/dist/commands/deploy/linker-dapp/api.js +0 -1
- package/dist/commands/deploy/linker-dapp/catalyst-pointers.d.ts +1 -1
- package/dist/commands/deploy/linker-dapp/catalyst-pointers.js +1 -1
- package/dist/commands/start/data-layer/ws.d.ts +2 -1
- package/dist/commands/start/data-layer/ws.js +4 -3
- package/dist/commands/start/index.js +2 -1
- package/dist/commands/start/server/endpoints.js +8 -7
- package/dist/commands/start/server/realm.js +3 -3
- package/dist/commands/start/server/routes.js +1 -1
- package/dist/components/analytics.d.ts +1 -1
- package/dist/components/analytics.js +4 -3
- package/dist/components/index.js +3 -2
- package/dist/components/log.d.ts +11 -1
- package/dist/components/log.js +19 -12
- package/dist/index.js +3 -2
- package/package.json +20 -20
@@ -60,7 +60,6 @@ async function main(options) {
|
|
60
60
|
const openBrowser = !options.args['--no-browser'];
|
61
61
|
const skipBuild = options.args['--skip-build'];
|
62
62
|
const linkerPort = options.args['--port'];
|
63
|
-
const { error } = options.components.logger;
|
64
63
|
if (options.args['--target'] && options.args['--target-content']) {
|
65
64
|
throw new error_1.CliError(`You can't set both the 'target' and 'target-content' arguments.`);
|
66
65
|
}
|
@@ -115,8 +114,8 @@ async function main(options) {
|
|
115
114
|
(0, beautiful_logs_1.printSuccess)(options.components.logger, 'Content uploaded', sceneUrl);
|
116
115
|
}
|
117
116
|
catch (e) {
|
118
|
-
error('Could not upload content:');
|
119
|
-
|
117
|
+
options.components.logger.error('Could not upload content:');
|
118
|
+
options.components.logger.error(e);
|
120
119
|
options.components.analytics.trackSync('Scene deploy failure', { ...trackProps, error: e.message ?? '' });
|
121
120
|
}
|
122
121
|
options.components.analytics.trackSync('Scene deploy success', { ...trackProps, dependencies });
|
@@ -42,7 +42,6 @@ function runLinkerApp(cliComponents, scene, files, port, rootCID, { isHttps, ski
|
|
42
42
|
components.server.setContext(components);
|
43
43
|
components.server.use(router.allowedMethods());
|
44
44
|
components.server.use(router.middleware());
|
45
|
-
console.log('\x1Bc');
|
46
45
|
await startComponents();
|
47
46
|
if (openBrowser)
|
48
47
|
await browse(cliComponents, url, queryParams);
|
@@ -16,5 +16,5 @@ export declare function fetchEntityByPointer({ fetch }: Pick<CliComponents, 'fet
|
|
16
16
|
baseUrl: string;
|
17
17
|
deployments: Entity[];
|
18
18
|
}>;
|
19
|
-
export declare function getPointers(components: Pick<CliComponents, 'fetch'>, pointer: string, network?: Network): Promise<CatalystInfo[]>;
|
19
|
+
export declare function getPointers(components: Pick<CliComponents, 'fetch' | 'logger'>, pointer: string, network?: Network): Promise<CatalystInfo[]>;
|
20
20
|
export {};
|
@@ -37,7 +37,7 @@ async function getPointers(components, pointer, network = 'mainnet') {
|
|
37
37
|
catalystInfo.push({ timestamp, entityId, url: baseUrl });
|
38
38
|
}
|
39
39
|
catch (err) {
|
40
|
-
|
40
|
+
components.logger.log('Error fetching catalyst pointers', err);
|
41
41
|
}
|
42
42
|
}
|
43
43
|
return catalystInfo;
|
@@ -1,3 +1,4 @@
|
|
1
1
|
import { WebSocket } from 'ws';
|
2
|
+
import { PreviewComponents } from '../types';
|
2
3
|
import { DataLayer } from './rpc';
|
3
|
-
export declare function handleDataLayerWs(ws: WebSocket, dataLayer: DataLayer): Promise<void>;
|
4
|
+
export declare function handleDataLayerWs(components: PreviewComponents, ws: WebSocket, dataLayer: DataLayer): Promise<void>;
|
@@ -2,15 +2,16 @@
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.handleDataLayerWs = void 0;
|
4
4
|
const WebSocket_1 = require("@dcl/rpc/dist/transports/WebSocket");
|
5
|
-
|
5
|
+
// TODO: dataLayer should be an optional component
|
6
|
+
async function handleDataLayerWs(components, ws, dataLayer) {
|
6
7
|
const wsTransport = (0, WebSocket_1.WebSocketTransport)(ws);
|
7
8
|
dataLayer.rpcServer.attachTransport(wsTransport, dataLayer.context);
|
8
9
|
ws.on('error', (error) => {
|
9
|
-
|
10
|
+
components.logger.error(error);
|
10
11
|
ws.close();
|
11
12
|
});
|
12
13
|
ws.on('close', () => {
|
13
|
-
|
14
|
+
components.logger.debug('Websocket closed');
|
14
15
|
});
|
15
16
|
}
|
16
17
|
exports.handleDataLayerWs = handleDataLayerWs;
|
@@ -150,7 +150,7 @@ async function main(options) {
|
|
150
150
|
};
|
151
151
|
return {
|
152
152
|
...options.components,
|
153
|
-
logger: (0, log_1.
|
153
|
+
logger: (0, log_1.createStderrCliLogger)(),
|
154
154
|
logs,
|
155
155
|
ethereumProvider: eth_1.providerInstance,
|
156
156
|
rooms,
|
@@ -162,6 +162,7 @@ async function main(options) {
|
|
162
162
|
};
|
163
163
|
},
|
164
164
|
async main({ components, startComponents }) {
|
165
|
+
// TODO: dataLayerRpc should be an optional component
|
165
166
|
const dataLayerRpc = withDataLayer ? await (0, rpc_1.createDataLayer)({ fs: components.fs }) : undefined;
|
166
167
|
await (0, routes_1.wireRouter)(components, projectRoot, dataLayerRpc);
|
167
168
|
if (watch) {
|
@@ -103,7 +103,8 @@ function setupEcs6Endpoints(components, dir, router) {
|
|
103
103
|
}
|
104
104
|
}
|
105
105
|
catch (err) {
|
106
|
-
|
106
|
+
components.logger.warn(`Failed to catch profile and fill with preview wearables.`);
|
107
|
+
components.logger.error(err);
|
107
108
|
}
|
108
109
|
return next();
|
109
110
|
});
|
@@ -130,7 +131,6 @@ function setupEcs6Endpoints(components, dir, router) {
|
|
130
131
|
router.post('/content/entities', async (ctx) => {
|
131
132
|
const catalystUrl = getCatalystUrl();
|
132
133
|
const headers = new node_fetch_1.Headers();
|
133
|
-
console.log(ctx.request.headers);
|
134
134
|
const res = await (0, node_fetch_1.default)(`${catalystUrl.toString()}/content/entities`, {
|
135
135
|
method: 'post',
|
136
136
|
headers,
|
@@ -224,7 +224,7 @@ async function getAllPreviewWearables(components, { baseFolders, baseUrl }) {
|
|
224
224
|
ret.push(await serveWearable(components, wearableJsonPath, baseUrl));
|
225
225
|
}
|
226
226
|
catch (err) {
|
227
|
-
|
227
|
+
components.logger.error(`Couldn't mock the wearable ${wearableJsonPath}. Please verify the correct format and scheme.` + err);
|
228
228
|
}
|
229
229
|
}
|
230
230
|
return ret;
|
@@ -234,7 +234,7 @@ async function serveWearable(components, wearableJsonPath, baseUrl) {
|
|
234
234
|
const wearableJson = JSON.parse((await components.fs.readFile(wearableJsonPath)).toString());
|
235
235
|
if (!sdk_1.WearableJson.validate(wearableJson)) {
|
236
236
|
const errors = (sdk_1.WearableJson.validate.errors || []).map((a) => `${a.data} ${a.message}`).join('');
|
237
|
-
|
237
|
+
components.logger.error(`Unable to validate wearable.json properly, please check it.` + errors);
|
238
238
|
throw new Error(`Invalid wearable.json (${wearableJsonPath})`);
|
239
239
|
}
|
240
240
|
const hashedFiles = await (0, project_files_1.getProjectContentMappings)(components, wearableDir, project_files_1.b64HashingFunction);
|
@@ -366,15 +366,16 @@ async function fakeEntityV3FromFolder(components, projectRoot, hashingFunction)
|
|
366
366
|
const wearableJson = JSON.parse(await components.fs.readFile(wearableJsonPath, 'utf-8'));
|
367
367
|
if (!sdk_1.WearableJson.validate(wearableJson)) {
|
368
368
|
const errors = (sdk_1.WearableJson.validate.errors || []).map((a) => `${a.data} ${a.message}`).join('');
|
369
|
-
|
370
|
-
|
369
|
+
components.logger.error(`Unable to validate wearable.json properly, please check its schema.` + errors);
|
370
|
+
components.logger.error(`Invalid wearable.json (${wearableJsonPath})`);
|
371
371
|
}
|
372
372
|
else {
|
373
373
|
isParcelScene = false;
|
374
374
|
}
|
375
375
|
}
|
376
376
|
catch (err) {
|
377
|
-
|
377
|
+
components.logger.error(`Unable to load wearable.json`);
|
378
|
+
components.logger.error(err);
|
378
379
|
}
|
379
380
|
}
|
380
381
|
if ((await components.fs.fileExists(sceneJsonPath)) && isParcelScene) {
|
@@ -40,14 +40,14 @@ function setupRealmAndComms(components, router) {
|
|
40
40
|
return (0, ws_1.upgradeWebSocketResponse)((ws) => {
|
41
41
|
if (ws.protocol === 'rfc5' || ws.protocol === 'rfc4') {
|
42
42
|
ws.on('error', (error) => {
|
43
|
-
|
43
|
+
components.logger.error(error);
|
44
44
|
ws.close();
|
45
45
|
});
|
46
46
|
ws.on('close', () => {
|
47
|
-
|
47
|
+
components.logger.debug('Websocket closed');
|
48
48
|
});
|
49
49
|
(0, handle_linear_protocol_1.handleSocketLinearProtocol)(components, ws, ctx.params.roomId).catch((err) => {
|
50
|
-
|
50
|
+
components.logger.info(err);
|
51
51
|
ws.close();
|
52
52
|
});
|
53
53
|
}
|
@@ -12,7 +12,7 @@ async function wireRouter(components, dir, dataLayer) {
|
|
12
12
|
if (dataLayer) {
|
13
13
|
router.get('/data-layer', async (ctx, next) => {
|
14
14
|
if (ctx.request.headers.get('upgrade') === 'websocket') {
|
15
|
-
return (0, ws_1.upgradeWebSocketResponse)((ws) => (0, ws_2.handleDataLayerWs)(ws, dataLayer));
|
15
|
+
return (0, ws_1.upgradeWebSocketResponse)((ws) => (0, ws_2.handleDataLayerWs)(components, ws, dataLayer));
|
16
16
|
}
|
17
17
|
return next();
|
18
18
|
});
|
@@ -69,4 +69,4 @@ export type Events = {
|
|
69
69
|
error: string;
|
70
70
|
};
|
71
71
|
};
|
72
|
-
export declare function createAnalyticsComponent({ dclInfoConfig }: Pick<CliComponents, 'dclInfoConfig'>): Promise<IAnalyticsComponent>;
|
72
|
+
export declare function createAnalyticsComponent({ dclInfoConfig, logger }: Pick<CliComponents, 'dclInfoConfig' | 'logger'>): Promise<IAnalyticsComponent>;
|
@@ -8,7 +8,7 @@ const uuid_1 = require("uuid");
|
|
8
8
|
const analytics_node_1 = require("@segment/analytics-node");
|
9
9
|
const fp_future_1 = __importDefault(require("fp-future"));
|
10
10
|
const log_1 = require("./log");
|
11
|
-
async function createAnalyticsComponent({ dclInfoConfig }) {
|
11
|
+
async function createAnalyticsComponent({ dclInfoConfig, logger }) {
|
12
12
|
const USER_ID = 'sdk-commands-user';
|
13
13
|
const config = await dclInfoConfig.get();
|
14
14
|
const analytics = new analytics_node_1.Analytics({ writeKey: config.segmentKey ?? '' });
|
@@ -41,7 +41,8 @@ async function createAnalyticsComponent({ dclInfoConfig }) {
|
|
41
41
|
trackFuture.resolve();
|
42
42
|
});
|
43
43
|
if (!dclInfoConfig.isProduction()) {
|
44
|
-
|
44
|
+
// TODO: what is this supposed to do?
|
45
|
+
logger.info('TrackingInfo: ' + JSON.stringify(trackInfo));
|
45
46
|
}
|
46
47
|
return trackFuture;
|
47
48
|
}
|
@@ -57,7 +58,7 @@ async function createAnalyticsComponent({ dclInfoConfig }) {
|
|
57
58
|
let dclInfo = {};
|
58
59
|
if (!config.userId) {
|
59
60
|
dclInfo = { userId, trackStats: true };
|
60
|
-
|
61
|
+
logger.info(`Decentraland CLI sends anonymous usage stats to improve their products, if you want to disable it change the configuration at ${log_1.colors.bold('~/.dclinfo')}\n`);
|
61
62
|
}
|
62
63
|
if (!config.userIdentified) {
|
63
64
|
dclInfo.userIdentified = true;
|
package/dist/components/index.js
CHANGED
@@ -9,12 +9,13 @@ const log_1 = require("./log");
|
|
9
9
|
async function initComponents() {
|
10
10
|
const fsComponent = (0, fs_1.createFsComponent)();
|
11
11
|
const dclInfoConfig = await (0, dcl_info_config_1.createDCLInfoConfigComponent)({ fs: fsComponent });
|
12
|
+
const logger = (0, log_1.createStderrCliLogger)();
|
12
13
|
return {
|
13
14
|
fs: fsComponent,
|
14
15
|
fetch: (0, fetch_1.createFetchComponent)(),
|
15
|
-
logger
|
16
|
+
logger,
|
16
17
|
dclInfoConfig,
|
17
|
-
analytics: await (0, analytics_1.createAnalyticsComponent)({ dclInfoConfig })
|
18
|
+
analytics: await (0, analytics_1.createAnalyticsComponent)({ dclInfoConfig, logger })
|
18
19
|
};
|
19
20
|
}
|
20
21
|
exports.initComponents = initComponents;
|
package/dist/components/log.d.ts
CHANGED
@@ -1,4 +1,14 @@
|
|
1
1
|
/// <reference types="colorette" />
|
2
2
|
import { ILoggerComponent } from '@well-known-components/interfaces';
|
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
|
+
export declare const writeToStderr: (...parameters: readonly unknown[]) => void;
|
3
13
|
export declare const colors: import("colorette").Colorette;
|
4
|
-
export declare function
|
14
|
+
export declare function createStderrCliLogger(): ILoggerComponent.ILogger;
|
package/dist/components/log.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.
|
3
|
+
exports.createStderrCliLogger = exports.colors = exports.writeToStderr = void 0;
|
4
4
|
const colorette_1 = require("colorette");
|
5
5
|
const error_1 = require("../logic/error");
|
6
6
|
/**
|
@@ -12,36 +12,43 @@ const error_1 = require("../logic/error");
|
|
12
12
|
* Warning: some text provided as argumen
|
13
13
|
* ^
|
14
14
|
*/
|
15
|
-
const
|
15
|
+
const writeToStderr = (...parameters) => {
|
16
16
|
process.stderr.write(`${parameters.filter(($) => $ !== undefined).join('')}\n`);
|
17
17
|
};
|
18
|
+
exports.writeToStderr = writeToStderr;
|
18
19
|
// @see https://no-color.org
|
19
20
|
// @see https://www.npmjs.com/package/chalk
|
20
21
|
exports.colors = (0, colorette_1.createColors)({
|
21
22
|
useColor: process.env.FORCE_COLOR !== '0' && !process.env.NO_COLOR
|
22
23
|
});
|
23
|
-
function
|
24
|
+
function createStderrCliLogger() {
|
24
25
|
return {
|
25
26
|
log(message, extra) {
|
26
|
-
|
27
|
+
(0, exports.writeToStderr)(message, extra && JSON.stringify(extra));
|
27
28
|
},
|
28
29
|
debug(message, extra) {
|
29
|
-
|
30
|
+
(0, exports.writeToStderr)(exports.colors.blueBright('debug: '), message, extra && JSON.stringify(extra));
|
30
31
|
},
|
31
32
|
error(error, extra) {
|
32
|
-
|
33
|
+
(0, exports.writeToStderr)(exports.colors.redBright('error: '), error, extra && JSON.stringify(extra));
|
33
34
|
/* istanbul ignore next */
|
34
|
-
if (!(error instanceof error_1.CliError)
|
35
|
-
|
36
|
-
|
35
|
+
if (!(error instanceof error_1.CliError)) {
|
36
|
+
if (error instanceof Error && error.stack) {
|
37
|
+
// print the stacktrace if it is not a CliError
|
38
|
+
(0, exports.writeToStderr)(error.stack);
|
39
|
+
}
|
40
|
+
else if (process.env.DEBUG) {
|
41
|
+
// print the stacktrace if it is not a CliError
|
42
|
+
(0, exports.writeToStderr)(error.toString());
|
43
|
+
}
|
37
44
|
}
|
38
45
|
},
|
39
46
|
info(message, extra) {
|
40
|
-
|
47
|
+
(0, exports.writeToStderr)(exports.colors.blueBright('info: '), message, extra && JSON.stringify(extra));
|
41
48
|
},
|
42
49
|
warn(message, extra) {
|
43
|
-
|
50
|
+
(0, exports.writeToStderr)(exports.colors.yellow('warning: '), message, extra && JSON.stringify(extra));
|
44
51
|
}
|
45
52
|
};
|
46
53
|
}
|
47
|
-
exports.
|
54
|
+
exports.createStderrCliLogger = createStderrCliLogger;
|
package/dist/index.js
CHANGED
@@ -57,12 +57,13 @@ async function main() {
|
|
57
57
|
}
|
58
58
|
main().catch(function handleError(err) {
|
59
59
|
if (err instanceof error_1.CliError) {
|
60
|
-
|
60
|
+
(0, log_1.writeToStderr)(log_1.colors.redBright('Error: ') + err.message);
|
61
61
|
}
|
62
62
|
else {
|
63
63
|
// log with console to show stacktrace and debug information
|
64
|
+
// eslint-disable-next-line no-console
|
64
65
|
console.error(err);
|
65
|
-
|
66
|
+
(0, log_1.writeToStderr)(`Developer: All errors thrown must be an instance of "CliError"`);
|
66
67
|
}
|
67
68
|
// set an exit code but not finish the program immediately to close any pending work
|
68
69
|
process.exitCode = 1;
|
package/package.json
CHANGED
@@ -1,35 +1,26 @@
|
|
1
1
|
{
|
2
2
|
"name": "@dcl/sdk-commands",
|
3
|
-
"version": "7.1.4-4492843881.commit-442dfb1",
|
4
3
|
"description": "",
|
5
|
-
"
|
6
|
-
|
7
|
-
"build": "tsc -p tsconfig.json"
|
8
|
-
},
|
4
|
+
"version": "7.1.4-4502579506.commit-4147243",
|
5
|
+
"author": "Decentraland",
|
9
6
|
"bin": {
|
10
7
|
"sdk-commands": "./dist/index.js"
|
11
8
|
},
|
12
|
-
"keywords": [],
|
13
|
-
"tsdoc": {
|
14
|
-
"tsdocFlavor": "AEDoc"
|
15
|
-
},
|
16
|
-
"author": "Decentraland",
|
17
|
-
"license": "Apache-2.0",
|
18
9
|
"dependencies": {
|
19
|
-
"@dcl/dcl-rollup": "7.1.4-
|
10
|
+
"@dcl/dcl-rollup": "7.1.4-4502579506.commit-4147243",
|
20
11
|
"@dcl/hashing": "1.1.3",
|
21
|
-
"@dcl/inspector": "7.1.4-
|
12
|
+
"@dcl/inspector": "7.1.4-4502579506.commit-4147243",
|
22
13
|
"@dcl/linker-dapp": "0.7.0",
|
23
14
|
"@dcl/mini-comms": "1.0.1-20230216163137.commit-a4c75be",
|
24
|
-
"@dcl/protocol": "1.0.0-
|
15
|
+
"@dcl/protocol": "1.0.0-4493564897.commit-c858f8a",
|
25
16
|
"@dcl/rpc": "^1.1.1",
|
26
|
-
"@dcl/schemas": "6.
|
17
|
+
"@dcl/schemas": "^6.11.1",
|
27
18
|
"@segment/analytics-node": "^1.0.0-beta.22",
|
28
19
|
"@well-known-components/env-config-provider": "^1.2.0",
|
29
20
|
"@well-known-components/http-server": "^2.0.0-20230216161243.commit-bfe3f0a",
|
30
21
|
"@well-known-components/logger": "^3.1.2",
|
31
22
|
"@well-known-components/metrics": "^2.0.1",
|
32
|
-
"arg": "5.0.2",
|
23
|
+
"arg": "^5.0.2",
|
33
24
|
"chokidar": "^3.5.3",
|
34
25
|
"colorette": "^2.0.19",
|
35
26
|
"dcl-catalyst-client": "^14.0.9",
|
@@ -46,15 +37,24 @@
|
|
46
37
|
"@types/uuid": "^9.0.1",
|
47
38
|
"@types/ws": "^8.5.4"
|
48
39
|
},
|
40
|
+
"files": [
|
41
|
+
"dist"
|
42
|
+
],
|
43
|
+
"keywords": [],
|
44
|
+
"license": "Apache-2.0",
|
49
45
|
"minCliVersion": "3.14.1",
|
46
|
+
"scripts": {
|
47
|
+
"build": "tsc -p tsconfig.json",
|
48
|
+
"start": "tsc -p tsconfig.json --watch"
|
49
|
+
},
|
50
|
+
"tsdoc": {
|
51
|
+
"tsdocFlavor": "AEDoc"
|
52
|
+
},
|
50
53
|
"typedoc": {
|
51
54
|
"entryPoint": "./src/index.ts",
|
52
55
|
"readmeFile": "./README.md",
|
53
56
|
"displayName": "SDK",
|
54
57
|
"tsconfig": "./tsconfig.json"
|
55
58
|
},
|
56
|
-
"
|
57
|
-
"dist"
|
58
|
-
],
|
59
|
-
"commit": "442dfb13140b94512e41ec32ec5c766961ae7ca2"
|
59
|
+
"commit": "41472432721ca80b377a54744da814b43fbf3631"
|
60
60
|
}
|