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,152 @@
|
|
1
|
+
/// <reference types="node" />
|
2
|
+
import { Scene } from '@dcl/schemas';
|
3
|
+
import { Coords } from '../utils/coordinateHelpers';
|
4
|
+
import { ProjectInfo } from '../project/projectInfo';
|
5
|
+
import { LinkerResponse } from './LinkerAPI';
|
6
|
+
export interface IFile {
|
7
|
+
path: string;
|
8
|
+
content: Buffer;
|
9
|
+
size: number;
|
10
|
+
}
|
11
|
+
declare type DeployInfo = {
|
12
|
+
linkerResponse?: LinkerResponse;
|
13
|
+
status?: 'deploying' | 'success';
|
14
|
+
};
|
15
|
+
export declare type ECSVersion = 'ecs6' | 'ecs7' | 'unknown';
|
16
|
+
export declare class Project {
|
17
|
+
private static MAX_FILE_SIZE_BYTES;
|
18
|
+
private projectWorkingDir;
|
19
|
+
private sceneFile;
|
20
|
+
private projectInfo;
|
21
|
+
private files;
|
22
|
+
private deployInfo;
|
23
|
+
constructor(projectWorkingDir: string);
|
24
|
+
getEcsVersion(): ECSVersion;
|
25
|
+
getEcsPackageVersion(): Promise<{
|
26
|
+
ecsVersion: "unknown";
|
27
|
+
packageVersion: string;
|
28
|
+
} | {
|
29
|
+
ecsVersion: "ecs6" | "ecs7";
|
30
|
+
packageVersion: string;
|
31
|
+
}>;
|
32
|
+
setDeployInfo(value: Partial<DeployInfo>): void;
|
33
|
+
getDeployInfo(): DeployInfo;
|
34
|
+
getProjectWorkingDir(): string;
|
35
|
+
getInfo(): ProjectInfo;
|
36
|
+
/**
|
37
|
+
* Returns `true` if the provided path contains a scene file
|
38
|
+
*/
|
39
|
+
sceneFileExists(): Promise<boolean>;
|
40
|
+
/**
|
41
|
+
* Returns `true` if the project working directory is empty of files
|
42
|
+
*/
|
43
|
+
isProjectDirEmpty(): Promise<boolean>;
|
44
|
+
/**
|
45
|
+
* Returns an object containing the contents of the `scene.json` file.
|
46
|
+
*/
|
47
|
+
getSceneFile(): Promise<Scene>;
|
48
|
+
/**
|
49
|
+
* Returns true if the project contains a package.json file and an empty node_modules folder
|
50
|
+
*/
|
51
|
+
needsDependencies(): Promise<boolean>;
|
52
|
+
/**
|
53
|
+
* Returns true if te project root contains a `tsconfig.json` file
|
54
|
+
* @param dir
|
55
|
+
*/
|
56
|
+
isTypescriptProject(): Promise<boolean>;
|
57
|
+
/**
|
58
|
+
* Writes the provided websocket server to the `scene.json` file
|
59
|
+
* @param server The url to a websocket server
|
60
|
+
*/
|
61
|
+
scaffoldWebsockets(server: string): Promise<void>;
|
62
|
+
/**
|
63
|
+
* Creates a new `scene.json` file
|
64
|
+
* @param path The path to the directory where the file will be written.
|
65
|
+
*/
|
66
|
+
writeSceneFile(content: Partial<Scene>): Promise<void>;
|
67
|
+
/**
|
68
|
+
* Copies the contents of a specific sample into the project (for scaffolding purposes).
|
69
|
+
* Merges `scene.json` and `package.json` files
|
70
|
+
* @param project The name of the sample folder (used as an indentifier).
|
71
|
+
* @param destination The path to the project root. By default the current woxsrking directory.
|
72
|
+
*/
|
73
|
+
copySample(project: string): Promise<void>;
|
74
|
+
/**
|
75
|
+
* Returns a promise of an object containing the base X and Y coordinates for a parcel.
|
76
|
+
*/
|
77
|
+
getParcelCoordinates(): Promise<Coords>;
|
78
|
+
/**
|
79
|
+
* Returns a promise of an array of the parcels of the scene
|
80
|
+
*/
|
81
|
+
getParcels(): Promise<Coords[]>;
|
82
|
+
/**
|
83
|
+
* Returns a promise of the owner address
|
84
|
+
*/
|
85
|
+
getOwner(): Promise<string>;
|
86
|
+
/**
|
87
|
+
* Fails the execution if one of the parcel data is invalid
|
88
|
+
*/
|
89
|
+
validateSceneOptions(): Promise<void>;
|
90
|
+
/**
|
91
|
+
* Writes the `.dclignore` file to the provided directory path.
|
92
|
+
* @param dir The target path where the file will be
|
93
|
+
*/
|
94
|
+
writeDclIgnore(): Promise<string>;
|
95
|
+
/**
|
96
|
+
* Validates all the conditions required to operate over an existing project.
|
97
|
+
* Throws if a project contains an invalid main path or if the `scene.json` file is missing.
|
98
|
+
*/
|
99
|
+
validateExistingProject(): Promise<void>;
|
100
|
+
/**
|
101
|
+
* Returns a promise of an array containing all the file paths for the given directory.
|
102
|
+
* @param dir The given directory where to list the file paths.
|
103
|
+
*/
|
104
|
+
getAllFilePaths({ dir, rootFolder }?: {
|
105
|
+
dir: string;
|
106
|
+
rootFolder: string;
|
107
|
+
}): Promise<string[]>;
|
108
|
+
/**
|
109
|
+
* Returns a promise of an array of objects containing the path and the content for all the files in the project.
|
110
|
+
* All the paths added to the `.dclignore` file will be excluded from the results.
|
111
|
+
* Windows directory separators are replaced for POSIX separators.
|
112
|
+
* @param ignoreFile The contents of the .dclignore file
|
113
|
+
*/
|
114
|
+
getFiles({ ignoreFiles, cache, skipFileSizeCheck }?: {
|
115
|
+
ignoreFiles?: string;
|
116
|
+
cache?: boolean;
|
117
|
+
skipFileSizeCheck?: boolean;
|
118
|
+
}): Promise<IFile[]>;
|
119
|
+
/**
|
120
|
+
* Returns the the contents of the `.dclignore` file
|
121
|
+
*/
|
122
|
+
getDCLIgnore(): Promise<string | null>;
|
123
|
+
/**
|
124
|
+
* Returns `true` if the provided path contains a valid main file format.
|
125
|
+
* @param path The path to the main file.
|
126
|
+
*/
|
127
|
+
private isValidMainFormat;
|
128
|
+
/**
|
129
|
+
* Returns true if the given URL is a valid websocket URL.
|
130
|
+
* @param url The given URL.
|
131
|
+
*/
|
132
|
+
private isWebSocket;
|
133
|
+
/**
|
134
|
+
* Returns `true` if the path exists as a valid file or websocket URL.
|
135
|
+
* @param filePath The path to a given file.
|
136
|
+
*/
|
137
|
+
private fileExists;
|
138
|
+
/**
|
139
|
+
* Fails the execution if one of the parcel data is invalid
|
140
|
+
* @param sceneFile The JSON parsed file of scene.json
|
141
|
+
*/
|
142
|
+
private validateSceneData;
|
143
|
+
getSceneBaseCoords(): Promise<{
|
144
|
+
x: number;
|
145
|
+
y: number;
|
146
|
+
}>;
|
147
|
+
getSceneParcelCount(): Promise<number>;
|
148
|
+
checkCLIandECSCompatibility(): Promise<void>;
|
149
|
+
}
|
150
|
+
export declare function copySample(projectSample: string, destWorkingDir: string): Promise<void>;
|
151
|
+
export {};
|
152
|
+
//# sourceMappingURL=Project.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"Project.d.ts","sourceRoot":"","sources":["../../src/lib/Project.ts"],"names":[],"mappings":";AAGA,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAA;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|
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.copySample = exports.Project = void 0;
|
7
|
+
const path_1 = __importDefault(require("path"));
|
8
|
+
const fs_extra_1 = __importDefault(require("fs-extra"));
|
9
|
+
const ignore_1 = __importDefault(require("ignore"));
|
10
|
+
const semver_1 = __importDefault(require("semver"));
|
11
|
+
const uuid_1 = require("uuid");
|
12
|
+
const filesystem_1 = require("../utils/filesystem");
|
13
|
+
const project_1 = require("../utils/project");
|
14
|
+
const errors_1 = require("../utils/errors");
|
15
|
+
const coordinateHelpers_1 = require("../utils/coordinateHelpers");
|
16
|
+
const projectInfo_1 = require("../project/projectInfo");
|
17
|
+
const sceneJson_1 = require("../sceneJson");
|
18
|
+
const logging_1 = require("../utils/logging");
|
19
|
+
const moduleHelpers_1 = require("../utils/moduleHelpers");
|
20
|
+
class Project {
|
21
|
+
constructor(projectWorkingDir) {
|
22
|
+
this.files = [];
|
23
|
+
this.deployInfo = {};
|
24
|
+
this.projectWorkingDir = projectWorkingDir || process.cwd();
|
25
|
+
const info = (0, projectInfo_1.getProjectInfo)(this.projectWorkingDir);
|
26
|
+
if (!info) {
|
27
|
+
throw new Error(`Unable to get project info of directory '${this.projectWorkingDir}'
|
28
|
+
Please, see if its json configuration file is wrong.`);
|
29
|
+
}
|
30
|
+
this.projectInfo = info;
|
31
|
+
}
|
32
|
+
getEcsVersion() {
|
33
|
+
const ecs6Path = path_1.default.resolve(this.projectWorkingDir, 'node_modules', 'decentraland-ecs');
|
34
|
+
const ecs7Path = path_1.default.resolve(this.projectWorkingDir, 'node_modules', '@dcl', 'sdk');
|
35
|
+
const ecs6 = fs_extra_1.default.pathExistsSync(ecs6Path);
|
36
|
+
const ecs7 = fs_extra_1.default.pathExistsSync(ecs7Path);
|
37
|
+
if (ecs6 && ecs7) {
|
38
|
+
throw new Error(`Conflict initializing project of '${this.projectWorkingDir}' because it has both 'decentraland-ecs' and '@dcl/sdk' packages installed.`);
|
39
|
+
}
|
40
|
+
else if (ecs6) {
|
41
|
+
return 'ecs6';
|
42
|
+
}
|
43
|
+
else if (ecs7) {
|
44
|
+
return 'ecs7';
|
45
|
+
}
|
46
|
+
return 'unknown';
|
47
|
+
}
|
48
|
+
async getEcsPackageVersion() {
|
49
|
+
const ecsVersion = this.getEcsVersion();
|
50
|
+
if (ecsVersion === 'unknown') {
|
51
|
+
return {
|
52
|
+
ecsVersion,
|
53
|
+
packageVersion: 'none'
|
54
|
+
};
|
55
|
+
}
|
56
|
+
const ecsPackageName = ecsVersion === 'ecs7' ? '@dcl/sdk' : 'decentraland-ecs';
|
57
|
+
const ecsPackageJson = await (0, filesystem_1.readJSON)(path_1.default.resolve((0, project_1.getNodeModulesPath)(this.projectWorkingDir), ecsPackageName, 'package.json'));
|
58
|
+
return {
|
59
|
+
ecsVersion,
|
60
|
+
packageVersion: ecsPackageJson.version
|
61
|
+
};
|
62
|
+
}
|
63
|
+
setDeployInfo(value) {
|
64
|
+
this.deployInfo = Object.assign(Object.assign({}, this.deployInfo), value);
|
65
|
+
}
|
66
|
+
getDeployInfo() {
|
67
|
+
return this.deployInfo;
|
68
|
+
}
|
69
|
+
getProjectWorkingDir() {
|
70
|
+
return this.projectWorkingDir;
|
71
|
+
}
|
72
|
+
getInfo() {
|
73
|
+
return this.projectInfo;
|
74
|
+
}
|
75
|
+
/**
|
76
|
+
* Returns `true` if the provided path contains a scene file
|
77
|
+
*/
|
78
|
+
sceneFileExists() {
|
79
|
+
return fs_extra_1.default.pathExists((0, project_1.getSceneFilePath)(this.projectWorkingDir));
|
80
|
+
}
|
81
|
+
/**
|
82
|
+
* Returns `true` if the project working directory is empty of files
|
83
|
+
*/
|
84
|
+
async isProjectDirEmpty() {
|
85
|
+
return (0, filesystem_1.isEmptyDirectory)(this.projectWorkingDir);
|
86
|
+
}
|
87
|
+
/**
|
88
|
+
* Returns an object containing the contents of the `scene.json` file.
|
89
|
+
*/
|
90
|
+
async getSceneFile() {
|
91
|
+
if (this.sceneFile) {
|
92
|
+
return this.sceneFile;
|
93
|
+
}
|
94
|
+
try {
|
95
|
+
const sceneFile = await (0, filesystem_1.readJSON)((0, project_1.getSceneFilePath)(this.projectWorkingDir));
|
96
|
+
this.sceneFile = sceneFile;
|
97
|
+
return sceneFile;
|
98
|
+
}
|
99
|
+
catch (e) {
|
100
|
+
(0, errors_1.fail)(errors_1.ErrorType.PROJECT_ERROR, `Unable to read 'scene.json' file. Try initializing the project using 'dcl init'.
|
101
|
+
\t > Folder: ${this.projectWorkingDir}
|
102
|
+
`);
|
103
|
+
}
|
104
|
+
return this.sceneFile;
|
105
|
+
}
|
106
|
+
/**
|
107
|
+
* Returns true if the project contains a package.json file and an empty node_modules folder
|
108
|
+
*/
|
109
|
+
async needsDependencies() {
|
110
|
+
const files = await this.getAllFilePaths({
|
111
|
+
dir: this.projectWorkingDir,
|
112
|
+
rootFolder: this.projectWorkingDir
|
113
|
+
});
|
114
|
+
const hasPackageFile = files.some((file) => file === 'package.json');
|
115
|
+
const nodeModulesPath = path_1.default.resolve(this.projectWorkingDir, 'node_modules');
|
116
|
+
const hasNodeModulesFolder = await fs_extra_1.default.pathExists(nodeModulesPath);
|
117
|
+
const isNodeModulesEmpty = (await this.getAllFilePaths({
|
118
|
+
dir: nodeModulesPath,
|
119
|
+
rootFolder: this.projectWorkingDir
|
120
|
+
})).length === 0;
|
121
|
+
if (hasPackageFile && (!hasNodeModulesFolder || isNodeModulesEmpty)) {
|
122
|
+
return true;
|
123
|
+
}
|
124
|
+
return false;
|
125
|
+
}
|
126
|
+
/**
|
127
|
+
* Returns true if te project root contains a `tsconfig.json` file
|
128
|
+
* @param dir
|
129
|
+
*/
|
130
|
+
async isTypescriptProject() {
|
131
|
+
const files = await this.getAllFilePaths({
|
132
|
+
dir: this.projectWorkingDir,
|
133
|
+
rootFolder: this.projectWorkingDir
|
134
|
+
});
|
135
|
+
return files.some((file) => file === 'tsconfig.json');
|
136
|
+
}
|
137
|
+
/**
|
138
|
+
* Writes the provided websocket server to the `scene.json` file
|
139
|
+
* @param server The url to a websocket server
|
140
|
+
*/
|
141
|
+
async scaffoldWebsockets(server) {
|
142
|
+
await this.copySample('websockets');
|
143
|
+
if (server) {
|
144
|
+
await this.writeSceneFile({ main: server });
|
145
|
+
}
|
146
|
+
}
|
147
|
+
/**
|
148
|
+
* Creates a new `scene.json` file
|
149
|
+
* @param path The path to the directory where the file will be written.
|
150
|
+
*/
|
151
|
+
writeSceneFile(content) {
|
152
|
+
return (0, filesystem_1.writeJSON)((0, project_1.getSceneFilePath)(this.projectWorkingDir), content);
|
153
|
+
}
|
154
|
+
/**
|
155
|
+
* Copies the contents of a specific sample into the project (for scaffolding purposes).
|
156
|
+
* Merges `scene.json` and `package.json` files
|
157
|
+
* @param project The name of the sample folder (used as an indentifier).
|
158
|
+
* @param destination The path to the project root. By default the current woxsrking directory.
|
159
|
+
*/
|
160
|
+
async copySample(project) {
|
161
|
+
await copySample(project, this.projectWorkingDir);
|
162
|
+
}
|
163
|
+
/**
|
164
|
+
* Returns a promise of an object containing the base X and Y coordinates for a parcel.
|
165
|
+
*/
|
166
|
+
async getParcelCoordinates() {
|
167
|
+
const sceneFile = await this.getSceneFile();
|
168
|
+
const { base } = sceneFile.scene;
|
169
|
+
return (0, coordinateHelpers_1.getObject)(base);
|
170
|
+
}
|
171
|
+
/**
|
172
|
+
* Returns a promise of an array of the parcels of the scene
|
173
|
+
*/
|
174
|
+
async getParcels() {
|
175
|
+
const sceneFile = await this.getSceneFile();
|
176
|
+
return sceneFile.scene.parcels.map(coordinateHelpers_1.getObject);
|
177
|
+
}
|
178
|
+
/**
|
179
|
+
* Returns a promise of the owner address
|
180
|
+
*/
|
181
|
+
async getOwner() {
|
182
|
+
const { owner } = await this.getSceneFile();
|
183
|
+
if (!owner) {
|
184
|
+
(0, errors_1.fail)(errors_1.ErrorType.PROJECT_ERROR, `Missing owner attribute at scene.json. Owner attribute is required for deploying`);
|
185
|
+
}
|
186
|
+
return (owner === null || owner === void 0 ? void 0 : owner.toLowerCase()) || '';
|
187
|
+
}
|
188
|
+
/**
|
189
|
+
* Fails the execution if one of the parcel data is invalid
|
190
|
+
*/
|
191
|
+
async validateSceneOptions() {
|
192
|
+
const sceneFile = await this.getSceneFile();
|
193
|
+
return this.validateSceneData(sceneFile);
|
194
|
+
}
|
195
|
+
/**
|
196
|
+
* Writes the `.dclignore` file to the provided directory path.
|
197
|
+
* @param dir The target path where the file will be
|
198
|
+
*/
|
199
|
+
async writeDclIgnore() {
|
200
|
+
const content = [
|
201
|
+
'.*',
|
202
|
+
'package.json',
|
203
|
+
'package-lock.json',
|
204
|
+
'yarn-lock.json',
|
205
|
+
'build.json',
|
206
|
+
'export',
|
207
|
+
'tsconfig.json',
|
208
|
+
'tslint.json',
|
209
|
+
'node_modules',
|
210
|
+
'*.ts',
|
211
|
+
'*.tsx',
|
212
|
+
'Dockerfile',
|
213
|
+
'dist',
|
214
|
+
'README.md',
|
215
|
+
'*.blend',
|
216
|
+
'*.fbx',
|
217
|
+
'*.zip',
|
218
|
+
'*.rar'
|
219
|
+
].join('\n');
|
220
|
+
await fs_extra_1.default.outputFile(path_1.default.join(this.projectWorkingDir, project_1.DCLIGNORE_FILE), content);
|
221
|
+
return content;
|
222
|
+
}
|
223
|
+
/**
|
224
|
+
* Validates all the conditions required to operate over an existing project.
|
225
|
+
* Throws if a project contains an invalid main path or if the `scene.json` file is missing.
|
226
|
+
*/
|
227
|
+
async validateExistingProject() {
|
228
|
+
const sceneFile = await this.getSceneFile();
|
229
|
+
if (!this.isWebSocket(sceneFile.main)) {
|
230
|
+
if (!this.isValidMainFormat(sceneFile.main)) {
|
231
|
+
(0, errors_1.fail)(errors_1.ErrorType.PROJECT_ERROR, `Main scene format file (${sceneFile.main}) is not a supported format`);
|
232
|
+
}
|
233
|
+
if (sceneFile.main !== null && !(await this.fileExists(sceneFile.main))) {
|
234
|
+
(0, errors_1.fail)(errors_1.ErrorType.PROJECT_ERROR, `Main scene file ${sceneFile.main} is missing in folder ${this.projectWorkingDir}`);
|
235
|
+
}
|
236
|
+
}
|
237
|
+
}
|
238
|
+
/**
|
239
|
+
* Returns a promise of an array containing all the file paths for the given directory.
|
240
|
+
* @param dir The given directory where to list the file paths.
|
241
|
+
*/
|
242
|
+
async getAllFilePaths({ dir, rootFolder } = {
|
243
|
+
dir: this.projectWorkingDir,
|
244
|
+
rootFolder: this.projectWorkingDir
|
245
|
+
}) {
|
246
|
+
try {
|
247
|
+
const files = await fs_extra_1.default.readdir(dir);
|
248
|
+
let tmpFiles = [];
|
249
|
+
for (let i = 0; i < files.length; i++) {
|
250
|
+
const file = files[i];
|
251
|
+
const filePath = path_1.default.resolve(dir, file);
|
252
|
+
const relativePath = path_1.default.relative(rootFolder, filePath);
|
253
|
+
const stat = await fs_extra_1.default.stat(filePath);
|
254
|
+
if (stat.isDirectory()) {
|
255
|
+
const folderFiles = await this.getAllFilePaths({
|
256
|
+
dir: filePath,
|
257
|
+
rootFolder
|
258
|
+
});
|
259
|
+
tmpFiles = tmpFiles.concat(folderFiles);
|
260
|
+
}
|
261
|
+
else {
|
262
|
+
tmpFiles.push(relativePath);
|
263
|
+
}
|
264
|
+
}
|
265
|
+
return tmpFiles;
|
266
|
+
}
|
267
|
+
catch (e) {
|
268
|
+
return [];
|
269
|
+
}
|
270
|
+
}
|
271
|
+
/**
|
272
|
+
* Returns a promise of an array of objects containing the path and the content for all the files in the project.
|
273
|
+
* All the paths added to the `.dclignore` file will be excluded from the results.
|
274
|
+
* Windows directory separators are replaced for POSIX separators.
|
275
|
+
* @param ignoreFile The contents of the .dclignore file
|
276
|
+
*/
|
277
|
+
async getFiles({ ignoreFiles = '', cache = false, skipFileSizeCheck = false } = {}) {
|
278
|
+
if (cache && this.files.length) {
|
279
|
+
return this.files;
|
280
|
+
}
|
281
|
+
const files = await this.getAllFilePaths();
|
282
|
+
const filteredFiles = ignore_1.default()
|
283
|
+
.add(ignoreFiles.split(/\n/g).map(($) => $.trim()))
|
284
|
+
.filter(files);
|
285
|
+
const data = [];
|
286
|
+
for (let i = 0; i < filteredFiles.length; i++) {
|
287
|
+
const file = filteredFiles[i];
|
288
|
+
const filePath = path_1.default.resolve(this.projectWorkingDir, file);
|
289
|
+
const stat = await fs_extra_1.default.stat(filePath);
|
290
|
+
if (stat.size > Project.MAX_FILE_SIZE_BYTES && !skipFileSizeCheck) {
|
291
|
+
(0, errors_1.fail)(errors_1.ErrorType.UPLOAD_ERROR, `Maximum file size exceeded: '${file}' is larger than ${Project.MAX_FILE_SIZE_BYTES / 1e6}MB`);
|
292
|
+
}
|
293
|
+
const content = await fs_extra_1.default.readFile(filePath);
|
294
|
+
data.push({
|
295
|
+
path: file.replace(/\\/g, '/'),
|
296
|
+
content: Buffer.from(content),
|
297
|
+
size: stat.size
|
298
|
+
});
|
299
|
+
}
|
300
|
+
this.files = data;
|
301
|
+
return data;
|
302
|
+
}
|
303
|
+
/**
|
304
|
+
* Returns the the contents of the `.dclignore` file
|
305
|
+
*/
|
306
|
+
async getDCLIgnore() {
|
307
|
+
let ignoreFile;
|
308
|
+
try {
|
309
|
+
ignoreFile = await fs_extra_1.default.readFile((0, project_1.getIgnoreFilePath)(this.projectWorkingDir), 'utf8');
|
310
|
+
}
|
311
|
+
catch (e) {
|
312
|
+
ignoreFile = null;
|
313
|
+
}
|
314
|
+
return ignoreFile;
|
315
|
+
}
|
316
|
+
/**
|
317
|
+
* Returns `true` if the provided path contains a valid main file format.
|
318
|
+
* @param path The path to the main file.
|
319
|
+
*/
|
320
|
+
isValidMainFormat(path) {
|
321
|
+
const supportedExtensions = new Set(['js', 'html', 'xml']);
|
322
|
+
const mainExt = path ? path.split('.').pop() : null;
|
323
|
+
return path === null || !!(mainExt && supportedExtensions.has(mainExt));
|
324
|
+
}
|
325
|
+
/**
|
326
|
+
* Returns true if the given URL is a valid websocket URL.
|
327
|
+
* @param url The given URL.
|
328
|
+
*/
|
329
|
+
isWebSocket(url) {
|
330
|
+
return /wss?\:\/\//gi.test(url);
|
331
|
+
}
|
332
|
+
/**
|
333
|
+
* Returns `true` if the path exists as a valid file or websocket URL.
|
334
|
+
* @param filePath The path to a given file.
|
335
|
+
*/
|
336
|
+
async fileExists(filePath) {
|
337
|
+
if (this.isWebSocket(filePath)) {
|
338
|
+
return true;
|
339
|
+
}
|
340
|
+
return fs_extra_1.default.pathExists(path_1.default.join(this.projectWorkingDir, filePath));
|
341
|
+
}
|
342
|
+
/**
|
343
|
+
* Fails the execution if one of the parcel data is invalid
|
344
|
+
* @param sceneFile The JSON parsed file of scene.json
|
345
|
+
*/
|
346
|
+
validateSceneData(sceneFile) {
|
347
|
+
const { base, parcels } = sceneFile.scene;
|
348
|
+
const parcelSet = new Set(parcels);
|
349
|
+
if (!base) {
|
350
|
+
(0, errors_1.fail)(errors_1.ErrorType.PROJECT_ERROR, 'Missing scene base attribute at scene.json');
|
351
|
+
}
|
352
|
+
if (!parcels) {
|
353
|
+
(0, errors_1.fail)(errors_1.ErrorType.PROJECT_ERROR, 'Missing scene parcels attribute at scene.json');
|
354
|
+
}
|
355
|
+
if (parcelSet.size < parcels.length) {
|
356
|
+
(0, errors_1.fail)(errors_1.ErrorType.PROJECT_ERROR, `There are duplicated parcels at scene.json. Project folder ${this.projectWorkingDir}`);
|
357
|
+
}
|
358
|
+
if (!parcelSet.has(base)) {
|
359
|
+
(0, errors_1.fail)(errors_1.ErrorType.PROJECT_ERROR, `Your base parcel ${base} should be included on parcels attribute at scene.json`);
|
360
|
+
}
|
361
|
+
const objParcels = parcels.map(coordinateHelpers_1.getObject);
|
362
|
+
objParcels.forEach(({ x, y }) => {
|
363
|
+
if ((0, coordinateHelpers_1.inBounds)(x, y)) {
|
364
|
+
return;
|
365
|
+
}
|
366
|
+
const { minX, maxX } = (0, coordinateHelpers_1.getBounds)();
|
367
|
+
(0, errors_1.fail)(errors_1.ErrorType.PROJECT_ERROR, `Coordinates ${x},${y} are outside of allowed limits (from ${minX} to ${maxX})`);
|
368
|
+
});
|
369
|
+
if (!(0, coordinateHelpers_1.areConnected)(objParcels)) {
|
370
|
+
(0, errors_1.fail)(errors_1.ErrorType.PROJECT_ERROR, 'Parcels described on scene.json are not connected. They should be one next to each other');
|
371
|
+
}
|
372
|
+
}
|
373
|
+
async getSceneBaseCoords() {
|
374
|
+
try {
|
375
|
+
const sceneFile = await (0, sceneJson_1.getSceneFile)(this.projectWorkingDir);
|
376
|
+
const [x, y] = sceneFile.scene.base.replace(/\ /g, '').split(',');
|
377
|
+
return { x: parseInt(x), y: parseInt(y) };
|
378
|
+
}
|
379
|
+
catch (e) {
|
380
|
+
console.log((0, logging_1.error)(`Could not open "scene.json" file`));
|
381
|
+
throw e;
|
382
|
+
}
|
383
|
+
}
|
384
|
+
async getSceneParcelCount() {
|
385
|
+
try {
|
386
|
+
const sceneFile = await (0, sceneJson_1.getSceneFile)(this.projectWorkingDir);
|
387
|
+
return sceneFile.scene.parcels.length;
|
388
|
+
}
|
389
|
+
catch (e) {
|
390
|
+
console.log((0, logging_1.error)(`Could not open "scene.json" file`));
|
391
|
+
throw e;
|
392
|
+
}
|
393
|
+
}
|
394
|
+
async checkCLIandECSCompatibility() {
|
395
|
+
const ecsVersion = this.getEcsVersion();
|
396
|
+
if (ecsVersion === 'unknown') {
|
397
|
+
throw new Error('There is no SDK installed to know how version should use. Please run `npm install`.');
|
398
|
+
}
|
399
|
+
const ecsPackageName = ecsVersion === 'ecs7' ? '@dcl/sdk' : 'decentraland-ecs';
|
400
|
+
const ecsPackageJson = await (0, filesystem_1.readJSON)(path_1.default.resolve((0, project_1.getNodeModulesPath)(this.projectWorkingDir), ecsPackageName, 'package.json'));
|
401
|
+
const cliPackageJson = await (0, moduleHelpers_1.getCLIPackageJson)();
|
402
|
+
if (ecsVersion === 'ecs6') {
|
403
|
+
if (cliPackageJson.minEcsVersion && semver_1.default.lt(ecsPackageJson.version, `${cliPackageJson.minEcsVersion}`)) {
|
404
|
+
throw new Error([
|
405
|
+
'This version of decentraland-cli (dcl) requires an ECS version higher than',
|
406
|
+
cliPackageJson.minEcsVersion,
|
407
|
+
'the installed version is',
|
408
|
+
ecsPackageJson.version,
|
409
|
+
'please go to https://docs.decentraland.org/creator/development-guide/cli/ to know more about the versions and upgrade guides'
|
410
|
+
].join(' '));
|
411
|
+
}
|
412
|
+
}
|
413
|
+
if (ecsPackageJson.minCliVersion && semver_1.default.lt(cliPackageJson.version, ecsPackageJson.minCliVersion)) {
|
414
|
+
throw new Error([
|
415
|
+
`This version of ${ecsPackageName} requires a version of the CLI (dcl) higher than`,
|
416
|
+
ecsPackageJson.minCliVersion,
|
417
|
+
'\nThe installed CLI version is',
|
418
|
+
cliPackageJson.version,
|
419
|
+
`\nRun npm i -g decentraland@${ecsPackageJson.minCliVersion} or npm i -g decentraland@latest to fix this issue.\n`,
|
420
|
+
'\nGo to https://docs.decentraland.org/creator/development-guide/cli/ to know more about the versions and upgrade guides'
|
421
|
+
].join(' '));
|
422
|
+
}
|
423
|
+
}
|
424
|
+
}
|
425
|
+
exports.Project = Project;
|
426
|
+
Project.MAX_FILE_SIZE_BYTES = 50 * 1e6; // 50mb
|
427
|
+
async function copySample(projectSample, destWorkingDir) {
|
428
|
+
const src = path_1.default.resolve(__dirname, '..', '..', 'samples', projectSample);
|
429
|
+
const files = await fs_extra_1.default.readdir(src);
|
430
|
+
for (let i = 0; i < files.length; i++) {
|
431
|
+
const file = files[i];
|
432
|
+
if (file === project_1.WEARABLE_JSON_FILE) {
|
433
|
+
const wearableJsonFile = await (0, filesystem_1.readJSON)(path_1.default.join(src, file));
|
434
|
+
const wearableJsonFileWithUuid = Object.assign(Object.assign({}, wearableJsonFile), { id: (0, uuid_1.v4)() });
|
435
|
+
await (0, filesystem_1.writeJSON)(path_1.default.join(destWorkingDir, file), wearableJsonFileWithUuid);
|
436
|
+
}
|
437
|
+
else if (file === project_1.GITIGNORE_FILE || file === project_1.NPMRC_FILE || file === project_1.ESTLINTRC_FILE) {
|
438
|
+
await fs_extra_1.default.copy(path_1.default.join(src, file), path_1.default.join(destWorkingDir, '.' + file));
|
439
|
+
}
|
440
|
+
else {
|
441
|
+
await fs_extra_1.default.copy(path_1.default.join(src, file), path_1.default.join(destWorkingDir, file));
|
442
|
+
}
|
443
|
+
}
|
444
|
+
}
|
445
|
+
exports.copySample = copySample;
|
446
|
+
//# sourceMappingURL=Project.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"Project.js","sourceRoot":"","sources":["../../src/lib/Project.ts"],"names":[],"mappings":";;;;;;AAAA,gDAAuB;AACvB,wDAAyB;AACzB,oDAA2B;AAE3B,oDAA2B;AAC3B,+BAAmC;AAEnC,oDAA2E;AAC3E,8CASyB;AACzB,4CAAiD;AACjD,kEAAiG;AACjG,wDAAoE;AACpE,4CAA2C;AAC3C,8CAAwC;AAExC,0DAA0D;AAe1D,MAAa,OAAO;IASlB,YAAY,iBAAyB;QAH7B,UAAK,GAAY,EAAE,CAAA;QACnB,eAAU,GAAe,EAAE,CAAA;QAGjC,IAAI,CAAC,iBAAiB,GAAG,iBAAiB,IAAI,OAAO,CAAC,GAAG,EAAE,CAAA;QAC3D,MAAM,IAAI,GAAG,IAAA,4BAAc,EAAC,IAAI,CAAC,iBAAiB,CAAC,CAAA;QAEnD,IAAI,CAAC,IAAI,EAAE;YACT,MAAM,IAAI,KAAK,CAAC,4CAA4C,IAAI,CAAC,iBAAiB;2DAC7B,CAAC,CAAA;SACvD;QACD,IAAI,CAAC,WAAW,GAAG,IAAI,CAAA;IACzB,CAAC;IAED,aAAa;QACX,MAAM,QAAQ,GAAG,cAAI,CAAC,OAAO,CAAC,IAAI,CAAC,iBAAiB,EAAE,cAAc,EAAE,kBAAkB,CAAC,CAAA;QAEzF,MAAM,QAAQ,GAAG,cAAI,CAAC,OAAO,CAAC,IAAI,CAAC,iBAAiB,EAAE,cAAc,EAAE,MAAM,EAAE,K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,EAAE,IAAI,CAAC,EAAE,cAAI,CAAC,IAAI,CAAC,cAAc,EAAE,IAAI,CAAC,CAAC,CAAA;SACrE;KACF;AACH,CAAC;AAhBD,gCAgBC"}
|
@@ -0,0 +1,21 @@
|
|
1
|
+
import { Project } from './Project';
|
2
|
+
export declare const workspaceConfigFile = "dcl-workspace.json";
|
3
|
+
export interface Workspace {
|
4
|
+
getAllProjects: () => Project[];
|
5
|
+
getProject: (index: number) => Project;
|
6
|
+
getSingleProject: () => Project | null;
|
7
|
+
isSingleProject: () => boolean;
|
8
|
+
hasPortableExperience: () => boolean;
|
9
|
+
getBaseCoords: () => Promise<{
|
10
|
+
x: number;
|
11
|
+
y: number;
|
12
|
+
}>;
|
13
|
+
getParcelCount: () => Promise<number>;
|
14
|
+
addProject: (projectPath: string) => Promise<void>;
|
15
|
+
}
|
16
|
+
export declare const createWorkspace: ({ workingDir, workspaceFilePath }: {
|
17
|
+
workingDir?: string | undefined;
|
18
|
+
workspaceFilePath?: string | undefined;
|
19
|
+
}) => Workspace;
|
20
|
+
export declare function initializeWorkspace(workingDir: string): Promise<Workspace>;
|
21
|
+
//# sourceMappingURL=Workspace.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"Workspace.d.ts","sourceRoot":"","sources":["../../src/lib/Workspace.ts"],"names":[],"mappings":"AAGA,OAAO,EAAc,OAAO,EAAE,MAAM,WAAW,CAAA;AAa/C,eAAO,MAAM,mBAAmB,uBAAuB,CAAA;AA2BvD,MAAM,WAAW,SAAS;IACxB,cAAc,EAAE,MAAM,OAAO,EAAE,CAAA;IAC/B,UAAU,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAAA;IACtC,gBAAgB,EAAE,MAAM,OAAO,GAAG,IAAI,CAAA;IACtC,eAAe,EAAE,MAAM,OAAO,CAAA;IAC9B,qBAAqB,EAAE,MAAM,OAAO,CAAA;IACpC,aAAa,EAAE,MAAM,OAAO,CAAC;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;IACtD,cAAc,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,CAAA;IACrC,UAAU,EAAE,CAAC,WAAW,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;CACnD;AAED,eAAO,MAAM,eAAe;;;MAMxB,SAkGH,CAAA;AAED,wBAAsB,mBAAmB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC,CAwBhF"}
|