Closed becky-gilbert closed 7 months ago
Latest commit: cc730a22e66831550c0e5e935f8381dd18bb288c
Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.
Click here to learn what changesets are, and how to add one.
Click here if you're a maintainer who wants to add a changeset to this PR
@okaycj when you set this up, were you opening a new terminal for each package and running npm run dev
from each package root? I'm guessing there's no way to run something like npm run dev --workspaces
from the monorepo root, because that would start up the first package server/watch and then just wait. Maybe we could &
the workspace dev
commands somehow, or use concurrently? I might try it... let me know if you think I'm wasting my time 😅
when you set this up, were you opening a new terminal for each package and running
npm run dev
from each package root? I'm guessing there's no way to run something likenpm run dev --workspaces
from the monorepo root, because that would start up the first package server/watch and then just wait. Maybe we could&
the workspacedev
commands somehow, or use concurrently? I might try it... let me know if you think I'm wasting my time 😅
Honcho! https://github.com/nickstenning/honcho
To summarize, you create a file called Procfile
with all the commands you want to run concurrently. Run the command "honcho start" and it does it.
Procfile:
lookit-initjspsych: npm run dev -w @lookit/lookit-initjspsych
lookit-api: npm run dev -w @lookit/lookit-api
lookit-helpers: npm run dev -w @lookit/lookit-helpers
To summarize, you create a file called Procfile with all the commands you want to run concurrently. Run the command "honcho start" and it does it.
Yay! Exactly what I wanted, thanks! Is it ok for me to add this to the readme?
a heads up that I'd like to make these changes.
Again, sorry I missed this. I'll try to be a bit better about it.
This adds
rollup-plugin-serve
as a dev dependency, and uses it in the package's rollup config. This rollup plugin package is used to run a local server for files in the package'sdist
directory, so that during development they can be accessed by our local lookit-api jsPsych study template.This also adds the 'watch' command to rollup (
npm run build
), which rebuilds the rollup bundle files indist
when the source files change.The
rollup-plugin-serve
servers are specific to each package (because they're added to the package's rollup config, rather than configured at the monorepo level). So each package needs a different port, and probably needs each server running in a separate terminal (I'm not entirely sure as I haven't tested this with multiple packages yet). If this is a problem, maybe we could figure out how to use it on the monorepo root level to serve all packagedist
folders, and load multiple package files via urls likehttp://localhost:10001/<packagename>/dist/index.browser.js
.To try this out, on the
add-rollup-plugin-serve
branch:npm install
for whole reponpm run build
in the lookit-initjspsych package (you should see messages in the terminal: "Server listening at http://localhost:10001/" and "waiting for changes...")<script src="http://localhost:10001/index.browser.js"></script>
. Now when you run jsPsych studies through your local lookit site, the study should load your local/dev version of thelookit-initjspsych/dist/index.browser.min.js
file.jsPsych.run
function inlookit-initjspsych/src/index.ts
. You should see in the terminal that, after you make a change to the source file, the rollup re-runs and updates the files indist
.jsPsych.run
is called).