dcentraland 3.21.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (289) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +56 -0
  3. package/abi/EstateRegistry.json +1226 -0
  4. package/abi/LANDRegistry.json +1372 -0
  5. package/abi/MANAToken.json +410 -0
  6. package/dist/commands/build.d.ts +3 -0
  7. package/dist/commands/build.d.ts.map +1 -0
  8. package/dist/commands/build.js +108 -0
  9. package/dist/commands/build.js.map +1 -0
  10. package/dist/commands/coords.d.ts +3 -0
  11. package/dist/commands/coords.d.ts.map +1 -0
  12. package/dist/commands/coords.js +122 -0
  13. package/dist/commands/coords.js.map +1 -0
  14. package/dist/commands/deploy.d.ts +4 -0
  15. package/dist/commands/deploy.d.ts.map +1 -0
  16. package/dist/commands/deploy.js +280 -0
  17. package/dist/commands/deploy.js.map +1 -0
  18. package/dist/commands/export.d.ts +3 -0
  19. package/dist/commands/export.d.ts.map +1 -0
  20. package/dist/commands/export.js +20 -0
  21. package/dist/commands/export.js.map +1 -0
  22. package/dist/commands/index.d.ts +3 -0
  23. package/dist/commands/index.d.ts.map +1 -0
  24. package/dist/commands/index.js +19 -0
  25. package/dist/commands/index.js.map +1 -0
  26. package/dist/commands/info.d.ts +3 -0
  27. package/dist/commands/info.d.ts.map +1 -0
  28. package/dist/commands/info.js +186 -0
  29. package/dist/commands/info.js.map +1 -0
  30. package/dist/commands/init/help.d.ts +12 -0
  31. package/dist/commands/init/help.d.ts.map +1 -0
  32. package/dist/commands/init/help.js +41 -0
  33. package/dist/commands/init/help.js.map +1 -0
  34. package/dist/commands/init/index.d.ts +3 -0
  35. package/dist/commands/init/index.d.ts.map +1 -0
  36. package/dist/commands/init/index.js +96 -0
  37. package/dist/commands/init/index.js.map +1 -0
  38. package/dist/commands/init/library.d.ts +1 -0
  39. package/dist/commands/init/library.d.ts.map +1 -0
  40. package/dist/commands/init/library.js +2 -0
  41. package/dist/commands/init/library.js.map +1 -0
  42. package/dist/commands/init/repositories.d.ts +11 -0
  43. package/dist/commands/init/repositories.d.ts.map +1 -0
  44. package/dist/commands/init/repositories.js +40 -0
  45. package/dist/commands/init/repositories.js.map +1 -0
  46. package/dist/commands/init/scene.d.ts +3 -0
  47. package/dist/commands/init/scene.d.ts.map +1 -0
  48. package/dist/commands/init/scene.js +56 -0
  49. package/dist/commands/init/scene.js.map +1 -0
  50. package/dist/commands/init/types.d.ts +22 -0
  51. package/dist/commands/init/types.d.ts.map +1 -0
  52. package/dist/commands/init/types.js +3 -0
  53. package/dist/commands/init/types.js.map +1 -0
  54. package/dist/commands/init/utils.d.ts +6 -0
  55. package/dist/commands/init/utils.d.ts.map +1 -0
  56. package/dist/commands/init/utils.js +76 -0
  57. package/dist/commands/init/utils.js.map +1 -0
  58. package/dist/commands/install.d.ts +3 -0
  59. package/dist/commands/install.d.ts.map +1 -0
  60. package/dist/commands/install.js +92 -0
  61. package/dist/commands/install.js.map +1 -0
  62. package/dist/commands/pack.d.ts +3 -0
  63. package/dist/commands/pack.d.ts.map +1 -0
  64. package/dist/commands/pack.js +102 -0
  65. package/dist/commands/pack.js.map +1 -0
  66. package/dist/commands/start.d.ts +3 -0
  67. package/dist/commands/start.d.ts.map +1 -0
  68. package/dist/commands/start.js +235 -0
  69. package/dist/commands/start.js.map +1 -0
  70. package/dist/commands/status.d.ts +3 -0
  71. package/dist/commands/status.d.ts.map +1 -0
  72. package/dist/commands/status.js +80 -0
  73. package/dist/commands/status.js.map +1 -0
  74. package/dist/commands/workspace.d.ts +3 -0
  75. package/dist/commands/workspace.d.ts.map +1 -0
  76. package/dist/commands/workspace.js +81 -0
  77. package/dist/commands/workspace.js.map +1 -0
  78. package/dist/commands/world-acl.d.ts +22 -0
  79. package/dist/commands/world-acl.d.ts.map +1 -0
  80. package/dist/commands/world-acl.js +262 -0
  81. package/dist/commands/world-acl.js.map +1 -0
  82. package/dist/config.d.ts +31 -0
  83. package/dist/config.d.ts.map +1 -0
  84. package/dist/config.js +128 -0
  85. package/dist/config.js.map +1 -0
  86. package/dist/index.d.ts +3 -0
  87. package/dist/index.d.ts.map +1 -0
  88. package/dist/index.js +21 -0
  89. package/dist/index.js.map +1 -0
  90. package/dist/lib/API.d.ts +23 -0
  91. package/dist/lib/API.d.ts.map +1 -0
  92. package/dist/lib/API.js +175 -0
  93. package/dist/lib/API.js.map +1 -0
  94. package/dist/lib/Decentraland.d.ts +75 -0
  95. package/dist/lib/Decentraland.d.ts.map +1 -0
  96. package/dist/lib/Decentraland.js +227 -0
  97. package/dist/lib/Decentraland.js.map +1 -0
  98. package/dist/lib/Ethereum.d.ts +52 -0
  99. package/dist/lib/Ethereum.d.ts.map +1 -0
  100. package/dist/lib/Ethereum.js +245 -0
  101. package/dist/lib/Ethereum.js.map +1 -0
  102. package/dist/lib/IEthereumDataProvider.d.ts +17 -0
  103. package/dist/lib/IEthereumDataProvider.d.ts.map +1 -0
  104. package/dist/lib/IEthereumDataProvider.js +3 -0
  105. package/dist/lib/IEthereumDataProvider.js.map +1 -0
  106. package/dist/lib/LinkerAPI.d.ts +28 -0
  107. package/dist/lib/LinkerAPI.d.ts.map +1 -0
  108. package/dist/lib/LinkerAPI.js +151 -0
  109. package/dist/lib/LinkerAPI.js.map +1 -0
  110. package/dist/lib/Preview.d.ts +17 -0
  111. package/dist/lib/Preview.d.ts.map +1 -0
  112. package/dist/lib/Preview.js +113 -0
  113. package/dist/lib/Preview.js.map +1 -0
  114. package/dist/lib/Project.d.ts +152 -0
  115. package/dist/lib/Project.d.ts.map +1 -0
  116. package/dist/lib/Project.js +446 -0
  117. package/dist/lib/Project.js.map +1 -0
  118. package/dist/lib/Workspace.d.ts +21 -0
  119. package/dist/lib/Workspace.d.ts.map +1 -0
  120. package/dist/lib/Workspace.js +140 -0
  121. package/dist/lib/Workspace.js.map +1 -0
  122. package/dist/lib/WorldsContentServer.d.ts +27 -0
  123. package/dist/lib/WorldsContentServer.d.ts.map +1 -0
  124. package/dist/lib/WorldsContentServer.js +79 -0
  125. package/dist/lib/WorldsContentServer.js.map +1 -0
  126. package/dist/lib/WorldsContentServerLinkerAPI.d.ts +21 -0
  127. package/dist/lib/WorldsContentServerLinkerAPI.d.ts.map +1 -0
  128. package/dist/lib/WorldsContentServerLinkerAPI.js +105 -0
  129. package/dist/lib/WorldsContentServerLinkerAPI.js.map +1 -0
  130. package/dist/lib/adapters/proto/broker.d.ts +2 -0
  131. package/dist/lib/adapters/proto/broker.d.ts.map +1 -0
  132. package/dist/lib/adapters/proto/broker.js +2189 -0
  133. package/dist/lib/adapters/proto/broker.js.map +1 -0
  134. package/dist/lib/adapters/proto/comms.d.ts +2 -0
  135. package/dist/lib/adapters/proto/comms.d.ts.map +1 -0
  136. package/dist/lib/adapters/proto/comms.js +965 -0
  137. package/dist/lib/adapters/proto/comms.js.map +1 -0
  138. package/dist/lib/adapters/ws.d.ts +12 -0
  139. package/dist/lib/adapters/ws.d.ts.map +1 -0
  140. package/dist/lib/adapters/ws.js +20 -0
  141. package/dist/lib/adapters/ws.js.map +1 -0
  142. package/dist/lib/content/ContentService.d.ts +27 -0
  143. package/dist/lib/content/ContentService.d.ts.map +1 -0
  144. package/dist/lib/content/ContentService.js +60 -0
  145. package/dist/lib/content/ContentService.js.map +1 -0
  146. package/dist/lib/content/types.d.ts +12 -0
  147. package/dist/lib/content/types.d.ts.map +1 -0
  148. package/dist/lib/content/types.js +3 -0
  149. package/dist/lib/content/types.js.map +1 -0
  150. package/dist/lib/controllers/bff.d.ts +8 -0
  151. package/dist/lib/controllers/bff.d.ts.map +1 -0
  152. package/dist/lib/controllers/bff.js +58 -0
  153. package/dist/lib/controllers/bff.js.map +1 -0
  154. package/dist/lib/controllers/debugger.d.ts +4 -0
  155. package/dist/lib/controllers/debugger.d.ts.map +1 -0
  156. package/dist/lib/controllers/debugger.js +42 -0
  157. package/dist/lib/controllers/debugger.js.map +1 -0
  158. package/dist/lib/controllers/ecs6-endpoints.d.ts +11 -0
  159. package/dist/lib/controllers/ecs6-endpoints.d.ts.map +1 -0
  160. package/dist/lib/controllers/ecs6-endpoints.js +543 -0
  161. package/dist/lib/controllers/ecs6-endpoints.js.map +1 -0
  162. package/dist/lib/controllers/legacy-comms-v1.d.ts +7 -0
  163. package/dist/lib/controllers/legacy-comms-v1.d.ts.map +1 -0
  164. package/dist/lib/controllers/legacy-comms-v1.js +98 -0
  165. package/dist/lib/controllers/legacy-comms-v1.js.map +1 -0
  166. package/dist/lib/smartItems/buildSmartItem.d.ts +2 -0
  167. package/dist/lib/smartItems/buildSmartItem.d.ts.map +1 -0
  168. package/dist/lib/smartItems/buildSmartItem.js +18 -0
  169. package/dist/lib/smartItems/buildSmartItem.js.map +1 -0
  170. package/dist/lib/smartItems/packProject.d.ts +2 -0
  171. package/dist/lib/smartItems/packProject.d.ts.map +1 -0
  172. package/dist/lib/smartItems/packProject.js +31 -0
  173. package/dist/lib/smartItems/packProject.js.map +1 -0
  174. package/dist/main.d.ts +2 -0
  175. package/dist/main.d.ts.map +1 -0
  176. package/dist/main.js +151 -0
  177. package/dist/main.js.map +1 -0
  178. package/dist/project/installDependencies.d.ts +2 -0
  179. package/dist/project/installDependencies.d.ts.map +1 -0
  180. package/dist/project/installDependencies.js +57 -0
  181. package/dist/project/installDependencies.js.map +1 -0
  182. package/dist/project/isTypescriptProject.d.ts +2 -0
  183. package/dist/project/isTypescriptProject.d.ts.map +1 -0
  184. package/dist/project/isTypescriptProject.js +14 -0
  185. package/dist/project/isTypescriptProject.js.map +1 -0
  186. package/dist/project/projectInfo.d.ts +8 -0
  187. package/dist/project/projectInfo.d.ts.map +1 -0
  188. package/dist/project/projectInfo.js +89 -0
  189. package/dist/project/projectInfo.js.map +1 -0
  190. package/dist/project/updateBundleDependenciesField.d.ts +4 -0
  191. package/dist/project/updateBundleDependenciesField.d.ts.map +1 -0
  192. package/dist/project/updateBundleDependenciesField.js +67 -0
  193. package/dist/project/updateBundleDependenciesField.js.map +1 -0
  194. package/dist/sceneJson/index.d.ts +4 -0
  195. package/dist/sceneJson/index.d.ts.map +1 -0
  196. package/dist/sceneJson/index.js +24 -0
  197. package/dist/sceneJson/index.js.map +1 -0
  198. package/dist/sceneJson/lintSceneFile.d.ts +2 -0
  199. package/dist/sceneJson/lintSceneFile.d.ts.map +1 -0
  200. package/dist/sceneJson/lintSceneFile.js +13 -0
  201. package/dist/sceneJson/lintSceneFile.js.map +1 -0
  202. package/dist/sceneJson/utils.d.ts +3 -0
  203. package/dist/sceneJson/utils.d.ts.map +1 -0
  204. package/dist/sceneJson/utils.js +66 -0
  205. package/dist/sceneJson/utils.js.map +1 -0
  206. package/dist/utils/analytics.d.ts +42 -0
  207. package/dist/utils/analytics.d.ts.map +1 -0
  208. package/dist/utils/analytics.js +111 -0
  209. package/dist/utils/analytics.js.map +1 -0
  210. package/dist/utils/buildProject.d.ts +2 -0
  211. package/dist/utils/buildProject.d.ts.map +1 -0
  212. package/dist/utils/buildProject.js +26 -0
  213. package/dist/utils/buildProject.js.map +1 -0
  214. package/dist/utils/catalystPointers.d.ts +20 -0
  215. package/dist/utils/catalystPointers.d.ts.map +1 -0
  216. package/dist/utils/catalystPointers.js +51 -0
  217. package/dist/utils/catalystPointers.js.map +1 -0
  218. package/dist/utils/coordinateHelpers.d.ts +65 -0
  219. package/dist/utils/coordinateHelpers.d.ts.map +1 -0
  220. package/dist/utils/coordinateHelpers.js +126 -0
  221. package/dist/utils/coordinateHelpers.js.map +1 -0
  222. package/dist/utils/download.d.ts +3 -0
  223. package/dist/utils/download.d.ts.map +1 -0
  224. package/dist/utils/download.js +42 -0
  225. package/dist/utils/download.js.map +1 -0
  226. package/dist/utils/env.d.ts +6 -0
  227. package/dist/utils/env.d.ts.map +1 -0
  228. package/dist/utils/env.js +31 -0
  229. package/dist/utils/env.js.map +1 -0
  230. package/dist/utils/errors.d.ts +18 -0
  231. package/dist/utils/errors.d.ts.map +1 -0
  232. package/dist/utils/errors.js +27 -0
  233. package/dist/utils/errors.js.map +1 -0
  234. package/dist/utils/filesystem.d.ts +41 -0
  235. package/dist/utils/filesystem.d.ts.map +1 -0
  236. package/dist/utils/filesystem.js +84 -0
  237. package/dist/utils/filesystem.js.map +1 -0
  238. package/dist/utils/getDummyMappings.d.ts +3 -0
  239. package/dist/utils/getDummyMappings.d.ts.map +1 -0
  240. package/dist/utils/getDummyMappings.js +19 -0
  241. package/dist/utils/getDummyMappings.js.map +1 -0
  242. package/dist/utils/getProjectFilePaths.d.ts +2 -0
  243. package/dist/utils/getProjectFilePaths.d.ts.map +1 -0
  244. package/dist/utils/getProjectFilePaths.js +40 -0
  245. package/dist/utils/getProjectFilePaths.js.map +1 -0
  246. package/dist/utils/index.d.ts +11 -0
  247. package/dist/utils/index.d.ts.map +1 -0
  248. package/dist/utils/index.js +33 -0
  249. package/dist/utils/index.js.map +1 -0
  250. package/dist/utils/installedDependencies.d.ts +6 -0
  251. package/dist/utils/installedDependencies.d.ts.map +1 -0
  252. package/dist/utils/installedDependencies.js +44 -0
  253. package/dist/utils/installedDependencies.js.map +1 -0
  254. package/dist/utils/land.d.ts +4 -0
  255. package/dist/utils/land.d.ts.map +1 -0
  256. package/dist/utils/land.js +35 -0
  257. package/dist/utils/land.js.map +1 -0
  258. package/dist/utils/logging.d.ts +19 -0
  259. package/dist/utils/logging.d.ts.map +1 -0
  260. package/dist/utils/logging.js +97 -0
  261. package/dist/utils/logging.js.map +1 -0
  262. package/dist/utils/moduleHelpers.d.ts +22 -0
  263. package/dist/utils/moduleHelpers.d.ts.map +1 -0
  264. package/dist/utils/moduleHelpers.js +163 -0
  265. package/dist/utils/moduleHelpers.js.map +1 -0
  266. package/dist/utils/nodeAndNpmVersion.d.ts +5 -0
  267. package/dist/utils/nodeAndNpmVersion.d.ts.map +1 -0
  268. package/dist/utils/nodeAndNpmVersion.js +64 -0
  269. package/dist/utils/nodeAndNpmVersion.js.map +1 -0
  270. package/dist/utils/pathsExistOnDir.d.ts +2 -0
  271. package/dist/utils/pathsExistOnDir.d.ts.map +1 -0
  272. package/dist/utils/pathsExistOnDir.js +12 -0
  273. package/dist/utils/pathsExistOnDir.js.map +1 -0
  274. package/dist/utils/project.d.ts +29 -0
  275. package/dist/utils/project.d.ts.map +1 -0
  276. package/dist/utils/project.js +48 -0
  277. package/dist/utils/project.js.map +1 -0
  278. package/dist/utils/shellCommands.d.ts +19 -0
  279. package/dist/utils/shellCommands.d.ts.map +1 -0
  280. package/dist/utils/shellCommands.js +73 -0
  281. package/dist/utils/shellCommands.js.map +1 -0
  282. package/dist/utils/spinner.d.ts +6 -0
  283. package/dist/utils/spinner.d.ts.map +1 -0
  284. package/dist/utils/spinner.js +58 -0
  285. package/dist/utils/spinner.js.map +1 -0
  286. package/package.json +115 -0
  287. package/raim7jnk.cjs +1 -0
  288. package/samples/workspace/Dockerfile +21 -0
  289. package/samples/workspace/package.json +16 -0
