Skip to content

Migrating packages to monorepo

Tomasz Pluskiewicz edited this page Aug 1, 2023 · 9 revisions

The process of integrating barnard packages to the monorepo is simple

For a hypothetical package barnard59-foobar

  1. Install filter-repo
  2. Fresh-clone the original repository (assuming /path/to/barnard59-foobar)
  3. Use it to rewrite history by moving all sources to package/foobar and renaming tags
    git filter-repo --to-subdirectory-filter packages/foobar --tag-rename v:barnard59-foobar@ --force
    
  4. Remove unwanted files. At least .github, yarn.lock/package-lock.json
  5. Adjust package.json. Typically all it takes is to remove some dev dependencies and shared config (lint-staged, etc), and correct metadata
  6. Commit
  7. Merge into a branch of barnard59
    git checkout -b migrate-foobar
    git remote add foobar /path/to/barnard59-foobar
    git fetch foobar
    git merge foobar/master --allow-unrelated-histories
    npm i
    
  8. npm run lint -- --fix
  9. Ensure npm run test succeeds
  10. Add package to test matrix
  11. Add package to README
  12. git push --follow-tags
  13. Create PR
  14. Transfer open issues
  15. Change the README to link to monorepo
  16. Archive original repo
Clone this wiki locally