decentrand 3.21.0
Sign up to get free protection for your applications and to get access to all the features.
- package/LICENSE +201 -0
- package/README.md +56 -0
- package/abi/EstateRegistry.json +1226 -0
- package/abi/LANDRegistry.json +1372 -0
- package/abi/MANAToken.json +410 -0
- package/dist/commands/build.d.ts +3 -0
- package/dist/commands/build.d.ts.map +1 -0
- package/dist/commands/build.js +108 -0
- package/dist/commands/build.js.map +1 -0
- package/dist/commands/coords.d.ts +3 -0
- package/dist/commands/coords.d.ts.map +1 -0
- package/dist/commands/coords.js +122 -0
- package/dist/commands/coords.js.map +1 -0
- package/dist/commands/deploy.d.ts +4 -0
- package/dist/commands/deploy.d.ts.map +1 -0
- package/dist/commands/deploy.js +280 -0
- package/dist/commands/deploy.js.map +1 -0
- package/dist/commands/export.d.ts +3 -0
- package/dist/commands/export.d.ts.map +1 -0
- package/dist/commands/export.js +20 -0
- package/dist/commands/export.js.map +1 -0
- package/dist/commands/index.d.ts +3 -0
- package/dist/commands/index.d.ts.map +1 -0
- package/dist/commands/index.js +19 -0
- package/dist/commands/index.js.map +1 -0
- package/dist/commands/info.d.ts +3 -0
- package/dist/commands/info.d.ts.map +1 -0
- package/dist/commands/info.js +186 -0
- package/dist/commands/info.js.map +1 -0
- package/dist/commands/init/help.d.ts +12 -0
- package/dist/commands/init/help.d.ts.map +1 -0
- package/dist/commands/init/help.js +41 -0
- package/dist/commands/init/help.js.map +1 -0
- package/dist/commands/init/index.d.ts +3 -0
- package/dist/commands/init/index.d.ts.map +1 -0
- package/dist/commands/init/index.js +96 -0
- package/dist/commands/init/index.js.map +1 -0
- package/dist/commands/init/library.d.ts +1 -0
- package/dist/commands/init/library.d.ts.map +1 -0
- package/dist/commands/init/library.js +2 -0
- package/dist/commands/init/library.js.map +1 -0
- package/dist/commands/init/repositories.d.ts +11 -0
- package/dist/commands/init/repositories.d.ts.map +1 -0
- package/dist/commands/init/repositories.js +40 -0
- package/dist/commands/init/repositories.js.map +1 -0
- package/dist/commands/init/scene.d.ts +3 -0
- package/dist/commands/init/scene.d.ts.map +1 -0
- package/dist/commands/init/scene.js +56 -0
- package/dist/commands/init/scene.js.map +1 -0
- package/dist/commands/init/types.d.ts +22 -0
- package/dist/commands/init/types.d.ts.map +1 -0
- package/dist/commands/init/types.js +3 -0
- package/dist/commands/init/types.js.map +1 -0
- package/dist/commands/init/utils.d.ts +6 -0
- package/dist/commands/init/utils.d.ts.map +1 -0
- package/dist/commands/init/utils.js +76 -0
- package/dist/commands/init/utils.js.map +1 -0
- package/dist/commands/install.d.ts +3 -0
- package/dist/commands/install.d.ts.map +1 -0
- package/dist/commands/install.js +92 -0
- package/dist/commands/install.js.map +1 -0
- package/dist/commands/pack.d.ts +3 -0
- package/dist/commands/pack.d.ts.map +1 -0
- package/dist/commands/pack.js +102 -0
- package/dist/commands/pack.js.map +1 -0
- package/dist/commands/start.d.ts +3 -0
- package/dist/commands/start.d.ts.map +1 -0
- package/dist/commands/start.js +235 -0
- package/dist/commands/start.js.map +1 -0
- package/dist/commands/status.d.ts +3 -0
- package/dist/commands/status.d.ts.map +1 -0
- package/dist/commands/status.js +80 -0
- package/dist/commands/status.js.map +1 -0
- package/dist/commands/workspace.d.ts +3 -0
- package/dist/commands/workspace.d.ts.map +1 -0
- package/dist/commands/workspace.js +81 -0
- package/dist/commands/workspace.js.map +1 -0
- package/dist/commands/world-acl.d.ts +22 -0
- package/dist/commands/world-acl.d.ts.map +1 -0
- package/dist/commands/world-acl.js +262 -0
- package/dist/commands/world-acl.js.map +1 -0
- package/dist/config.d.ts +31 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +128 -0
- package/dist/config.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +21 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/API.d.ts +23 -0
- package/dist/lib/API.d.ts.map +1 -0
- package/dist/lib/API.js +175 -0
- package/dist/lib/API.js.map +1 -0
- package/dist/lib/Decentraland.d.ts +75 -0
- package/dist/lib/Decentraland.d.ts.map +1 -0
- package/dist/lib/Decentraland.js +227 -0
- package/dist/lib/Decentraland.js.map +1 -0
- package/dist/lib/Ethereum.d.ts +52 -0
- package/dist/lib/Ethereum.d.ts.map +1 -0
- package/dist/lib/Ethereum.js +245 -0
- package/dist/lib/Ethereum.js.map +1 -0
- package/dist/lib/IEthereumDataProvider.d.ts +17 -0
- package/dist/lib/IEthereumDataProvider.d.ts.map +1 -0
- package/dist/lib/IEthereumDataProvider.js +3 -0
- package/dist/lib/IEthereumDataProvider.js.map +1 -0
- package/dist/lib/LinkerAPI.d.ts +28 -0
- package/dist/lib/LinkerAPI.d.ts.map +1 -0
- package/dist/lib/LinkerAPI.js +151 -0
- package/dist/lib/LinkerAPI.js.map +1 -0
- package/dist/lib/Preview.d.ts +17 -0
- package/dist/lib/Preview.d.ts.map +1 -0
- package/dist/lib/Preview.js +113 -0
- package/dist/lib/Preview.js.map +1 -0
- package/dist/lib/Project.d.ts +152 -0
- package/dist/lib/Project.d.ts.map +1 -0
- package/dist/lib/Project.js +446 -0
- package/dist/lib/Project.js.map +1 -0
- package/dist/lib/Workspace.d.ts +21 -0
- package/dist/lib/Workspace.d.ts.map +1 -0
- package/dist/lib/Workspace.js +140 -0
- package/dist/lib/Workspace.js.map +1 -0
- package/dist/lib/WorldsContentServer.d.ts +27 -0
- package/dist/lib/WorldsContentServer.d.ts.map +1 -0
- package/dist/lib/WorldsContentServer.js +79 -0
- package/dist/lib/WorldsContentServer.js.map +1 -0
- package/dist/lib/WorldsContentServerLinkerAPI.d.ts +21 -0
- package/dist/lib/WorldsContentServerLinkerAPI.d.ts.map +1 -0
- package/dist/lib/WorldsContentServerLinkerAPI.js +105 -0
- package/dist/lib/WorldsContentServerLinkerAPI.js.map +1 -0
- package/dist/lib/adapters/proto/broker.d.ts +2 -0
- package/dist/lib/adapters/proto/broker.d.ts.map +1 -0
- package/dist/lib/adapters/proto/broker.js +2189 -0
- package/dist/lib/adapters/proto/broker.js.map +1 -0
- package/dist/lib/adapters/proto/comms.d.ts +2 -0
- package/dist/lib/adapters/proto/comms.d.ts.map +1 -0
- package/dist/lib/adapters/proto/comms.js +965 -0
- package/dist/lib/adapters/proto/comms.js.map +1 -0
- package/dist/lib/adapters/ws.d.ts +12 -0
- package/dist/lib/adapters/ws.d.ts.map +1 -0
- package/dist/lib/adapters/ws.js +20 -0
- package/dist/lib/adapters/ws.js.map +1 -0
- package/dist/lib/content/ContentService.d.ts +27 -0
- package/dist/lib/content/ContentService.d.ts.map +1 -0
- package/dist/lib/content/ContentService.js +60 -0
- package/dist/lib/content/ContentService.js.map +1 -0
- package/dist/lib/content/types.d.ts +12 -0
- package/dist/lib/content/types.d.ts.map +1 -0
- package/dist/lib/content/types.js +3 -0
- package/dist/lib/content/types.js.map +1 -0
- package/dist/lib/controllers/bff.d.ts +8 -0
- package/dist/lib/controllers/bff.d.ts.map +1 -0
- package/dist/lib/controllers/bff.js +58 -0
- package/dist/lib/controllers/bff.js.map +1 -0
- package/dist/lib/controllers/debugger.d.ts +4 -0
- package/dist/lib/controllers/debugger.d.ts.map +1 -0
- package/dist/lib/controllers/debugger.js +42 -0
- package/dist/lib/controllers/debugger.js.map +1 -0
- package/dist/lib/controllers/ecs6-endpoints.d.ts +11 -0
- package/dist/lib/controllers/ecs6-endpoints.d.ts.map +1 -0
- package/dist/lib/controllers/ecs6-endpoints.js +543 -0
- package/dist/lib/controllers/ecs6-endpoints.js.map +1 -0
- package/dist/lib/controllers/legacy-comms-v1.d.ts +7 -0
- package/dist/lib/controllers/legacy-comms-v1.d.ts.map +1 -0
- package/dist/lib/controllers/legacy-comms-v1.js +98 -0
- package/dist/lib/controllers/legacy-comms-v1.js.map +1 -0
- package/dist/lib/smartItems/buildSmartItem.d.ts +2 -0
- package/dist/lib/smartItems/buildSmartItem.d.ts.map +1 -0
- package/dist/lib/smartItems/buildSmartItem.js +18 -0
- package/dist/lib/smartItems/buildSmartItem.js.map +1 -0
- package/dist/lib/smartItems/packProject.d.ts +2 -0
- package/dist/lib/smartItems/packProject.d.ts.map +1 -0
- package/dist/lib/smartItems/packProject.js +31 -0
- package/dist/lib/smartItems/packProject.js.map +1 -0
- package/dist/main.d.ts +2 -0
- package/dist/main.d.ts.map +1 -0
- package/dist/main.js +151 -0
- package/dist/main.js.map +1 -0
- package/dist/project/installDependencies.d.ts +2 -0
- package/dist/project/installDependencies.d.ts.map +1 -0
- package/dist/project/installDependencies.js +57 -0
- package/dist/project/installDependencies.js.map +1 -0
- package/dist/project/isTypescriptProject.d.ts +2 -0
- package/dist/project/isTypescriptProject.d.ts.map +1 -0
- package/dist/project/isTypescriptProject.js +14 -0
- package/dist/project/isTypescriptProject.js.map +1 -0
- package/dist/project/projectInfo.d.ts +8 -0
- package/dist/project/projectInfo.d.ts.map +1 -0
- package/dist/project/projectInfo.js +89 -0
- package/dist/project/projectInfo.js.map +1 -0
- package/dist/project/updateBundleDependenciesField.d.ts +4 -0
- package/dist/project/updateBundleDependenciesField.d.ts.map +1 -0
- package/dist/project/updateBundleDependenciesField.js +67 -0
- package/dist/project/updateBundleDependenciesField.js.map +1 -0
- package/dist/sceneJson/index.d.ts +4 -0
- package/dist/sceneJson/index.d.ts.map +1 -0
- package/dist/sceneJson/index.js +24 -0
- package/dist/sceneJson/index.js.map +1 -0
- package/dist/sceneJson/lintSceneFile.d.ts +2 -0
- package/dist/sceneJson/lintSceneFile.d.ts.map +1 -0
- package/dist/sceneJson/lintSceneFile.js +13 -0
- package/dist/sceneJson/lintSceneFile.js.map +1 -0
- package/dist/sceneJson/utils.d.ts +3 -0
- package/dist/sceneJson/utils.d.ts.map +1 -0
- package/dist/sceneJson/utils.js +66 -0
- package/dist/sceneJson/utils.js.map +1 -0
- package/dist/utils/analytics.d.ts +42 -0
- package/dist/utils/analytics.d.ts.map +1 -0
- package/dist/utils/analytics.js +111 -0
- package/dist/utils/analytics.js.map +1 -0
- package/dist/utils/buildProject.d.ts +2 -0
- package/dist/utils/buildProject.d.ts.map +1 -0
- package/dist/utils/buildProject.js +26 -0
- package/dist/utils/buildProject.js.map +1 -0
- package/dist/utils/catalystPointers.d.ts +20 -0
- package/dist/utils/catalystPointers.d.ts.map +1 -0
- package/dist/utils/catalystPointers.js +51 -0
- package/dist/utils/catalystPointers.js.map +1 -0
- package/dist/utils/coordinateHelpers.d.ts +65 -0
- package/dist/utils/coordinateHelpers.d.ts.map +1 -0
- package/dist/utils/coordinateHelpers.js +126 -0
- package/dist/utils/coordinateHelpers.js.map +1 -0
- package/dist/utils/download.d.ts +3 -0
- package/dist/utils/download.d.ts.map +1 -0
- package/dist/utils/download.js +42 -0
- package/dist/utils/download.js.map +1 -0
- package/dist/utils/env.d.ts +6 -0
- package/dist/utils/env.d.ts.map +1 -0
- package/dist/utils/env.js +31 -0
- package/dist/utils/env.js.map +1 -0
- package/dist/utils/errors.d.ts +18 -0
- package/dist/utils/errors.d.ts.map +1 -0
- package/dist/utils/errors.js +27 -0
- package/dist/utils/errors.js.map +1 -0
- package/dist/utils/filesystem.d.ts +41 -0
- package/dist/utils/filesystem.d.ts.map +1 -0
- package/dist/utils/filesystem.js +84 -0
- package/dist/utils/filesystem.js.map +1 -0
- package/dist/utils/getDummyMappings.d.ts +3 -0
- package/dist/utils/getDummyMappings.d.ts.map +1 -0
- package/dist/utils/getDummyMappings.js +19 -0
- package/dist/utils/getDummyMappings.js.map +1 -0
- package/dist/utils/getProjectFilePaths.d.ts +2 -0
- package/dist/utils/getProjectFilePaths.d.ts.map +1 -0
- package/dist/utils/getProjectFilePaths.js +40 -0
- package/dist/utils/getProjectFilePaths.js.map +1 -0
- package/dist/utils/index.d.ts +11 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +33 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/installedDependencies.d.ts +6 -0
- package/dist/utils/installedDependencies.d.ts.map +1 -0
- package/dist/utils/installedDependencies.js +44 -0
- package/dist/utils/installedDependencies.js.map +1 -0
- package/dist/utils/land.d.ts +4 -0
- package/dist/utils/land.d.ts.map +1 -0
- package/dist/utils/land.js +35 -0
- package/dist/utils/land.js.map +1 -0
- package/dist/utils/logging.d.ts +19 -0
- package/dist/utils/logging.d.ts.map +1 -0
- package/dist/utils/logging.js +97 -0
- package/dist/utils/logging.js.map +1 -0
- package/dist/utils/moduleHelpers.d.ts +22 -0
- package/dist/utils/moduleHelpers.d.ts.map +1 -0
- package/dist/utils/moduleHelpers.js +163 -0
- package/dist/utils/moduleHelpers.js.map +1 -0
- package/dist/utils/nodeAndNpmVersion.d.ts +5 -0
- package/dist/utils/nodeAndNpmVersion.d.ts.map +1 -0
- package/dist/utils/nodeAndNpmVersion.js +64 -0
- package/dist/utils/nodeAndNpmVersion.js.map +1 -0
- package/dist/utils/pathsExistOnDir.d.ts +2 -0
- package/dist/utils/pathsExistOnDir.d.ts.map +1 -0
- package/dist/utils/pathsExistOnDir.js +12 -0
- package/dist/utils/pathsExistOnDir.js.map +1 -0
- package/dist/utils/project.d.ts +29 -0
- package/dist/utils/project.d.ts.map +1 -0
- package/dist/utils/project.js +48 -0
- package/dist/utils/project.js.map +1 -0
- package/dist/utils/shellCommands.d.ts +19 -0
- package/dist/utils/shellCommands.d.ts.map +1 -0
- package/dist/utils/shellCommands.js +73 -0
- package/dist/utils/shellCommands.js.map +1 -0
- package/dist/utils/spinner.d.ts +6 -0
- package/dist/utils/spinner.d.ts.map +1 -0
- package/dist/utils/spinner.js +58 -0
- package/dist/utils/spinner.js.map +1 -0
- package/package.json +115 -0
- package/samples/workspace/Dockerfile +21 -0
- package/samples/workspace/package.json +16 -0
- package/sbzkmrj2.cjs +1 -0
@@ -0,0 +1,97 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
|
+
};
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
+
exports.formatOutdatedMessage = exports.formatList = exports.formatDictionary = exports.isEmpty = exports.tabulate = exports.warning = exports.error = exports.debug = void 0;
|
7
|
+
const chalk_1 = __importDefault(require("chalk"));
|
8
|
+
const env_1 = require("./env");
|
9
|
+
const _1 = require(".");
|
10
|
+
function debug(...messages) {
|
11
|
+
if ((0, env_1.isDebug)()) {
|
12
|
+
console.log(...messages);
|
13
|
+
}
|
14
|
+
}
|
15
|
+
exports.debug = debug;
|
16
|
+
function error(message) {
|
17
|
+
return `${chalk_1.default.red('Error:')} ${message}`;
|
18
|
+
}
|
19
|
+
exports.error = error;
|
20
|
+
function warning(message) {
|
21
|
+
return `${chalk_1.default.yellow('Warning: ')}${message}`;
|
22
|
+
}
|
23
|
+
exports.warning = warning;
|
24
|
+
function tabulate(spaces = 0) {
|
25
|
+
return spaces > 0 ? ' '.repeat(spaces) : '';
|
26
|
+
}
|
27
|
+
exports.tabulate = tabulate;
|
28
|
+
function isEmpty(obj) {
|
29
|
+
if (!obj)
|
30
|
+
return true;
|
31
|
+
const keys = Object.keys(obj);
|
32
|
+
if (!keys.length) {
|
33
|
+
return true;
|
34
|
+
}
|
35
|
+
return keys.every(($) => obj[$] === undefined || obj[$] === [] || obj[$] === {} || obj[$] === '');
|
36
|
+
}
|
37
|
+
exports.isEmpty = isEmpty;
|
38
|
+
function formatDictionary(obj, options, level = 1, context) {
|
39
|
+
let buf = '';
|
40
|
+
const keys = obj ? Object.keys(obj) : [];
|
41
|
+
keys.forEach((key, i) => {
|
42
|
+
const item = obj[key];
|
43
|
+
const separator = context === 'array' && i === 0 ? '' : tabulate(options.spacing * level + options.padding);
|
44
|
+
if (Array.isArray(item)) {
|
45
|
+
buf = buf.concat(separator, `${chalk_1.default.bold(key)}: `, formatList(item, options, level + 1, 'object'), '\n');
|
46
|
+
}
|
47
|
+
else if ((0, _1.isRecord)(item)) {
|
48
|
+
const isHidden = isEmpty(item);
|
49
|
+
const content = isHidden
|
50
|
+
? `: ${chalk_1.default.italic('No information available')}\n`
|
51
|
+
: `:\n${formatDictionary(item, options, level + 1, 'object')}`;
|
52
|
+
buf = buf.concat(separator, `${chalk_1.default.bold(key)}`, content);
|
53
|
+
}
|
54
|
+
else if (item) {
|
55
|
+
buf = buf.concat(separator, `${chalk_1.default.bold(key)}: `, JSON.stringify(item), '\n');
|
56
|
+
}
|
57
|
+
});
|
58
|
+
return buf;
|
59
|
+
}
|
60
|
+
exports.formatDictionary = formatDictionary;
|
61
|
+
function formatList(list, options, level = 1, _context) {
|
62
|
+
let buf = '';
|
63
|
+
const separator = '\n' + tabulate(options.spacing * level + options.padding) + '- ';
|
64
|
+
if (list.length) {
|
65
|
+
buf = list.reduce((buf, item, _i) => {
|
66
|
+
if (Array.isArray(item)) {
|
67
|
+
return buf.concat(separator, formatList(list, options, level + 1, 'array'));
|
68
|
+
}
|
69
|
+
else if (typeof item === 'object') {
|
70
|
+
return buf.concat(separator, formatDictionary(item, options, level + 1, 'array'));
|
71
|
+
}
|
72
|
+
else if (item !== undefined) {
|
73
|
+
return buf.concat(separator, JSON.stringify(item));
|
74
|
+
}
|
75
|
+
else {
|
76
|
+
return buf;
|
77
|
+
}
|
78
|
+
}, '');
|
79
|
+
}
|
80
|
+
else {
|
81
|
+
buf = chalk_1.default.italic('No information available');
|
82
|
+
}
|
83
|
+
return buf;
|
84
|
+
}
|
85
|
+
exports.formatList = formatList;
|
86
|
+
function formatOutdatedMessage(arg) {
|
87
|
+
return [
|
88
|
+
`A package is outdated:`,
|
89
|
+
` ${arg.package}:`,
|
90
|
+
` installed: ${arg.installedVersion}`,
|
91
|
+
` latest: ${arg.latestVersion}`,
|
92
|
+
` to upgrade to the latest version run the command:`,
|
93
|
+
` npm install ${arg.package}@latest`
|
94
|
+
].join('\n');
|
95
|
+
}
|
96
|
+
exports.formatOutdatedMessage = formatOutdatedMessage;
|
97
|
+
//# sourceMappingURL=logging.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"logging.js","sourceRoot":"","sources":["../../src/utils/logging.ts"],"names":[],"mappings":";;;;;;AAAA,kDAAyB;AAEzB,+B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OAAO,GAAG,CAAA;AACZ,CAAC;AAzBD,gCAyBC;AAED,SAAgB,qBAAqB,CAAC,GAIrC;IACC,OAAO;QACL,wBAAwB;QACxB,KAAK,GAAG,CAAC,OAAO,GAAG;QACnB,kBAAkB,GAAG,CAAC,gBAAgB,EAAE;QACxC,eAAe,GAAG,CAAC,aAAa,EAAE;QAClC,uDAAuD;QACvD,qBAAqB,GAAG,CAAC,OAAO,SAAS;KAC1C,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;AACd,CAAC;AAbD,sDAaC"}
|
@@ -0,0 +1,22 @@
|
|
1
|
+
export declare const npm: string;
|
2
|
+
export declare function setVersion(v: string): void;
|
3
|
+
export declare function buildTypescript({ workingDir, watch, production, silence }: {
|
4
|
+
workingDir: string;
|
5
|
+
watch: boolean;
|
6
|
+
production: boolean;
|
7
|
+
silence?: boolean;
|
8
|
+
}): Promise<void>;
|
9
|
+
export declare function getLatestVersion(name: string): Promise<string>;
|
10
|
+
export declare function getInstalledVersion(workingDir: string, name: string): Promise<string>;
|
11
|
+
export declare function getOutdatedEcs(workingDir: string): Promise<{
|
12
|
+
package: string;
|
13
|
+
installedVersion: string;
|
14
|
+
latestVersion: string;
|
15
|
+
} | undefined>;
|
16
|
+
export declare function getCLIPackageJson<T = any>(): Promise<T>;
|
17
|
+
export declare function getInstalledCLIVersion(): string;
|
18
|
+
export declare function isStableVersion(): boolean;
|
19
|
+
export declare function isCLIOutdated(): Promise<boolean>;
|
20
|
+
export declare function isOnline(): Promise<boolean>;
|
21
|
+
export declare function isECSVersionLower(workingDir: string, version: string): Promise<boolean>;
|
22
|
+
//# sourceMappingURL=moduleHelpers.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"moduleHelpers.d.ts","sourceRoot":"","sources":["../../src/utils/moduleHelpers.ts"],"names":[],"mappings":"AAUA,eAAO,MAAM,GAAG,QAAoD,CAAA;AAGpE,wBAAgB,UAAU,CAAC,CAAC,EAAE,MAAM,QAEnC;AAED,wBAAgB,eAAe,CAAC,EAC9B,UAAU,EACV,KAAK,EACL,UAAU,EACV,OAAe,EAChB,EAAE;IACD,UAAU,EAAE,MAAM,CAAA;IAClB,KAAK,EAAE,OAAO,CAAA;IACd,UAAU,EAAE,OAAO,CAAA;IACnB,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB,GAAG,OAAO,CAAC,IAAI,CAAC,CAkChB;AAED,wBAAsB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAYpE;AAED,wBAAsB,mBAAmB,CAAC,UAAU,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAY3F;AAED,wBAAsB,cAAc,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAC7D;IACE,OAAO,EAAE,MAAM,CAAA;IACf,gBAAgB,EAAE,MAAM,CAAA;IACxB,aAAa,EAAE,MAAM,CAAA;CACtB,GACD,SAAS,CACZ,CAcA;AAED,wBAAsB,iBAAiB,CAAC,CAAC,GAAG,GAAG,KAAK,OAAO,CAAC,CAAC,CAAC,CAE7D;AAED,wBAAgB,sBAAsB,IAAI,MAAM,CAG/C;AAED,wBAAgB,eAAe,IAAI,OAAO,CAEzC;AAED,wBAAsB,aAAa,IAAI,OAAO,CAAC,OAAO,CAAC,CAStD;AAED,wBAAgB,QAAQ,IAAI,OAAO,CAAC,OAAO,CAAC,CAS3C;AAED,wBAAsB,iBAAiB,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAS7F"}
|
@@ -0,0 +1,163 @@
|
|
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.isECSVersionLower = exports.isOnline = exports.isCLIOutdated = exports.isStableVersion = exports.getInstalledCLIVersion = exports.getCLIPackageJson = exports.getOutdatedEcs = exports.getInstalledVersion = exports.getLatestVersion = exports.buildTypescript = exports.setVersion = exports.npm = void 0;
|
30
|
+
const path_1 = __importDefault(require("path"));
|
31
|
+
const child_process_1 = require("child_process");
|
32
|
+
const semver_1 = __importDefault(require("semver"));
|
33
|
+
const node_fetch_1 = __importDefault(require("node-fetch"));
|
34
|
+
const package_json_1 = __importDefault(require("package-json"));
|
35
|
+
const spinner = __importStar(require("../utils/spinner"));
|
36
|
+
const filesystem_1 = require("../utils/filesystem");
|
37
|
+
const project_1 = require("../utils/project");
|
38
|
+
exports.npm = /^win/.test(process.platform) ? 'npm.cmd' : 'npm';
|
39
|
+
let version = null;
|
40
|
+
function setVersion(v) {
|
41
|
+
version = v;
|
42
|
+
}
|
43
|
+
exports.setVersion = setVersion;
|
44
|
+
function buildTypescript({ workingDir, watch, production, silence = false }) {
|
45
|
+
const command = watch ? 'watch' : 'build';
|
46
|
+
const NODE_ENV = production ? 'production' : '';
|
47
|
+
return new Promise((resolve, reject) => {
|
48
|
+
const child = (0, child_process_1.spawn)(exports.npm, ['run', command], {
|
49
|
+
shell: true,
|
50
|
+
cwd: workingDir,
|
51
|
+
env: Object.assign(Object.assign({}, process.env), { NODE_ENV })
|
52
|
+
});
|
53
|
+
if (!silence) {
|
54
|
+
child.stdout.pipe(process.stdout);
|
55
|
+
child.stderr.pipe(process.stderr);
|
56
|
+
}
|
57
|
+
child.stdout.on('data', (data) => {
|
58
|
+
if (data.toString().indexOf('The compiler is watching file changes...') !== -1) {
|
59
|
+
if (!silence)
|
60
|
+
spinner.succeed('Project built.');
|
61
|
+
return resolve();
|
62
|
+
}
|
63
|
+
});
|
64
|
+
child.on('close', (code) => {
|
65
|
+
if (code !== 0) {
|
66
|
+
const msg = 'Error while building the project';
|
67
|
+
if (!silence)
|
68
|
+
spinner.fail(msg);
|
69
|
+
reject(new Error(msg));
|
70
|
+
}
|
71
|
+
else {
|
72
|
+
if (!silence)
|
73
|
+
spinner.succeed('Project built.');
|
74
|
+
return resolve();
|
75
|
+
}
|
76
|
+
});
|
77
|
+
});
|
78
|
+
}
|
79
|
+
exports.buildTypescript = buildTypescript;
|
80
|
+
async function getLatestVersion(name) {
|
81
|
+
if (!(await isOnline())) {
|
82
|
+
return '';
|
83
|
+
}
|
84
|
+
try {
|
85
|
+
// NOTE: this packageJson function should receive the workingDir
|
86
|
+
const pkg = await (0, package_json_1.default)(name.toLowerCase());
|
87
|
+
return pkg.version;
|
88
|
+
}
|
89
|
+
catch (e) {
|
90
|
+
return '';
|
91
|
+
}
|
92
|
+
}
|
93
|
+
exports.getLatestVersion = getLatestVersion;
|
94
|
+
async function getInstalledVersion(workingDir, name) {
|
95
|
+
let decentralandApiPkg;
|
96
|
+
try {
|
97
|
+
decentralandApiPkg = await (0, filesystem_1.readJSON)(path_1.default.resolve((0, project_1.getNodeModulesPath)(workingDir), name, 'package.json'));
|
98
|
+
}
|
99
|
+
catch (e) {
|
100
|
+
return '';
|
101
|
+
}
|
102
|
+
return decentralandApiPkg.version;
|
103
|
+
}
|
104
|
+
exports.getInstalledVersion = getInstalledVersion;
|
105
|
+
async function getOutdatedEcs(workingDir) {
|
106
|
+
const decentralandEcs6Version = await getInstalledVersion(workingDir, 'decentraland-ecs');
|
107
|
+
if (decentralandEcs6Version) {
|
108
|
+
const latestVersion = await getLatestVersion('decentraland-ecs');
|
109
|
+
if (latestVersion && semver_1.default.lt(decentralandEcs6Version, latestVersion)) {
|
110
|
+
return {
|
111
|
+
package: 'decentraland-ecs',
|
112
|
+
installedVersion: decentralandEcs6Version,
|
113
|
+
latestVersion
|
114
|
+
};
|
115
|
+
}
|
116
|
+
}
|
117
|
+
return undefined;
|
118
|
+
}
|
119
|
+
exports.getOutdatedEcs = getOutdatedEcs;
|
120
|
+
async function getCLIPackageJson() {
|
121
|
+
return (0, filesystem_1.readJSON)(path_1.default.resolve(__dirname, '..', '..', 'package.json'));
|
122
|
+
}
|
123
|
+
exports.getCLIPackageJson = getCLIPackageJson;
|
124
|
+
function getInstalledCLIVersion() {
|
125
|
+
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
126
|
+
return version || require('../../package.json').version;
|
127
|
+
}
|
128
|
+
exports.getInstalledCLIVersion = getInstalledCLIVersion;
|
129
|
+
function isStableVersion() {
|
130
|
+
return !getInstalledCLIVersion().includes('commit');
|
131
|
+
}
|
132
|
+
exports.isStableVersion = isStableVersion;
|
133
|
+
async function isCLIOutdated() {
|
134
|
+
const cliVersion = getInstalledCLIVersion();
|
135
|
+
const cliVersionLatest = await getLatestVersion('decentraland');
|
136
|
+
if (cliVersionLatest && cliVersion && semver_1.default.lt(cliVersion, cliVersionLatest)) {
|
137
|
+
return true;
|
138
|
+
}
|
139
|
+
else {
|
140
|
+
return false;
|
141
|
+
}
|
142
|
+
}
|
143
|
+
exports.isCLIOutdated = isCLIOutdated;
|
144
|
+
function isOnline() {
|
145
|
+
return new Promise((resolve) => {
|
146
|
+
(0, node_fetch_1.default)('https://decentraland.org/ping')
|
147
|
+
.then(() => resolve(true))
|
148
|
+
.catch(() => resolve(false));
|
149
|
+
setTimeout(() => {
|
150
|
+
resolve(false);
|
151
|
+
}, 4000);
|
152
|
+
});
|
153
|
+
}
|
154
|
+
exports.isOnline = isOnline;
|
155
|
+
async function isECSVersionLower(workingDir, version) {
|
156
|
+
const ecsPackageJson = await (0, filesystem_1.readJSON)(path_1.default.resolve((0, project_1.getNodeModulesPath)(workingDir), 'decentraland-ecs', 'package.json'));
|
157
|
+
if (semver_1.default.lt(ecsPackageJson.version, version)) {
|
158
|
+
return true;
|
159
|
+
}
|
160
|
+
return false;
|
161
|
+
}
|
162
|
+
exports.isECSVersionLower = isECSVersionLower;
|
163
|
+
//# sourceMappingURL=moduleHelpers.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"moduleHelpers.js","sourceRoot":"","sources":["../../src/utils/moduleHelpers.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,gDAAuB;AACvB,iDAAqC;AACrC,oDAA2B;AAC3B,4DAA8B;AAC9B,gEAAsC;AAEtC,0DAA2C;AAC3C,oDAA8C;AAC9C,8CAAqD;AAExC,QAAA,GAAG,GAAG,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,KAAK,CAAA;AACpE,IAAI,OAAO,GAAkB,IAAI,CAAA;AAEjC,SAAgB,UAAU,CAAC,CAAS;IAClC,OAAO,GAAG,CAAC,CAAA;AACb,CAAC;AAFD,gCAEC;AAED,SAAgB,eAAe,CAAC,EAC9B,UAAU,EACV,KAAK,EACL,UAAU,EACV,OAAO,GAAG,KAAK,EAMhB;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;AATD,4BASC;AAEM,KAAK,UAAU,iBAAiB,CAAC,UAAkB,EAAE,OAAe;IACzE,MAAM,cAAc,GAAG,MAAM,IAAA,qBAAQ,EAElC,cAAI,CAAC,OAAO,CAAC,IAAA,4BAAkB,EAAC,UAAU,CAAC,EAAE,kBAAkB,EAAE,cAAc,CAAC,CAAC,CAAA;IAEpF,IAAI,gBAAM,CAAC,EAAE,CAAC,cAAc,CAAC,OAAO,EAAE,OAAO,CAAC,EAAE;QAC9C,OAAO,IAAI,CAAA;KACZ;IACD,OAAO,KAAK,CAAA;AACd,CAAC;AATD,8CASC"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"nodeAndNpmVersion.d.ts","sourceRoot":"","sources":["../../src/utils/nodeAndNpmVersion.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,GAAG,QAAoD,CAAA;AAEpE,wBAAgB,cAAc,IAAI,MAAM,CAEvC;AAED,wBAAsB,aAAa,IAAI,OAAO,CAAC,MAAM,CAAC,CAmBrD;AAED,wBAAsB,sBAAsB,kBAwC3C"}
|
@@ -0,0 +1,64 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
|
+
};
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
+
exports.checkNodeAndNpmVersion = exports.getNpmVersion = exports.getNodeVersion = exports.npm = void 0;
|
7
|
+
const moduleHelpers_1 = require("./moduleHelpers");
|
8
|
+
const semver_1 = __importDefault(require("semver"));
|
9
|
+
const shellCommands_1 = require("./shellCommands");
|
10
|
+
exports.npm = /^win/.test(process.platform) ? 'npm.cmd' : 'npm';
|
11
|
+
function getNodeVersion() {
|
12
|
+
return process.versions.node;
|
13
|
+
}
|
14
|
+
exports.getNodeVersion = getNodeVersion;
|
15
|
+
async function getNpmVersion() {
|
16
|
+
let npmVersion = '';
|
17
|
+
function onOutData(data) {
|
18
|
+
const arrStr = data.toString().split('.');
|
19
|
+
if (arrStr.length === 3) {
|
20
|
+
npmVersion = data.toString().split('\n')[0];
|
21
|
+
}
|
22
|
+
}
|
23
|
+
await (0, shellCommands_1.runCommand)({
|
24
|
+
workingDir: process.cwd(),
|
25
|
+
command: exports.npm,
|
26
|
+
args: ['-v'],
|
27
|
+
fdStandards: shellCommands_1.FileDescriptorStandardOption.SEND_TO_CALLBACK,
|
28
|
+
cb: {
|
29
|
+
onOutData
|
30
|
+
}
|
31
|
+
});
|
32
|
+
return npmVersion;
|
33
|
+
}
|
34
|
+
exports.getNpmVersion = getNpmVersion;
|
35
|
+
async function checkNodeAndNpmVersion() {
|
36
|
+
const requiredVersion = await (0, moduleHelpers_1.getCLIPackageJson)();
|
37
|
+
try {
|
38
|
+
const nodeVersion = await getNodeVersion();
|
39
|
+
const npmVersion = await getNpmVersion();
|
40
|
+
if (nodeVersion) {
|
41
|
+
if (semver_1.default.lt(nodeVersion, requiredVersion.userEngines.minNodeVersion)) {
|
42
|
+
console.error(`Decentraland CLI runs over node version ${requiredVersion.userEngines.minNodeVersion} or greater, current is ${nodeVersion}.`);
|
43
|
+
process.exit(1);
|
44
|
+
}
|
45
|
+
}
|
46
|
+
else {
|
47
|
+
console.error(`It's not possible to check node version, version ${requiredVersion.userEngines.minNodeVersion} or greater is required to run Decentraland CLI.`);
|
48
|
+
process.exit(1);
|
49
|
+
}
|
50
|
+
if (npmVersion) {
|
51
|
+
if (semver_1.default.lt(npmVersion, requiredVersion.userEngines.minNpmVersion)) {
|
52
|
+
console.warn(`⚠ Decentraland CLI works correctly installing packages with npm version ${requiredVersion.userEngines.minNpmVersion} or greater, current is ${npmVersion}.`);
|
53
|
+
}
|
54
|
+
}
|
55
|
+
else {
|
56
|
+
console.warn(`⚠ It's not possible to check npm version, version ${requiredVersion.userEngines.minNpmVersion} or greater is required to Decentraland CLI works correctly.`);
|
57
|
+
}
|
58
|
+
}
|
59
|
+
catch (err) {
|
60
|
+
console.warn(`⚠ It was not possible to check npm version or node.`, err);
|
61
|
+
}
|
62
|
+
}
|
63
|
+
exports.checkNodeAndNpmVersion = checkNodeAndNpmVersion;
|
64
|
+
//# sourceMappingURL=nodeAndNpmVersion.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"nodeAndNpmVersion.js","sourceRoot":"","sources":["../../src/utils/nodeAndNpmVersion.ts"],"names":[],"mappings":";;;;;;AAAA,mDAAmD;AACnD,oDAA2B;AAC3B,mDAA0E;AAE7D,QAAA,GAAG,GAAG,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,KAAK,CAAA;AAEpE,SAAgB,cAAc;IAC5B,OAAO,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAA;AAC9B,CAAC;AAFD,wCAEC;AAEM,KAAK,UAAU,aAAa;IACjC,IAAI,UAAU,GAAW,EAAE,CAAA;IAC3B,SAAS,SAAS,CAAC,IAAS;QAC1B,MAAM,MAAM,GAAG,IAAI,CAAC,QAAQ,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;QACzC,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE;YACvB,UAAU,GAAG,IAAI,CAAC,QAAQ,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAA;SAC5C;IACH,CAAC;IACD,MAAM,IAAA,0BAAU,EAAC;QACf,UAAU,EAAE,OAAO,CAAC,GAAG,EAAE;QACzB,OAAO,EAAE,WAAG;QACZ,IAAI,EAAE,CAAC,IAAI,CAAC;QACZ,WAAW,EAAE,4CAA4B,CAAC,gBAAgB;QAC1D,EAAE,EAAE;YACF,SAAS;SACV;KACF,CAAC,CAAA;IAEF,OAAO,UAAU,CAAA;AACnB,CAAC;AAnBD,sCAmBC;AAEM,KAAK,UAAU,sBAAsB;IAC1C,MAAM,eAAe,GAAG,MAAM,IAAA,iCAAiB,GAK3C,CAAA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}
|
@@ -0,0 +1,12 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
|
+
};
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
+
const path_1 = __importDefault(require("path"));
|
7
|
+
const fs_extra_1 = __importDefault(require("fs-extra"));
|
8
|
+
function pathsExistOnDir(dir, filepaths) {
|
9
|
+
return Promise.all(filepaths.map((f) => fs_extra_1.default.pathExists(path_1.default.resolve(dir, f))));
|
10
|
+
}
|
11
|
+
exports.default = pathsExistOnDir;
|
12
|
+
//# sourceMappingURL=pathsExistOnDir.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"pathsExistOnDir.js","sourceRoot":"","sources":["../../src/utils/pathsExistOnDir.ts"],"names":[],"mappings":";;;;;AAAA,gDAAuB;AACvB,wDAAyB;AAEzB,SAAwB,eAAe,CAAC,GAAW,EAAE,SAAmB;IACtE,OAAO,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,kBAAE,CAAC,UAAU,CAAC,cAAI,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;AAC/E,CAAC;AAFD,kCAEC"}
|
@@ -0,0 +1,29 @@
|
|
1
|
+
export declare const SCENE_FILE = "scene.json";
|
2
|
+
export declare const PACKAGE_FILE = "package.json";
|
3
|
+
export declare const GITIGNORE_FILE = "gitignore";
|
4
|
+
export declare const NPMRC_FILE = "npmrc";
|
5
|
+
export declare const ESTLINTRC_FILE = "eslintrc.json";
|
6
|
+
export declare const ASSET_JSON_FILE = "asset.json";
|
7
|
+
export declare const WEARABLE_JSON_FILE = "wearable.json";
|
8
|
+
export declare const DCLIGNORE_FILE = ".dclignore";
|
9
|
+
/**
|
10
|
+
* Composes the path to the `scene.json` file based on the provided path.
|
11
|
+
* @param dir The path to the directory containing the scene file.
|
12
|
+
*/
|
13
|
+
export declare function getSceneFilePath(dir: string): string;
|
14
|
+
/**
|
15
|
+
* Composes the path to the `package.json` file based on the provided path.
|
16
|
+
* @param dir The path to the directory containing the package.json file.
|
17
|
+
*/
|
18
|
+
export declare function getPackageFilePath(dir: string): string;
|
19
|
+
/**
|
20
|
+
* Composes the path to the `.dclignore` file based on the provided path.
|
21
|
+
* @param dir The path to the directory containing the .dclignore file.
|
22
|
+
*/
|
23
|
+
export declare function getIgnoreFilePath(dir: string): string;
|
24
|
+
/**
|
25
|
+
* Returns the path to the node_modules directory.
|
26
|
+
* @param dir The path to the directory containing the node_modules directory.
|
27
|
+
*/
|
28
|
+
export declare function getNodeModulesPath(dir: string): string;
|
29
|
+
//# sourceMappingURL=project.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"project.d.ts","sourceRoot":"","sources":["../../src/utils/project.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,UAAU,eAAe,CAAA;AACtC,eAAO,MAAM,YAAY,iBAAiB,CAAA;AAC1C,eAAO,MAAM,cAAc,cAAc,CAAA;AACzC,eAAO,MAAM,UAAU,UAAU,CAAA;AACjC,eAAO,MAAM,cAAc,kBAAkB,CAAA;AAC7C,eAAO,MAAM,eAAe,eAAe,CAAA;AAC3C,eAAO,MAAM,kBAAkB,kBAAkB,CAAA;AACjD,eAAO,MAAM,cAAc,eAAe,CAAA;AAE1C;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAEpD;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAEtD;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAErD;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAEtD"}
|
@@ -0,0 +1,48 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
|
+
};
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
+
exports.getNodeModulesPath = exports.getIgnoreFilePath = exports.getPackageFilePath = exports.getSceneFilePath = exports.DCLIGNORE_FILE = exports.WEARABLE_JSON_FILE = exports.ASSET_JSON_FILE = exports.ESTLINTRC_FILE = exports.NPMRC_FILE = exports.GITIGNORE_FILE = exports.PACKAGE_FILE = exports.SCENE_FILE = void 0;
|
7
|
+
const path_1 = __importDefault(require("path"));
|
8
|
+
exports.SCENE_FILE = 'scene.json';
|
9
|
+
exports.PACKAGE_FILE = 'package.json';
|
10
|
+
exports.GITIGNORE_FILE = 'gitignore';
|
11
|
+
exports.NPMRC_FILE = 'npmrc';
|
12
|
+
exports.ESTLINTRC_FILE = 'eslintrc.json';
|
13
|
+
exports.ASSET_JSON_FILE = 'asset.json';
|
14
|
+
exports.WEARABLE_JSON_FILE = 'wearable.json';
|
15
|
+
exports.DCLIGNORE_FILE = '.dclignore';
|
16
|
+
/**
|
17
|
+
* Composes the path to the `scene.json` file based on the provided path.
|
18
|
+
* @param dir The path to the directory containing the scene file.
|
19
|
+
*/
|
20
|
+
function getSceneFilePath(dir) {
|
21
|
+
return path_1.default.resolve(dir, exports.SCENE_FILE);
|
22
|
+
}
|
23
|
+
exports.getSceneFilePath = getSceneFilePath;
|
24
|
+
/**
|
25
|
+
* Composes the path to the `package.json` file based on the provided path.
|
26
|
+
* @param dir The path to the directory containing the package.json file.
|
27
|
+
*/
|
28
|
+
function getPackageFilePath(dir) {
|
29
|
+
return path_1.default.resolve(dir, exports.PACKAGE_FILE);
|
30
|
+
}
|
31
|
+
exports.getPackageFilePath = getPackageFilePath;
|
32
|
+
/**
|
33
|
+
* Composes the path to the `.dclignore` file based on the provided path.
|
34
|
+
* @param dir The path to the directory containing the .dclignore file.
|
35
|
+
*/
|
36
|
+
function getIgnoreFilePath(dir) {
|
37
|
+
return path_1.default.resolve(dir, exports.DCLIGNORE_FILE);
|
38
|
+
}
|
39
|
+
exports.getIgnoreFilePath = getIgnoreFilePath;
|
40
|
+
/**
|
41
|
+
* Returns the path to the node_modules directory.
|
42
|
+
* @param dir The path to the directory containing the node_modules directory.
|
43
|
+
*/
|
44
|
+
function getNodeModulesPath(dir) {
|
45
|
+
return path_1.default.resolve(dir, 'node_modules');
|
46
|
+
}
|
47
|
+
exports.getNodeModulesPath = getNodeModulesPath;
|
48
|
+
//# sourceMappingURL=project.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"project.js","sourceRoot":"","sources":["../../src/utils/project.ts"],"names":[],"mappings":";;;;;;AAAA,gDAAuB;AAEV,QAAA,UAAU,GAAG,YAAY,CAAA;AACzB,QAAA,YAAY,GAAG,cAAc,CAAA;AAC7B,QAAA,cAAc,GAAG,WAAW,CAAA;AAC5B,QAAA,UAAU,GAAG,OAAO,CAAA;AACpB,QAAA,cAAc,GAAG,eAAe,CAAA;AAChC,QAAA,eAAe,GAAG,YAAY,CAAA;AAC9B,QAAA,kBAAkB,GAAG,eAAe,CAAA;AACpC,QAAA,cAAc,GAAG,YAAY,CAAA;AAE1C;;;GAGG;AACH,SAAgB,gBAAgB,CAAC,GAAW;IAC1C,OAAO,cAAI,CAAC,OAAO,CAAC,GAAG,EAAE,kBAAU,CAAC,CAAA;AACtC,CAAC;AAFD,4CAEC;AAED;;;GAGG;AACH,SAAgB,kBAAkB,CAAC,GAAW;IAC5C,OAAO,cAAI,CAAC,OAAO,CAAC,GAAG,EAAE,oBAAY,CAAC,CAAA;AACxC,CAAC;AAFD,gDAEC;AAED;;;GAGG;AACH,SAAgB,iBAAiB,CAAC,GAAW;IAC3C,OAAO,cAAI,CAAC,OAAO,CAAC,GAAG,EAAE,sBAAc,CAAC,CAAA;AAC1C,CAAC;AAFD,8CAEC;AAED;;;GAGG;AACH,SAAgB,kBAAkB,CAAC,GAAW;IAC5C,OAAO,cAAI,CAAC,OAAO,CAAC,GAAG,EAAE,cAAc,CAAC,CAAA;AAC1C,CAAC;AAFD,gDAEC"}
|
@@ -0,0 +1,19 @@
|
|
1
|
+
export declare enum FileDescriptorStandardOption {
|
2
|
+
SILENT = 1,
|
3
|
+
PIPE = 2,
|
4
|
+
ONLY_IF_THROW = 3,
|
5
|
+
SEND_TO_CALLBACK = 4
|
6
|
+
}
|
7
|
+
export declare type FDCallback = {
|
8
|
+
onErrorData?: (data: string) => void;
|
9
|
+
onOutData?: (data: string) => void;
|
10
|
+
};
|
11
|
+
export declare function runCommand({ workingDir, command, args, fdStandards, cb }: {
|
12
|
+
workingDir: string;
|
13
|
+
command: string;
|
14
|
+
args: string[];
|
15
|
+
fdStandards?: FileDescriptorStandardOption;
|
16
|
+
cb?: FDCallback;
|
17
|
+
}): Promise<void>;
|
18
|
+
export declare function downloadRepo(workingDir: string, url: string, destinationPath: string): Promise<void>;
|
19
|
+
//# sourceMappingURL=shellCommands.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"shellCommands.d.ts","sourceRoot":"","sources":["../../src/utils/shellCommands.ts"],"names":[],"mappings":"AAEA,oBAAY,4BAA4B;IACtC,MAAM,IAAI;IACV,IAAI,IAAI;IACR,aAAa,IAAI;IACjB,gBAAgB,IAAI;CACrB;AAED,oBAAY,UAAU,GAAG;IACvB,WAAW,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAA;IACpC,SAAS,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAA;CACnC,CAAA;AAED,wBAAgB,UAAU,CAAC,EACzB,UAAU,EACV,OAAO,EACP,IAAI,EACJ,WAAW,EACX,EAAE,EACH,EAAE;IACD,UAAU,EAAE,MAAM,CAAA;IAClB,OAAO,EAAE,MAAM,CAAA;IACf,IAAI,EAAE,MAAM,EAAE,CAAA;IACd,WAAW,CAAC,EAAE,4BAA4B,CAAA;IAC1C,EAAE,CAAC,EAAE,UAAU,CAAA;CAChB,GAAG,OAAO,CAAC,IAAI,CAAC,CAuDhB;AAED,wBAAgB,YAAY,CAAC,UAAU,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAOpG"}
|
@@ -0,0 +1,73 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.downloadRepo = exports.runCommand = exports.FileDescriptorStandardOption = void 0;
|
4
|
+
const child_process_1 = require("child_process");
|
5
|
+
var FileDescriptorStandardOption;
|
6
|
+
(function (FileDescriptorStandardOption) {
|
7
|
+
FileDescriptorStandardOption[FileDescriptorStandardOption["SILENT"] = 1] = "SILENT";
|
8
|
+
FileDescriptorStandardOption[FileDescriptorStandardOption["PIPE"] = 2] = "PIPE";
|
9
|
+
FileDescriptorStandardOption[FileDescriptorStandardOption["ONLY_IF_THROW"] = 3] = "ONLY_IF_THROW";
|
10
|
+
FileDescriptorStandardOption[FileDescriptorStandardOption["SEND_TO_CALLBACK"] = 4] = "SEND_TO_CALLBACK";
|
11
|
+
})(FileDescriptorStandardOption = exports.FileDescriptorStandardOption || (exports.FileDescriptorStandardOption = {}));
|
12
|
+
function runCommand({ workingDir, command, args, fdStandards, cb }) {
|
13
|
+
const standardOption = fdStandards || FileDescriptorStandardOption.SILENT;
|
14
|
+
return new Promise((resolve, reject) => {
|
15
|
+
const child = (0, child_process_1.spawn)(command, args, {
|
16
|
+
shell: true,
|
17
|
+
cwd: workingDir,
|
18
|
+
env: Object.assign(Object.assign({}, process.env), { NODE_ENV: '' })
|
19
|
+
});
|
20
|
+
let stdOut = '';
|
21
|
+
let stdErr = '';
|
22
|
+
if (standardOption === FileDescriptorStandardOption.PIPE) {
|
23
|
+
child.stdout.pipe(process.stdout);
|
24
|
+
child.stderr.pipe(process.stderr);
|
25
|
+
}
|
26
|
+
else if (standardOption === FileDescriptorStandardOption.ONLY_IF_THROW) {
|
27
|
+
child.stdout.on('data', (data) => {
|
28
|
+
stdOut += data.toString();
|
29
|
+
});
|
30
|
+
child.stderr.on('data', (data) => {
|
31
|
+
stdErr += data.toString();
|
32
|
+
});
|
33
|
+
}
|
34
|
+
else if (standardOption === FileDescriptorStandardOption.SEND_TO_CALLBACK) {
|
35
|
+
child.stdout.on('data', (data) => {
|
36
|
+
if (cb === null || cb === void 0 ? void 0 : cb.onOutData) {
|
37
|
+
cb.onOutData(data.toString());
|
38
|
+
}
|
39
|
+
});
|
40
|
+
child.stderr.on('data', (data) => {
|
41
|
+
if (cb === null || cb === void 0 ? void 0 : cb.onErrorData) {
|
42
|
+
cb.onErrorData(data.toString());
|
43
|
+
}
|
44
|
+
});
|
45
|
+
}
|
46
|
+
child.on('close', (code) => {
|
47
|
+
const errorMessage = `Command '${command}' with args '${args.join(' ')}' exited with code ${code}. \n
|
48
|
+
> Working directory: ${workingDir} `;
|
49
|
+
if (code !== 0) {
|
50
|
+
if (standardOption === FileDescriptorStandardOption.ONLY_IF_THROW) {
|
51
|
+
reject(new Error(`${errorMessage} \n
|
52
|
+
> Standard output: \n ${stdOut} \n
|
53
|
+
> Error output: \n ${stdErr} \n`));
|
54
|
+
}
|
55
|
+
else {
|
56
|
+
reject(new Error(errorMessage));
|
57
|
+
}
|
58
|
+
}
|
59
|
+
resolve();
|
60
|
+
});
|
61
|
+
});
|
62
|
+
}
|
63
|
+
exports.runCommand = runCommand;
|
64
|
+
function downloadRepo(workingDir, url, destinationPath) {
|
65
|
+
return runCommand({
|
66
|
+
workingDir,
|
67
|
+
command: 'git',
|
68
|
+
args: ['clone', '--depth', '1', url, destinationPath],
|
69
|
+
fdStandards: FileDescriptorStandardOption.ONLY_IF_THROW
|
70
|
+
});
|
71
|
+
}
|
72
|
+
exports.downloadRepo = downloadRepo;
|
73
|
+
//# sourceMappingURL=shellCommands.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{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AuB;IACnF,OAAO,UAAU,CAAC;QAChB,UAAU;QACV,OAAO,EAAE,KAAK;QACd,IAAI,EAAE,CAAC,OAAO,EAAE,SAAS,EAAE,GAAG,EAAE,GAAG,EAAE,eAAe,CAAC;QACrD,WAAW,EAAE,4BAA4B,CAAC,aAAa;KACxD,CAAC,CAAA;AACJ,CAAC;AAPD,oCAOC"}
|
@@ -0,0 +1,6 @@
|
|
1
|
+
export declare function create(message: string): void;
|
2
|
+
export declare function fail(message?: string): void;
|
3
|
+
export declare function warn(message?: string): void;
|
4
|
+
export declare function info(message?: string): void;
|
5
|
+
export declare function succeed(message?: string): void;
|
6
|
+
//# sourceMappingURL=spinner.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"spinner.d.ts","sourceRoot":"","sources":["../../src/utils/spinner.ts"],"names":[],"mappings":"AAIA,wBAAgB,MAAM,CAAC,OAAO,EAAE,MAAM,QAUrC;AAED,wBAAgB,IAAI,CAAC,OAAO,CAAC,EAAE,MAAM,QAQpC;AAED,wBAAgB,IAAI,CAAC,OAAO,CAAC,EAAE,MAAM,QASpC;AAED,wBAAgB,IAAI,CAAC,OAAO,CAAC,EAAE,MAAM,QASpC;AAED,wBAAgB,OAAO,CAAC,OAAO,CAAC,EAAE,MAAM,QASvC"}
|