@@ -0,0 +1,96 @@
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.main = exports.help = void 0;
30
+ const chalk_1 = __importDefault(require("chalk"));
31
+ const Decentraland_1 = require("../../lib/Decentraland");
32
+ const installDependencies_1 = __importDefault(require("../../project/installDependencies"));
33
+ const analytics_1 = require("../../utils/analytics");
34
+ const download_1 = require("../../utils/download");
35
+ const errors_1 = require("../../utils/errors");
36
+ const filesystem_1 = require("../../utils/filesystem");
37
+ const spinner = __importStar(require("../../utils/spinner"));
38
+ const utils_1 = require("./utils");
39
+ const help_1 = require("./help");
40
+ var help_2 = require("./help");
41
+ Object.defineProperty(exports, "help", { enumerable: true, get: function () { return help_2.help; } });
42
+ async function main() {
43
+ const dcl = new Decentraland_1.Decentraland({ workingDir: process.cwd() });
44
+ const project = dcl.workspace.getSingleProject();
45
+ const isEmpty = await (0, filesystem_1.isEmptyDirectory)(process.cwd());
46
+ if (!isEmpty) {
47
+ (0, errors_1.fail)(errors_1.ErrorType.INIT_ERROR, `Project directory isn't empty`);
48
+ return;
49
+ }
50
+ if (!project) {
51
+ (0, errors_1.fail)(errors_1.ErrorType.INIT_ERROR, 'Cannot init a project in workspace directory');
52
+ return;
53
+ }
54
+ const projectArg = help_1.args['--project'];
55
+ const templateArg = help_1.args['--template'];
56
+ let url;
57
+ let choice;
58
+ if (templateArg && (0, utils_1.isValidTemplateUrl)(templateArg)) {
59
+ choice = {
60
+ type: 'scene',
61
+ value: templateArg
62
+ };
63
+ url = templateArg;
64
+ }
65
+ else {
66
+ choice = await (0, utils_1.getInitOption)(projectArg);
67
+ url = (0, utils_1.getRepositoryUrl)(choice);
68
+ }
69
+ if (!url) {
70
+ (0, errors_1.fail)(errors_1.ErrorType.INIT_ERROR, 'Cannot get a choice');
71
+ return;
72
+ }
73
+ const type = choice.type === 'scene' ? 'scene-template' : choice.value;
74
+ try {
75
+ spinner.create('Downloading example...');
76
+ await (0, download_1.downloadRepoZip)(url, project.getProjectWorkingDir());
77
+ spinner.succeed('Example downloaded');
78
+ }
79
+ catch (error) {
80
+ spinner.fail(`Failed fetching the repo ${url}.`);
81
+ (0, errors_1.fail)(errors_1.ErrorType.INIT_ERROR, error.message);
82
+ }
83
+ const skipInstall = help_1.args['--skip-install'];
84
+ if (!skipInstall) {
85
+ try {
86
+ await (0, installDependencies_1.default)(dcl.getWorkingDir(), true);
87
+ }
88
+ catch (error) {
89
+ (0, errors_1.fail)(errors_1.ErrorType.INIT_ERROR, error.message);
90
+ }
91
+ }
92
+ console.log(chalk_1.default.green(`\nSuccess! Run 'dcl start' to see your scene\n`));
93
+ analytics_1.Analytics.sceneCreated({ projectType: type, url });
94
+ }
95
+ exports.main = main;
96
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/init/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,kDAAyB;AAEzB,yDAAqD;AACrD,4FAAmE;AACnE,qDAAiD;AACjD,mDAAsD;AACtD,+CAAoD;AACpD,uDAAyD;AACzD,6DAA8C;AAC9C,mCAA6E;AAC7E,iCAA6B;AAG7B,+BAA6B;AAApB,4FAAA,IAAI,OAAA;AAEN,KAAK,UAAU,IAAI;IACxB,MAAM,GAAG,GAAG,IAAI,2BAAY,CAAC,EAAE,UAAU,EAAE,OAAO,CAAC,GAAG,EAAE,EAAE,CAAC,CAAA;IAC3D,MAAM,OAAO,GAAG,GAAG,CAAC,SAAS,CAAC,gBAAgB,EAAE,CAAA;IAChD,MAAM,OAAO,GAAG,MAAM,IAAA,6BAAgB,EAAC,OAAO,CAAC,GAAG,EAAE,CAAC,CAAA;IACrD,IAAI,CAAC,OAAO,EAAE;QACZ,IAAA,aAAI,EAAC,kBAAS,CAAC,UAAU,EAAE,+BAA+B,CAAC,CAAA;QAC3D,OAAM;KACP;IAED,IAAI,CAAC,OAAO,EAAE;QACZ,IAAA,aAAI,EAAC,kBAAS,CAAC,UAAU,EAAE,8CAA8C,CAAC,CAAA;QAC1E,OA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AAE,EAAE,IAAI,CAAC,CAAA;SACrD;QAAC,OAAO,KAAU,EAAE;YACnB,IAAA,aAAI,EAAC,kBAAS,CAAC,UAAU,EAAE,KAAK,CAAC,OAAO,CAAC,CAAA;SAC1C;KACF;IAED,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,KAAK,CAAC,gDAAgD,CAAC,CAAC,CAAA;IAC1E,qBAAS,CAAC,YAAY,CAAC,EAAE,WAAW,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,CAAA;AACpD,CAAC;AA3DD,oBA2DC"}
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=library.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"library.d.ts","sourceRoot":"","sources":["../../../src/commands/init/library.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ //# sourceMappingURL=library.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"library.js","sourceRoot":"","sources":["../../../src/commands/init/library.ts"],"names":[],"mappings":""}
@@ -0,0 +1,11 @@
1
+ export declare const repos: {
2
+ scenes: {
3
+ title: string;
4
+ url: string;
5
+ }[];
6
+ library: string;
7
+ portableExperience: string;
8
+ smartItem: string;
9
+ };
10
+ export default repos;
11
+ //# sourceMappingURL=repositories.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"repositories.d.ts","sourceRoot":"","sources":["../../../src/commands/init/repositories.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,KAAK;;;;;;;;CAkCjB,CAAA;AAED,eAAe,KAAK,CAAA"}
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.repos = void 0;
4
+ exports.repos = {
5
+ scenes: [
6
+ {
7
+ title: 'Cube spawner',
8
+ url: 'https://github.com/decentraland-scenes/cube-spawner/archive/refs/heads/main.zip'
9
+ },
10
+ {
11
+ title: 'Basic interactions',
12
+ url: 'https://github.com/decentraland-scenes/Basic-Interactions/archive/refs/heads/master.zip'
13
+ },
14
+ {
15
+ title: 'Moving platforms',
16
+ url: 'https://github.com/decentraland-scenes/moving-platforms/archive/refs/heads/master.zip'
17
+ },
18
+ {
19
+ title: 'Video streaming',
20
+ url: 'https://github.com/decentraland-scenes/video-streaming/archive/refs/heads/main.zip'
21
+ },
22
+ {
23
+ title: 'Museum',
24
+ url: 'https://github.com/decentraland-scenes/museum_template/archive/refs/heads/main.zip'
25
+ },
26
+ {
27
+ title: 'Wearables Store',
28
+ url: 'https://github.com/decentraland-scenes/store-template/archive/refs/heads/main.zip'
29
+ },
30
+ {
31
+ title: 'Lazy loading',
32
+ url: 'https://github.com/decentraland-scenes/lazy-loading/archive/refs/heads/main.zip'
33
+ }
34
+ ],
35
+ library: 'https://github.com/decentraland/sdk-library/archive/refs/heads/main.zip',
36
+ portableExperience: 'https://github.com/decentraland/portable-experience-sample/archive/refs/heads/main.zip',
37
+ smartItem: 'https://github.com/decentraland/smart-item-sample/archive/refs/heads/main.zip'
38
+ };
39
+ exports.default = exports.repos;
40
+ //# sourceMappingURL=repositories.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"repositories.js","sourceRoot":"","sources":["../../../src/commands/init/repositories.ts"],"names":[],"mappings":";;;AAAa,QAAA,KAAK,GAAG;IACnB,MAAM,EAAE;QACN;YACE,KAAK,EAAE,cAAc;YACrB,GAAG,EAAE,iFAAiF;SACvF;QACD;YACE,KAAK,EAAE,oBAAoB;YAC3B,GAAG,EAAE,yFAAyF;SAC/F;QACD;YACE,KAAK,EAAE,kBAAkB;YACzB,GAAG,EAAE,uFAAuF;SAC7F;QACD;YACE,KAAK,EAAE,iBAAiB;YACxB,GAAG,EAAE,oFAAoF;SAC1F;QACD;YACE,KAAK,EAAE,QAAQ;YACf,GAAG,EAAE,oFAAoF;SAC1F;QACD;YACE,KAAK,EAAE,iBAAiB;YACxB,GAAG,EAAE,mFAAmF;SACzF;QACD;YACE,KAAK,EAAE,cAAc;YACrB,GAAG,EAAE,iFAAiF;SACvF;KACF;IACD,OAAO,EAAE,yEAAyE;IAClF,kBAAkB,EAAE,wFAAwF;IAC5G,SAAS,EAAE,+EAA+E;CAC3F,CAAA;AAED,kBAAe,aAAK,CAAA"}
@@ -0,0 +1,3 @@
1
+ import { InitOption } from './types';
2
+ export declare function sceneOptions(): Promise<InitOption>;
3
+ //# sourceMappingURL=scene.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scene.d.ts","sourceRoot":"","sources":["../../../src/commands/init/scene.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AAEpC,wBAAsB,YAAY,IAAI,OAAO,CAAC,UAAU,CAAC,CA+CxD"}
@@ -0,0 +1,56 @@
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.sceneOptions = void 0;
7
+ const inquirer_1 = __importDefault(require("inquirer"));
8
+ const repositories_1 = __importDefault(require("./repositories"));
9
+ const errors_1 = require("../../utils/errors");
10
+ async function sceneOptions() {
11
+ const sceneChoices = [
12
+ ...repositories_1.default.scenes.map((repo, index) => ({
13
+ name: `(${index + 1}) ${repo.title}`,
14
+ value: repo.url
15
+ })),
16
+ {
17
+ name: 'Paste a repository URL',
18
+ value: 'write-repository'
19
+ }
20
+ ];
21
+ const projectTypeList = [
22
+ {
23
+ type: 'list',
24
+ name: 'scene',
25
+ message: 'Choose a scene',
26
+ choices: sceneChoices
27
+ }
28
+ ];
29
+ const answers = await inquirer_1.default.prompt(projectTypeList);
30
+ if (answers.scene === 'write-repository') {
31
+ const answers = await inquirer_1.default.prompt([
32
+ {
33
+ type: 'input',
34
+ name: 'url',
35
+ message: 'Write the repository URL:'
36
+ }
37
+ ]);
38
+ return {
39
+ type: 'scene',
40
+ value: answers.url
41
+ };
42
+ }
43
+ else if (answers.scene) {
44
+ const choice = sceneChoices.find((item) => item.value === answers.scene);
45
+ if (choice) {
46
+ return {
47
+ type: 'scene',
48
+ value: answers.scene
49
+ };
50
+ }
51
+ }
52
+ (0, errors_1.fail)(errors_1.ErrorType.INIT_ERROR, `Couldn't get a valid scene-level choice. Try to select a valid one.`);
53
+ return {};
54
+ }
55
+ exports.sceneOptions = sceneOptions;
56
+ //# sourceMappingURL=scene.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scene.js","sourceRoot":"","sources":["../../../src/commands/init/scene.ts"],"names":[],"mappings":";;;;;;AAAA,wDAAuD;AACvD,kEAAyC;AACzC,+CAAoD;AAG7C,KAAK,UAAU,YAAY;IAChC,MAAM,YAAY,GAAG;QACnB,GAAG,sBAAY,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC;YAC3C,IAAI,EAAE,IAAI,KAAK,GAAG,CAAC,KAAK,IAAI,CAAC,KAAK,EAAE;YACpC,KAAK,EAAE,IAAI,CAAC,GAAG;SAChB,CAAC,CAAC;QACH;YACE,IAAI,EAAE,wBAAwB;YAC9B,KAAK,EAAE,kBAAkB;SAC1B;KACF,CAAA;IAED,MAAM,eAAe,GAAuB;QAC1C;YACE,IAAI,EAAE,MAAM;YACZ,IAAI,EAAE,OAAO;YACb,OAAO,EAAE,gBAAgB;YACzB,OAAO,EAAE,YAAY;SACtB;KACF,CAAA;IAED,MAAM,OAAO,GAAG,MAAM,kBAAQ,CAAC,MAAM,CAAC,eAAe,CAAC,CAAA;IAEtD,IAAI,OAAO,CAAC,KAAK,KAAK,kBAAkB,EAAE;QACxC,MAAM,OAAO,GAAG,MAAM,kBAAQ,CAAC,MAAM,CAAC;YACpC;gBACE,IAAI,EAAE,OAAO;gBACb,IAAI,EAAE,KAAK;gBACX,OAAO,EAAE,2BAA2B;aACrC;SACF,CAAC,CAAA;QACF,OAAO;YACL,IAAI,EAAE,OAAO;YACb,KAAK,EAAE,OAAO,CAAC,GAAG;SACnB,CAAA;KACF;SAAM,IAAI,OAAO,CAAC,KAAK,EAAE;QACxB,MAAM,MAAM,GAAG,YAAY,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,KAAK,OAAO,CAAC,KAAK,CAAC,CAAA;QACxE,IAAI,MAAM,EAAE;YACV,OAAO;gBACL,IAAI,EAAE,OAAO;gBACb,KAAK,EAAE,OAAO,CAAC,KAAK;aACrB,CAAA;SACF;KACF;IAED,IAAA,aAAI,EAAC,kBAAS,CAAC,UAAU,EAAE,qEAAqE,CAAC,CAAA;IACjG,OAAO,EAAS,CAAA;AAClB,CAAC;AA/CD,oCA+CC"}
@@ -0,0 +1,22 @@
1
+ import { sdk } from '@dcl/schemas';
2
+ declare type URL = string;
3
+ export declare type InitOptionProjectType = {
4
+ type: 'project';
5
+ value: sdk.ProjectType;
6
+ };
7
+ export declare type InitOptionRepositoryURL = {
8
+ type: 'scene';
9
+ value: URL;
10
+ };
11
+ export declare type InitOption = InitOptionProjectType | InitOptionRepositoryURL;
12
+ export declare type RepositoryJson = {
13
+ scenes: {
14
+ title: string;
15
+ url: string;
16
+ }[];
17
+ library: string;
18
+ portableExperience: string;
19
+ smartItem: string;
20
+ };
21
+ export {};
22
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/commands/init/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,cAAc,CAAA;AAElC,aAAK,GAAG,GAAG,MAAM,CAAA;AAEjB,oBAAY,qBAAqB,GAAG;IAClC,IAAI,EAAE,SAAS,CAAA;IACf,KAAK,EAAE,GAAG,CAAC,WAAW,CAAA;CACvB,CAAA;AAED,oBAAY,uBAAuB,GAAG;IACpC,IAAI,EAAE,OAAO,CAAA;IACb,KAAK,EAAE,GAAG,CAAA;CACX,CAAA;AAED,oBAAY,UAAU,GAAG,qBAAqB,GAAG,uBAAuB,CAAA;AAExE,oBAAY,cAAc,GAAG;IAC3B,MAAM,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE,EAAE,CAAA;IACxC,OAAO,EAAE,MAAM,CAAA;IACf,kBAAkB,EAAE,MAAM,CAAA;IAC1B,SAAS,EAAE,MAAM,CAAA;CAClB,CAAA"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/commands/init/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,6 @@
1
+ import { InitOption } from './types';
2
+ export declare function getProjectTypes(): string;
3
+ export declare function getInitOption(type?: string): Promise<InitOption>;
4
+ export declare function getRepositoryUrl(choice: InitOption): string | void;
5
+ export declare function isValidTemplateUrl(url: string): boolean;
6
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/commands/init/utils.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AAEpC,wBAAgB,eAAe,WAI9B;AAED,wBAAsB,aAAa,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CA+CtE;AAED,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,UAAU,GAAG,MAAM,GAAG,IAAI,CAYlE;AAED,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,MAAM,WAE7C"}
@@ -0,0 +1,76 @@
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.isValidTemplateUrl = exports.getRepositoryUrl = exports.getInitOption = exports.getProjectTypes = void 0;
7
+ const schemas_1 = require("@dcl/schemas");
8
+ const inquirer_1 = __importDefault(require("inquirer"));
9
+ const chalk_1 = __importDefault(require("chalk"));
10
+ const errors_1 = require("../../utils/errors");
11
+ const repositories_1 = __importDefault(require("./repositories"));
12
+ const scene_1 = require("./scene");
13
+ function getProjectTypes() {
14
+ return Object.values(schemas_1.sdk.ProjectType)
15
+ .filter((a) => typeof a === 'string')
16
+ .join(', ');
17
+ }
18
+ exports.getProjectTypes = getProjectTypes;
19
+ async function getInitOption(type) {
20
+ if (type) {
21
+ if (!schemas_1.sdk.ProjectType.validate(type)) {
22
+ (0, errors_1.fail)(errors_1.ErrorType.INIT_ERROR, `Invalid projectType: "${chalk_1.default.bold(type)}". Supported types are ${chalk_1.default.bold(getProjectTypes())}`);
23
+ }
24
+ return {
25
+ type: 'project',
26
+ value: type
27
+ };
28
+ }
29
+ const projectTypeList = [
30
+ {
31
+ type: 'list',
32
+ name: 'project',
33
+ message: 'Choose a project type',
34
+ choices: [
35
+ {
36
+ name: 'Scene',
37
+ value: 'scene-option'
38
+ },
39
+ {
40
+ name: 'Library',
41
+ value: schemas_1.sdk.ProjectType.LIBRARY
42
+ }
43
+ ]
44
+ }
45
+ ];
46
+ const answers = await inquirer_1.default.prompt(projectTypeList);
47
+ if (answers.project === 'scene-option') {
48
+ return (0, scene_1.sceneOptions)();
49
+ }
50
+ if (schemas_1.sdk.ProjectType.validate(answers.project)) {
51
+ return {
52
+ type: 'project',
53
+ value: answers.project
54
+ };
55
+ }
56
+ (0, errors_1.fail)(errors_1.ErrorType.INIT_ERROR, `Couldn't get a valid first-level choice. Try to select a valid one.`);
57
+ return {};
58
+ }
59
+ exports.getInitOption = getInitOption;
60
+ function getRepositoryUrl(choice) {
61
+ if (choice.value === schemas_1.sdk.ProjectType.SCENE) {
62
+ return repositories_1.default.scenes[0].url;
63
+ }
64
+ if (choice.value === schemas_1.sdk.ProjectType.LIBRARY) {
65
+ return repositories_1.default.library;
66
+ }
67
+ if (choice.type === 'scene') {
68
+ return choice.value;
69
+ }
70
+ }
71
+ exports.getRepositoryUrl = getRepositoryUrl;
72
+ function isValidTemplateUrl(url) {
73
+ return /^https:\/\/github\.com\/decentraland(-scenes)?\/(.)+\.zip/.test(url);
74
+ }
75
+ exports.isValidTemplateUrl = isValidTemplateUrl;
76
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/commands/init/utils.ts"],"names":[],"mappings":";;;;;;AAAA,0CAAkC;AAClC,wDAAuD;AACvD,kDAAyB;AAEzB,+CAAoD;AACpD,kEAAyC;AACzC,mCAAsC;AAGtC,SAAgB,eAAe;IAC7B,OAAO,MAAM,CAAC,MAAM,CAAC,aAAG,CAAC,WAAW,CAAC;SAClC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,QAAQ,CAAC;SACpC,IAAI,CAAC,IAAI,CAAC,CAAA;AACf,CAAC;AAJD,0CAIC;AAEM,KAAK,UAAU,aAAa,CAAC,IAAa;IAC/C,IAAI,IAAI,EAAE;QACR,IAAI,CAAC,aAAG,CAAC,WAAW,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE;YACnC,IAAA,aAAI,EACF,kBAAS,CAAC,UAAU,EACpB,yBAAyB,eAAK,CAAC,IAAI,CAAC,IAAI,CAAC,0BAA0B,eAAK,CAAC,IAAI,CAAC,eAAe,EAAE,CAAC,EAAE,CACnG,CAAA;SACF;QAED,OAAO;YACL,IAAI,EAAE,SAAS;YACf,KAAK,EAAE,IAAuB;SAC/B,CAAA;KACF;IAED,MAAM,eAAe,GAAuB;QAC1C;YACE,IAAI,EAAE,MAAM;YACZ,IAAI,EAAE,SAAS;YACf,OAAO,EAAE,uBAAuB;YAChC,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,OAAO;oBACb,KAAK,EAAE,cAAc;iBACtB;gBACD;oBACE,IAAI,EAAE,SAAS;oBACf,KAAK,EAAE,aAAG,CAAC,WAAW,CAAC,OAAO;iBAC/B;aACF;SACF;KACF,CAAA;IACD,MAAM,OAAO,GAAG,MAAM,kBAAQ,CAAC,MAAM,CAAC,eAAe,CAAC,CAAA;IAEtD,IAAI,OAAO,CAAC,OAAO,KAAK,cAAc,EAAE;QACtC,OAAO,IAAA,oBAAY,GAAE,CAAA;KACtB;IAED,IAAI,aAAG,CAAC,WAAW,CAAC,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE;QAC7C,OAAO;YACL,IAAI,EAAE,SAAS;YACf,KAAK,EAAE,OAAO,CAAC,OAAO;SACvB,CAAA;KACF;IAED,IAAA,aAAI,EAAC,kBAAS,CAAC,UAAU,EAAE,qEAAqE,CAAC,CAAA;IACjG,OAAO,EAAS,CAAA;AAClB,CAAC;AA/CD,sCA+CC;AAED,SAAgB,gBAAgB,CAAC,MAAkB;IACjD,IAAI,MAAM,CAAC,KAAK,KAAK,aAAG,CAAC,WAAW,CAAC,KAAK,EAAE;QAC1C,OAAO,sBAAY,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,GAAG,CAAA;KAClC;IAED,IAAI,MAAM,CAAC,KAAK,KAAK,aAAG,CAAC,WAAW,CAAC,OAAO,EAAE;QAC5C,OAAO,sBAAY,CAAC,OAAO,CAAA;KAC5B;IAED,IAAI,MAAM,CAAC,IAAI,KAAK,OAAO,EAAE;QAC3B,OAAO,MAAM,CAAC,KAAK,CAAA;KACpB;AACH,CAAC;AAZD,4CAYC;AAED,SAAgB,kBAAkB,CAAC,GAAW;IAC5C,OAAO,2DAA2D,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;AAC9E,CAAC;AAFD,gDAEC"}
@@ -0,0 +1,3 @@
1
+ export declare const help: () => string;
2
+ export declare function main(): Promise<void>;
3
+ //# sourceMappingURL=install.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"install.d.ts","sourceRoot":"","sources":["../../src/commands/install.ts"],"names":[],"mappings":"AASA,eAAO,MAAM,IAAI,cAgBhB,CAAA;AA+BD,wBAAsB,IAAI,kBAgBzB"}
@@ -0,0 +1,92 @@
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.main = exports.help = void 0;
30
+ const arg_1 = __importDefault(require("arg"));
31
+ const chalk_1 = __importDefault(require("chalk"));
32
+ const updateBundleDependenciesField_1 = __importDefault(require("../project/updateBundleDependenciesField"));
33
+ const child_process_1 = require("child_process");
34
+ const moduleHelpers_1 = require("./../utils/moduleHelpers");
35
+ const spinner = __importStar(require("../utils/spinner"));
36
+ const Workspace_1 = require("../lib/Workspace");
37
+ const assert_1 = require("assert");
38
+ const help = () => `
39
+ Usage: ${chalk_1.default.bold('dcl install [package]')}
40
+
41
+ ${chalk_1.default.dim('Options:')}
42
+
43
+ -h, --help Displays complete help
44
+
45
+ ${chalk_1.default.dim('Examples:')}
46
+
47
+ - Install a new package
48
+
49
+ ${chalk_1.default.green('$ dcl install package-example')}
50
+
51
+ - Check the Decentraland libraries used are in bundleDependencies
52
+
53
+ ${chalk_1.default.green('$ dcl install')}
54
+ `;
55
+ exports.help = help;
56
+ const spawnNpmInstall = (args) => {
57
+ return new Promise((resolve, reject) => {
58
+ spinner.create(`npm ${args.join(' ')}\n`);
59
+ const child = (0, child_process_1.spawn)(moduleHelpers_1.npm, args, {
60
+ shell: true,
61
+ cwd: process.cwd(),
62
+ env: Object.assign(Object.assign({}, process.env), { NODE_ENV: '' })
63
+ });
64
+ child.stdout.pipe(process.stdout);
65
+ child.stderr.pipe(process.stderr);
66
+ child.on('close', (code) => {
67
+ if (code !== 0) {
68
+ spinner.fail();
69
+ reject(new Error(`${chalk_1.default.bold(`npm ${args.join(' ')}`)} exited with code ${code}. Please try running the command manually`));
70
+ }
71
+ else {
72
+ spinner.succeed();
73
+ resolve();
74
+ }
75
+ });
76
+ });
77
+ };
78
+ async function main() {
79
+ const args = (0, arg_1.default)({
80
+ '--help': Boolean,
81
+ '-h': '--help'
82
+ });
83
+ const workingDir = process.cwd();
84
+ const workspace = (0, Workspace_1.createWorkspace)({ workingDir });
85
+ if (!workspace.isSingleProject()) {
86
+ (0, assert_1.fail)("You should't use `dcl install` in a workspace folder.");
87
+ }
88
+ await spawnNpmInstall(args._);
89
+ await (0, updateBundleDependenciesField_1.default)({ workDir: workingDir });
90
+ }
91
+ exports.main = main;
92
+ //# sourceMappingURL=install.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"install.js","sourceRoot":"","sources":["../../src/commands/install.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,8CAAqB;AACrB,kDAAyB;AACzB,6GAAoF;AACpF,iDAAqC;AACrC,4DAA8C;AAC9C,0DAA2C;AAC3C,gDAAkD;AAClD,mCAA6B;AAEtB,MAAM,IAAI,GAAG,GAAG,EAAE,CAAC;WACf,eAAK,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ACJ,CAAC,CAAC,CAAA;AACJ,CAAC,CAAA;AAEM,KAAK,UAAU,IAAI;IACxB,MAAM,IAAI,GAAG,IAAA,aAAG,EAAC;QACf,QAAQ,EAAE,OAAO;QACjB,IAAI,EAAE,QAAQ;KACf,CAAC,CAAA;IAEF,MAAM,UAAU,GAAG,OAAO,CAAC,GAAG,EAAE,CAAA;IAChC,MAAM,SAAS,GAAG,IAAA,2BAAe,EAAC,EAAE,UAAU,EAAE,CAAC,CAAA;IAEjD,IAAI,CAAC,SAAS,CAAC,eAAe,EAAE,EAAE;QAChC,IAAA,aAAI,EAAC,uDAAuD,CAAC,CAAA;KAC9D;IAED,MAAM,eAAe,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;IAE7B,MAAM,IAAA,uCAA6B,EAAC,EAAE,OAAO,EAAE,UAAU,EAAE,CAAC,CAAA;AAC9D,CAAC;AAhBD,oBAgBC"}
@@ -0,0 +1,3 @@
1
+ export declare const help: () => string;
2
+ export declare function main(): Promise<number>;
3
+ //# sourceMappingURL=pack.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pack.d.ts","sourceRoot":"","sources":["../../src/commands/pack.ts"],"names":[],"mappings":"AAaA,eAAO,MAAM,IAAI,cAUhB,CAAA;AAED,wBAAsB,IAAI,IAAI,OAAO,CAAC,MAAM,CAAC,CA0D5C"}
@@ -0,0 +1,102 @@
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.main = exports.help = void 0;
30
+ const path_1 = __importDefault(require("path"));
31
+ const fs_extra_1 = __importDefault(require("fs-extra"));
32
+ const chalk_1 = __importDefault(require("chalk"));
33
+ const schemas_1 = require("@dcl/schemas");
34
+ const spinner = __importStar(require("../utils/spinner"));
35
+ const packProject_1 = require("../lib/smartItems/packProject");
36
+ const buildSmartItem_1 = require("../lib/smartItems/buildSmartItem");
37
+ const getProjectFilePaths_1 = __importDefault(require("../utils/getProjectFilePaths"));
38
+ const moduleHelpers_1 = require("../utils/moduleHelpers");
39
+ const assert_1 = require("assert");
40
+ const Workspace_1 = require("../lib/Workspace");
41
+ const help = () => `
42
+ Usage: ${chalk_1.default.bold('dcl pack [options]')}
43
+
44
+ ${chalk_1.default.dim('There are no available options yet (experimental feature)')}
45
+
46
+ ${chalk_1.default.dim('Example:')}
47
+
48
+ - Pack your project into a .zip file:
49
+
50
+ ${chalk_1.default.green('$ dcl pack')}
51
+ `;
52
+ exports.help = help;
53
+ async function main() {
54
+ const workingDir = process.cwd();
55
+ const workspace = (0, Workspace_1.createWorkspace)({ workingDir });
56
+ const project = workspace.getSingleProject();
57
+ if (project === null) {
58
+ (0, assert_1.fail)("You should't use `dcl pack` in a workspace folder.");
59
+ }
60
+ const projectInfo = project.getInfo();
61
+ const zipFileName = projectInfo.sceneType === schemas_1.sdk.ProjectType.PORTABLE_EXPERIENCE ? 'portable-experience.zip' : 'item.zip';
62
+ try {
63
+ if (projectInfo.sceneType === schemas_1.sdk.ProjectType.SMART_ITEM) {
64
+ await (0, buildSmartItem_1.buildSmartItem)(workingDir);
65
+ }
66
+ else if (projectInfo.sceneType === schemas_1.sdk.ProjectType.PORTABLE_EXPERIENCE) {
67
+ await (0, moduleHelpers_1.buildTypescript)({
68
+ workingDir,
69
+ watch: false,
70
+ production: true
71
+ });
72
+ }
73
+ }
74
+ catch (error) {
75
+ console.error('Could not build the project properly, please check errors.', error);
76
+ }
77
+ spinner.create('Packing project');
78
+ const ignoreFileContent = await fs_extra_1.default.readFile(path_1.default.resolve(workingDir, '.dclignore'), 'utf-8');
79
+ const filePaths = await (0, getProjectFilePaths_1.default)(workingDir, ignoreFileContent);
80
+ let totalSize = 0;
81
+ for (const filePath of filePaths) {
82
+ const stat = fs_extra_1.default.statSync(filePath);
83
+ if (stat.isFile()) {
84
+ totalSize += stat.size;
85
+ }
86
+ }
87
+ if (projectInfo.sceneType === schemas_1.sdk.ProjectType.PORTABLE_EXPERIENCE) {
88
+ const MAX_WEARABLE_SIZE = 2097152;
89
+ const MAX_WEARABLE_SIZE_MB = Math.round(MAX_WEARABLE_SIZE / 1024 / 1024);
90
+ if (totalSize > MAX_WEARABLE_SIZE) {
91
+ console.error(`The sumatory of all packed files exceed the limit of wearable size (${MAX_WEARABLE_SIZE_MB}MB - ${MAX_WEARABLE_SIZE} bytes).
92
+ Please try to remove unneccessary files and/or reduce the files size, you can ignore file adding in .dclignore.`);
93
+ }
94
+ }
95
+ const packDir = path_1.default.resolve(workingDir, zipFileName);
96
+ await fs_extra_1.default.remove(packDir);
97
+ await (0, packProject_1.packProject)(filePaths, packDir);
98
+ spinner.succeed(`Pack successful. Total size: ${Math.round((totalSize * 100) / 1024 / 1024) / 100}MB - ${totalSize} bytes`);
99
+ return 0;
100
+ }
101
+ exports.main = main;
102
+ //# sourceMappingURL=pack.js.map
@@ -0,0 +1 @@
1
+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,CAAC,CAAA;IAErC,OAAO,CAAC,OAAO,CACb,gCAAgC,IAAI,CAAC,KAAK,CAAC,CAAC,SAAS,GAAG,GAAG,CAAC,GAAG,IAAI,GAAG,IAAI,CAAC,GAAG,GAAG,QAAQ,SAAS,QAAQ,CAC3G,CAAA;IACD,OAAO,CAAC,CAAA;AACV,CAAC;AA1DD,oBA0DC"}
@@ -0,0 +1,3 @@
1
+ export declare const help: () => string;
2
+ export declare function main(): Promise<void>;
3
+ //# sourceMappingURL=start.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"start.d.ts","sourceRoot":"","sources":["../../src/commands/start.ts"],"names":[],"mappings":"AAgBA,eAAO,MAAM,IAAI,cA0BhB,CAAA;AAED,wBAAsB,IAAI,kBA8LzB"}