-
Notifications
You must be signed in to change notification settings - Fork 28
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
workspaces with vite for demo running, and rollup for module building #147
Conversation
Do we need the |
@@ -34,9 +34,9 @@ | |||
"watch": "preconstruct watch", | |||
"start": "yarn workspace @behave-graph/examples start", | |||
"build-examples": "yarn workspace @behave-graph/examples build", | |||
"lint": "npx eslint \"src/**/*.{ts,json}\"", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks! this was on my mental todo
I did some more work in this branch here: Currently issues:
I know how to solve the second error. It was just me changing node type names -- which is a separate issue. But the first issue with the exec-graph example not working, I am less sure how to fix. Off to bed for this evening. |
Moved them back into the `lib` folder, but now they are separate entry points that can be called directly. in reality export-node-spec should not be called on its own
Ok after a lot of trying of difference approaches, I've fixed this issue:
I tried many things - the ideal solution would just to be able to have an This seems like the best solution and it works as of now. One issue - when running |
iterations: string | ||
}; | ||
|
||
function execGraph({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just a minor refactoring - in case we want to just export this function and call it directly from the outside world
"preconstruct": { | ||
"entrypoints": [ | ||
"index.ts", | ||
"exec-graph.ts", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2 new entrypoints so that these scripts are built, and we can call them directly
@@ -42,6 +42,9 @@ | |||
"author": "", | |||
"license": "ISC", | |||
"dependencies": { | |||
"commander": "^9.4.1", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
these had to be moved into main dependencies for the build
step to work
"export-node-spec": "npm run build && node --enable-source-maps ./dist/examples/export-node-spec/index.js" | ||
"prepare": "yarn export-node-spec", | ||
"exec-graph": "yarn workspace behave-graph exec-graph", | ||
"export-node-spec": "yarn build && yarn workspace behave-graph export-node-spec" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
building where will build all the entrypoints within lib, allowing their individual 'dists' to be called
fixed the three demo
thank you! Merged in! |
awesome thank you!!! |
This PR breaks up the
examples
folder from thelib
folder into separate workspaces, thus removing the dependency of three.js from the corelib
and reducing its bundle size, and enablingexamples
to more freely import other dependencies that are not needed by the corelib
, such asreact
, or@react-three/fiber
.Addresses #128
It takes inspiration from the workspace setup of react-three-fiber.
import { Vec3 } from
behave-graph`rollup
andbabel
- this also generates nice source maps which i don't believe exist in the current build (I'm currently unable to step into code from the lib in chrome debugger when importing it from another app)Now,
examples
can importbehave-graph
code the 'normal' way (not by relative path), enabling the code to be copied and pasted more easily to those who want to do their own modifications on it:Example code before:
After:
Main organizational changes:
/lib
folder for the core package - maybe this can be eventually put intopackaages/core
src/lib
->lib/src
src/graphs ->
lib/graph`src/examples ->
examples/src`package.json
tolib
- this is the core lib package.json, and nowbehave-graph
is the package name in there - should it be? Or should we do something like@behave-graph/core
Still todo:
export-node-spec
script