Zero App Client
===================

<img src="https://gitlab.com/uploads/-/system/project/avatar/17863970/LogoZeroPreto.png?width=88" />

---

:rocket: Builds Status
=============

## Master:
[![pipeline status](https://gitlab.com/laborit/webmotors-projects/zero-client/badges/master/pipeline.svg)](https://gitlab.com/laborit/webmotors-projects/zero-client/commits/master)

## Development:
[![pipeline status](https://gitlab.com/laborit/webmotors-projects/zero-client/badges/development/pipeline.svg)](https://gitlab.com/laborit/webmotors-projects/zero-client/commits/development)

:nail_care: Test Coverage
=============

## Master:
[![coverage report](https://gitlab.com/laborit/webmotors-projects/zero-client/badges/master/coverage.svg)](https://gitlab.com/laborit/webmotors-projects/zero-client/commits/master)

## Development:
[![coverage report](https://gitlab.com/laborit/webmotors-projects/zero-client/badges/development/coverage.svg)](https://gitlab.com/laborit/webmotors-projects/zero-client/commits/development)

---

:memo: Documentation
=============

## Requirements
- nvm v0.34.0 ([install details](https://github.com/nvm-sh/nvm#installation-and-update))
- Node v12.16.1 ([install details](https://github.com/nvm-sh/nvm#nvmrc))
- npm v5.6.0

## Stack

- [Node](https://nodejs.org/en/) ([12.16.1](https://github.com/nodejs/node/blob/master/CHANGELOG.md))


- [Webpack](https://webpack.js.org/) ([^4.42.0](https://github.com/webpack/webpack/releases))

- [Rollup](https://rollupjs.org/guide/en/) ([^2.3.2](https://github.com/rollup/rollup/blob/master/CHANGELOG.md))

- [ES6](https://babeljs.io/) ([^7.8.4](https://github.com/babel/babel/blob/master/CHANGELOG.md))

- [React](https://reactjs.org/) ([^16.13.0](https://github.com/facebook/react/blob/master/CHANGELOG.md))

- [SASS](https://sass-guidelin.es/pt/) ([^4.13.1](https://github.com/sass/node-sass/blob/master/CHANGELOG.md))

- [Jest](https://jestjs.io/en/) ([^25.1.0](https://github.com/facebook/jest/blob/master/CHANGELOG.md))

- [Enzyme](https://enzymejs.github.io/enzyme/) ([^3.11.0](https://github.com/enzymejs/enzyme/blob/master/CHANGELOG.md))


---

## Environment Variables

### Application variables
Set Application variables in the .env file
- NODE_ENV
- ENV
- DEV (changes the development mode for the use of the library) 
- NPM_TOKEN (token do publish in npm)

## Initialization

```bash
git clone git@gitlab.com:laborit/zero-client.git
cd zero-client/
cp .env.sample .env
npm i
npm run dev
```

### Testing library to localhost
#### Changes the development mode for the use of the library

```bash
npm run build:lib
npm run dev:browser
```

---


## Build

### Build library to production

```bash
npm run build:lib
```
output path `/lib`

### Build client to production

```bash
npm run build:dist
```
output path `/dist`

---

## Testing

### Using jest with enzyme and chai (see examples on `./src/**/*.spec.js`)

```bash
npm test
npm run test:coverage
```

---

## Linting

### Using eslint

```bash
npm run lint
```

---

## Deploy

### NPM package

#### Locally

Logged in at NPM with your user

Build the library

```bash
npm run build:lib
```

Update package version:

```bash
npm version major | minor | patch
```
see more details in [npm-version](https://docs.npmjs.com/cli/version)

Publish the package

```bash
npm publish
```

#### With Gitlab CI

Set the npm token on gitlab ci environment variable `NPM_TOKEN`

Before commit, update package version:

```bash
npm version major | minor | patch
```
see more details in [npm-version](https://docs.npmjs.com/cli/version)

After than, commit to branch master:

```
git push origin master
```

**Why?**

It removes all original styling and ensures that all outputted code conforms to a consistent style.


As you can see, these two tools we make sure our codebase is consistent across all developers, IDE's and operating systems. Make sure you have them properly configurated on your IDE before starting writing code.



### Useful references & links

- [Trello board](https://trello.com/b/Roy5BAVy/lab-zero)

- [PPT Zero](https://docs.google.com/presentation/d/1PxQmasUwL5weCpCgFQ4_gtzmUCGKaZ7qnrSxZwo6m0Y/edit#slide=id.g6c86a47204_2_747)

- [Wireframe Zero](https://www.figma.com/proto/wwgU03cILbUMpTxjmrBFna/Wireframe-Zero)