cfpb / capital-framework

The Consumer Financial Protection Bureau's user interface framework
https://cfpb.github.io/capital-framework/
Creative Commons Zero v1.0 Universal
55 stars 29 forks source link

Add Yarn and Lerna to project, remove CI #885

Closed contolini closed 5 years ago

contolini commented 5 years ago

Adds Lerna for monorepo management and Yarn for it's neato workspaces and caching features.

Check out the contributing docs to see how these changes affect CF development. Spoiler alert: The only thing you'll have to do differently is remember to use yarn instead of npm.

Notable Changes

  1. The src/ directory in the project's root has been renamed to packages/.
  2. All the Travis CI stuff has been removed. We'll manually publish components (which is easy with Lerna) for the time being and we can move the task back into Travis if/when we're ready.
  3. No more npm or package-lock.json. Node modules are cached in the git repo.
  4. No more scary scripts for publishing/linking. Yarn and Lerna do most of it natively.

Testing

  1. Pull down this branch (might take a minute with all the cached packages).
  2. rm -rf node_modules/ to ensure you're starting with a clean slate.
  3. yarn to install (no more npm install)
  4. yarn test to confirm the tests pass as normal.
  5. yarn run cf-link to link all the components
  6. Edit /packages/cf-core/src/cf-vars.less and set the text color on line 13 to something silly like red.
  7. cd ~/wherever/cfgov-refresh
  8. yarn link cf-core
  9. gulp clean && gulp build
  10. Start up cfgov-refresh and open http://0.0.0.0:8000/. Text should now be red, indicating that it's correctly picking up your local version of cf-core.

Unanswered questions

  1. It's currently configured to use fixed versioning. Should we use independent versioning instead? We've been split on this. Let's keep discussing. Update: We discussed this and are happy with fixed versioning.
anselmbradford commented 5 years ago

any testing instructions?

contolini commented 5 years ago

Yeah, I'll paste some here after I do a sanity check on the FEWD bi-weekly.

contolini commented 5 years ago

Hey look, I finally rebased this branch and added testing instructions! Nice job @contolini!

After this is merged I'd like to do a few test patch releases to kick the tires and confirm lerna-changelog works how we expect. I'll record the process and add the video to our docs.

contolini commented 5 years ago

Snyk can be ignored because it's looking for the manifests in /src/ and not /packages/. Once master is updated we'll need to delete and re-add the repo to snyk to have it pick up the new paths.

Scotchester commented 5 years ago

@contolini Can you tell me how to see what the generated changelog will look like?

Scotchester commented 5 years ago

There's a lot of repeated content in each package's meta files (CONTRIBUTING, LICENSE, README, TERMS, etc.). Are those generated from a single source and then checked in in this PR? If not, can they be?

contolini commented 5 years ago

Can you tell me how to see what the generated changelog will look like?

Unfortunately lerna-changelog uses GH PR titles so I haven't been able to test it on this repo until we merge this PR. You can see the format over in bapital's changelog.

There's a lot of repeated content in each package's meta files (CONTRIBUTING, LICENSE, README, TERMS, etc.). Are those generated from a single source and then checked in in this PR? If not, can they be?

This was intentional because I wanted to remove all "magic" from the publishing process. Each package exists in this repo exactly as it does in npm (and thus other project's node_modules/ directories). We rarely, if ever, update the above files so I didn't see it necessary to automate their creation. We can automate it later if it proves to be helpful. We'll likely want to implement other automation steps (like Travis publishing) down the road.