Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix example #66

Merged
merged 2 commits into from
Oct 10, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions codecov.yaml
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
ignore:
- */test/*
- crates/wasm/*
98 changes: 0 additions & 98 deletions crates/wasm/examples/graph/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,6 @@ console.log(`root id after "mkdir -p /pictures/cats": ${rootDir.getId()}`);

var tree = await draw(rootDir, store);

// ------------------------------------------------------------------------------
// mkdir -p /pictures/dogs
// ------------------------------------------------------------------------------

var { rootDir } = await rootDir.mkdir(["pictures", "dogs"], time, store);

console.log(`root id after "mkdir -p /pictures/dogs": ${rootDir.getId()}`);

var tree = await draw(rootDir, store, tree);

//------------------------------------------------------------------------------
// mkdir -p /videos/dogs
//------------------------------------------------------------------------------
Expand All @@ -50,91 +40,3 @@ var { rootDir } = await rootDir.mkdir(["videos", "dogs"], time, store);
console.log(`root id after "mkdir -p /videos/dogs": ${rootDir.getId()}`);

var tree = await draw(rootDir, store, tree);

//------------------------------------------------------------------------------
// echo '...' >> /videos/dogs/puppy.mp4
//------------------------------------------------------------------------------

var { rootDir } = await rootDir.write(
["videos", "dogs", "puppy.mp4"],
sampleCID,
time,
store
);

console.log(
`root id after "echo '...' >> /videos/dogs/puppy.mp4": ${rootDir.getId()}`
);

var tree = await draw(rootDir, store, tree);

//------------------------------------------------------------------------------
// echo '...' >> /pictures/cats/kitten.png
//------------------------------------------------------------------------------

var { rootDir } = await rootDir.write(
["pictures", "cats", "kitten.png"],
sampleCID,
time,
store
);

console.log(
`root id after "echo '...' >> /pictures/cats/kitten.png": ${rootDir.getId()}`
);

var tree = await draw(rootDir, store, tree);

//------------------------------------------------------------------------------
// mkdir -p /music/rock
//------------------------------------------------------------------------------

var { rootDir } = await rootDir.mkdir(["music", "rock"], time, store);

console.log(`root id after "mkdir -p /music/rock": ${rootDir.getId()}`);

var tree = await draw(rootDir, store, tree);

//------------------------------------------------------------------------------
// echo '...' >> /music/rock/toxicity.mp3
//------------------------------------------------------------------------------

var { rootDir } = await rootDir.write(
["music", "rock", "toxicity.mp3"],
sampleCID,
time,
store
);

console.log(
`root id after "echo '...' >> /music/rock/toxicity.mp3": ${rootDir.getId()}`
);

var tree = await draw(rootDir, store, tree);

//------------------------------------------------------------------------------
// rm /pictures/cats/kitten.png
//------------------------------------------------------------------------------

var { rootDir } = await rootDir.rm(["pictures", "cats", "kitten.png"], store);

console.log(`root id after "rm /pictures/cats/kitten.png": ${rootDir.getId()}`);

var tree = await draw(rootDir, store, tree);

//------------------------------------------------------------------------------
// echo '...' >> /movies/anime/ghibli/ponyo.mov
//------------------------------------------------------------------------------

var { rootDir } = await rootDir.write(
["movies", "anime", "ghibli", "ponyo.mov"],
sampleCID,
time,
store
);

console.log(
`root id after "echo '...' >> /movies/anime/ghibli/ponyo.mov": ${rootDir.getId()}`
);

var tree = await draw(rootDir, store, tree);
7 changes: 5 additions & 2 deletions crates/wasm/examples/graph/src/tree.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,14 @@ export class Tree {
async getChildrenForVertex(vertex: Vertex): Promise<Vertex[]> {
if (vertex.node && vertex.node.isDir()) {
const dir = vertex.node.asDir();
const { result }: { result: string[] } = await dir.ls([], this.store);
const { result }: { result: { name: string }[] } = await dir.ls(
[],
this.store
);

if (result.length > 0) {
const children: Vertex[] = [];
for (let name of result) {
for (let { name } of result) {
const node: PublicNode = await dir.lookupNode(name, this.store);
children.push(new Vertex(name, node, vertex, this, vertex.rootDir));
}
Expand Down
4 changes: 0 additions & 4 deletions crates/wasm/examples/graph/webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
const path = require("path");
const HtmlWebpackPlugin = require("html-webpack-plugin");
const webpack = require("webpack");
const WasmPackPlugin = require("@wasm-tool/wasm-pack-plugin");

Expand Down Expand Up @@ -29,9 +28,6 @@ module.exports = {
],
},
plugins: [
new HtmlWebpackPlugin({
template: "index.html",
}),
new WasmPackPlugin({
crateDirectory: path.resolve(__dirname, "../.."),
}),
Expand Down