
Library name:       workflowskit
Version:            3.1.4
Repository URL:     ssh://git@dvcs.cml.appfire.net:7999/comp/workflowskit
License:            Custom: https://comalatech.jira.com/projects/WK
License Text:       # Workflows Kit

Collection of reusable (React-based ATM) components for workflows

## How to start

Requirements: node 16.15 or higher, but lower than 17

* Install dependencies: `npm install`
* Check lint and tests are ok: `npm run lint` && `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:
* add `npm install --save workflowskit`
* make sure component is **exported** at index.js facade
* add the following line to webpack config `exclude: /node_modules\/(?!(workflowskit|comalakit))/` in js(x) module, so both workflowskit and comalakit are included as ESM modules in the bundle
* pick components as usual: `import { Avatar } from 'workflowskit`

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

## I18n support

For components needing i18n support, we follow a slight different approach, basically you need to import /src/i18n (ex ìmport '../../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 Jest 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.
```

### Creating a SNAPSHOT
1. Create a `feature/X.X.X` 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 updated.
3. Update `CHANGELOG.md` with the issues fixed in the new release.
4. Push changes to the `feature/X.X.X` branch. A new SNAPSHOT will be created in Nexus.

After the Bamboo Plan `Publish Library` is done, you will get a SNAPSHOT version of Workflowskit published to nexus that you can install.
A new SNAPSHOT version will be deployed to nexus on each push to tho feature branch.

### Releasing the FINAL VERSION
Once you're happy with the testing of the SNAPSHOTs, you can release the final version following these steps:

1. Create a release on the Jira project for Workflowskit for the feature.
2. Create a PR from your Feature branch to `develop` and add people from the other team (cloud if you're from server, server if you're from cloud) and a Senior front-end developer to review.
3. Once the PR is approved, merge the PR to `develop`.
4. A new version of the library will be deployed automatically in Nexus and the last commit of develop branch will be tagged with the new version.

```
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
```

### After releasing
1.  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/WK?selectedItem=com.atlassian.jira.jira-projects-plugin:release-page

2. Update Workflowskit Release Queue page https://corp.comalatech.com/pages/resumedraft.action?draftId=129439703&draftShareId=87730d22-1ae0-42b5-a7fd-447a906f30f1&

3. Post a comment on #comala-frontend channel in Slack letting everybody know about the update e.g. "@here Workflowskit 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)


## Publish StoryBook
The storyBook will be uploaded into a S3 when a new library has been published successfully
StoryBook URL: https://workflowskit.ci.comala.zone
