Skip to content

Commit

Permalink
Merge pull request #401 from reactioncommerce/docs-kieckhafer-testing…
Browse files Browse the repository at this point in the history
…Locally

docs: how to test component library locally
  • Loading branch information
aldeed authored Mar 5, 2019
2 parents 2624e04 + d61bc33 commit 31acfc4
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 0 deletions.
4 changes: 4 additions & 0 deletions styleguide.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,10 @@ module.exports = {
{
name: "Understanding Component References",
content: "styleguide/src/sections/ComponentsContext.md"
},
{
name: "Developing Locally Inside Another Project",
content: "styleguide/src/sections/LocalDevelopment.md"
}
]
},
Expand Down
39 changes: 39 additions & 0 deletions styleguide/src/sections/LocalDevelopment.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
If you'd like to see your changes locally inside of another project, such as the [Reaction Operator UI](https://github.com/reactioncommerce/reaction) or the [Reaction Storefront](https://github.com/reactioncommerce/reaction-next-starterkit), it's possible to link your local version of this Component Library using the following steps:

- `cd` into your local version of the [Reaction Component Library](https://github.com/reactioncommerce/reaction-component-library), and run the following commands:

```diff
yarn install
cd package
yarn install
yarn run build
```

- Next, `cd` into the local version of the repository you'd like to use the local `Component Library` inside. Add the following line to the `volumes:` portion of the `docker-compose.yml` file:

Inside `Reaction Storefront`:

```diff
volumes:
- $HOME/.cache/yarn-offline-mirror:/home/node/.cache/yarn-offline-mirror
- web-yarn:/home/node/.cache/yarn
- .:/usr/local/src/reaction-app
- empty_node_modules:/usr/local/src/reaction-app/node_modules # do not link node_modules in, and persist it between dc up runs
- node_modules:/usr/local/src/node_modules
+ - /{Path-to-your-local-repo}/reaction-component-library/package/dist:/usr/local/src/reaction-app/node_modules/@reactioncommerce/components
```

Inside `Reaction Operator UI`:
```diff
volumes:
- $HOME/.cache/yarn-offline-mirror:/home/node/.cache/yarn-offline-mirror
- web-yarn:/home/node/.cache/yarn
- .:/usr/local/src/reaction-app
- empty_node_modules:/usr/local/src/reaction-app/node_modules # do not link node_modules in, and persist it between dc up runs
- node_modules:/usr/local/src/node_modules
+ - /{Path-to-your-local-repo}/reaction-component-library/package/dist:/usr/local/src/node_modules/@reactioncommerce/components
```

- Next, run `docker-compose up -d` like normal to access the app in your browser and test it.

**Be sure to remove and not commit the added line from `docker-compose.yml` when you are done testing.**

0 comments on commit 31acfc4

Please sign in to comment.