chore: cleanup node buildscripts
This commit is contained in:
@@ -1,9 +1,10 @@
|
||||
import { createWasmWrapper } from "@nodarium/utils";
|
||||
import fs from "fs/promises";
|
||||
import path from "path";
|
||||
import { createWasmWrapper } from '@nodarium/utils';
|
||||
import fs from 'fs/promises';
|
||||
import path from 'path';
|
||||
|
||||
export async function getWasm(id: `${string}/${string}/${string}`) {
|
||||
const filePath = path.resolve(`../nodes/${id}/pkg/node.wasm`);
|
||||
const filePath = path.resolve(`./static/nodes/${id}`);
|
||||
console.log({ filePath });
|
||||
|
||||
try {
|
||||
await fs.access(filePath);
|
||||
@@ -36,12 +37,12 @@ export async function getNode(id: `${string}/${string}/${string}`) {
|
||||
}
|
||||
|
||||
export async function getCollectionNodes(userId: `${string}/${string}`) {
|
||||
const nodes = await fs.readdir(path.resolve(`../nodes/${userId}`));
|
||||
const nodes = await fs.readdir(path.resolve(`./static/nodes/${userId}`));
|
||||
return nodes
|
||||
.filter((n) => n !== "pkg" && n !== ".template")
|
||||
.filter((n) => n !== 'pkg' && n !== '.template')
|
||||
.map((n) => {
|
||||
return {
|
||||
id: `${userId}/${n}`,
|
||||
id: `${userId}/${n}`
|
||||
};
|
||||
});
|
||||
}
|
||||
@@ -50,20 +51,20 @@ export async function getCollection(userId: `${string}/${string}`) {
|
||||
const nodes = await getCollectionNodes(userId);
|
||||
return {
|
||||
id: userId,
|
||||
nodes,
|
||||
nodes
|
||||
};
|
||||
}
|
||||
|
||||
export async function getUserCollections(userId: string) {
|
||||
const collections = await fs.readdir(path.resolve(`../nodes/${userId}`));
|
||||
const collections = await fs.readdir(path.resolve(`./static/nodes/${userId}`));
|
||||
return Promise.all(
|
||||
collections.map(async (n) => {
|
||||
const nodes = await getCollectionNodes(`${userId}/${n}`);
|
||||
return {
|
||||
id: `${userId}/${n}`,
|
||||
nodes,
|
||||
nodes
|
||||
};
|
||||
}),
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
@@ -71,20 +72,20 @@ export async function getUser(userId: string) {
|
||||
const collections = await getUserCollections(userId);
|
||||
return {
|
||||
id: userId,
|
||||
collections,
|
||||
collections
|
||||
};
|
||||
}
|
||||
|
||||
export async function getUsers() {
|
||||
const nodes = await fs.readdir(path.resolve("../nodes"));
|
||||
const nodes = await fs.readdir(path.resolve('./static/nodes'));
|
||||
const users = await Promise.all(
|
||||
nodes.map(async (n) => {
|
||||
const collections = await getUserCollections(n);
|
||||
return {
|
||||
id: n,
|
||||
collections,
|
||||
collections
|
||||
};
|
||||
}),
|
||||
})
|
||||
);
|
||||
return users;
|
||||
}
|
||||
|
||||
1
app/static/.gitignore
vendored
Normal file
1
app/static/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
nodes/
|
||||
@@ -1,6 +0,0 @@
|
||||
{
|
||||
"scripts": {
|
||||
"build": "cargo build --target wasm32-unknown-unknown --release && mkdir -p pkg && cp ../../../../target/wasm32-unknown-unknown/release/out.wasm ./pkg/node.wasm",
|
||||
"dev": "cargo watch -s 'wasm-pack build --dev --out-name index --no-default-features'"
|
||||
}
|
||||
}
|
||||
@@ -8,5 +8,5 @@ edition = "2018"
|
||||
crate-type = ["cdylib", "rlib"]
|
||||
|
||||
[dependencies]
|
||||
nodarium_utils = { version = "0.1.0", path = "../../../../packages/utils" }
|
||||
nodarium_macros = { version = "0.1.0", path = "../../../../packages/macros" }
|
||||
nodarium_utils = { version = "0.1.0", path = "../../../../packages/utils" }
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
{
|
||||
"scripts": {
|
||||
"build": "cargo build --target wasm32-unknown-unknown --release && mkdir -p pkg && cp ../../../../target/wasm32-unknown-unknown/release/box.wasm ./pkg/node.wasm",
|
||||
"dev": "cargo watch -s 'wasm-pack build --dev --out-name index --no-default-features'"
|
||||
}
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
{
|
||||
"scripts": {
|
||||
"build": "cargo build --target wasm32-unknown-unknown --release && mkdir -p pkg && cp ../../../../target/wasm32-unknown-unknown/release/branch.wasm ./pkg/node.wasm",
|
||||
"dev": "cargo watch -s 'wasm-pack build --dev --out-name index --no-default-features'"
|
||||
}
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
{
|
||||
"scripts": {
|
||||
"build": "cargo build --target wasm32-unknown-unknown --release && mkdir -p pkg && cp ../../../../target/wasm32-unknown-unknown/release/float.wasm ./pkg/node.wasm",
|
||||
"dev": "cargo watch -s 'wasm-pack build --dev --out-name index --no-default-features'"
|
||||
}
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
{
|
||||
"scripts": {
|
||||
"build": "cargo build --target wasm32-unknown-unknown --release && mkdir -p pkg && cp ../../../../target/wasm32-unknown-unknown/release/gravity.wasm ./pkg/node.wasm",
|
||||
"dev": "cargo watch -s 'wasm-pack build --dev --out-name index --no-default-features'"
|
||||
}
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
{
|
||||
"scripts": {
|
||||
"build": "cargo build --target wasm32-unknown-unknown --release && mkdir -p pkg && cp ../../../../target/wasm32-unknown-unknown/release/instance.wasm ./pkg/node.wasm",
|
||||
"dev": "cargo watch -s 'wasm-pack build --dev --out-name index --no-default-features'"
|
||||
}
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
{
|
||||
"scripts": {
|
||||
"build": "cargo build --target wasm32-unknown-unknown --release && mkdir -p pkg && cp ../../../../target/wasm32-unknown-unknown/release/math.wasm ./pkg/node.wasm",
|
||||
"dev": "cargo watch -s 'wasm-pack build --dev --out-name index --no-default-features'"
|
||||
}
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
{
|
||||
"scripts": {
|
||||
"build": "cargo build --target wasm32-unknown-unknown --release && mkdir -p pkg && cp ../../../../target/wasm32-unknown-unknown/release/noise.wasm ./pkg/node.wasm",
|
||||
"dev": "cargo watch -s 'wasm-pack build --dev --out-name index --no-default-features'"
|
||||
}
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
{
|
||||
"scripts": {
|
||||
"build": "cargo build --target wasm32-unknown-unknown --release && mkdir -p pkg && cp ../../../../target/wasm32-unknown-unknown/release/output.wasm ./pkg/node.wasm",
|
||||
"dev": "cargo watch -s 'wasm-pack build --dev --out-name index --no-default-features'"
|
||||
}
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
{
|
||||
"scripts": {
|
||||
"build": "cargo build --target wasm32-unknown-unknown --release && mkdir -p pkg && cp ../../../../target/wasm32-unknown-unknown/release/random.wasm ./pkg/node.wasm",
|
||||
"dev": "cargo watch -s 'wasm-pack build --dev --out-name index --no-default-features'"
|
||||
}
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
{
|
||||
"scripts": {
|
||||
"build": "cargo build --target wasm32-unknown-unknown --release && mkdir -p pkg && cp ../../../../target/wasm32-unknown-unknown/release/rotate.wasm ./pkg/node.wasm",
|
||||
"dev": "cargo watch -s 'wasm-pack build --dev --out-name index --no-default-features'"
|
||||
}
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
{
|
||||
"scripts": {
|
||||
"build": "cargo build --target wasm32-unknown-unknown --release && mkdir -p pkg && cp ../../../../target/wasm32-unknown-unknown/release/stem.wasm ./pkg/node.wasm",
|
||||
"dev": "cargo watch -s 'wasm-pack build --dev --out-name index --no-default-features'"
|
||||
}
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
{
|
||||
"scripts": {
|
||||
"build": "cargo build --target wasm32-unknown-unknown --release && mkdir -p pkg && cp ../../../../target/wasm32-unknown-unknown/release/triangle.wasm ./pkg/node.wasm",
|
||||
"dev": "cargo watch -s 'wasm-pack build --dev --out-name index --no-default-features'"
|
||||
}
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
{
|
||||
"scripts": {
|
||||
"build": "cargo build --target wasm32-unknown-unknown --release && mkdir -p pkg && cp ../../../../target/wasm32-unknown-unknown/release/vec3.wasm ./pkg/node.wasm",
|
||||
"dev": "cargo watch -s 'wasm-pack build --dev --out-name index --no-default-features'"
|
||||
}
|
||||
}
|
||||
@@ -3,7 +3,7 @@
|
||||
"build": "pnpm build:nodes && pnpm build:app",
|
||||
"build:story": "pnpm -r --filter 'ui' story:build",
|
||||
"build:app": "BASE_PATH=/ui pnpm -r --filter 'ui' build && pnpm -r --filter 'app' build",
|
||||
"build:nodes": "pnpm -r --filter './nodes/**' build",
|
||||
"build:nodes": "cargo build --workspace --target wasm32-unknown-unknown --release && rm -rf ./app/static/nodes/max/plantarium/ && mkdir -p ./app/static/nodes/max/plantarium/ && cp -R ./target/wasm32-unknown-unknown/release/*.wasm ./app/static/nodes/max/plantarium/",
|
||||
"build:deploy": "pnpm build",
|
||||
"dev:all": "pnpm -r dev",
|
||||
"dev:nodes": "pnpm -r --parallel --filter './nodes/**' dev",
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
use nodarium_utils::{
|
||||
geometry::{create_multiple_paths, create_path, wrap_multiple_paths},
|
||||
geometry::{create_multiple_paths, wrap_multiple_paths},
|
||||
split_args,
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user