{"id":13621662,"url":"https://github.com/Hy-Vee/lerna-yarn-workspaces-monorepo","last_synced_at":"2025-04-15T01:33:36.248Z","repository":{"id":35496017,"uuid":"177599327","full_name":"Hy-Vee/lerna-yarn-workspaces-monorepo","owner":"Hy-Vee","description":"🐉 A Monorepo with multiple packages and a shared build, test, and release process.","archived":false,"fork":false,"pushed_at":"2023-01-06T20:57:24.000Z","size":1047,"stargazers_count":265,"open_issues_count":11,"forks_count":43,"subscribers_count":11,"default_branch":"main","last_synced_at":"2024-10-14T22:40:55.154Z","etag":null,"topics":["babel","jest","lerna","monorepo","react","storybook","styled-components","yarn-workspaces"],"latest_commit_sha":null,"homepage":"https://medium.com/hy-vee-engineering/creating-a-monorepo-with-lerna-yarn-workspaces-cf163908965d","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Hy-Vee.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-03-25T14:09:52.000Z","updated_at":"2024-10-10T06:36:44.000Z","dependencies_parsed_at":"2023-01-15T22:15:44.057Z","dependency_job_id":null,"html_url":"https://github.com/Hy-Vee/lerna-yarn-workspaces-monorepo","commit_stats":null,"previous_names":[],"tags_count":2,"template":true,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Hy-Vee%2Flerna-yarn-workspaces-monorepo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Hy-Vee%2Flerna-yarn-workspaces-monorepo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Hy-Vee%2Flerna-yarn-workspaces-monorepo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Hy-Vee%2Flerna-yarn-workspaces-monorepo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Hy-Vee","download_url":"https://codeload.github.com/Hy-Vee/lerna-yarn-workspaces-monorepo/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223472762,"owners_count":17150745,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["babel","jest","lerna","monorepo","react","storybook","styled-components","yarn-workspaces"],"created_at":"2024-08-01T21:01:09.302Z","updated_at":"2024-11-08T08:31:26.653Z","avatar_url":"https://github.com/Hy-Vee.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"# Monorepo with Lerna \u0026 Yarn Workspaces\n\n\u003e A Monorepo with multiple packages and a shared build, test, and release process.\n\nView example ➡️ https://storybook-monorepo.now.sh/\n\n![image](https://user-images.githubusercontent.com/9113740/71946241-d9f43a00-318e-11ea-80c4-72c483b88325.png)\n\n-   🐉 [Lerna](https://lernajs.io/)  - The Monorepo manager\n-   📦 [Yarn Workspaces](https://yarnpkg.com/lang/en/docs/workspaces/)  -  Sane multi-package management\n-   🚀 [React](https://reactjs.org/)  -  JavaScript library for user interfaces\n-   💅 [styled-components](https://www.styled-components.com/)  -  CSS in JS elegance\n-   🛠 [Babel](https://babeljs.io/)  -  Compiles next-gen JavaScript\n-   📖 [Storybook](https://storybook.js.org/) - UI Component Environment\n-   🃏 [Jest](https://jestjs.io/)  -  Unit/Snapshot Testing\n\n## Usage\n\n-   `yarn dev` - This starts Storybook for viewing all the components locally.\n-   `yarn bootstrap` - This installs all of the packages and links dependent packages together.\n-   `yarn build` - This babelfies all of the packages and creates `/lib` folders for each one.\n-   `yarn test` - Run all linting and unit tests before committing.\n-   `yarn test -o` - Run only the tests that have changed.\n-   `yarn test -u` - Update all of the snapshot tests.\n\n## Lerna\n\n-   `lerna changed` - Show which packages have changed.\n-   `lerna diff` - Show specifically what files have cause the packages to change.\n\n## Linking\n\nWhen linking inside of the Monorepo, everything works as expected. If you are trying to consume packages from this Monorepo _in a different application_ locally, using `npm link` or `yarn link` [does not work as expected](https://github.com/yarnpkg/yarn/issues/5538). However, we have a workaround for the time being.\n\n1. Run `yarn build`\n1. Run `yarn dev`\n1. Change the `package.json` of the consumer from `$YOUR_PACKAGE_NAME` (which lives inside the monorepo) to `file:./../monorepo/packages/$YOUR_PACKAGE_NAME`\n1. Run `rm -rf node_modules \u0026\u0026 yarn` in the consumer\n1. 🎉\n\n## Contributing\n\nAll formatting and linting should be taken care of for you using [stylelint](https://github.com/stylelint/stylelint), [ESLint](https://eslint.org/), and [Prettier](https://prettier.io/). You should also consider installing an extension for CSS syntax highlighting.\n\n-   [vscode-styled-components](https://marketplace.visualstudio.com/items?itemName=jpoissonnier.vscode-styled-components)\n-   [webstorm-styled-components](https://github.com/styled-components/webstorm-styled-components)\n-   [Other IDEs](https://www.styled-components.com/docs/tooling#syntax-highlighting)\n\n## FAQ\n\n### Why the limitation on yarn versions?\n\n[It's a known issue](https://github.com/yarnpkg/yarn/issues/7807) that yarn workspaces using yarn versions \u003e `1.18.0` can produce the following false positive error message when adding or updating dependencies in packages.\n\n```\nerror An unexpected error occurred: \"expected workspace package to exist for \"XXX\".\n```\n\nTo guard against this, we've:\n\n-   Changed `package.json` to enforce a yarn version range.\n-   Added a `.yvmrc` file, so if you're using [yvm](https://yvm.js.org/docs/overview) to manage your yarn versions (like [nvm](https://github.com/nvm-sh/nvm) for node version), it'll pick up the yarn version automatically.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FHy-Vee%2Flerna-yarn-workspaces-monorepo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FHy-Vee%2Flerna-yarn-workspaces-monorepo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FHy-Vee%2Flerna-yarn-workspaces-monorepo/lists"}