bonfirelink / websites

bonfire.link websites monorepo
MIT License
0 stars 2 forks source link

Maybe decouple global package.json file #23

Open OmeGak opened 4 years ago

OmeGak commented 4 years ago

This is clearly early optimization and not necessary at the moment, but I've been thinking about it and I prefer to dump my thoughts and leads here.

All sites share the same package.json file at the moment. This makes sense, since all sites use the same npm scripts and depend on the same devPackages. With #22, however, one site will need a prod package that the other doesn't. This, however, is not really a problem. Packages won't be bundled by WebPack unless they are explicitly imported when processing JS files.

In case this becomes really necessary at some point, there are two strategies we can take:

  1. Each site maintains its own package.json. While trivial to implement, it will lead to divergencies between sites. Not only in prod and dev packages that we may want to have available in all sites, but also in npm scripts.
  2. Using hierarchical package.json. Ideal, as we could define common properties in one file and extend from it. Unfortunately, npm doesn't support this and we would need to use another tool like dry or builder (system dependency).