diff --git a/docs/latest/contributing/index.md b/docs/latest/contributing/index.md index 0887a5ff8..5dfc5698c 100644 --- a/docs/latest/contributing/index.md +++ b/docs/latest/contributing/index.md @@ -10,7 +10,15 @@ 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 +Pull requests that are: + +- Small +- [Well tested](./testing.md) +- Decoupled + +Are much more likely to get reviewed and merged in a timely manner. + +## When changes impact multiple repositories While this can be tricky, we've tried to reduce how often this situation crops up this with our [recent switch to a monorepo][monorepo]. Our maintained @@ -22,7 +30,7 @@ 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` +### `cornerstone-tools` On your local file system: @@ -47,7 +55,12 @@ On your local file system: As you make changed to `cornerstone-tools`, and it's output is rebuilt, you should see the following behavior: - +
+ + Example of linked cornerstone-tools package + +
example of linked cornerstone-tools package
+
If you wish to stop using your local package, run the following commands in the `ohif/viewers` repository root: @@ -55,9 +68,27 @@ If you wish to stop using your local package, run the following commands in the - `yarn unlink cornerstone-tools` - `yarn install --force` -#### `react-vtkjs-viewport` +### `react-vtkjs-viewport` -... +On your local file system: + +```bash +# code/my-projects/ +. +├── ohif/react-vtkjs-viewport +└── ohif/viewers +``` + +- Open a terminal/shell +- Navigate to `ohif/react-vtkjs-viewport` + - `yarn install` + - [`yarn link`](https://yarnpkg.com/en/docs/cli/link) + - `yarn run start` +- Open a new terminal/shell +- Navigate to `ohif/viewers`. + - `yarn install` + - [`yarn link react-vtkjs-viewport`](https://yarnpkg.com/en/docs/cli/link) + - `yarn run dev` #### Other linkage notes diff --git a/docs/latest/deployment/recipes/build-for-production.md b/docs/latest/deployment/recipes/build-for-production.md index 1b9c43b94..aa96e584b 100644 --- a/docs/latest/deployment/recipes/build-for-production.md +++ b/docs/latest/deployment/recipes/build-for-production.md @@ -19,9 +19,6 @@ _With Git:_ ```bash # Clone the remote repository to your local machine git clone https://github.com/OHIF/Viewers.git - -# Make sure the local code reflects the `react` version of the OHIF Viewer -git checkout react ``` More on: _[`git clone`](https://git-scm.com/docs/git-clone), @@ -29,7 +26,7 @@ More on: _[`git clone`](https://git-scm.com/docs/git-clone), _From .zip:_ -[OHIF/Viewers: react.zip](https://github.com/OHIF/Viewers/archive/react.zip) +[OHIF/Viewers: react.zip](https://github.com/OHIF/Viewers/archive/master.zip) ### Restore Dependencies & Build @@ -37,20 +34,24 @@ Open your terminal, and navigate to the directory containing the source files. Next run these commands: ```js +// If you haven't already, enable yarn workspaces +yarn config set workspaces-experimental true + // Restore dependencies yarn install // Build source code for production -yarn run build:web +yarn run build ``` -If everything worked as expected, you should have a new `build/` directory in -the project's folder. It should roughly resemble the following: +If everything worked as expected, you should have a new `dist/` directory in the +project's folder. It should roughly resemble the following: ```bash -build -├── config/ -├── static/ +dist/ +├── app-config.js +├── app.bundle.js +├── app.css ├── index.html ├── manifest.json ├── service-worker.js @@ -64,60 +65,15 @@ how to configure the project for your own imaging archive below. ### Configuration -> This step assumes you have an imaging archive. If you need assistance setting -> one up, check out the [`Data Source` Guide](./../../essentials/data-source.md) -> or a deployment recipe that contains an open source Image Archive +The configuration for our viewer is in the `platform/viewer/public/config` +directory. Our build process knows which configuration file to use based on the +`APP_CONFIG` environment variable. By default, its value is +[`config/default.js`][default-config]. The majority of the viewer's features, +and registered extension's features, are configured using this file. -#### How it Works - -The configuration for our project is in the `/public/config` directory. Our -build process knows which configuration file to use based on the `APP_CONFIG` -environment variable. By default, its value is -[`default.js`](https://github.com/OHIF/Viewers/blob/master/platform/viewer/public/config/default.js). -When we build, the `%APP_CONFIG%` value in -our[`/public/index.html`](https://github.com/OHIF/Viewers/blob/master/platform/viewer/public/index.html) -file is substituted for the correct configuration file's name. This sets -the`window.config` equal to our configuration file's value. - -#### How do I configure my project? - -The simplest way is to update the existing default config: - -_/public/config/default.js_ - -```js -window.config = { - routerBasename: '/', - servers: { - dicomWeb: [ - { - name: 'DCM4CHEE', - wadoUriRoot: 'https://server.dcmjs.org/dcm4chee-arc/aets/DCM4CHEE/wado', - qidoRoot: 'https://server.dcmjs.org/dcm4chee-arc/aets/DCM4CHEE/rs', - wadoRoot: 'https://server.dcmjs.org/dcm4chee-arc/aets/DCM4CHEE/rs', - qidoSupportsIncludeField: true, - imageRendering: 'wadors', - thumbnailRendering: 'wadors', - requestOptions: { - requestFromBrowser: true, - }, - }, - ], - }, -}; -``` - -You can also create a new config file and specify its path relative to the build -output's root by setting the `APP_CONFIG` environment variable. You can set the -value of this environment variable a few different ways: - -- [Add a temporary environment variable in your shell](https://facebook.github.io/create-react-app/docs/adding-custom-environment-variables#adding-temporary-environment-variables-in-your-shell) -- [Add environment specific variables in `.env` file(s)](https://facebook.github.io/create-react-app/docs/adding-custom-environment-variables#adding-development-environment-variables-in-env) -- Using the `cross-env` package in an npm script: - - `"build": "cross-env APP_CONFIG=config/my-config.js react-scripts build"` - -After updating the configuration, `yarn run build:web` to generate updated build -output. +The easiest way to apply your own configuration is to modify the `default.js` +file. For more advanced cofiguration options, check out our +[configuration essentials guide](/essentials/configuration.md). ## Next Steps @@ -141,7 +97,7 @@ _Advanced_ ### Testing Build Output Locally A quick way to test your build output locally is to spin up a small webserver. -You can do this by running the following commands in the `build/` output +You can do this by running the following commands in the `dist/` output directory: ```js @@ -162,8 +118,7 @@ web application. For a starting point, check out this repository's own use of: - [CircleCI][circleci]: [config.yaml][circleci-config] - [Netlify][netlify]: [netlify.toml][netlify.toml] | - [generateStaticSite.sh][generatestaticsite.sh] -- [Semantic-Release][semantic-release]: [.releaserc][releaserc] + [build-deploy-preview.sh][build-deploy-preview.sh] ## Troubleshooting @@ -173,10 +128,8 @@ web application. For a starting point, check out this repository's own use of: [circleci]: https://circleci.com/gh/OHIF/Viewers -[circleci-config]: https://github.com/OHIF/Viewers/blob/react/.circleci/config.yml +[circleci-config]: https://github.com/OHIF/Viewers/blob/master/.circleci/config.yml [netlify]: https://app.netlify.com/sites/ohif/deploys -[netlify.toml]: https://github.com/OHIF/Viewers/blob/react/netlify.toml -[generateStaticSite.sh]: https://github.com/OHIF/Viewers/blob/react/generateStaticSite.sh -[semantic-release]: https://semantic-release.gitbook.io/semantic-release/ -[releaserc]: https://github.com/OHIF/Viewers/blob/react/.releaserc +[netlify.toml]: https://github.com/OHIF/Viewers/blob/master/netlify.toml +[build-deploy-preview.sh]: https://github.com/OHIF/Viewers/blob/master/.netlify/build-deploy-preview.sh diff --git a/package.json b/package.json index 6c1264278..361fd8123 100644 --- a/package.json +++ b/package.json @@ -28,7 +28,8 @@ "docs:publish": "chmod +x ./build-and-publish-docs.sh && ./build-and-publish-docs.sh", "release": "yarn run lerna:version && yarn run lerna:publish", "lerna:version": "npx lerna version prerelease --force-publish", - "lerna:publish": "lerna publish from-package --canary --dist-tag canary" + "lerna:publish": "lerna publish from-package --canary --dist-tag canary", + "link-list": "npm ls --depth=0 --link=true" }, "dependencies": { "@babel/runtime": "^7.5.5", diff --git a/platform/viewer/package.json b/platform/viewer/package.json index a39ae53b5..13af0acf5 100644 --- a/platform/viewer/package.json +++ b/platform/viewer/package.json @@ -28,7 +28,8 @@ "start": "yarn run dev", "test:e2e": "cypress open", "test:unit": "jest --watchAll", - "test:unit:ci": "jest --ci --runInBand --collectCoverage" + "test:unit:ci": "jest --ci --runInBand --collectCoverage", + "prepublishOnly": "yarn run build:package" }, "files": [ "dist",