diff --git a/config/commitlint.config.js b/config/commitlint.config.js new file mode 100644 index 0000000..ad3fb36 --- /dev/null +++ b/config/commitlint.config.js @@ -0,0 +1,3 @@ +module.exports = { + extends: ['@commitlint/config-conventional', 'cz'], +}; diff --git a/config/esdoc.config.js b/config/esdoc.config.js new file mode 100644 index 0000000..8c0ea14 --- /dev/null +++ b/config/esdoc.config.js @@ -0,0 +1,39 @@ +module.exports = { + source: './src', + destination: './docs', + excludes: ['__mocks__'], + plugins: [ + { + name: 'esdoc-standard-plugin', + option: { + lint: { enable: true }, + accessor: { + access: ['public', 'protected'], + autoPrivate: true, + }, + undocumentIdentifier: { enable: false }, + unexportedIdentifier: { enable: false }, + typeInference: { enable: true }, + manual: { + index: './readme.md', + globalIndex: true, + files: [ + './other/examples.md', + './contributing.md', + './other/code_of_conduct.md', + './other/roadmap.md', + ], + }, + test: { + source: './src', + interfaces: ['describe', 'it', 'context', 'suite', 'test'], + includes: ['\\.test\\.js$'], + }, + }, + }, + { + name: 'esdoc-ecmascript-proposal-plugin', + option: { all: true }, + }, + ], +}; diff --git a/config/jest.config.js b/config/jest.config.js new file mode 100644 index 0000000..d9bb32a --- /dev/null +++ b/config/jest.config.js @@ -0,0 +1,15 @@ +const path = require('path'); + +const projectRoot = path.resolve(__dirname, '../'); + +const config = { + rootDir: projectRoot, + roots: [path.resolve(projectRoot, './src')], + testEnvironment: 'node', + transform: { + '^.+\\.js$': 'babel-jest', + }, + collectCoverage: true, +}; + +module.exports = config; diff --git a/package.json b/package.json index 2cc0030..45155e0 100644 --- a/package.json +++ b/package.json @@ -16,14 +16,14 @@ "prebuild": "rimraf dist", "build": "yarn build:babel && yarn build:docs", "build:babel": "babel src --out-dir dist --ignore **/*.test.js", - "build:docs": "esdoc -c .esdoc.json", + "build:docs": "esdoc -c ./config/esdoc.config.js", "develop:docs": "watch \"yarn build:docs\" . --ignoreDirectoryPattern='/node_modules|docs|dist|coverage|.git|.nyc*./'", - "test:watch": "jest --watch", - "test": "jest --coverage", + "test:watch": "jest --config ./config/jest.config.js --watch", + "test": "jest --config ./config/jest.config.js --coverage", "coveralls": "cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js", "lint": "eslint ./src", - "lint:commit": "commitlint -e", - "lint:commit-travis": "commitlint-travis", + "lint:commit": "commitlint -e --config ./config/commitlint.config.js", + "lint:commit-travis": "commitlint-travis --config ./config/commitlint.config.js", "commit": "git-cz", "semantic-release": "semantic-release" }, @@ -63,15 +63,6 @@ "cz-conventional-changelog": "^3.0.2", "semantic-release": "^15.13.1" }, - "jest": { - "testEnvironment": "node", - "transform": { - "^.+\\.js$": "babel-jest" - }, - "collectCoverageFrom": [ - "src/**/*.js" - ] - }, "config": { "commitizen": { "path": "./node_modules/cz-conventional-changelog"