-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e7e759e
commit c03aa0b
Showing
16 changed files
with
135 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,16 @@ | ||
|
||
# Inspector | ||
|
||
## Developing | ||
Run `npm start` to spawn esbuild in `watch` mode. This serves the `public/` folder, every change triggers rebuilding the `bundle.js` and you'll need refresh the page. The server created is in `localhost:8000` by default, an initial message is printed but it probably quickly missed. | ||
## Development | ||
Run `npm start` to spawn esbuild in `watch` mode. This serves the `public/` folder, every change triggers rebuilding the `bundle.js` and you'll need refresh the page. The server created is in `localhost:8000` by default, an initial message is printed but it probably quickly missed. | ||
|
||
This also rebuilds the library section (data-layer) and exposes in `dist/` folder. | ||
|
||
### Running with data-layer | ||
For faster development experience, we are faking the file system for the data-layer, if you want to use your actual file-system, you can either: | ||
|
||
* Run the extension from VSCode on a scene | ||
* Run `sdk-commands start -- --data-layer --port 8001` in a scene & go to http://localhost:8000/?ws=ws://127.0.0.1:8001/data-layer | ||
|
||
## Build | ||
The `make build ` in the repo root builds all the necessary for package publishment. | ||
The `make build ` in the repo root builds all the necessary for package publishment. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 24 additions & 3 deletions
27
packages/@dcl/inspector/src/lib/data-layer/host/fs-utils.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,45 @@ | ||
import { FileSystemInterface } from '../types' | ||
|
||
export async function getFilesInDirectory( | ||
fileSystem: FileSystemInterface, | ||
fs: FileSystemInterface, | ||
dirPath: string, | ||
files: string[], | ||
recursive: boolean = true, | ||
ignore: string[] = [] // This functionality can be extended, now only 'absolute' path can be ignored | ||
) { | ||
const currentDirFiles = await fileSystem.readdir(dirPath) | ||
const currentDirFiles = await fs.readdir(dirPath) | ||
for (const currentPath of currentDirFiles) { | ||
if (ignore.includes(currentPath.name)) continue | ||
|
||
const slashIfRequire = (dirPath.length && !dirPath.endsWith('/') && '/') || '' | ||
const fullPath = dirPath + slashIfRequire + currentPath.name | ||
|
||
if (currentPath.isDirectory && recursive) { | ||
await getFilesInDirectory(fileSystem, fullPath, files, recursive) | ||
await getFilesInDirectory(fs, fullPath, files, recursive) | ||
} else { | ||
files.push(fullPath) | ||
} | ||
} | ||
return files | ||
} | ||
|
||
export const DIRECTORY = { | ||
ASSETS: 'assets' | ||
} | ||
|
||
export function createAssetsFs(fs: FileSystemInterface): FileSystemInterface { | ||
const ASSETS_PATH = DIRECTORY.ASSETS | ||
|
||
function withAssetDir(filePath: string = '') { | ||
return `${ASSETS_PATH}/${filePath}` | ||
} | ||
|
||
return { | ||
existFile: (filePath: string) => fs.existFile(withAssetDir(filePath)), | ||
readFile: (filePath: string) => fs.readFile(withAssetDir(filePath)), | ||
writeFile: (filePath: string, content: Buffer) => fs.writeFile(withAssetDir(filePath), content), | ||
readdir: (filePath: string) => fs.readdir(withAssetDir(filePath)), | ||
rm: (filePath: string) => fs.rm(withAssetDir(filePath)), | ||
cwd: async () => `${(await fs.cwd())}/${ASSETS_PATH}` | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.