tutorbookapp / old-tutorbook

Source available code for Tutorbook's progressive web app (PWA).
https://tutorbook.app
Other
13 stars 10 forks source link

Configure deps better using Lerna #261

Open nicholaschiang opened 4 years ago

nicholaschiang commented 4 years ago

Right now we have some dependencies that are shared across sub-packages contained in the package.json in their top level directories (e.g. firebase is listed as a dependency in the package.json in src/app and in src/site).

We want to move everything to each sub-package (i.e. duplicate dependencies that are hoisted automatically with Lerna). See Lerna's best practices for more information.

One way to test if you've successfully completed what I want here is to remove all of our node_modules directories and run one lerna bootstrap. That should install everything you need to build (minus perhaps some devDependencies that should be specified in a top-level package.json).

Also note that this gets a little bit more difficult with David because we want to be able to track that all of our deps are up to date (in every sub-package).

OrkhanHuseynli commented 4 years ago

@nicholaschiang you want to get rid off common "package.json" ?

nicholaschiang commented 4 years ago

Yup @OrkhanHuseynli! We want to get rid of all the dependencies in the common package.json but we'll have to keep the devDependencies to support webpack and such.

OrkhanHuseynli commented 4 years ago

@nicholaschiang to clarify : are we talking about "tutorbook/package.json"?

nicholaschiang commented 4 years ago

@OrkhanHuseynli The tutorbook/package.json file is just a copy of the src/app/package.json (for David's nice README badge). The idea here is to move all of our deps to the individual sub-package package.json files and then to somehow automatically aggregate those deps into one root package.json that is only used for our README badge.

Does that make sense?

OrkhanHuseynli commented 4 years ago

@nicholaschiang hmm..... when you say individual, do you mean move from src/app/package.json to (for instance) src/app/ads/package.json src/app/analytics/package.json and so on

by aggregate you mean, copy deps defined in packages.json to the common package.json? or to copy installed node packages in each package to the common node_packages?

nicholaschiang commented 4 years ago

Yup, for individual you're correct!

But for aggregate, we want the first option you described:

by aggregate you mean, copy deps defined in packages.json to the common package.json?

Because the only point of that file is to check if all of our deps are up to date.

Also, Lerna can automatically hoist shared dependencies to a top-level node_modules folder by running:

$ lerna bootstrap --hoist
OrkhanHuseynli commented 4 years ago

@nicholaschiang thanks I will take a look tomorrow, as it is a late night already in Prague. I put this task to To-Do list, just in case if someone can pick this up and fix quickly in Americas