@dcl/sdk-commands 7.1.4-4566053119.commit-f66a565 → 7.1.4-4567379411.commit-066d4ed
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,3 +1,3 @@
|
|
1
1
|
import { FileSystemInterface } from '@dcl/inspector';
|
2
|
-
import {
|
3
|
-
export declare function
|
2
|
+
import { CliComponents } from '../../../components';
|
3
|
+
export declare function createFileSystemInterfaceFromFsComponent({ fs }: Pick<CliComponents, 'fs'>): FileSystemInterface;
|
@@ -1,30 +1,37 @@
|
|
1
1
|
"use strict";
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
|
+
};
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.
|
4
|
-
|
6
|
+
exports.createFileSystemInterfaceFromFsComponent = void 0;
|
7
|
+
const path_1 = __importDefault(require("path"));
|
8
|
+
function createFileSystemInterfaceFromFsComponent({ fs }) {
|
5
9
|
return {
|
6
10
|
async existFile(filePath) {
|
7
|
-
|
8
|
-
await fs.access(filePath, fs.constants.F_OK | fs.constants.R_OK);
|
9
|
-
return true;
|
10
|
-
}
|
11
|
-
catch (error) {
|
12
|
-
return false;
|
13
|
-
}
|
11
|
+
return fs.fileExists(filePath);
|
14
12
|
},
|
15
13
|
async readFile(filePath) {
|
16
14
|
return fs.readFile(filePath);
|
17
15
|
},
|
18
16
|
async writeFile(filePath, content) {
|
17
|
+
const folder = path_1.default.dirname(filePath);
|
18
|
+
if (!(await fs.directoryExists(folder))) {
|
19
|
+
await fs.mkdir(folder, { recursive: true });
|
20
|
+
}
|
19
21
|
await fs.writeFile(filePath, content);
|
20
22
|
},
|
21
23
|
async readdir(dirPath) {
|
22
|
-
|
24
|
+
if (dirPath.indexOf('/../') !== -1) {
|
25
|
+
throw new Error('The usage of /../ is not allowed');
|
26
|
+
}
|
27
|
+
const root = dirPath === '.' || dirPath === './' || dirPath === '';
|
28
|
+
const resolvedPath = root ? process.cwd() : dirPath;
|
29
|
+
const result = await fs.readdir(resolvedPath);
|
23
30
|
return Promise.all(result.map(async (name) => ({
|
24
31
|
name: name,
|
25
|
-
isDirectory: await fs.directoryExists(name)
|
32
|
+
isDirectory: await fs.directoryExists(path_1.default.resolve(dirPath, name))
|
26
33
|
})));
|
27
34
|
}
|
28
35
|
};
|
29
36
|
}
|
30
|
-
exports.
|
37
|
+
exports.createFileSystemInterfaceFromFsComponent = createFileSystemInterfaceFromFsComponent;
|
@@ -29,7 +29,7 @@ const rpc_1 = require("@dcl/rpc");
|
|
29
29
|
const codegen = __importStar(require("@dcl/rpc/dist/codegen"));
|
30
30
|
const fs_1 = require("./fs");
|
31
31
|
async function createDataLayer({ fs, logger }) {
|
32
|
-
const dataLayerHost = await (0, inspector_1.createDataLayerHost)((0, fs_1.
|
32
|
+
const dataLayerHost = await (0, inspector_1.createDataLayerHost)((0, fs_1.createFileSystemInterfaceFromFsComponent)({ fs }));
|
33
33
|
const context = {
|
34
34
|
dataLayerHost
|
35
35
|
};
|
package/package.json
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
{
|
2
2
|
"name": "@dcl/sdk-commands",
|
3
3
|
"description": "",
|
4
|
-
"version": "7.1.4-
|
4
|
+
"version": "7.1.4-4567379411.commit-066d4ed",
|
5
5
|
"author": "Decentraland",
|
6
6
|
"bin": {
|
7
7
|
"sdk-commands": "./dist/index.js"
|
8
8
|
},
|
9
9
|
"dependencies": {
|
10
10
|
"@dcl/hashing": "1.1.3",
|
11
|
-
"@dcl/inspector": "7.1.4-
|
11
|
+
"@dcl/inspector": "7.1.4-4567379411.commit-066d4ed",
|
12
12
|
"@dcl/linker-dapp": "0.7.0",
|
13
13
|
"@dcl/mini-comms": "1.0.1-20230216163137.commit-a4c75be",
|
14
14
|
"@dcl/protocol": "1.0.0-4493564897.commit-c858f8a",
|
@@ -60,5 +60,5 @@
|
|
60
60
|
"displayName": "SDK",
|
61
61
|
"tsconfig": "./tsconfig.json"
|
62
62
|
},
|
63
|
-
"commit": "
|
63
|
+
"commit": "066d4ed39460adc93eeca9241e8d13724a60a240"
|
64
64
|
}
|