@dcl/sdk-commands 7.15.3-20580436143.commit-0ba0d8c → 7.15.3-20598875042.commit-f242d6d
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/start/index.d.ts +3 -0
- package/dist/commands/start/index.js +36 -11
- package/dist/commands/start/index.js.map +1 -1
- package/dist/commands/start/server/routes.js +27 -0
- package/dist/commands/start/server/routes.js.map +1 -1
- package/dist/commands/start/utils.d.ts +8 -0
- package/dist/commands/start/utils.js +48 -0
- package/dist/commands/start/utils.js.map +1 -0
- package/package.json +5 -3
|
@@ -24,6 +24,8 @@ export declare const args: {
|
|
|
24
24
|
'--explorer-alpha': BooleanConstructor;
|
|
25
25
|
'--web-explorer': BooleanConstructor;
|
|
26
26
|
'--hub': BooleanConstructor;
|
|
27
|
+
'--mobile': BooleanConstructor;
|
|
28
|
+
'-m': string;
|
|
27
29
|
'--debug': BooleanConstructor;
|
|
28
30
|
'--dclenv': StringConstructor;
|
|
29
31
|
'--realm': StringConstructor;
|
|
@@ -32,6 +34,7 @@ export declare const args: {
|
|
|
32
34
|
'--skip-auth-screen': BooleanConstructor;
|
|
33
35
|
'--landscape-terrain-enabled': BooleanConstructor;
|
|
34
36
|
'-n': BooleanConstructor;
|
|
37
|
+
'--bevy-web': BooleanConstructor;
|
|
35
38
|
};
|
|
36
39
|
export declare function help(options: Options): Promise<void>;
|
|
37
40
|
export declare function main(options: Options): Promise<void>;
|
|
@@ -30,6 +30,7 @@ exports.main = exports.help = exports.args = void 0;
|
|
|
30
30
|
const os = __importStar(require("os"));
|
|
31
31
|
const path = __importStar(require("path"));
|
|
32
32
|
const open_1 = __importDefault(require("open"));
|
|
33
|
+
const qrcode_1 = __importDefault(require("qrcode"));
|
|
33
34
|
const build_1 = require("../build");
|
|
34
35
|
const args_1 = require("../../logic/args");
|
|
35
36
|
const scene_validations_1 = require("../../logic/scene-validations");
|
|
@@ -52,6 +53,7 @@ const workspace_validations_1 = require("../../logic/workspace-validations");
|
|
|
52
53
|
const beautiful_logs_1 = require("../../logic/beautiful-logs");
|
|
53
54
|
const project_validations_1 = require("../../logic/project-validations");
|
|
54
55
|
const explorer_alpha_1 = require("./explorer-alpha");
|
|
56
|
+
const utils_1 = require("./utils");
|
|
55
57
|
exports.args = (0, args_1.declareArgs)({
|
|
56
58
|
'--dir': String,
|
|
57
59
|
'--help': Boolean,
|
|
@@ -72,6 +74,8 @@ exports.args = (0, args_1.declareArgs)({
|
|
|
72
74
|
'--explorer-alpha': Boolean,
|
|
73
75
|
'--web-explorer': Boolean,
|
|
74
76
|
'--hub': Boolean,
|
|
77
|
+
'--mobile': Boolean,
|
|
78
|
+
'-m': '--mobile',
|
|
75
79
|
// Params related to the explorer-alpha
|
|
76
80
|
'--debug': Boolean,
|
|
77
81
|
'--dclenv': String,
|
|
@@ -80,7 +84,8 @@ exports.args = (0, args_1.declareArgs)({
|
|
|
80
84
|
'--position': String,
|
|
81
85
|
'--skip-auth-screen': Boolean,
|
|
82
86
|
'--landscape-terrain-enabled': Boolean,
|
|
83
|
-
'-n': Boolean
|
|
87
|
+
'-n': Boolean,
|
|
88
|
+
'--bevy-web': Boolean
|
|
84
89
|
});
|
|
85
90
|
async function help(options) {
|
|
86
91
|
options.components.logger.log(`
|
|
@@ -105,6 +110,8 @@ async function help(options) {
|
|
|
105
110
|
--skip-auth-screen Skip the auth screen (accepts 'true' or 'false').
|
|
106
111
|
--landscape-terrain-enabled Enable landscape terrain.
|
|
107
112
|
-n Open a new instance of the Client even if one is already running.
|
|
113
|
+
--bevy-web Opens preview using the Bevy Web browser window.
|
|
114
|
+
--mobile Show QR code for mobile preview on the same network
|
|
108
115
|
|
|
109
116
|
|
|
110
117
|
Examples:
|
|
@@ -129,8 +136,10 @@ async function main(options) {
|
|
|
129
136
|
const watch = !options.args['--no-watch'];
|
|
130
137
|
const withDataLayer = options.args['--data-layer'];
|
|
131
138
|
const enableWeb3 = options.args['--web3'];
|
|
132
|
-
const explorerAlpha = !options.args['--web-explorer'];
|
|
133
139
|
const isHub = !!options.args['--hub'];
|
|
140
|
+
const bevyWeb = !!options.args['--bevy-web'];
|
|
141
|
+
const isMobile = options.args['--mobile'];
|
|
142
|
+
const explorerAlpha = !options.args['--web-explorer'] && !bevyWeb;
|
|
134
143
|
let hasSmartWearable = false;
|
|
135
144
|
const workspace = await (0, workspace_validations_1.getValidWorkspace)(options.components, workingDirectory);
|
|
136
145
|
/* istanbul ignore if */
|
|
@@ -203,7 +212,7 @@ async function main(options) {
|
|
|
203
212
|
await (0, routes_1.wireRouter)(components, workspace, dataLayer);
|
|
204
213
|
if (watch) {
|
|
205
214
|
for (const project of workspace.projects) {
|
|
206
|
-
await (0, file_watch_notifier_1.wireFileWatcherToWebSockets)(components, project.workingDirectory, project.kind, !!explorerAlpha);
|
|
215
|
+
await (0, file_watch_notifier_1.wireFileWatcherToWebSockets)(components, project.workingDirectory, project.kind, !!explorerAlpha || !!bevyWeb);
|
|
207
216
|
}
|
|
208
217
|
}
|
|
209
218
|
await startComponents();
|
|
@@ -229,32 +238,48 @@ async function main(options) {
|
|
|
229
238
|
}
|
|
230
239
|
});
|
|
231
240
|
});
|
|
241
|
+
// Get the LAN URL for external device access
|
|
242
|
+
const lanUrl = (0, utils_1.getLanUrl)(port);
|
|
232
243
|
// Push localhost and 127.0.0.1 at top
|
|
233
244
|
const sortedURLs = availableURLs.sort((a, _b) => {
|
|
234
245
|
return a.toLowerCase().includes('localhost') || a.includes('127.0.0.1') || a.includes('0.0.0.0') ? -1 : 1;
|
|
235
246
|
});
|
|
247
|
+
const bevyUrl = `https://decentraland.zone/bevy-web/?preview=true&initialRealm=${new URL(sortedURLs[0]).origin}&location=${baseCoords.x},${baseCoords.y}`;
|
|
236
248
|
if (!explorerAlpha) {
|
|
237
|
-
|
|
238
|
-
components.logger.log(` ${
|
|
249
|
+
if (bevyWeb) {
|
|
250
|
+
components.logger.log(` ${bevyUrl}`);
|
|
251
|
+
}
|
|
252
|
+
else {
|
|
253
|
+
for (const addr of sortedURLs) {
|
|
254
|
+
components.logger.log(` ${addr}`);
|
|
255
|
+
}
|
|
239
256
|
}
|
|
240
|
-
}
|
|
241
|
-
if (!explorerAlpha) {
|
|
242
|
-
components.logger.log('\n Details:\n');
|
|
243
257
|
}
|
|
244
258
|
components.logger.log('\nPress CTRL+C to exit\n');
|
|
245
|
-
if (explorerAlpha) {
|
|
259
|
+
if (explorerAlpha && !isMobile) {
|
|
246
260
|
const realm = new URL(sortedURLs[0]).origin;
|
|
247
261
|
await (0, explorer_alpha_1.runExplorerAlpha)(components, { cwd: workingDirectory, realm, baseCoords, isHub, args: options.args });
|
|
248
262
|
}
|
|
263
|
+
if (options.args['--mobile'] && lanUrl) {
|
|
264
|
+
const deepLink = `decentraland://open?preview=${lanUrl}`;
|
|
265
|
+
qrcode_1.default.toString(deepLink, { type: 'terminal', small: true }, (err, qr) => {
|
|
266
|
+
if (!err) {
|
|
267
|
+
components.logger.log(log_1.colors.bold('\nScan to preview on mobile: \n'));
|
|
268
|
+
components.logger.log(qr);
|
|
269
|
+
}
|
|
270
|
+
});
|
|
271
|
+
}
|
|
249
272
|
// Open preferably localhost/127.0.0.1
|
|
250
|
-
if (!explorerAlpha && openBrowser && sortedURLs.length) {
|
|
273
|
+
if ((!explorerAlpha || bevyWeb) && openBrowser && sortedURLs.length) {
|
|
251
274
|
try {
|
|
252
|
-
|
|
275
|
+
const url = bevyWeb ? bevyUrl : sortedURLs[0];
|
|
276
|
+
await (0, open_1.default)(url);
|
|
253
277
|
}
|
|
254
278
|
catch (_) {
|
|
255
279
|
components.logger.warn('Unable to open browser automatically.');
|
|
256
280
|
}
|
|
257
281
|
}
|
|
282
|
+
components.logger.log('\nPress CTRL+C to exit\n');
|
|
258
283
|
}
|
|
259
284
|
});
|
|
260
285
|
// this signal is resolved by: (wkc)program.stop(), SIGTERM, SIGHUP
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/start/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAwB;AACxB,2CAA4B;AAC5B,gDAAuB;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/start/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAwB;AACxB,2CAA4B;AAC5B,gDAAuB;AACvB,oDAA2B;AAG3B,oCAAqC;AACrC,2CAA8C;AAC9C,qEAA6D;AAC7D,6DAAmD;AAEnD,4DAA2E;AAC3E,kEAA6D;AAC7D,oFAAwF;AACxF,+DAAwF;AACxF,oEAA0E;AAC1E,0DAAyE;AACzE,8CAAuD;AACvD,8CAAoE;AACpE,sEAA0E;AAC1E,4CAA4C;AAC5C,oCAA+C;AAC/C,6DAA8D;AAC9D,0CAA6D;AAC7D,8DAAwE;AACxE,6EAAqE;AACrE,+DAAyG;AAEzG,yEAAkE;AAClE,qDAAmD;AACnD,mCAAmC;AAOtB,QAAA,IAAI,GAAG,IAAA,kBAAW,EAAC;IAC9B,OAAO,EAAE,MAAM;IACf,QAAQ,EAAE,OAAO;IACjB,QAAQ,EAAE,MAAM;IAChB,YAAY,EAAE,OAAO;IACrB,cAAc,EAAE,OAAO;IACvB,YAAY,EAAE,OAAO;IACrB,MAAM,EAAE,OAAO;IACf,gBAAgB,EAAE,OAAO;IACzB,QAAQ,EAAE,OAAO;IACjB,IAAI,EAAE,QAAQ;IACd,IAAI,EAAE,QAAQ;IACd,IAAI,EAAE,YAAY;IAClB,IAAI,EAAE,cAAc;IACpB,IAAI,EAAE,YAAY;IAClB,cAAc,EAAE,OAAO;IACvB,cAAc,EAAE,OAAO;IACvB,kBAAkB,EAAE,OAAO;IAC3B,gBAAgB,EAAE,OAAO;IACzB,OAAO,EAAE,OAAO;IAChB,UAAU,EAAE,OAAO;IACnB,IAAI,EAAE,UAAU;IAChB,uCAAuC;IACvC,SAAS,EAAE,OAAO;I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AC,CAAA;wBACrE,UAAU,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,CAAA;qBAC1B;gBACH,CAAC,CAAC,CAAA;aACH;YAED,sCAAsC;YACtC,IAAI,CAAC,CAAC,aAAa,IAAI,OAAO,CAAC,IAAI,WAAW,IAAI,UAAU,CAAC,MAAM,EAAE;gBACnE,IAAI;oBACF,MAAM,GAAG,GAAG,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,CAAA;oBAC7C,MAAM,IAAA,cAAI,EAAC,GAAG,CAAC,CAAA;iBAChB;gBAAC,OAAO,CAAC,EAAE;oBACV,UAAU,CAAC,MAAM,CAAC,IAAI,CAAC,uCAAuC,CAAC,CAAA;iBAChE;aACF;YACD,UAAU,CAAC,MAAM,CAAC,GAAG,CAAC,0BAA0B,CAAC,CAAA;QACnD,CAAC;KACF,CAAC,CAAA;IAEF,mEAAmE;IACnE,8EAA8E;IAC9E,UAAU;IACV,MAAM,OAAO,CAAC,UAAU,CAAC,QAAQ,CAAC,aAAa,CAAA;AACjD,CAAC;AAtLD,oBAsLC"}
|
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
6
|
exports.wireRouter = exports.sceneUpdateClients = void 0;
|
|
7
|
+
const qrcode_1 = __importDefault(require("qrcode"));
|
|
4
8
|
const http_server_1 = require("@well-known-components/http-server");
|
|
5
9
|
const ws_1 = require("@well-known-components/http-server/dist/ws");
|
|
6
10
|
const ws_2 = require("../data-layer/ws");
|
|
7
11
|
const endpoints_1 = require("./endpoints");
|
|
8
12
|
const realm_1 = require("./realm");
|
|
13
|
+
const utils_1 = require("../utils");
|
|
9
14
|
exports.sceneUpdateClients = new Set();
|
|
10
15
|
async function wireRouter(components, workspace, dataLayer) {
|
|
11
16
|
const router = new http_server_1.Router();
|
|
@@ -29,6 +34,28 @@ async function wireRouter(components, workspace, dataLayer) {
|
|
|
29
34
|
localSceneParcels.push(parcel);
|
|
30
35
|
}
|
|
31
36
|
}
|
|
37
|
+
// Mobile preview QR code endpoint
|
|
38
|
+
router.get('/mobile-preview', async (ctx) => {
|
|
39
|
+
const lanUrl = (0, utils_1.getLanUrl)(ctx.url.port);
|
|
40
|
+
if (!lanUrl) {
|
|
41
|
+
return {
|
|
42
|
+
status: 404,
|
|
43
|
+
body: { ok: false, error: 'No LAN IP address found' }
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
const deepLink = `decentraland://open?preview=${lanUrl}`;
|
|
47
|
+
const qrDataUrl = await qrcode_1.default.toDataURL(deepLink);
|
|
48
|
+
return {
|
|
49
|
+
headers: { 'content-type': 'application/json' },
|
|
50
|
+
body: {
|
|
51
|
+
ok: true,
|
|
52
|
+
data: {
|
|
53
|
+
url: deepLink,
|
|
54
|
+
qr: qrDataUrl
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
});
|
|
32
59
|
(0, realm_1.setupRealmAndComms)(components, router, localSceneParcels);
|
|
33
60
|
await (0, endpoints_1.setupEcs6Endpoints)(components, router, workspace);
|
|
34
61
|
components.server.setContext(components);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"routes.js","sourceRoot":"","sources":["../../../../src/commands/start/server/routes.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"routes.js","sourceRoot":"","sources":["../../../../src/commands/start/server/routes.ts"],"names":[],"mappings":";;;;;;AAAA,oDAA2B;AAC3B,oEAA2D;AAC3D,mEAAqF;AAIrF,yCAAoD;AAEpD,2CAAgD;AAChD,mCAA4C;AAC5C,oCAAoC;AAEvB,QAAA,kBAAkB,GAAG,IAAI,GAAG,EAAa,CAAA;AAC/C,KAAK,UAAU,UAAU,CAAC,U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AE,GAAG,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAA;AAC1C,CAAC,CAAA"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Get the LAN IP address for external device access (e.g., mobile preview)
|
|
3
|
+
*/
|
|
4
|
+
export declare function getLanIp(): string | undefined;
|
|
5
|
+
/**
|
|
6
|
+
* Get the full LAN URL with protocol for external device access
|
|
7
|
+
*/
|
|
8
|
+
export declare function getLanUrl(port: number | string): string | undefined;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.getLanUrl = exports.getLanIp = void 0;
|
|
27
|
+
const os = __importStar(require("os"));
|
|
28
|
+
/**
|
|
29
|
+
* Get the LAN IP address for external device access (e.g., mobile preview)
|
|
30
|
+
*/
|
|
31
|
+
function getLanIp() {
|
|
32
|
+
const networkInterfaces = os.networkInterfaces();
|
|
33
|
+
return Object.values(networkInterfaces)
|
|
34
|
+
.flat()
|
|
35
|
+
.find((details) => details?.family === 'IPv4' && !details.internal && details.address !== '127.0.0.1')?.address;
|
|
36
|
+
}
|
|
37
|
+
exports.getLanIp = getLanIp;
|
|
38
|
+
/**
|
|
39
|
+
* Get the full LAN URL with protocol for external device access
|
|
40
|
+
*/
|
|
41
|
+
function getLanUrl(port) {
|
|
42
|
+
const ip = getLanIp();
|
|
43
|
+
if (!ip)
|
|
44
|
+
return undefined;
|
|
45
|
+
return `http://${ip}:${port}`;
|
|
46
|
+
}
|
|
47
|
+
exports.getLanUrl = getLanUrl;
|
|
48
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/commands/start/utils.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAwB;AAExB;;GAEG;AACH,SAAgB,QAAQ;IACtB,MAAM,iBAAiB,GAAG,EAAE,CAAC,iBAAiB,EAAE,CAAA;IAChD,OAAO,MAAM,CAAC,MAAM,CAAC,iBAAiB,CAAC;SACpC,IAAI,EAAE;SACN,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,MAAM,IAAI,CAAC,OAAO,CAAC,QAAQ,IAAI,OAAO,CAAC,OAAO,KAAK,WAAW,CAAC,EAAE,OAAO,CAAA;AACnH,CAAC;AALD,4BAKC;AAED;;GAEG;AACH,SAAgB,SAAS,CAAC,IAAqB;IAC7C,MAAM,EAAE,GAAG,QAAQ,EAAE,CAAA;IACrB,IAAI,CAAC,EAAE;QAAE,OAAO,SAAS,CAAA;IACzB,OAAO,UAAU,EAAE,IAAI,IAAI,EAAE,CAAA;AAC/B,CAAC;AAJD,8BAIC"}
|
package/package.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dcl/sdk-commands",
|
|
3
3
|
"description": "",
|
|
4
|
-
"version": "7.15.3-
|
|
4
|
+
"version": "7.15.3-20598875042.commit-f242d6d",
|
|
5
5
|
"author": "Decentraland",
|
|
6
6
|
"bin": {
|
|
7
7
|
"sdk-commands": "./dist/index.js"
|
|
8
8
|
},
|
|
9
9
|
"dependencies": {
|
|
10
10
|
"@dcl/crypto": "^3.4.4",
|
|
11
|
-
"@dcl/ecs": "7.15.3-
|
|
11
|
+
"@dcl/ecs": "7.15.3-20598875042.commit-f242d6d",
|
|
12
12
|
"@dcl/gltf-validator-ts": "1.0.14",
|
|
13
13
|
"@dcl/hashing": "1.1.3",
|
|
14
14
|
"@dcl/inspector": "7.16.6",
|
|
@@ -41,6 +41,7 @@
|
|
|
41
41
|
"open": "^8.4.0",
|
|
42
42
|
"portfinder": "^1.0.32",
|
|
43
43
|
"prompts": "^2.4.2",
|
|
44
|
+
"qrcode": "^1.5.4",
|
|
44
45
|
"typescript": "^5.0.2",
|
|
45
46
|
"undici": "^5.19.1",
|
|
46
47
|
"uuid": "^9.0.1"
|
|
@@ -49,6 +50,7 @@
|
|
|
49
50
|
"@types/archiver": "^5.3.2",
|
|
50
51
|
"@types/node-fetch": "^2.6.4",
|
|
51
52
|
"@types/prompts": "^2.4.4",
|
|
53
|
+
"@types/qrcode": "^1.5.6",
|
|
52
54
|
"@types/uuid": "^9.0.5",
|
|
53
55
|
"@types/ws": "^8.5.4"
|
|
54
56
|
},
|
|
@@ -78,5 +80,5 @@
|
|
|
78
80
|
"displayName": "SDK",
|
|
79
81
|
"tsconfig": "./tsconfig.json"
|
|
80
82
|
},
|
|
81
|
-
"commit": "
|
|
83
|
+
"commit": "f242d6db068a1e0a32951557f13477c0be49fe0b"
|
|
82
84
|
}
|