diff --git a/.circleci/config.yml b/.circleci/config.yml new file mode 100644 index 00000000..3b495170 --- /dev/null +++ b/.circleci/config.yml @@ -0,0 +1,162 @@ +unit_tests: &unit_tests + steps: + - checkout + - setup_remote_docker + - restore_cache: + key: dependency-cache-{{ checksum "package.json" }} + - run: + name: NPM Rebuild + command: npm rebuild + - run: + name: Run unit tests. + command: npm run ci:test +canary_tests: &canary_tests + steps: + - checkout + - setup_remote_docker + - restore_cache: + key: dependency-cache-{{ checksum "package.json" }} + - run: + name: NPM Rebuild + command: npm rebuild + - run: + name: Install Webpack Canary + command: npm i --no-save webpack@next + - run: + name: Run unit tests. + command: npm run ci:test + +version: 2 +jobs: + dependency_cache: + docker: + - image: webpackcontrib/circleci-node-base:latest + steps: + - checkout + - setup_remote_docker + - restore_cache: + key: dependency-cache-{{ checksum "package.json" }} + - run: + name: Install Dependencies + command: npm install + - save_cache: + key: dependency-cache-{{ checksum "package.json" }} + paths: + - ./node_modules + + node8_webpack_latest: + docker: + - image: webpackcontrib/circleci-node8:latest + steps: + - checkout + - setup_remote_docker + - restore_cache: + key: dependency-cache-{{ checksum "package.json" }} + - run: + name: NPM Rebuild + command: npm rebuild + - run: + name: Run unit tests. + command: npm run ci:coverage + - run: + name: Submit coverage data to codecov. + command: bash <(curl -s https://codecov.io/bash) + when: on_success + node6_webpack_latest: + docker: + - image: webpackcontrib/circleci-node6:latest + <<: *unit_tests + node9_webpack_latest: + docker: + - image: webpackcontrib/circleci-node9:latest + <<: *unit_tests + node8_webpack_canary: + docker: + - image: webpackcontrib/circleci-node8:latest + <<: *canary_tests + analysis: + docker: + - image: webpackcontrib/circleci-node-base:latest + steps: + - checkout + - setup_remote_docker + - restore_cache: + key: dependency-cache-{{ checksum "package.json" }} + - run: + name: NPM Rebuild + command: npm rebuild + - run: + name: Run linting. + command: npm run lint + - run: + name: Run NSP Security Check. + command: npm run security + - run: + name: Validate Commit Messages + command: npm run ci:lint:commits + publish: + docker: + - image: webpackcontrib/circleci-node-base:latest + steps: + - checkout + - setup_remote_docker + - restore_cache: + key: dependency-cache-{{ checksum "package.json" }} + - run: + name: NPM Rebuild + command: npm rebuild + - run: + name: Validate Commit Messages + command: npm run release:validate + - run: + name: Publish to NPM + command: printf "noop running conventional-github-releaser" + +version: 2.0 +workflows: + version: 2 + validate-publish: + jobs: + - dependency_cache + - node6_webpack_latest: + requires: + - dependency_cache + filters: + tags: + only: /.*/ + - node8_webpack_latest: + requires: + - dependency_cache + filters: + tags: + only: /.*/ + - node9_webpack_latest: + requires: + - dependency_cache + filters: + tags: + only: /.*/ + - node8_webpack_canary: + requires: + - dependency_cache + filters: + tags: + only: /.*/ + - analysis: + requires: + - node6_webpack_latest + - node8_webpack_latest + - node9_webpack_latest + filters: + tags: + only: /.*/ + - publish: + requires: + - node6_webpack_latest + - node8_webpack_latest + - node9_webpack_latest + - analysis + filters: + branches: + only: + - master diff --git a/.eslintrc b/.eslintrc deleted file mode 100644 index 94f21799..00000000 --- a/.eslintrc +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "webpack" -} \ No newline at end of file diff --git a/.eslintrc.js b/.eslintrc.js new file mode 100644 index 00000000..f5064a31 --- /dev/null +++ b/.eslintrc.js @@ -0,0 +1,11 @@ +module.exports = { + root: true, + plugins: ['prettier'], + extends: ['@webpack-contrib/eslint-config-webpack'], + rules: { + 'prettier/prettier': [ + 'error', + { singleQuote: true, trailingComma: 'es5', arrowParens: 'always' }, + ], + }, +}; diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS new file mode 100644 index 00000000..f3206485 --- /dev/null +++ b/.github/CODEOWNERS @@ -0,0 +1,6 @@ +# These are the default owners for everything in +# webpack-contrib +@webpack-contrib/org-maintainers + +# Add repository specific users / groups +# below here for libs that are not maintained by the org. diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 00000000..e537c8ad --- /dev/null +++ b/.prettierrc @@ -0,0 +1,5 @@ +{ + "singleQuote": true, + "trailingComma": "es5", + "arrowParens": "always" +} diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 7f1bea0e..00000000 --- a/.travis.yml +++ /dev/null @@ -1,49 +0,0 @@ -sudo: false -dist: trusty -language: node_js -branches: - only: - - master - - next -jobs: - fast_finish: true - allow_failures: - - env: WEBPACK_VERSION=canary - - node_js: 9 - include: - - &test-latest - stage: Webpack latest - node_js: 6 - env: WEBPACK_VERSION=latest JOB_PART=test - script: npm run travis:$JOB_PART - - <<: *test-latest - node_js: 8 - env: WEBPACK_VERSION=latest JOB_PART=lint - script: npm run travis:$JOB_PART - - <<: *test-latest - node_js: 8 - env: WEBPACK_VERSION=latest JOB_PART=coverage - script: npm run travis:$JOB_PART - after_success: 'bash <(curl -s https://codecov.io/bash)' - - stage: Webpack canary - node_js: 8 - env: WEBPACK_VERSION=4.0.0-alpha.0 JOB_PART=test - script: npm run travis:$JOB_PART - - stage: NodeJS Next - node_js: 9 - env: WEBPACK_VERSION=latest JOB_PART=test - script: npm run travis:$JOB_PART -before_install: - - 'if [[ `npm -v` != 5* ]]; then npm i -g npm@^5.0.0; fi' - - nvm --version - - node --version - - npm --version -before_script: - - |- - if [ "$WEBPACK_VERSION" ]; then - npm i --no-save webpack@$WEBPACK_VERSION - fi -script: - - 'npm run travis:$JOB_PART' -after_success: - - 'bash <(curl -s https://codecov.io/bash)' diff --git a/appveyor.yml b/appveyor.yml index ee79ff1b..6f7f941e 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -13,7 +13,7 @@ environment: webpack_version: latest job_part: test - nodejs_version: '8' - webpack_version: 4.0.0-alpha.0 + webpack_version: next job_part: test build: 'off' matrix: @@ -27,4 +27,4 @@ before_test: test_script: - node --version - npm --version - - cmd: npm run appveyor:%job_part% + - cmd: npm run ci:%job_part% diff --git a/codecov.yml b/codecov.yml new file mode 100644 index 00000000..9ff91665 --- /dev/null +++ b/codecov.yml @@ -0,0 +1,10 @@ +coverage: + precision: 2 + round: down + range: 70...100 + + status: + project: no + patch: yes + +comment: 'off' diff --git a/commitlint.config.js b/commitlint.config.js new file mode 100644 index 00000000..ede6e237 --- /dev/null +++ b/commitlint.config.js @@ -0,0 +1,31 @@ +/* eslint-disable */ +const Configuration = { + extends: ['@commitlint/config-angular'], + + rules: { + 'body-leading-blank': [1, 'always'], + 'footer-leading-blank': [1, 'always'], + 'header-max-length': [2, 'always', 72], + 'scope-case': [2, 'always', 'lower-case'], + 'subject-case': [2, 'never', ['start-case', 'pascal-case', 'upper-case']], + 'subject-empty': [2, 'never'], + 'subject-full-stop': [2, 'never', '.'], + 'type-case': [2, 'always', 'lower-case'], + 'type-empty': [2, 'never'], + 'type-enum': [ + 'build', + 'chore', + 'ci', + 'docs', + 'feat', + 'fix', + 'perf', + 'refactor', + 'revert', + 'style', + 'test', + ], + }, +}; + +module.exports = Configuration; diff --git a/package.json b/package.json index 750c3940..be36c5fd 100644 --- a/package.json +++ b/package.json @@ -18,30 +18,36 @@ "schema-utils": "^0.4.2" }, "devDependencies": { + "@commitlint/cli": "^5.0.0", + "@commitlint/config-angular": "^5.0.0", + "@webpack-contrib/eslint-config-webpack": "^2.0.0", "babel-cli": "^6.0.0", "babel-jest": "^21.0.0", "babel-plugin-transform-object-rest-spread": "^6.0.0", "babel-polyfill": "^6.0.0", "babel-preset-env": "^1.0.0", + "conventional-github-releaser": "^2.0.0", "cross-env": "^5.0.0", "del": "^3.0.0", "del-cli": "^1.0.0", "eslint": "^4.0.0", - "eslint-config-webpack": "^1.0.0", "eslint-plugin-import": "^2.0.0", + "eslint-plugin-prettier": "^2.0.0", "file-loader": "^1.0.0", + "husky": "^0.14.3", "jest": "^21.0.0", "jsdom": "^11.0.0", "lint-staged": "^6.0.0", "memory-fs": "^0.4.0", "nsp": "^3.0.0", "pre-commit": "^1.0.0", + "prettier": "^1.9.2", "standard-version": "^4.0.0", "webpack": "^3.0.0", - "webpack-defaults": "^1.6.0" + "webpack-defaults": "^2.0.0-beta.0" }, "peerDependencies": { - "webpack": "^3.0.0 || ^4.0.0-alpha.0 || ^4.0.0" + "webpack": "^3.0.0 || ^4.0.0" }, "scripts": { "start": "npm run build -- -w", @@ -55,11 +61,16 @@ "test": "jest", "test:watch": "jest --watch", "test:coverage": "jest --collectCoverageFrom='src/**/*.js' --coverage", - "travis:coverage": "npm run test:coverage -- --runInBand", - "travis:lint": "npm run lint && npm run security", - "travis:test": "npm run test -- --runInBand", + "commitlint": "commitlint", + "commitmsg": "commitlint -e $GIT_PARAMS", + "ci:lint": "npm run lint && npm run security", + "ci:lint:commits": "commitlint --from=${CIRCLE_BRANCH} --to=${CIRCLE_SHA1}", + "ci:test": "npm run test -- --runInBand", + "ci:coverage": "npm run test:coverage -- --runInBand", "appveyor:test": "npm run test", "webpack-defaults": "webpack-defaults", + "release:ci": "conventional-github-releaser -p angular", + "release:validate": "commitlint --from=$(git describe --tags --abbrev=0) --to=$(git rev-parse HEAD)", "release": "standard-version" }, "repository": "https://github.com/webpack-contrib/html-loader.git",