Skip to content

Instantly share code, notes, and snippets.

@mikemaccana
Created September 11, 2017 17:24
Show Gist options
  • Save mikemaccana/0a0812d8c0e015f4107a98f48be1553b to your computer and use it in GitHub Desktop.
Save mikemaccana/0a0812d8c0e015f4107a98f48be1553b to your computer and use it in GitHub Desktop.
Moving to yarn for modules everywhere / monorepo pattern

Moving to yarn for modules everywhere / monorepo pattern

npm/npm#17929 still occurs in npm 5.4.1 - private packages on the local disk are deleted whenever npm is used.

If npm fixes this in future great, but in the meantime, for others having the issue, if you're using monorepo / modules everywhere:

  • Install yarn and run yarn config set workspaces-experimental true

  • Move your private packages to /packages

  • Add a yarn workspace to your package.json with:

     "workspaces": [
       "packages/*"
     ],
    
  • Delete npm-shrinkwrap.js and/or package-lock.json

  • Remove any hacks you were doing to restore the packages deleted by npm in your deploy tools

  • Change npm install to yarn in your deploy tools

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment