diff --git a/.gitignore b/.gitignore
index 86f13c5..d560b2c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -4,7 +4,7 @@ package-lock.json
yarn.lock
dist/
-docs/typedocs
+packages/core/docs/typedocs
test-results/
*.tsbuildinfo
.vite/
diff --git a/.prettierignore b/.prettierignore
index c907ed1..e8be54f 100644
--- a/.prettierignore
+++ b/.prettierignore
@@ -1,5 +1,5 @@
dist/
node_modules/
test-results/
-docs/typedocs
+packages/core/docs/typedocs
pnpm-lock.yaml
diff --git a/AGENTS.md b/AGENTS.md
index d2eac67..5691312 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -4,13 +4,17 @@ Guidance for coding agents working in this repository.
## What this is
+This is a monorepo containing multiple packages related to 3D asset processing.
+
`@babylonjs/node-assets` is an experimental TypeScript library for reading many 3D source formats and producing web-ready formats. The package targets Node and browser environments and bundles all required converters and compressors.
+`@babylonjs/node-assets-cli` is a command-line interface for building and running pipelines with `@babylonjs/node-assets`.
+
## Getting started
- Read [[CONTRIBUTING.md]] for setup and scripts.
-- Read [[docs/usage.md]] for user-facing behavior contracts.
-- Read [[docs/architecture/index.md]] for intended implementation details and more behavior contracts.
+- Read [[packages/core/docs/usage.md]] for user-facing behavior contracts.
+- Read [[packages/core/docs/basics.md]] and [[packages/core/docs/blocks.md]] for intended implementation details and more behavior contracts.
## Guidelines
@@ -21,7 +25,7 @@ Guidance for coding agents working in this repository.
## Planning
-- To propose a feature, first update or add the smallest task-focused guide, section, or note in [[docs/usage.md]].
+- To propose a feature, first update or add the smallest task-focused guide, section, or note in [[packages/core/docs/usage.md]].
## Style
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index f088fd2..f4863de 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -14,6 +14,15 @@ pnpm install
pnpm build
```
+The `packages/core` workspace contains the `@babylonjs/node-assets` library.
+`packages/cli` contains the command-line package and depends on the core package.
+Build both before running the local CLI:
+
+```sh
+pnpm cli pipeline input.gltf ktx2 draco output.glb
+pnpm cli --help
+```
+
## Scripts
```sh
@@ -22,8 +31,17 @@ pnpm lint:fix # ESLint autofix
pnpm format # Write Prettier formatting
pnpm test # Run Vitest
pnpm test:watch # Run Vitest in watch mode
-pnpm build # Build with Vite and emit dist/
+pnpm build # Build the library, then the CLI
+pnpm build:core # Build only the library into packages/core/dist/
+pnpm cli # Run the built CLI (append pipeline arguments)
pnpm typedocs # Generate the TypeDoc API reference
```
+The shared lint, format, and typecheck commands cover both packages. CLI tests
+live in `tests/e2e/cli.test.ts` and build isolated package fixtures:
+
+```sh
+pnpm test tests/e2e/cli.test.ts
+```
+
Make sure you've run `pnpm lint`, `pnpm test`, and `pnpm build` before opening a pull request.
diff --git a/README.md b/README.md
index 794406d..5625d40 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,6 @@
# Node Assets
-A graph-based system for preparing 3D assets for the web.
+A TypeScript library to help prepare 3D assets for the web.
> **⚠️ Notice:** This package is experimental. API is subject to change and not intended for production use.
diff --git a/eslint.config.mjs b/eslint.config.mjs
index d4d91f2..4a9cbca 100644
--- a/eslint.config.mjs
+++ b/eslint.config.mjs
@@ -63,7 +63,7 @@ const internalNamingPlugin = {
export default tseslint.config(
{
- ignores: ["dist/**", "node_modules/**", "test-results/**", "docs/**", "**/*.md"],
+ ignores: ["**/dist/**", "**/node_modules/**", "test-results/**", "docs/**", "packages/core/docs/typedocs/**", "**/*.md"],
},
js.configs.recommended,
diff --git a/package.json b/package.json
index 3b3a02a..59c066f 100644
--- a/package.json
+++ b/package.json
@@ -1,73 +1,29 @@
{
- "name": "@babylonjs/node-assets",
- "version": "0.1.0",
+ "name": "node-assets-workspace",
+ "private": true,
"license": "Apache-2.0",
- "type": "module",
- "sideEffects": false,
- "main": "./dist/index.js",
- "types": "./dist/index.d.ts",
- "exports": {
- ".": {
- "types": "./dist/index.d.ts",
- "import": "./dist/index.js"
- },
- "./package.json": "./package.json"
- },
- "files": [
- "dist"
- ],
- "keywords": [
- "babylon",
- "babylonjs",
- "3d",
- "gltf",
- "glb",
- "asset-pipeline",
- "draco",
- "meshopt",
- "ktx2"
- ],
- "repository": {
- "type": "git",
- "url": "git+https://github.com/BabylonJS/Node-Assets.git"
- },
- "bugs": {
- "url": "https://github.com/BabylonJS/Node-Assets/issues"
- },
- "homepage": "https://github.com/BabylonJS/Node-Assets#readme",
"engines": {
"node": "^20.19.0 || ^22.13.0 || >=24"
},
"packageManager": "pnpm@11.9.0",
- "publishConfig": {
- "access": "public"
- },
"scripts": {
- "build": "vite build",
+ "build": "pnpm --filter @babylonjs/node-assets build && pnpm --filter @babylonjs/node-assets-cli build",
+ "build:core": "pnpm --filter @babylonjs/node-assets build",
+ "cli": "node packages/cli/bin/node-assets.cjs",
"typecheck": "tsc -p tsconfig.json --noEmit",
"lint": "eslint . && pnpm typecheck",
"lint:fix": "eslint . --fix",
- "format": "prettier --write \"src/**/*.ts\" \"tests/**/*.ts\" \"*.config.ts\" \"*.config.mjs\"",
- "format:check": "prettier --check \"src/**/*.ts\" \"tests/**/*.ts\" \"*.config.ts\" \"*.config.mjs\"",
+ "format": "prettier --write \"packages/**/*.{ts,cjs}\" \"tests/**/*.ts\" \"*.config.ts\" \"*.config.mjs\"",
+ "format:check": "prettier --check \"packages/**/*.{ts,cjs}\" \"tests/**/*.ts\" \"*.config.ts\" \"*.config.mjs\"",
"test": "vitest run",
"test:watch": "vitest",
- "typedocs": "typedoc"
- },
- "dependencies": {
- "@babylonjs/core": "^9.21.2",
- "@babylonjs/loaders": "^9.21.2",
- "@babylonjs/serializers": "^9.21.2",
- "@gltf-transform/core": "4.5.0",
- "@gltf-transform/extensions": "4.5.0",
- "@gltf-transform/functions": "4.5.0",
- "@types/draco3dgltf": "1.4.3",
- "babylonpress-ktx2-encoder": "0.6.0",
- "draco3dgltf": "1.5.7",
- "meshoptimizer": "1.2.0",
- "sharp": "0.35.4"
+ "typedocs": "pnpm --filter @babylonjs/node-assets typedocs"
},
"devDependencies": {
+ "@babylonjs/node-assets": "workspace:*",
"@eslint/js": "^10.0.1",
+ "@gltf-transform/core": "4.5.0",
+ "@gltf-transform/extensions": "4.5.0",
"@types/node": "^26.1.1",
"eslint": "^10.7.0",
"eslint-config-prettier": "^10.1.8",
diff --git a/packages/cli/README.md b/packages/cli/README.md
new file mode 100644
index 0000000..a6e5f75
--- /dev/null
+++ b/packages/cli/README.md
@@ -0,0 +1,43 @@
+# Node Assets CLI
+
+A command-line interface for building and running pipelines with `@babylonjs/node-assets`.
+
+> **⚠️ Notice:** This package is experimental. API is subject to change and not intended for production use.
+
+## Usage
+
+### Pipelines
+
+A pipeline is a sequence of operations applied to a 3D asset. The CLI allows you to define and run pipelines using the `node-assets pipeline` command.
+
+```sh
+node-assets pipeline input.gltf output.glb
+node-assets pipeline input.glb ktx2 draco output.glb
+```
+
+The command syntax is:
+
+```text
+node-assets pipeline [operation...]