beamer-bridge / beamer

Beamer - Bridging rollups with L1 inherited security
https://beamerbridge.com
MIT License
44 stars 21 forks source link

chore: Use workspaces feature for our JS packages #1292

Open manuelwedler opened 1 year ago

manuelwedler commented 1 year ago

Rationale

We started to have multiple JS packages in our project: frontend, relayer, subgraph. Besides, we have dependencies on the top level package.json that are only meant to be used with the contracts.

The benefits of workspaces are: This will allow installing the dependencies of all of our JS packages by one command. Yarn will automatically enhance the installation and make it more performant. Commands can be run from the top level of our project folder. We will have only one lockfile.

Implementation

See this: https://classic.yarnpkg.com/lang/en/docs/workspaces/

Btw this npm preinstall script on the top-level package.json should prevent the usage of npm in our setup: "preinstall": "npx only-allow yarn"

Additionally, I would like to see moving the linting / formatting dependencies of the contracts inside its own package.json inside the contracts folder. npm scripts should be added for running it. These scripts should be referenced in the makefile. Adds another layer, but that's a proper setup of JS dependencies. If a change on the linting / formatting command has to be made, it should be done in the package.json.

Another addition, the pkg build of the relayer should also be an npm script and not be inside the makefile.

GabrielBuragev commented 1 year ago

Me like this. Lets look into it as a part of the "technical debt" phase next month.