
Library name:       comalakit
Version:            1.7.15
Repository URL:     ssh://git@dvcs.comalatech.com:7999/comp/comalakit
License:            Custom: https://nexus.comalatech.com/repository/npm-releases/
License Text:       ComalaKit
=========
This repo contains a set of custom React components built on top of AtlasKit and that can potentially be reused by other Comalatech apps.


## How to start

Requirements: node 10.16.3

* Install dependencies: `npm install`
* Check lint and tests are ok: `npm run lint:fix` && `npm test`
* Generate a production build: `npm run build`, yeah, it'll check both tests and lint :)
* Watch the storybook: `npm run storybook`

## How to integrate (and dev mode)

As easy as:
* run `npm i comalakit -S`
* make sure component is **exported** at index.js facade
* pick components as usual: `import { Avatar } from 'comalakit'`

**DEV MODE**: you want to make changes into workflowskit and see them live in client code (ex. rioja)
* download the comalakit repository (ex. into <path>/comalakit)
* install it **locally** into client: `npm link <path>/comalakit`: this will replace dep with a sym link (you can check with `ls -la node_modules/comalakit`)

## I18n support

For components needing i18n support, we follow a slight different approach, basically you need to import /src/i18n (ex import '../../i18n'), and add a customized translate hoc.  All components needing i18n should be wrapped with following code:

```
import { translate } from '<path-to>/i18n';

const MyComponent = ...

export default translate(MyComponent);
```

Please check /src/i18n/TestI18n component as PoC

## Tests

We're using mocha/chai stack for unit tests and Enzyme for integration tests

Just add a file `XXX.spec.js` under a folder in /test and it'll be run as part of the suite

## How to release

```
TODO
The following process is going to receive some improvements and automation in a near future.
```

**DISCLAIMER:** All Jira issues in a release should belong to `CK` project. If an issue comes from `CWC`, `AWP` or `AHLISTS` projects, a linked Jira issue should be created in `CK` project and the branch and commits should be linked to that issue.
All Jira issues need a fix version. If you can't create a new release version in Jira in the `CK` project, ask someone to create it for you. Do not link issues to released fix versions.

1. When all issues linked to the fix version are ready to be released, create a `release` branch from `develop` and update the package version in `package.json` with the fix version. Make sure there is no `-SNAPSHOT.X` suffix in the version.
2. Run `npm install` to make sure `package-lock.json` is up to date.
3. Update `CHANGELOG.md` with the issues fixed in the new release.
4. Run `npm run build` to make sure the build works and all tests pass.
5. Push changes to the `release` branch and create a PR to `master`. Usually a `release` PR does not need review, since every issue belonging to it has already been reviewed in their corresponding PRs.
6. Merge the PR to `master`.
7. Checkout `master`, `pull` changes and run the following command:
```
npm publish --registry https://nexus.comalatech.com/repository/npm-releases/
```
8. Once you confirm the version has been published to the nexus repository, create a `tag` from the last commit to `master` using the version as the `tag` name.
9. Checkout `develop` branch and merge `master` to `develop`, then push. Confirm both `develop` and `master` branches look alike.
10. Increase `package.json` minor version by one and append `-SNAPSHOT.0` to ease the next testing / release iteration. Run `npm i` to update `package-lock.json`, commit and push to `develop`.
11. Change the release status in JIRA to Released. If you don't see the buttons for Create version and Release, ask a Senior Frontend Developer in the team to do this.
https://comalatech.jira.com/projects/CK?selectedItem=com.atlassian.jira.jira-projects-plugin:release-page 

```
On the app that is using the snapshot version, workflows in this case, if you want it to use the latest snapshot after already using one (the x.y.z-SNAPSHOT.0 one probably) there are some manual steps to be performed until we develop the tooling to automate it, although there is a script already available that can be used) you would need to remove the snapshot dep entry from package-lock.json and the remove the lib from ./node_modules
```

12. Update Comalakit Release Queue page https://corp.comalatech.com/display/DEV/Comalakit+release+queue

13. Post a comment on #comala-frontend channel in Slack letting everybody know about the update e.g. "@here Comalakit version x.y.z released".

## Doco

TBD, but as a component library, we should keep both an component index and a good doco about them (work in progress)
