Deer Park - EA React component library
Production usage
Deer park is deployed to NPM as a private package scoped to the @eneryaspects
organisation.
To be able to install this project as a npm dependency you will need to setup a npm account that has been given access to read from the @energyaspects
organisation.
- Run
npm login
. - Enter your npm username, password and email address as prompted.
- To install this project as a dependency type
npm install --save @energyaspects/deer-park
Development setup
1. Ensure you're on Node LTS/Erbium aka. v12
Deer Park is set up to run with the latest Node LTS version which is LTS/Erbium aka. v12.
2. Log in to NPM Enterprise
You will need to connect to the Energy Aspects NPM organisation for NPM to resolve @energyaspects/...
modules.
Request an enterprise NPM account from the team lead, then do npm login
to log in.
Then you will be able to run npm install
and resolve @energyaspects/...
modules.
3. Ignore non-code folders in your IDE
The /dist
and /legacy
folders are not for active development, however your IDE will treat these folders
as source folders by default. Mark these folders are non-source/excluded folders to prevent them being indexed
in searches or watches.
Development alongside other local applications
You can use npm link to make local changes deer-park
without having to publish a new version to npm.
In your terminal:
- Checkout the source code
git clone git@github.com:energyaspects/deer-park.git
- Run
npm start
and wait for successful compilation. This will also start webpack in watch mode. - In a seperate terminal window while in the root of the
deer-park
project runnpm run setup-link
. - Navigate to the root of the project that will have or has
deer-park
as a dependency. - Type
npm link @energyaspects/deer-park
Changes made to deer-park
components will now persist into the application consuming deer-park
.
While npm start
is running you can also run these commands at the same time to assist with development.
-
npm run storybook
- Runs storybook on a seperate port. -
npm test:watch
- Runs Jest in watch mode.
Publishing to npm
You will need an npm account that has write access to the @energyaspects
organisation on npm.
Things to note:
- Always publish from master.
- Always change the version number in your PR before merging into master.
Steps to publish:
- Ensure you are on the master branch.
- Ensure the version number in the
package.json
is appropriate and has been updated (attempting to publish a with an existing version number will fail). - Login to npm with your account as described above.
- Run
npm build
- Run
npm run build-and-publish
A new version of deer-park
will now be able to install as a private npm dependency.