docs(contributing): yarn link instead of yalc

This commit is contained in:
dannyrb 2019-09-05 22:27:01 -04:00
parent 9120db49f1
commit 373b01ac50
2 changed files with 37 additions and 41 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 422 KiB

View File

@ -1,26 +1,47 @@
# Contributing # Contributing
## I would like to contribute code - how do I do this? ## How can I help?
Fork the repository, make your change and submit a pull request. Fork the repository, make your change and submit a pull request. If you would
like to discuss the changes you intend to make to clarify where or how they
should be implemented, please don't hesitate to create a new issue. At a
minimum, you may want to read the following documentation:
- The OHIF Viewer consists of code from three different repositories. Make sure - [Essentials: Getting Started](./essentials/getting-started.md)
your change is modifying the appropriate one: - [Advanced: Architecture](./advanced/architecture.md)
- `ohif-core`: Business Logic
- `react-viewerbase`: Reusable React Component Library
- `Viewers`: The glue, PWA, and primary extension point
- At a minimum, you may want to read the following documentation:
- [Essentials: Getting Started](./essentials/getting-started.md)
- [Advanced: Architecture](./advanced/architecture.md)
### When changes impact multiple repositories ### When changes impact multiple repositories
This is a particularly tricky scenario. We don't want to publish code in one While this can be tricky, we've tried to reduce how often this situation crops
repository, just so we can test and complete the other half of its requirements up this with our [recent switch to a monorepo][monorepo]. Our maintained
in another. Thankfully, there are a couple of ways you can test unpublished extensions, ui components, internationalization library, and business logic can
dependent changes locally before publishing: all be developed by simply running `yarn run dev` from the repository root.
- [Use `yarn link`](https://yarnpkg.com/en/docs/cli/link) Testing the viewer with locally developed, unpublished package changes from a
package outside of the monorepo is most common with extension development. Let's
demonstrate how to accomplish this with two commonly forked extension
dependencies:
#### `cornerstone-tools`
On your local file system:
```bash
# code/my-projects/
.
├── cornerstonejs/cornerstone-tools
└── ohif/viewers
```
- Open a terminal/shell
- Navigate to `cornerstonejs/cornerstone-tools`
- `npm install`
- [`yarn link`](https://yarnpkg.com/en/docs/cli/link)
- `npm run dev`
- Navigate to `ohif/viewers`.
- `yarn install`
- [`yarn link cornerstone-tools`](https://yarnpkg.com/en/docs/cli/link)
- `yarn run dev`
For example if you are working on `ohif-core` and would like to use your local For example if you are working on `ohif-core` and would like to use your local
version to debug a problem in `Viewers`, simply run yarn link inside of the version to debug a problem in `Viewers`, simply run yarn link inside of the
@ -29,30 +50,6 @@ version to debug a problem in `Viewers`, simply run yarn link inside of the
- If you're experiencing issues with `yarn link`, - If you're experiencing issues with `yarn link`,
[try `yalc`](https://github.com/whitecolor/yalc) [try `yalc`](https://github.com/whitecolor/yalc)
Yalc provides an improved workflow as we add more and more dependent packages
that are "in-progress". This comes into play as we begin working on extensions
and their dependencies.
```js
// Install yalc for the first time
yarn global add yalc
// EXAMPLE: using an in-development version of ohif-core w/ Viewers locally
// 1. Navigate to ohif-core's project root
yarn install
yalc publish
// 2. Run the following after each change to ohif-core
yarn build
yalc push .
// 3. Use the local package in our Viewers project. Navigate to the Viewers
// Project root.
yarn install
yalc add ohif-core
yarn run dev
```
## Any guidance on submitting changes? ## Any guidance on submitting changes?
While we do appreciate code contributions, triaging and integrating contributed While we do appreciate code contributions, triaging and integrating contributed
@ -96,8 +93,7 @@ https://deploy-preview-237--ohif.netlify.com/contributing.html
--> -->
<!-- prettier-ignore-start --> <!-- prettier-ignore-start -->
[example-url]: https://deploy-preview-237--ohif.netlify.com/viewer/?url=https://s3.eu-central-1.amazonaws.com/ohif-viewer/sampleDICOM.json [example-url]: https://deploy-preview-237--ohif.netlify.com/viewer/?url=https://s3.eu-central-1.amazonaws.com/ohif-viewer/sampleDICOM.json
[pr-237]: https://github.com/OHIF/Viewers/pull/237 [pr-237]: https://github.com/OHIF/Viewers/pull/237
[monorepo]: https://github.com/OHIF/Viewers/issues/768
<!-- prettier-ignore-end --> <!-- prettier-ignore-end -->