diff --git a/.circleci/config.yml b/.circleci/config.yml index 6e2a080b..f0375fd3 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -49,10 +49,21 @@ jobs: ignore: - gh-pages + node12: + docker: + - image: circleci/node:12 + <<: *common-build + + filters: + branches: + ignore: + - gh-pages + workflows: version: 2 test_node_versions: jobs: - node8 - node10 + - node12 diff --git a/CHANGELOG.md b/CHANGELOG.md index a3c636f4..0517cce6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,48 @@ -# Change Log +# Changelog All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. +## [2.0.0](https://github.com/nodeshift/opossum/compare/v1.11.1...v2.0.0) (2019-06-05) + + +### Build System + +* use node 12 on ci/cd in addition to 8 and 10 ([93f8008](https://github.com/nodeshift/opossum/commit/93f8008)) + + +### Features + +* prometheus client integration ([282b467](https://github.com/nodeshift/opossum/commit/282b467)) + +### Breaking Changes + +* `health-check-failed` and `semaphore-locked` events have been changed to `healthCheckFailed` and `semaphoreLocked` respectively + + +### [1.11.1](https://github.com/nodeshift/opossum/compare/v1.11.0...v1.11.1) (2019-05-22) + + +### Build System + +* don't fail coverage from untrusted forks ([194e18d](https://github.com/nodeshift/opossum/commit/194e18d)) +* remove travis-ci now that circleci is good ([9756bf5](https://github.com/nodeshift/opossum/commit/9756bf5)) +* rename the workflow to test_node_versions in circleci ([c7cc277](https://github.com/nodeshift/opossum/commit/c7cc277)) +* set circleci to ignore gh-pages branch ([23e1384](https://github.com/nodeshift/opossum/commit/23e1384)) +* set up coveralls (again); remove Makefile ([d099b45](https://github.com/nodeshift/opossum/commit/d099b45)) +* switch to standardx for linting ([4967736](https://github.com/nodeshift/opossum/commit/4967736)) +* try circleci for continuous integration ([1a77f3a](https://github.com/nodeshift/opossum/commit/1a77f3a)) +* try workflows for multiple version builds ([5e9e6c8](https://github.com/nodeshift/opossum/commit/5e9e6c8)) +* use codacy for coverage instead of coveralls ([e359ab9](https://github.com/nodeshift/opossum/commit/e359ab9)) + + +### Tests + +* generate browser/headless test suite ([2d24b35](https://github.com/nodeshift/opossum/commit/2d24b35)) +* improve circuit.shutdown() test ([6841abc](https://github.com/nodeshift/opossum/commit/6841abc)) +* switch to serve instead of http-server for browser tests ([50ccab7](https://github.com/nodeshift/opossum/commit/50ccab7)) + + + # [1.11.0](https://github.com/nodeshift/opossum/compare/v1.10.1...v1.11.0) (2019-03-14) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index b3b45adb..568486f3 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -86,8 +86,8 @@ Click the 'Pull Request' button and fill out the form. These are mostly notes for myself. - * Make sure everything works: `make clean && npm install && make ci` - * Run standard-version: `npm run release` + * Be sure you are starting from a clean slate: `npm clean && npm install` + * Run standard-version: `npm run release` - this will run the `ci` task * Push to GitHub: `git push --follow-tags origin master` * Publish to npmjs.com: `npm publish` * Assuming all goes well, head over to https://github.com/nodeshift/opossum/releases diff --git a/README.md b/README.md index 5a3322bd..56e70c00 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,7 @@ on the web - search it! Fowler's blog post is one place to | Documentation: | https://nodeshift.dev/opossum/ | | Typngs: | https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/opossum | Issue tracker: | https://github.com/nodeshift/opossum/issues | -| Engines: | Node.js 8.x, 10.x, 11.x | +| Engines: | Node.js 8.x, 10.x, 11.x, 12.x | ## Usage @@ -161,8 +161,8 @@ Here are the events you can listen for. * `close` - emitted when the breaker state changes to `closed` * `halfOpen` - emitted when the breaker state changes to `halfOpen` * `fallback` - emitted when the breaker has a fallback function and executes it - * `semaphore-locked` - emitted when the breaker is at capacity and cannot execute the request - * `health-check-failed` - emitted when a user-supplied health check function returns a rejected promise + * `semaphoreLocked` - emitted when the breaker is at capacity and cannot execute the request + * `healthCheckFailed` - emitted when a user-supplied health check function returns a rejected promise Handling events gives a greater level of control over your application behavior. diff --git a/config/webpack.browser.config.js b/config/webpack.browser.config.js new file mode 100644 index 00000000..3646eea2 --- /dev/null +++ b/config/webpack.browser.config.js @@ -0,0 +1,66 @@ +const path = require('path'); +const webpack = require('webpack'); +const configs = ['opossum', 'opossum.min', 'browser-test'] + .map(key => generateConfig(key)); + +// add a webpack for tests +configs.push({ + target: 'web', + mode: 'development', + entry: './test/browser/index.js', + node: { + fs: 'empty' + }, + output: { + path: path.resolve(__dirname, '..', 'test', 'browser'), + filename: 'webpack-test.js' + }, + resolve: { + modules: ['node_modules'], + extensions: ['*', '.js'] + }, + plugins: [ + new webpack.IgnorePlugin(/prom-client/), + new webpack.DefinePlugin({ + 'process.env': { + WEB: JSON.stringify('web') + } + }) + ] +}); + +function generateConfig (name) { + const mode = name.indexOf('min') > -1 ? 'production' : 'development'; + const config = { + mode, + entry: { + circuitBreaker: './index.js' + }, + output: { + path: path.resolve(__dirname, '..', 'dist'), + filename: `${name}.js`, + sourceMapFilename: `${name}.map`, + library: 'circuitBreaker', + libraryTarget: 'umd' + }, + node: { + process: true, + console: true + }, + plugins: [ + new webpack.IgnorePlugin(/prom-client/), + new webpack.ProvidePlugin({ + 'circuitBreaker': 'opossum' + }), + new webpack.DefinePlugin({ + 'process.env': { + WEB: JSON.stringify('web') + } + }) + ], + devtool: 'source-map' + }; + return config; +} + +module.exports = configs; diff --git a/config/webpack.config.js b/config/webpack.config.js index c71a9b39..30904aa4 100644 --- a/config/webpack.config.js +++ b/config/webpack.config.js @@ -1,29 +1,12 @@ const path = require('path'); const webpack = require('webpack'); -const configs = ['opossum', 'opossum.min', 'browser-test'] +const configs = ['opossum', 'opossum.min'] .map(key => generateConfig(key)); -// add a webpack for tests -configs.push({ - target: 'web', - mode: 'development', - entry: './test/browser/index.js', - node: { - fs: 'empty' - }, - output: { - path: path.resolve(__dirname, '..', 'test', 'browser'), - filename: 'webpack-test.js' - }, - resolve: { - modules: ['node_modules'], - extensions: ['*', '.js'] - } -}); - function generateConfig (name) { const mode = name.indexOf('min') > -1 ? 'production' : 'development'; const config = { + target: 'node', mode, entry: { circuitBreaker: './index.js' diff --git a/docs/index.html b/docs/index.html index 0fa6fde0..cf4b2d54 100644 --- a/docs/index.html +++ b/docs/index.html @@ -146,6 +146,12 @@

opossum

#hystrixStats +
  • + #metrics +
  • +
  • @@ -300,9 +306,9 @@

    opossum

  • - CircuitBreaker#semaphore-locked + CircuitBreaker#semaphoreLocked @@ -310,9 +316,9 @@

    opossum

  • - CircuitBreaker#health-check-failed + CircuitBreaker#healthCheckFailed @@ -588,8 +594,8 @@

    Events

  • close - emitted when the breaker state changes to closed
  • halfOpen - emitted when the breaker state changes to halfOpen
  • fallback - emitted when the breaker has a fallback function and executes it
  • -
  • semaphore-locked - emitted when the breaker is at capacity and cannot execute the request
  • -
  • health-check-failed - emitted when a user-supplied health check function returns a rejected promise
  • +
  • semaphoreLocked - emitted when the breaker is at capacity and cannot execute the request
  • +
  • healthCheckFailed - emitted when a user-supplied health check function returns a rejected promise
  • Handling events gives a greater level of control over your application behavior.

    const circuit = circuitBreaker(() => $.get(route), circuitBreakerOptions);
    @@ -1921,6 +1927,58 @@ 

    + + + + + + + + + + + + +
    +
    +
    + + metrics +
    +
    +