diff --git a/.browserslistrc b/.browserslistrc new file mode 100644 index 0000000..48d3a67 --- /dev/null +++ b/.browserslistrc @@ -0,0 +1,5 @@ +last 2 chrome versions +last 2 firefox versions +last 2 edge versions +IE >= 10 +Safari >= 7 diff --git a/.dependabot/config.yml b/.dependabot/config.yml deleted file mode 100644 index 6f5b070..0000000 --- a/.dependabot/config.yml +++ /dev/null @@ -1,12 +0,0 @@ -version: 1 -update_configs: - - package_manager: 'javascript' - directory: '/' - update_schedule: 'weekly' - automerged_updates: - - match: - dependency_type: "development" - update_type: "all" - - match: - dependency_type: "production" - update_type: "semver:patch" diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..201a4c3 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,19 @@ +version: 2 +updates: +- package-ecosystem: npm + directory: "/" + schedule: + interval: weekly + time: "11:00" + open-pull-requests-limit: 10 + ignore: + - dependency-name: webpack + versions: + - 5.24.2 + - 5.24.4 + - 5.25.1 + - 5.27.1 + - 5.28.0 + - 5.30.0 + - 5.31.2 + - 5.33.2 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..ad6344c --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,120 @@ +name: CI + +on: + push: + branches: + - main + pull_request: + branches: + - main + +jobs: + install: + name: Install + runs-on: ubuntu-18.04 + + steps: + - name: Checkout + uses: actions/checkout@v2 + with: + fetch-depth: 0 + - name: Use Node.js + uses: actions/setup-node@v2 + with: + node-version: 14 + - name: Cache node modules + uses: actions/cache@v2 + with: + path: node_modules + key: ${{ runner.os }}-node--${{ hashFiles('package.json') }} + restore-keys: | + ${{ runner.os }}-node- + - name: Install Dependencies + run: npm i + + + browserstack: + name: Browserstack + runs-on: ubuntu-18.04 + if: github.ref == 'refs/heads/main' + needs: install + + steps: + - name: Checkout + uses: actions/checkout@v2 + with: + fetch-depth: 0 + - name: Use Node.js + uses: actions/setup-node@v2 + with: + node-version: 14 + - name: Restore node modules + uses: actions/cache@v2 + with: + path: node_modules + key: ${{ runner.os }}-node--${{ hashFiles('package.json') }} + restore-keys: | + ${{ runner.os }}-node- + - name: Run Tests + if: github.ref == 'refs/heads/main' + env: + BROWSERSTACK_USERNAME: ${{ secrets.BROWSERSTACK_USERNAME }} + BROWSERSTACK_ACCESS_KEY: ${{ secrets.BROWSERSTACK_ACCESS_KEY }} + run: npm start test.ci + + validate: + name: Validate + runs-on: ubuntu-18.04 + needs: install + + steps: + - name: Checkout + uses: actions/checkout@v2 + with: + fetch-depth: 0 + - name: Use Node.js + uses: actions/setup-node@v2 + with: + node-version: 14 + - name: Restore node modules + uses: actions/cache@v2 + with: + path: node_modules + key: ${{ runner.os }}-node--${{ hashFiles('package.json') }} + restore-keys: | + ${{ runner.os }}-node- + - name: Run Tests + run: npm start test + - name: Coveralls + uses: coverallsapp/github-action@master + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + + release: + name: Release + runs-on: ubuntu-18.04 + needs: [browserstack, validate] + if: github.ref == 'refs/heads/main' + + steps: + - name: Checkout + uses: actions/checkout@v2 + with: + fetch-depth: 0 + - name: Use Node.js + uses: actions/setup-node@v2 + with: + node-version: 14 + - name: Restore node modules + uses: actions/cache@v2 + with: + path: node_modules + key: ${{ runner.os }}-node--${{ hashFiles('package.json') }} + restore-keys: | + ${{ runner.os }}-node- + # Release the Codes!! + - name: Release! + env: + GH_TOKEN: ${{ secrets.GH_TOKEN }} + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} + run: npm start semantic-release diff --git a/.husky/.gitignore b/.husky/.gitignore new file mode 100644 index 0000000..31354ec --- /dev/null +++ b/.husky/.gitignore @@ -0,0 +1 @@ +_ diff --git a/.husky/pre-commit b/.husky/pre-commit new file mode 100755 index 0000000..974e268 --- /dev/null +++ b/.husky/pre-commit @@ -0,0 +1,4 @@ +#!/bin/sh +. "$(dirname "$0")/_/husky.sh" + +npx remove-lockfiles diff --git a/.releaserc.yml b/.releaserc.yml new file mode 100644 index 0000000..d6e12ef --- /dev/null +++ b/.releaserc.yml @@ -0,0 +1 @@ +branches: main diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 89d71b8..0000000 --- a/.travis.yml +++ /dev/null @@ -1,18 +0,0 @@ -language: node_js -node_js: stable -dist: trusty -sudo: false -cache: npm -branches: - only: - - master - - /^greenkeeper/.*$/ -script: - - npm start lint - - if [ "${TRAVIS_PULL_REQUEST}" = "false" ] && [ "${TRAVIS_BRANCH}" = "master" ]; then npm start test.sauce; fi - - npm start test -after_success: - - npm start report-coverage - - npm start semantic-release -notifications: - email: change diff --git a/README.md b/README.md index acbffd0..4f655f9 100644 --- a/README.md +++ b/README.md @@ -2,11 +2,10 @@ [![NPM Version][npm-version-image]][npm-url] [![NPM Downloads][npm-downloads-image]][npm-url] -[![Travis][travis-ci-image]][travis-ci-url] +[![CI Build][github-actions-image]][github-actions-url] [![Coveralls][coveralls-image]][coveralls-url] [![semantic-release][semantic-release-image]][semantic-release-url] -[![Greenkeeper badge][greenkeeper-image]][greenkeeper-url] The simple way to consume HATEOAS enabled REST APIs with AngularJS @@ -161,19 +160,17 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -[npm-version-image]: http://img.shields.io/npm/v/salte-angular-hateoas.svg?style=flat -[npm-downloads-image]: http://img.shields.io/npm/dm/salte-angular-hateoas.svg?style=flat + +[npm-version-image]: https://img.shields.io/npm/v/salte-angular-hateoas.svg?style=flat +[npm-downloads-image]: https://img.shields.io/npm/dm/salte-angular-hateoas.svg?style=flat [npm-url]: https://npmjs.org/package/salte-angular-hateoas -[travis-ci-image]: https://img.shields.io/travis/com/salte-io/salte-angular-hateoas/master.svg?style=flat -[travis-ci-url]: https://travis-ci.com/salte-io/salte-angular-hateoas +[github-actions-image]: https://github.com/salte-io/salte-angular-hateoas/actions/workflows/ci.yml/badge.svg?branch=main +[github-actions-url]: https://github.com/salte-io/salte-angular-hateoas/actions/workflows/ci.yml -[coveralls-image]: https://img.shields.io/coveralls/salte-io/salte-angular-hateoas/master.svg +[coveralls-image]: https://img.shields.io/coveralls/salte-io/salte-angular-hateoas/main.svg [coveralls-url]: https://coveralls.io/github/salte-io/salte-angular-hateoas -[commitizen-image]: https://img.shields.io/badge/commitizen-friendly-brightgreen.svg -[commitizen-url]: http://commitizen.github.io/cz-cli/ - [semantic-release-url]: https://github.com/semantic-release/semantic-release [semantic-release-image]: https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg diff --git a/.babelrc b/babel.config.json similarity index 100% rename from .babelrc rename to babel.config.json diff --git a/karma.ci.conf.js b/karma.ci.conf.js index 53e8152..023fe42 100644 --- a/karma.ci.conf.js +++ b/karma.ci.conf.js @@ -2,64 +2,21 @@ const webpackConfig = require('./webpack.test.config.js'); module.exports = function(config) { const customLaunchers = { - ChromeBeta: { - base: 'SauceLabs', - browserName: 'chrome', - version: 'beta' - }, - Chrome: { - base: 'SauceLabs', - browserName: 'chrome' - }, - Firefox: { - base: 'SauceLabs', - browserName: 'firefox' - }, - Edge: { - base: 'SauceLabs', - browserName: 'microsoftedge' - }, InternetExplorer11: { - base: 'SauceLabs', - browserName: 'internet explorer', - version: '11' - }, - InternetExplorer10: { - base: 'SauceLabs', - browserName: 'internet explorer', - version: '10' - }, - // TODO: Enable this once https://github.com/karma-runner/karma/issues/3198 is resolved - // Safari10: { - // base: 'SauceLabs', - // browserName: 'safari', - // version: '10' - // }, - Safari9: { - base: 'SauceLabs', - browserName: 'safari', - version: '9' - }, - Safari8: { - base: 'SauceLabs', - browserName: 'safari', - version: '8' + base: 'BrowserStack', + browser: 'IE', + browser_version: '11', + os: 'Windows', + os_version: '10' } - // TODO: For some reason Safari 7 gets fails to load - // the test page, every other browser seems to work fine. - // Safari7: { - // base: 'SauceLabs', - // browserName: 'safari', - // platform: 'OS X 10.9', - // version: '7' - // } }; const karmaConfig = { basePath: '', frameworks: [ - 'mocha' + 'mocha', + 'webpack' ], files: [ @@ -77,7 +34,7 @@ module.exports = function(config) { stats: 'errors-only' }, - reporters: ['mocha', 'saucelabs'], + reporters: ['mocha', 'BrowserStack'], mochaReporter: { showDiff: true @@ -89,12 +46,6 @@ module.exports = function(config) { logLevel: config.LOG_INFO, - sauceLabs: { - testName: 'salte-io/salte-angular-hateoas', - tunnelIdentifier: process.env.TRAVIS_JOB_NUMBER, - startConnect: true - }, - customLaunchers: customLaunchers, browsers: Object.keys(customLaunchers), captureTimeout: 0, diff --git a/karma.conf.js b/karma.conf.js index 9e27a31..73999dc 100644 --- a/karma.conf.js +++ b/karma.conf.js @@ -4,7 +4,7 @@ webpackConfig.module.rules.push({ test: /\.js$/, exclude: /tests|node_modules/, use: { - loader: 'istanbul-instrumenter-loader', + loader: '@jsdevtools/coverage-istanbul-loader', options: { esModules: true } } }); @@ -14,7 +14,8 @@ module.exports = function(config) { basePath: '', frameworks: [ - 'mocha' + 'mocha', + 'webpack' ], files: [ diff --git a/local.log b/local.log new file mode 100644 index 0000000..7f23841 --- /dev/null +++ b/local.log @@ -0,0 +1,8 @@ + + +Thu Jul 01 2021 12:05:15 GMT-0500 (Central Daylight Time) -- [INFO] Started the BrowserStack Binary server on 45691, PID: 54909 +Thu Jul 01 2021 12:05:15 GMT-0500 (Central Daylight Time) -- [SUCCESS] You can now access your local server(s) in our remote browser + +Thu Jul 01 2021 12:05:17 GMT-0500 (Central Daylight Time) -- Press Ctrl-C to exit + + diff --git a/package-scripts.yml b/package-scripts.yml index edd532f..31439ed 100644 --- a/package-scripts.yml +++ b/package-scripts.yml @@ -9,9 +9,9 @@ scripts: tdd: script: karma start description: Watches for changes and executes the Test Suite accordingly - sauce: + ci: script: karma start karma.ci.conf.js - description: Executes the Test Suite on Sauce Labs + description: Executes the Test Suite on BrowserStack serve: script: webpack-dev-server --config webpack.server.config.js description: Starts a server at http://localhost:8080 @@ -20,10 +20,10 @@ scripts: script: nps build.dev && nps build.prod description: Builds both a minified and unminified artifact dev: - script: webpack --progress --colors --mode development + script: webpack --progress --mode development description: Builds an unminified artifact prod: - script: webpack --progress --colors --mode production + script: webpack --progress --mode production description: Builds a minified artifact report-coverage: script: coveralls < coverage/lcov.info diff --git a/package.json b/package.json index 34edd0f..b2c7d2e 100644 --- a/package.json +++ b/package.json @@ -18,7 +18,8 @@ }, "scripts": { "start": "nps", - "prepublishOnly": "yarn start build" + "prepublishOnly": "npm start build", + "prepare": "husky install" }, "license": "MIT", "peerDependencies": { @@ -27,30 +28,30 @@ "devDependencies": { "@babel/core": "^7.2.2", "@babel/preset-env": "^7.3.1", + "@jsdevtools/coverage-istanbul-loader": "^3.0.5", "angular": "^1.7.7", "angular-mocks": "^1.7.7", "babel-loader": "^8.0.5", "chai": "^4.1.1", "coveralls": "^3.0.0", "deindent": "^0.1.0", - "eslint": "^6.0.0", - "eslint-plugin-mocha": "^6.0.0", - "husky": "^4.0.2", - "istanbul-instrumenter-loader": "^3.0.0", - "karma": "^5.0.3", + "eslint": "^7.0.0", + "eslint-plugin-mocha": "^10.0.4", + "husky": "^7.0.0", + "karma": "^6.0.0", + "karma-browserstack-launcher": "1.6.0", "karma-chrome-launcher": "^3.0.0", "karma-coverage": "^2.0.0", "karma-mocha": "^2.0.1", "karma-mocha-reporter": "^2.2.5", - "karma-sauce-launcher": "^4.1.4", "karma-sourcemap-loader": "^0.3.7", - "karma-webpack": "^4.0.2", - "mocha": "^7.0.1", + "karma-webpack": "^5.0.0-alpha.5", + "mocha": "^9.0.0", "nps": "^5.0.0", "remove-lockfiles": "^2.0.0", "semantic-release": "^17.0.0", - "webpack": "^4.29.4", - "webpack-cli": "^3.2.3" + "webpack": "^5.15.0", + "webpack-cli": "^4.0.0" }, "husky": { "hooks": { diff --git a/webpack.config.js b/webpack.config.js index a3bc37a..f40b90c 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -39,7 +39,7 @@ module.exports = { /** * ${packageJson.name} JavaScript Library v${packageJson.version} * - * @license MIT (https://github.com/salte-io/salte-angular-hateoas/blob/master/LICENSE) + * @license MIT (https://github.com/salte-io/salte-angular-hateoas/blob/main/LICENSE) * * Made with ♥ by ${packageJson.contributors.join(', ')} */ diff --git a/webpack.test.config.js b/webpack.test.config.js index 13b7365..b961790 100644 --- a/webpack.test.config.js +++ b/webpack.test.config.js @@ -4,8 +4,8 @@ module.exports = { }, module: { rules: [{ - test: /\.js$/, - exclude: /node_modules/, + test: /\.m?js$/, + exclude: /node_modules\/(?!chai)/, loader: 'babel-loader' }] },