Styleguidist playground to see the reusable components for the climate watch platform applications.
Use node v.8.10.0 and npm (not yarn)
yarn add github:ClimateWatch-Vizzuality/climate-watch-components#versionNumber
After adding the version number, go to your's project frontend entry file (most probably app/javascript/app.jsx
) and import the css:
import 'cw-components/dist/main.css';
import { NoContent, Loading, Table } from 'cw-components';
and will be ready to use them!
Install using yarn install. Package-lock.json won't be created as we want to avoid conflicts
- Register cw-components as linked package. Run
yarn link
. Have to be done just once. - Run
yarn dev
to run webpack with development config. - On app repo.
yarn link cw-components
. - It's a good practice to unlink the package after testing to not forget about it later.
To remove this local linked package from the application. Run following on the app repo:
- Unlink package
yarn unlink cw-components
. - Remove node modules
rm -rf node_modules
. - Reinstall packages
yarn
to bring back previous version of cw-components.
Make sure that React, react-dom or maybe other libraries are not loaded twice when linking this package locally.
In the app webpack configuration, resolve packages to always use app's node_modules version and do not resolve symlinks, because webpack has some problems with that.
resolve: {
symlinks: false,
alias: {
react: path.resolve('./node_modules/react'),
'react-dom': path.resolve('./node_modules/react-dom')
}
}
You can also add duplication checker plugin to know about other duplicated libraries.
We are using the release package to run automatically this process
To make it easier with our workflow it is using a custom fork where it only takes all of the PR commits to generate the changelog instead of them al
So to make a new release follow the next steps:
- Make sure you want to put in production everything that it is in master.
- Merge all the approved PRs to master
- Checkout to
build
branch and mergemaster
into build. - Run
yarn compile
to compile js and css. - Run the command
npx release major|minor|patch
. Remember this has to be run onbuild
branch after yarn compile. - You will be prompted with a list of commits where you select what time of change it includes. Normally
feature/*
branches go tominor
andfix/*
topatches
- When finished you will have:
- The new version number.
- The package.json version updated.
- A new tag committed
- Changelog ready to publish.