@dcl/sdk-commands 7.5.0 → 7.5.1-9235895775.commit-075ab65
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.
@@ -20,8 +20,10 @@ export declare const args: {
|
|
20
20
|
'-b': string;
|
21
21
|
'-w': string;
|
22
22
|
'--skip-build': BooleanConstructor;
|
23
|
-
'--
|
23
|
+
'--dao-explorer': BooleanConstructor;
|
24
24
|
'--data-layer': BooleanConstructor;
|
25
|
+
'-e': string;
|
26
|
+
'--customEntryPoint': BooleanConstructor;
|
25
27
|
};
|
26
28
|
export declare function help(options: Options): Promise<void>;
|
27
29
|
export declare function main(options: Options): Promise<void>;
|
@@ -51,6 +51,7 @@ const exit_signal_1 = require("../../components/exit-signal");
|
|
51
51
|
const workspace_validations_1 = require("../../logic/workspace-validations");
|
52
52
|
const beautiful_logs_1 = require("../../logic/beautiful-logs");
|
53
53
|
const project_validations_1 = require("../../logic/project-validations");
|
54
|
+
const dao_explorer_1 = require("../../logic/dao-explorer");
|
54
55
|
exports.args = (0, args_1.declareArgs)({
|
55
56
|
'--dir': String,
|
56
57
|
'--help': Boolean,
|
@@ -67,8 +68,10 @@ exports.args = (0, args_1.declareArgs)({
|
|
67
68
|
'-b': '--no-browser',
|
68
69
|
'-w': '--no-watch',
|
69
70
|
'--skip-build': Boolean,
|
70
|
-
'--
|
71
|
-
'--data-layer': Boolean
|
71
|
+
'--dao-explorer': Boolean,
|
72
|
+
'--data-layer': Boolean,
|
73
|
+
'-e': '--dao-explorer',
|
74
|
+
'--customEntryPoint': Boolean
|
72
75
|
});
|
73
76
|
async function help(options) {
|
74
77
|
options.components.logger.log(`
|
@@ -103,13 +106,17 @@ async function main(options) {
|
|
103
106
|
const workingDirectory = path.resolve(process.cwd(), options.args['--dir'] || '.');
|
104
107
|
const isCi = options.args['--ci'] || process.env.CI || false;
|
105
108
|
const debug = !options.args['--no-debug'] && !isCi;
|
106
|
-
const
|
109
|
+
const experimentalDaoExplorer = options.args['--dao-explorer'] && !isCi;
|
110
|
+
const openBrowser = (!experimentalDaoExplorer || !options.args['--no-browser']) && !isCi && !experimentalDaoExplorer;
|
107
111
|
const build = !options.args['--skip-build'];
|
108
112
|
const watch = !options.args['--no-watch'];
|
109
113
|
const withDataLayer = options.args['--data-layer'];
|
110
114
|
const enableWeb3 = options.args['--web3'];
|
111
115
|
let hasSmartWearable = false;
|
112
116
|
const workspace = await (0, workspace_validations_1.getValidWorkspace)(options.components, workingDirectory);
|
117
|
+
if (experimentalDaoExplorer) {
|
118
|
+
await (0, dao_explorer_1.ensureDaoExplorer)(options.components, workspace.rootWorkingDirectory);
|
119
|
+
}
|
113
120
|
/* istanbul ignore if */
|
114
121
|
if (workspace.projects.length > 1)
|
115
122
|
(0, beautiful_logs_1.printWarning)(options.components.logger, 'Support for multiple projects is still experimental.');
|
@@ -121,7 +128,15 @@ async function main(options) {
|
|
121
128
|
// first run `npm run build`, this can be disabled with --skip-build
|
122
129
|
// then start the embedded compiler, this can be disabled with --no-watch
|
123
130
|
if (watch || build) {
|
124
|
-
await (0, build_1.buildScene)({
|
131
|
+
await (0, build_1.buildScene)({
|
132
|
+
...options,
|
133
|
+
args: {
|
134
|
+
'--dir': project.workingDirectory,
|
135
|
+
'--watch': watch,
|
136
|
+
_: [],
|
137
|
+
'--customEntryPoint': !!options.args['--customEntryPoint']
|
138
|
+
}
|
139
|
+
}, project);
|
125
140
|
await (0, project_validations_1.startValidations)(options.components, project.workingDirectory);
|
126
141
|
}
|
127
142
|
// track the event
|
@@ -192,38 +207,36 @@ async function main(options) {
|
|
192
207
|
(networkInterfaces[dev] || []).forEach((details) => {
|
193
208
|
if (details.family === 'IPv4') {
|
194
209
|
const oldBackpack = 'DISABLE_backpack_editor_v2=&ENABLE_backpack_editor_v1';
|
195
|
-
|
210
|
+
const baseUrl = `http://${details.address}:${port}`;
|
211
|
+
let url = `${baseUrl}?position=${baseCoords.x}%2C${baseCoords.y}&${oldBackpack}`;
|
196
212
|
if (debug) {
|
197
|
-
|
213
|
+
url = `${url}&SCENE_DEBUG_PANEL`;
|
198
214
|
}
|
199
215
|
if (enableWeb3 || hasSmartWearable) {
|
200
|
-
|
216
|
+
url = `${url}&ENABLE_WEB3`;
|
201
217
|
}
|
202
|
-
availableURLs.push(
|
218
|
+
availableURLs.push({ base: baseUrl, url });
|
203
219
|
}
|
204
220
|
});
|
205
221
|
});
|
206
222
|
// Push localhost and 127.0.0.1 at top
|
207
223
|
const sortedURLs = availableURLs.sort((a, _b) => {
|
208
|
-
return a.toLowerCase().includes('localhost') || a.includes('127.0.0.1') || a.includes('0.0.0.0')
|
224
|
+
return a.base.toLowerCase().includes('localhost') || a.base.includes('127.0.0.1') || a.base.includes('0.0.0.0')
|
225
|
+
? -1
|
226
|
+
: 1;
|
209
227
|
});
|
210
228
|
for (const addr of sortedURLs) {
|
211
|
-
components.logger.log(` ${addr}`);
|
212
|
-
}
|
213
|
-
if (options.args['--desktop-client']) {
|
214
|
-
components.logger.log('\n Desktop client:\n');
|
215
|
-
for (const addr of sortedURLs) {
|
216
|
-
const searchParams = new URLSearchParams();
|
217
|
-
searchParams.append('PREVIEW-MODE', addr);
|
218
|
-
components.logger.log(` dcl://${searchParams.toString()}&`);
|
219
|
-
}
|
229
|
+
components.logger.log(` ${addr.url}`);
|
220
230
|
}
|
221
231
|
components.logger.log('\n Details:\n');
|
222
232
|
components.logger.log('\nPress CTRL+C to exit\n');
|
233
|
+
if (experimentalDaoExplorer && sortedURLs.length) {
|
234
|
+
(0, dao_explorer_1.runDaoExplorer)(components, sortedURLs[0].base, `${baseCoords.x},${baseCoords.y}`, workingDirectory);
|
235
|
+
}
|
223
236
|
// Open preferably localhost/127.0.0.1
|
224
|
-
if (openBrowser && sortedURLs.length
|
237
|
+
if (openBrowser && sortedURLs.length) {
|
225
238
|
try {
|
226
|
-
await (0, open_1.default)(sortedURLs[0]);
|
239
|
+
await (0, open_1.default)(sortedURLs[0].url);
|
227
240
|
}
|
228
241
|
catch (_) {
|
229
242
|
components.logger.warn('Unable to open browser automatically.');
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/start/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAwB;AACxB,2CAA4B;AAC5B,gDAAuB;AAGvB,oCAAqC;AACrC,2CAA8C;AAC9C,qEAA6D;AAC7D,6DAAmD;AAEnD,4DAA2E;AAC3E,kEAA6D;AAC7D,oFAAwF;AACxF,+DAAwF;AACxF,oEAA0E;AAC1E,0DAAyE;AACzE,8CAAuD;AACvD,8CAA4D;AAC5D,sEAA0E;AAC1E,4CAA4C;AAC5C,oCAA+C;AAC/C,6DAA8D;AAC9D,0CAA6D;AAC7D,8DAAwE;AACxE,6EAAqE;AACrE,+DAAyG;AAEzG,yEAAkE;
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/start/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAwB;AACxB,2CAA4B;AAC5B,gDAAuB;AAGvB,oCAAqC;AACrC,2CAA8C;AAC9C,qEAA6D;AAC7D,6DAAmD;AAEnD,4DAA2E;AAC3E,kEAA6D;AAC7D,oFAAwF;AACxF,+DAAwF;AACxF,oEAA0E;AAC1E,0DAAyE;AACzE,8CAAuD;AACvD,8CAA4D;AAC5D,sEAA0E;AAC1E,4CAA4C;AAC5C,oCAA+C;AAC/C,6DAA8D;AAC9D,0CAA6D;AAC7D,8DAAwE;AACxE,6EAAqE;AACrE,+DAAyG;AAEzG,yEAAkE;AAClE,2DAA4E;AAO/D,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,EAA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AAA;YACP,CAAC,CAAC,CAAA;YAEF,KAAK,MAAM,IAAI,IAAI,UAAU,EAAE;gBAC7B,UAAU,CAAC,MAAM,CAAC,GAAG,CAAC,OAAO,IAAI,CAAC,GAAG,EAAE,CAAC,CAAA;aACzC;YAED,UAAU,CAAC,MAAM,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAA;YACvC,UAAU,CAAC,MAAM,CAAC,GAAG,CAAC,0BAA0B,CAAC,CAAA;YAEjD,IAAI,uBAAuB,IAAI,UAAU,CAAC,MAAM,EAAE;gBAChD,IAAA,6BAAc,EAAC,UAAU,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,GAAG,UAAU,CAAC,CAAC,IAAI,UAAU,CAAC,CAAC,EAAE,EAAE,gBAAgB,CAAC,CAAA;aACpG;YAED,sCAAsC;YACtC,IAAI,WAAW,IAAI,UAAU,CAAC,MAAM,EAAE;gBACpC,IAAI;oBACF,MAAM,IAAA,cAAI,EAAC,UAAU,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAA;iBAC9B;gBAAC,OAAO,CAAC,EAAE;oBACV,UAAU,CAAC,MAAM,CAAC,IAAI,CAAC,uCAAuC,CAAC,CAAA;iBAChE;aACF;QACH,CAAC;KACF,CAAC,CAAA;IAEF,mEAAmE;IACnE,8EAA8E;IAC9E,UAAU;IACV,MAAM,OAAO,CAAC,UAAU,CAAC,QAAQ,CAAC,aAAa,CAAA;AACjD,CAAC;AAxKD,oBAwKC"}
|
@@ -0,0 +1,3 @@
|
|
1
|
+
import { CliComponents } from '../components';
|
2
|
+
export declare function ensureDaoExplorer(components: Pick<CliComponents, 'logger' | 'fs' | 'fetch'>, workingDirectory: string): Promise<void>;
|
3
|
+
export declare function runDaoExplorer(components: Pick<CliComponents, 'logger' | 'fs' | 'fetch'>, realmUrl: string, locationCoords: string, workingDirectory: string): void;
|
@@ -0,0 +1,154 @@
|
|
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
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
27
|
+
};
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
29
|
+
exports.runDaoExplorer = exports.ensureDaoExplorer = void 0;
|
30
|
+
const fs_1 = require("./fs");
|
31
|
+
const path_1 = __importDefault(require("path"));
|
32
|
+
const os_1 = require("os");
|
33
|
+
const error_1 = require("./error");
|
34
|
+
const beautiful_logs_1 = require("./beautiful-logs");
|
35
|
+
const tar = __importStar(require("tar"));
|
36
|
+
const child_process_1 = __importDefault(require("child_process"));
|
37
|
+
var SupportedPlatform;
|
38
|
+
(function (SupportedPlatform) {
|
39
|
+
SupportedPlatform[SupportedPlatform["SP_MACOS_ARM64"] = 0] = "SP_MACOS_ARM64";
|
40
|
+
SupportedPlatform[SupportedPlatform["SP_MACOS_X64"] = 1] = "SP_MACOS_X64";
|
41
|
+
SupportedPlatform[SupportedPlatform["SP_LINUX_X64"] = 2] = "SP_LINUX_X64";
|
42
|
+
SupportedPlatform[SupportedPlatform["SP_WINDOWS_X64"] = 3] = "SP_WINDOWS_X64";
|
43
|
+
SupportedPlatform[SupportedPlatform["SP_UNSUPPORTED"] = 4] = "SP_UNSUPPORTED";
|
44
|
+
})(SupportedPlatform || (SupportedPlatform = {}));
|
45
|
+
const BEVY_BASE_URL = 'https://github.com/decentraland/bevy-explorer/releases/download/alpha-2024-05-25-12-28-51/bevy-explorer-2024-05-25-12-28-51';
|
46
|
+
const BEVY_URL_PLATFORM_SUFFIX = {
|
47
|
+
[SupportedPlatform.SP_LINUX_X64]: 'linux-x86_64.tar.gz',
|
48
|
+
[SupportedPlatform.SP_MACOS_ARM64]: 'macos-m1m2.tar.gz',
|
49
|
+
[SupportedPlatform.SP_MACOS_X64]: 'macos-x86_64.tar.gz',
|
50
|
+
[SupportedPlatform.SP_WINDOWS_X64]: 'windows-x86_64.zip',
|
51
|
+
[SupportedPlatform.SP_UNSUPPORTED]: 'empty'
|
52
|
+
};
|
53
|
+
function getPlatform() {
|
54
|
+
const os = (0, os_1.platform)();
|
55
|
+
const arch = process.arch;
|
56
|
+
switch (os) {
|
57
|
+
case 'darwin':
|
58
|
+
if (arch === 'arm64') {
|
59
|
+
return SupportedPlatform.SP_MACOS_ARM64;
|
60
|
+
}
|
61
|
+
else if (arch === 'x64') {
|
62
|
+
return SupportedPlatform.SP_MACOS_ARM64;
|
63
|
+
}
|
64
|
+
else {
|
65
|
+
return SupportedPlatform.SP_UNSUPPORTED;
|
66
|
+
}
|
67
|
+
case 'win32':
|
68
|
+
if (arch === 'x64') {
|
69
|
+
return SupportedPlatform.SP_WINDOWS_X64;
|
70
|
+
}
|
71
|
+
else {
|
72
|
+
return SupportedPlatform.SP_UNSUPPORTED;
|
73
|
+
}
|
74
|
+
case 'linux':
|
75
|
+
if (arch === 'x64') {
|
76
|
+
return SupportedPlatform.SP_LINUX_X64;
|
77
|
+
}
|
78
|
+
else {
|
79
|
+
return SupportedPlatform.SP_UNSUPPORTED;
|
80
|
+
}
|
81
|
+
default:
|
82
|
+
return SupportedPlatform.SP_UNSUPPORTED;
|
83
|
+
}
|
84
|
+
}
|
85
|
+
function getDaoExplorerPath(workingDirectory) {
|
86
|
+
return path_1.default.resolve(workingDirectory, 'node_modules', '.bin', 'dao-explorer');
|
87
|
+
}
|
88
|
+
function getDaoExplorerExecutablePath(workingDirectory) {
|
89
|
+
const platform = getPlatform();
|
90
|
+
if (platform === SupportedPlatform.SP_UNSUPPORTED) {
|
91
|
+
throw new error_1.CliError('This platform is not supported to run the DAO Explorers.');
|
92
|
+
}
|
93
|
+
if (platform === SupportedPlatform.SP_WINDOWS_X64) {
|
94
|
+
return path_1.default.resolve(getDaoExplorerPath(workingDirectory), 'decentra-bevy.exe');
|
95
|
+
}
|
96
|
+
else {
|
97
|
+
return path_1.default.resolve(getDaoExplorerPath(workingDirectory), 'decentra-bevy');
|
98
|
+
}
|
99
|
+
}
|
100
|
+
async function ensureDaoExplorer(components, workingDirectory) {
|
101
|
+
const daoExplorerFolderPath = getDaoExplorerPath(workingDirectory);
|
102
|
+
const platform = getPlatform();
|
103
|
+
if (platform === SupportedPlatform.SP_UNSUPPORTED) {
|
104
|
+
throw new error_1.CliError('This platform is not supported to run the DAO Explorers.');
|
105
|
+
}
|
106
|
+
const url = `${BEVY_BASE_URL}-${BEVY_URL_PLATFORM_SUFFIX[platform]}`;
|
107
|
+
const versionFilePath = path_1.default.resolve(daoExplorerFolderPath, 'version');
|
108
|
+
if (await components.fs.fileExists(versionFilePath)) {
|
109
|
+
const versionContent = await components.fs.readFile(versionFilePath, 'utf-8');
|
110
|
+
if (versionContent === url) {
|
111
|
+
return;
|
112
|
+
}
|
113
|
+
}
|
114
|
+
const tempPackagePath = path_1.default.resolve(daoExplorerFolderPath, BEVY_URL_PLATFORM_SUFFIX[platform]);
|
115
|
+
(0, beautiful_logs_1.printProgressInfo)(components.logger, `Downloading DAO Explorer ${BEVY_URL_PLATFORM_SUFFIX[platform]} from ${url}`);
|
116
|
+
if (await components.fs.directoryExists(daoExplorerFolderPath)) {
|
117
|
+
await components.fs.rm(daoExplorerFolderPath, { recursive: true, force: true });
|
118
|
+
}
|
119
|
+
await components.fs.mkdir(daoExplorerFolderPath, { recursive: true });
|
120
|
+
await (0, fs_1.download)(components, url, tempPackagePath);
|
121
|
+
if (tempPackagePath.endsWith('.zip')) {
|
122
|
+
await (0, fs_1.extract)(tempPackagePath, daoExplorerFolderPath);
|
123
|
+
}
|
124
|
+
else if (tempPackagePath.endsWith('.tar.gz') || tempPackagePath.endsWith('.tgz')) {
|
125
|
+
await tar.extract({
|
126
|
+
C: daoExplorerFolderPath,
|
127
|
+
f: tempPackagePath
|
128
|
+
});
|
129
|
+
}
|
130
|
+
await components.fs.writeFile(versionFilePath, url);
|
131
|
+
}
|
132
|
+
exports.ensureDaoExplorer = ensureDaoExplorer;
|
133
|
+
function runDaoExplorer(components, realmUrl, locationCoords, workingDirectory) {
|
134
|
+
const daoExplorerFolderPath = getDaoExplorerPath(workingDirectory);
|
135
|
+
const executablePath = getDaoExplorerExecutablePath(workingDirectory);
|
136
|
+
executablePath;
|
137
|
+
const ts = child_process_1.default.spawn(executablePath, ['--server', realmUrl, '--location', locationCoords], {
|
138
|
+
env: process.env,
|
139
|
+
cwd: daoExplorerFolderPath
|
140
|
+
});
|
141
|
+
ts.on('close', (code) => {
|
142
|
+
/* istanbul ignore else */
|
143
|
+
if (code === 0) {
|
144
|
+
(0, beautiful_logs_1.printProgressInfo)(components.logger, `Type checking completed without errors`);
|
145
|
+
}
|
146
|
+
else {
|
147
|
+
return;
|
148
|
+
}
|
149
|
+
});
|
150
|
+
ts.stdout.pipe(process.stdout);
|
151
|
+
ts.stderr.pipe(process.stderr);
|
152
|
+
}
|
153
|
+
exports.runDaoExplorer = runDaoExplorer;
|
154
|
+
//# sourceMappingURL=dao-explorer.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"dao-explorer.js","sourceRoot":"","sources":["../../src/logic/dao-explorer.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,6BAAwC;AACxC,gDAAuB;AACvB,2BAA6B;AAC7B,mCAAkC;AAClC,qDAAoD;AACpD,yCAA0B;AAC1B,kEAAyC;AAEzC,IAAK,iBAMJ;AAND,WAAK,iBAAiB;IACpB,6EAAc,CAAA;IACd,yEAAY,CAAA;IACZ,yEAAY,CAAA;IACZ,6EAAc,CAAA;IACd,6EAAc,CAAA;AAChB,CAAC,EANI,iBAAiB,KAAjB,iBAAiB,QAMrB;AAED,MAAM,aAAa,GACjB,6HAA6H,CAAA;AAC/H,MAAM,wBAAwB,GAAsC;IAClE,CAAC,iBAAiB,CAAC,YAAY,CAAC,EAAE,qBAAqB;IACvD,CAAC,iBAAiB,CAAC,cAAc,CAAC,EAAE,mBAAmB;IACvD,CAAC,iBAAiB,CAAC,YAAY,CAAC,EAAE,qBAAqB;IACvD,CAAC,iBAAiB,CAAC,cAAc,CAAC,EAAE,oBAAoB;IACxD,CAAC,iBAAiB,CAAC,cAAc,CAAC,EAAE,OAAO;CAC5C,CAAA;AAED,SAAS,WAAW;IAClB,MAAM,EAAE,GAAG,IAAA,aAAQ,GAAE,CAAA;IACrB,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAA;IACzB,QAAQ,EAAE,EAAE;QACV,KAAK,QAAQ;YACX,IAAI,IAAI,KAAK,OAAO,EAAE;gBACpB,OAAO,iBAAiB,CAAC,cAAc,CAAA;aACxC;iBAAM,IAAI,IAAI,KAAK,KAAK,EAAE;gBACzB,OAAO,iBAAiB,CAAC,cAAc,CAAA;aACxC;iBAAM;gBACL,OAAO,iBAAiB,CAAC,cAAc,CAAA;aACxC;QACH,KAAK,OAAO;YACV,IAAI,IAAI,KAAK,KAAK,EAA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CAAC,EAAE,eAAe;SACnB,CAAC,CAAA;KACH;IAED,MAAM,UAAU,CAAC,EAAE,CAAC,SAAS,CAAC,eAAe,EAAE,GAAG,CAAC,CAAA;AACrD,CAAC;AAvCD,8CAuCC;AAED,SAAgB,cAAc,CAC5B,UAA0D,EAC1D,QAAgB,EAChB,cAAsB,EACtB,gBAAwB;IAExB,MAAM,qBAAqB,GAAG,kBAAkB,CAAC,gBAAgB,CAAC,CAAA;IAClE,MAAM,cAAc,GAAG,4BAA4B,CAAC,gBAAgB,CAAC,CAAA;IACrE,cAAc,CAAA;IACd,MAAM,EAAE,GAAG,uBAAa,CAAC,KAAK,CAAC,cAAc,EAAE,CAAC,UAAU,EAAE,QAAQ,EAAE,YAAY,EAAE,cAAc,CAAC,EAAE;QACnG,GAAG,EAAE,OAAO,CAAC,GAAG;QAChB,GAAG,EAAE,qBAAqB;KAC3B,CAAC,CAAA;IAEF,EAAE,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,IAAI,EAAE,EAAE;QACtB,0BAA0B;QAC1B,IAAI,IAAI,KAAK,CAAC,EAAE;YACd,IAAA,kCAAiB,EAAC,UAAU,CAAC,MAAM,EAAE,wCAAwC,CAAC,CAAA;SAC/E;aAAM;YACL,OAAM;SACP;IACH,CAAC,CAAC,CAAA;IAEF,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAA;IAC9B,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAA;AAChC,CAAC;AAzBD,wCAyBC"}
|
package/package.json
CHANGED
@@ -1,19 +1,19 @@
|
|
1
1
|
{
|
2
2
|
"name": "@dcl/sdk-commands",
|
3
3
|
"description": "",
|
4
|
-
"version": "7.5.
|
4
|
+
"version": "7.5.1-9235895775.commit-075ab65",
|
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.5.
|
11
|
+
"@dcl/ecs": "7.5.1-9235895775.commit-075ab65",
|
12
12
|
"@dcl/hashing": "1.1.3",
|
13
|
-
"@dcl/inspector": "7.5.
|
13
|
+
"@dcl/inspector": "7.5.1-9235895775.commit-075ab65",
|
14
14
|
"@dcl/linker-dapp": "^0.12.0",
|
15
15
|
"@dcl/mini-comms": "1.0.1-20230216163137.commit-a4c75be",
|
16
|
-
"@dcl/protocol": "1.0.0-
|
16
|
+
"@dcl/protocol": "1.0.0-9127033568.commit-26c5ae7",
|
17
17
|
"@dcl/quests-client": "^1.0.3",
|
18
18
|
"@dcl/quests-manager": "^0.1.4",
|
19
19
|
"@dcl/rpc": "^1.1.1",
|
@@ -38,6 +38,7 @@
|
|
38
38
|
"open": "^8.4.0",
|
39
39
|
"portfinder": "^1.0.32",
|
40
40
|
"prompts": "^2.4.2",
|
41
|
+
"tar": "^7.1.0",
|
41
42
|
"typescript": "^5.0.2",
|
42
43
|
"undici": "^5.19.1",
|
43
44
|
"uuid": "^9.0.1"
|
@@ -73,5 +74,5 @@
|
|
73
74
|
"displayName": "SDK",
|
74
75
|
"tsconfig": "./tsconfig.json"
|
75
76
|
},
|
76
|
-
"commit": "
|
77
|
+
"commit": "075ab65a8da74643a2d70ea916d4c0d9feb8b89b"
|
77
78
|
}
|