diff --git a/.nycrc b/.nycrc index e586b2e..e9ccf80 100644 --- a/.nycrc +++ b/.nycrc @@ -1,17 +1,18 @@ { "include": [ - "src/**/*.ts" + "src" ], "extension": [ ".ts" ], "exclude": [ "**/*.d.ts", - "lib/**", - "esm/**", - "lib/**/*.test.ts", - "tests/**", - "node_modules/**" + "lib", + "esm", + "tests", + "src/**/*.spec.ts", + "src/types", + "src/**/index.ts" ], "reporter": [ "clover", diff --git a/.travis.yml b/.travis.yml index 7084ec5..12f04c6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,12 +1,22 @@ language: node_js node_js: - - '10' - - '11' + - lts/* - '12' + - '11' + - '10' script: - - yarn test + - yarn build + - npm run cover + +env: + - COVERAGE_RUN_ON_NODE_VERSION=12 + +after_success: > + node -e 'process.exit(process.version.replace(/^v(\d+).*?$/, "$1") === process.env.COVERAGE_RUN_ON_NODE_VERSION ? 0 : 1)' \ + && cat reports/coverage/lcov.info | yarn coveralls \ + || echo "not publishing coverage for node $(node -v)" jobs: include: diff --git a/README.md b/README.md index 3e2d353..8d5102f 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,11 @@ # @lleon/object-builders +[![npm (scoped)](https://img.shields.io/npm/v/@lleon/object-builders)](https://www.npmjs.com/package/@lleon/object-builders) +[![Travis (.org)](https://img.shields.io/travis/leon19/node-object-builders)](https://travis-ci.org/leon19/node-object-builders) +[![Coverage Status](https://coveralls.io/repos/github/leon19/node-object-builders/badge.svg?branch=master)](https://coveralls.io/github/leon19/node-object-builders?branch=master) +[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release) +[![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg)](https://github.com/prettier/prettier) + Library to easily create object builders, useful for testing or for generating seed data. This library requires @@ -30,10 +36,6 @@ yarn add @lleon/object-builders npm install @lleon/object-builders ``` -The project use [husky](https://github.com/typicode/husky) and -[lint-staged](https://github.com/okonet/lint-staged) for linting and fixing possible errors on -source code before commit - ### fromInterface() Creates a new object builder typed from an interface @@ -165,6 +167,9 @@ code > 0 on error ### yarn cover +> For some reason this script does not work when used with `yarn` so it is needed to launch with npm +> `npm run cover` + The same as as `yarn test` and generates coverages reports in `reports/coverage`. Exit with code > 0 on error diff --git a/package.json b/package.json index 76cafdc..807f636 100644 --- a/package.json +++ b/package.json @@ -20,7 +20,7 @@ "lib" ], "keywords": [ - "buider", + "builder", "object builder", "class builder" ], @@ -40,6 +40,7 @@ "@typescript-eslint/parser": "^2.3.1", "chai": "^4.2.0", "concurrently": "^4.1.2", + "coveralls": "^3.0.6", "eslint": "^6.4.0", "eslint-config-prettier": "^6.3.0", "eslint-plugin-prettier": "^3.1.1", diff --git a/tsconfig.test.json b/tsconfig.test.json index 90f2f80..2696218 100644 --- a/tsconfig.test.json +++ b/tsconfig.test.json @@ -5,6 +5,6 @@ "noEmit": true, "types": ["mocha"] }, - "include": ["./src", "src/**/*.spec.ts", "./tests"], + "include": ["src", "tests"], "exclude": ["node_modules", "esm", "lib"] } diff --git a/yarn.lock b/yarn.lock index 095e931..df88037 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1142,6 +1142,18 @@ cosmiconfig@^5.0.1, cosmiconfig@^5.2.1: js-yaml "^3.13.1" parse-json "^4.0.0" +coveralls@^3.0.6: + version "3.0.6" + resolved "https://registry.yarnpkg.com/coveralls/-/coveralls-3.0.6.tgz#5c63b2759b6781118e7439bd870ba5e9ee428b25" + integrity sha512-Pgh4v3gCI4T/9VijVrm8Ym5v0OgjvGLKj3zTUwkvsCiwqae/p6VLzpsFNjQS2i6ewV7ef+DjFJ5TSKxYt/mCrA== + dependencies: + growl "~> 1.10.0" + js-yaml "^3.13.1" + lcov-parse "^0.0.10" + log-driver "^1.2.7" + minimist "^1.2.0" + request "^2.86.0" + cp-file@^6.2.0: version "6.2.0" resolved "https://registry.yarnpkg.com/cp-file/-/cp-file-6.2.0.tgz#40d5ea4a1def2a9acdd07ba5c0b0246ef73dc10d" @@ -2140,7 +2152,7 @@ graceful-fs@^4.1.11, graceful-fs@^4.1.15, graceful-fs@^4.1.2, graceful-fs@^4.1.6 resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.2.tgz#6f0952605d0140c1cfdb138ed005775b92d67b02" integrity sha512-IItsdsea19BoLC7ELy13q1iJFNmd7ofZH5+X/pJr90/nRoPEX0DJo1dHDbgtYWOhJhcCgMDTOw84RZ72q6lB+Q== -growl@1.10.5: +growl@1.10.5, "growl@~> 1.10.0": version "1.10.5" resolved "https://registry.yarnpkg.com/growl/-/growl-1.10.5.tgz#f2735dc2283674fa67478b10181059355c369e5e" integrity sha512-qBr4OuELkhPenW6goKVXiv47US3clb3/IbuWF9KNKEijAy9oeHxU9IgzjvJhHkUzhaj7rOUD7+YGWqUjLp5oSA== @@ -2821,6 +2833,11 @@ lcid@^2.0.0: dependencies: invert-kv "^2.0.0" +lcov-parse@^0.0.10: + version "0.0.10" + resolved "https://registry.yarnpkg.com/lcov-parse/-/lcov-parse-0.0.10.tgz#1b0b8ff9ac9c7889250582b70b71315d9da6d9a3" + integrity sha1-GwuP+ayceIklBYK3C3ExXZ2m2aM= + levn@^0.3.0, levn@~0.3.0: version "0.3.0" resolved "https://registry.yarnpkg.com/levn/-/levn-0.3.0.tgz#3b09924edf9f083c0490fdd4c0bc4421e04764ee" @@ -3178,6 +3195,11 @@ lodash@^4.17.11, lodash@^4.17.12, lodash@^4.17.13, lodash@^4.17.14, lodash@^4.17 resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.15.tgz#b447f6670a0455bbfeedd11392eff330ea097548" integrity sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A== +log-driver@^1.2.7: + version "1.2.7" + resolved "https://registry.yarnpkg.com/log-driver/-/log-driver-1.2.7.tgz#63b95021f0702fedfa2c9bb0a24e7797d71871d8" + integrity sha512-U7KCmLdqsGHBLeWqYlFA0V0Sl6P08EE1ZrmA9cxjUE0WVqT9qnyVDPz1kzpFEP0jdJuFnasWIfSd7fsaNXkpbg== + log-symbols@2.2.0: version "2.2.0" resolved "https://registry.yarnpkg.com/log-symbols/-/log-symbols-2.2.0.tgz#5740e1c5d6f0dfda4ad9323b5332107ef6b4c40a" @@ -4714,7 +4736,7 @@ release-zalgo@^1.0.0: dependencies: es6-error "^4.0.1" -request@^2.87.0, request@^2.88.0: +request@^2.86.0, request@^2.87.0, request@^2.88.0: version "2.88.0" resolved "https://registry.yarnpkg.com/request/-/request-2.88.0.tgz#9c2fca4f7d35b592efe57c7f0a55e81052124fef" integrity sha512-NAqBSrijGLZdM0WZNsInLJpkJokL72XYjUpnB0iwsRgxh7dB6COrHnTBNwN0E+lHDAJzu7kLAkDeY08z2/A0hg==