-
Notifications
You must be signed in to change notification settings - Fork 3
How to install a local version of simularium viewer as a dependency for testing
Sometimes, you want to test out your local changes to simularium-viewer in the context of simularium-website. It's a good idea to do this on a branch that you keep up to date with the main branch so you don't have to revert these changes every time. Here's one way:
- In your local simularium-viewer project folder: run
npm run build
- In your local simularium-website project folder:
- Delete the directory node_modules/@aics/simularium-viewer
- In package.json, replace the version number string for
"@aics/simularium-viewer"
under"dependencies"
with the relative path to your local simularium-viewer folder, e.g., replace"^2.9.5"
with"file:../simularium-viewer"
if simularium-website and simularium-viewer are inside the same parent directory. - In webpack/webpack.config.js, add
path.resolve(__dirname, "../", "../simularium-viewer/style")
to theinclude
array under the first CSS rule. - Run
npm i
thennpm start
.
Now your localhost:9001 will launch simularium-website that runs the version of simularium-viewer that you built in step 1.
While your simularium-website local dev server is running, if you make a change locally in simularium-viewer and run npm run build
there again, theoretically simularium-website should automatically re-build and reload localhost:9001. But sometimes it doesn't automatically update, so it's good to check the source code inside simularium-website/node-modules/@aics/simularium-viewer to make sure the changes are there if something doesn't seem right.
There might be a way better way to do this. If you know one, please feel free to edit this page.