Go to the original repo for its docs – this README just explains the fork.
We use esm.sh to load dependencies for blocks in the demo sandbox, e.g. the Code block.
The code that does this is here.
esm.sh is a great project, but it has some stability issues. Updates occasionally break the packages we are using it to import, which means that the fail to load, breaking both user-facing pages and our CI (which test the block pages).
The code in the repo is built to a Dockerfile and deployed to AWS's ECS.
This process is not automated, instead:
- Build the image
- Test the image locally (see below)
- Tag the image as latest for the relevant repository
- Push it to the repository
- Force a new deployment of the ECS service
To test the built Docker image before deploying:
docker run -p 80:80 bp-esm(you can expose a different port but amend the command below)- Visit
localhostand check you see the homepage - In the
blockprotocolrepo, setESM_CDN_URL="http://localhost"in.env.local - Run
yarn devin theblockprotocolrepo to start the site - Visit a block page and check it works, e.g. http://localhost:3000/@hash/blocks/code
If we want to stick with this approach and need to update this, we should probably:
- Move this config into the
blockprotocolrepo, e.g.- add the Dockerfile and the config.json there
- have the Dockerfile checkout the
esm.shrepo at a specific, known-working tag
- Automate deployment