Skip to content

How to install a local version of simularium viewer as a dependency for testing

Megan Riel-Mehan edited this page Jul 2, 2021 · 2 revisions

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:

  1. In your local simularium-viewer project folder: run npm run build
  2. In your local simularium-website project folder:
    1. Delete the directory node_modules/@aics/simularium-viewer
    2. 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.
    3. In webpack/webpack.config.js, add path.resolve(__dirname, "../", "../simularium-viewer/style") to the include array under the first CSS rule.
    4. Run npm i then npm 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.

Clone this wiki locally