To understand the development process of the cliengo-sdk library you have to manage 2 aspects: Testing and Building. Testing is done with Mocha as the test framework to define how tests are to be done. Mocha can be used with human-readable sintaxis by adding Chai, and can mock code components with Sinon.
- Run the tests:
npm run testor
- Run the tests and compute coverage :
npm run test:with-coverage. Html coverage reports will be in the "coverage/lcov-report/" folder.
- Check that coverage is 100 percent:
npm run test:check-coverage
- Build your library for npm:
npm run build:lib
- Build your library for the browser:
npm run build:umdor minified with
npm run build:umd.min
- All of the above:
npm run build
- If you chose to not have a browser build, there's just
npm run buildwhich does the same as
npm run build:lib.
Running in localhost
- Build library dist/cliengo-sdk.js:
npm run build:umd
- Run in localhost with
npm run start
Other useful scripts
- Clean coverage reports:
npm run clean:coverage
- Clean build artifacts:
npm run clean:build
- All of the above:
npm run clean
Commiting source code
You can commit like you normally would, but you'll have to follow the angular conventional commit format. To help you do this you can use commitizen (see usage section).
Before each commit is taken into account, the tests wil be run and the coverage will be checked. If this fails, you can commit with the same message by running
git cz --retry.
The commit message is also validated to ensure you respect the format. This is important so that the semantic-release module works properly.
For every change in source code:
git add . npm run commit
Alternatively, you can commit using commitizen installed globally with
npm i -g commitizen and
git cz. Choose the 'feat' commit type for the creation of your library! Then
git push origin master to take your code into GitHub.
To publish new versions in npm you have to be logged in with your npm account and be part of the Cliengo organization
npm run build npm version <option> npm publish
<option> can be
patch that modify major.minor.patch (Ex: 0.17.2). See
npm version --help for more information.