diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..beffa30 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,11 @@ +root = true + +[*] +indent_style = space +indent_size = 2 +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true + +[*.md] +trim_trailing_whitespace = false diff --git a/.eslintignore b/.eslintignore new file mode 100644 index 0000000..8493529 --- /dev/null +++ b/.eslintignore @@ -0,0 +1,3 @@ +tmp +node_modules/ +.git diff --git a/.eslintrc.json b/.eslintrc.json new file mode 100644 index 0000000..de3a642 --- /dev/null +++ b/.eslintrc.json @@ -0,0 +1,11 @@ +{ + "extends": "groupon", + "overrides": [ + { + "files": "*.test.js", + "env": { + "mocha": true + } + } + ] +} diff --git a/.gitignore b/.gitignore index 3c3629e..0e6f9ba 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,6 @@ -node_modules +/.nyc_output +node_modules/ +npm-debug.log +/tmp +*.log +/target diff --git a/.npmignore b/.npmignore deleted file mode 100644 index 366f223..0000000 --- a/.npmignore +++ /dev/null @@ -1,3 +0,0 @@ -/examples -/src -/test diff --git a/.npmrc b/.npmrc new file mode 100644 index 0000000..7061c24 --- /dev/null +++ b/.npmrc @@ -0,0 +1,2 @@ +ignore-engines=true +registry=https://registry.npmjs.org diff --git a/.travis.yml b/.travis.yml index e3447bf..1053e0e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,15 @@ language: node_js node_js: - - "0.8" - - "0.10" - - "0.11" + - 8 + - 10 + - 12 +deploy: + - provider: script + script: npx nlm release + skip_cleanup: true + 'on': + branch: master + node: 12 services: memcached +before_install: + - npm i -g npm@^6 diff --git a/CHANGELOG.md b/CHANGELOG.md index d5aad14..a632447 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,106 @@ +### 5.0.2 + +* misc updates - **[@dbushong](https://github.com/dbushong)** [#46](https://github.com/groupon/node-cached/pull/46) + - [`25732ff`](https://github.com/groupon/node-cached/commit/25732ffaf461edddb9c03db28bb3c6b4f8d91342) **chore:** run updater + - [`eb5db4e`](https://github.com/groupon/node-cached/commit/eb5db4e64de5e6472de68c9e18cd9b3d05e066d3) **chore:** lint fixes + - [`e301ea9`](https://github.com/groupon/node-cached/commit/e301ea90eb56b2ce143fc394eea869538f3a3716) **chore:** npm audit fix + + +### 5.0.1 + +* chore: Remove yarn check that breaks people - **[@jkrems](https://github.com/jkrems)** [#42](https://github.com/groupon/node-cached/pull/42) + - [`147a7f3`](https://github.com/groupon/node-cached/commit/147a7f3e1a5dd1a3690e134facf077b3b3329edf) **chore:** Remove yarn check that breaks people + + +### 5.0.0 + +#### Breaking Changes + +drops support for Node 6, which is a current LTS release. + +*See: [`f4ba4c9`](https://github.com/groupon/node-cached/commit/f4ba4c988b5d5db0cf07edfe9f0013d5fada075f)* + +#### Commits + +* feat: drop node4 support - **[@aaarichter](https://github.com/aaarichter)** [#39](https://github.com/groupon/node-cached/pull/39) + - [`29b26fa`](https://github.com/groupon/node-cached/commit/29b26fa240033cd7b5409407ea42b375a29c4c33) **feat:** drop node4 support + - [`23dcc6a`](https://github.com/groupon/node-cached/commit/23dcc6aa409f82be5485f3041948a9cdd1c1755e) **chore:** feedback addressed +* Drop Node 6 support, and Babel as a result - **[@markowsiak](https://github.com/markowsiak)** [#40](https://github.com/groupon/node-cached/pull/40) + - [`2339fd1`](https://github.com/groupon/node-cached/commit/2339fd1d2064e6bab3f21fce0ca68af3916be129) **chore:** npm audit, drop babel + - [`f4ba4c9`](https://github.com/groupon/node-cached/commit/f4ba4c988b5d5db0cf07edfe9f0013d5fada075f) **chore:** drop support for node 6, keep async/await in test + - [`fe943d8`](https://github.com/groupon/node-cached/commit/fe943d8b7b34c7d4439e674cacc675699e3ba98e) **chore:** use npm 6 in travis + + +### 4.3.2 + +* Apply latest nlm generator - **[@markowsiak](https://github.com/markowsiak)** [#38](https://github.com/groupon/node-cached/pull/38) + - [`35b216e`](https://github.com/groupon/node-cached/commit/35b216e3d11b94502d968d40fcf7f34e7a5b507e) **chore:** Apply latest nlm generator + + +### 4.3.1 + +* docs: Clarify that timeout applies to unset - **[@Zanadar](https://github.com/Zanadar)** [#36](https://github.com/groupon/node-cached/pull/36) + - [`89209ce`](https://github.com/groupon/node-cached/commit/89209cefca9ad39ea1b2a789dd49e23d65eee960) **docs:** Clarify that timeout applies to unset +* docs: Fix typo in contributing.md - **[@Zanadar](https://github.com/Zanadar)** [#35](https://github.com/groupon/node-cached/pull/35) + - [`a3e5efa`](https://github.com/groupon/node-cached/commit/a3e5efaeec84e115de7fea035d5f69efc08cae3e) **docs:** fix typo in contributing.md + + +### 4.3.0 + +* feat: expose `cache.unset` - **[@fdegiuli](https://github.com/fdegiuli)** [#31](https://github.com/groupon/node-cached/pull/31) + - [`4e296af`](https://github.com/groupon/node-cached/commit/4e296afed9ce305ed27f94fb9d0e011a01d0bd87) **feat:** expose `cache.unset` + + +### 4.2.3 + +* docs: Update memory backend docs - **[@fdegiuli](https://github.com/fdegiuli)** [#29](https://github.com/groupon/node-cached/pull/29) + - [`3cebdb3`](https://github.com/groupon/node-cached/commit/3cebdb3cdb0dc997803d81d6c8c615e308261b0b) **docs:** Update memory backend docs + - [`dabce45`](https://github.com/groupon/node-cached/commit/dabce45603667e7112a87bf5592eaab73aac3b0e) **docs:** Fix formatting + + +### 4.2.2 + +* Update documentation for `cached` and backends - **[@fdegiuli](https://github.com/fdegiuli)** [#27](https://github.com/groupon/node-cached/pull/27) + - [`b137f56`](https://github.com/groupon/node-cached/commit/b137f56b77f1278ca6ab3680b6a0d1187941f788) **docs:** Add memory, noop backends to docs + - [`e4bd666`](https://github.com/groupon/node-cached/commit/e4bd6667d8f9fa2f4017876badee9e28e9d0bd49) **docs:** Deprecate unnamed caches + + +### 4.2.1 + +* Apply latest nlm generator - **[@i-tier-bot](https://github.com/i-tier-bot)** [#24](https://github.com/groupon/node-cached/pull/24) + - [`ee2b354`](https://github.com/groupon/node-cached/commit/ee2b354f83c2ee0fa4cc865e49bb4c6c4434c001) **chore:** Apply latest nlm generator + + +### 4.2.0 + +* True timeouts for cache calls - **[@jkrems](https://github.com/jkrems)** [#22](https://github.com/groupon/node-cached/pull/22) + - [`0d9e48f`](https://github.com/groupon/node-cached/commit/0d9e48fc07b82723a481499084a9bf14f3bc1b0d) **feat:** True timeouts for cache calls + + +### 4.1.1 + +* Switch to nlm - **[@jkrems](https://github.com/jkrems)** [#21](https://github.com/groupon/node-cached/pull/21) + - [`bdac8c6`](https://github.com/groupon/node-cached/commit/bdac8c6f1f68e6296abf513c941736c88771149a) **chore:** Switch to nlm + + +4.0.2 +----- +* Fix unhandled rejections w/ lazy fetching - @jkrems + https://github.com/groupon/node-cached/pull/16 + +4.0.1 +----- +* Fixing memcached.set slowness - @chkhoo #15 + +4.0.0 +----- +* Recompiled using cs 1.9.1 - @jkrems #11 +* Bringing this package into the future, io.js support - @jkrems #10 + +v3.0.1 +------ +* exchange cs (for csr) and lodash (for underscore) - @Kofia5 #8 + v3.0.0 ------ Upgrading to this version changes the key hashing. diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index bcf866b..1ef00de 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,30 +1,171 @@ -# Contribution Guide + -Please follow this guide when -creating issues or pull requests. +# Contributing -## Reporting a Bug +🎉🏅 Thanks for helping us improve this project! 🙏 -Before reporting a bug, -make sure you are using the latest versions of cached. +This document outlines some of the practices we care about. +If you have any questions or suggestions about the process, +feel free to [open an issue](#reporting-issues) +. -When reporting a bug with cached, -please provide a minimal test case. -This can be a gist, -inline in the description, -or in the form of a pull request -that includes a failing test. +## How Can I Contribute? -If you are contributing a bug fix, -make sure it has a passing test -in your pull request. +### Reporting Issues -## Adding a Feature +If you find any mistakes in the docs or a bug in the code, +please [open an issue in Github](https://github.com/groupon/node-cached/issues/new) so we can look into it. +You can also [create a PR](#contributing-code) fixing it yourself, or course. -Before implementing features, -try to make sure that -(1) no one else is currently working on that and -(2) you have checked with the maintainers -that this is something they would like to see. +If you report a bug, please follow these guidelines: + +* Make sure the bug exists in the latest version. +* Include instructions on how to reproduce the issue. + The instructions should be as minimal as possible + and answer the three big questions: + 1. What are the exact steps you took? This includes the exact versions of + node, npm, and any packages involved. + 1. What result are you expecting? + 1. What is the actual result? + +### Improving Documentation + +For small documentation changes, you can use [Github's editing feature][ghedit]. +The only thing to keep in mind is to prefix the commit message with "docs: ". +The default commit message generated by Github will lead to a failing CI build. + +[ghedit]: https://help.github.com/articles/editing-files-in-another-user-s-repository/ + +For larger updates to the documentation +it might be better to follow the +[instructions for contributing code below](#contributing-code). + +### Contributing Code + +**Note:** If you're planning on making substantial changes, +please [open an issue first to discuss your idea](#reporting-issues). +Otherwise you might end up investing a lot of work +only to discover that it conflicts with plans the maintainers might have. + +The general steps for creating a pull request are: + +1. Create a branch for your change. Always start your branch from the latest + `master`. We recommend using `git wf start some-feature-name` by using + [git workflow][gitwf]. Run `npm install` to install the dependencies. +1. If you're fixing a bug, be sure to write a test *first*. That way you can + validate that the test actually catches the bug and doesn't pass. +1. Make your changes to the code. Remember to update the tests if you add new + features or change behavior. +1. Run the tests via `npm test`. This will also run style checks and other + validations. You might see errors about uncommitted files. This is + expected until you commit your changes. +1. Once you're done, `git add .` and `git commit`. Please follow the + [commit message conventions](#commits--commit-messages) described below. +1. Push your branch to Github & create a PR. + +[gitwf]: https://github.com/groupon/git-workflow + +#### Code Style + +In addition to any linting rules the project might include, a few general rules +of thumb: + +* Try to match the style of the rest of the code. +* We prefer simple code that is easy to understand over terse, expressive code. +* We try to structure projects by semantics instead of role. E.g. we'd rather + have a `tree.js` module that contains tree traversal-related helpers than + a `helpers.js` module. +* Actually, if you create helpers you might want to put those into a separate + package. That way it's easier to reuse them. + +#### Commits & Commit Messages + +Please follow the [angular commit message conventions][angular-commits]. We +use an automated tool for generating releases that depends on the conventions +to determine the next version and the content of the changelog. Commit messages +that don't follow the conventions will cause `npm test` (and thus CI) to fail. + +The short summary - a commit message should look like this: + +``` +: + + + + + +