diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..53cd4bd --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,17 @@ +name: Release +on: + push: + tags: ['*'] +permissions: + contents: write +jobs: + release: + name: Release + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Create GitHub release + uses: docker://antonyurchenko/git-release:v4 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/CHANGELOG.md b/CHANGELOG.md index a888219..182be6e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ ## [7.0.0] - 2021-04-09 +_If you are upgrading: please see [`UPGRADING.md`](UPGRADING.md)._ + ### Changed - **Breaking:** drop node 6 and 8 ([Level/community#98](https://github.com/Level/community/issues/98)) ([`5c6752f`](https://github.com/Level/encoding-down/commit/5c6752f)) (Vincent Weevers) @@ -70,6 +72,8 @@ ## [6.0.0] - 2018-12-25 +_If you are upgrading: please see [`UPGRADING.md`](UPGRADING.md)._ + ### Changed - Prefer `const` over `var` in README ([**@ralphtheninja**](https://github.com/ralphtheninja)) @@ -120,6 +124,8 @@ ## [5.0.0] - 2018-05-13 +_If you are upgrading: please see [`UPGRADING.md`](UPGRADING.md)._ + ### Added - Add 10 to Travis ([**@ralphtheninja**](https://github.com/ralphtheninja)) @@ -141,6 +147,8 @@ ## [4.0.0] - 2018-02-12 +_If you are upgrading: please see [`UPGRADING.md`](UPGRADING.md)._ + ### Added - Add 9 to Travis ([**@ralphtheninja**](https://github.com/ralphtheninja)) @@ -166,6 +174,8 @@ ## [3.0.0] - 2017-11-11 +_If you are upgrading: please see [`UPGRADING.md`](UPGRADING.md)._ + ### Added - README: add node badge (>= 4) ([**@vweevers**](https://github.com/vweevers)) @@ -336,78 +346,78 @@ :seedling: Initial release. -[7.0.0]: https://github.com/Level/encoding-down/compare/v6.3.0...v7.0.0 +[7.0.0]: https://github.com/Level/encoding-down/releases/tag/v7.0.0 -[6.3.0]: https://github.com/Level/encoding-down/compare/v6.2.0...v6.3.0 +[6.3.0]: https://github.com/Level/encoding-down/releases/tag/v6.3.0 -[6.2.0]: https://github.com/Level/encoding-down/compare/v6.1.0...v6.2.0 +[6.2.0]: https://github.com/Level/encoding-down/releases/tag/v6.2.0 -[6.1.0]: https://github.com/Level/encoding-down/compare/v6.0.2...v6.1.0 +[6.1.0]: https://github.com/Level/encoding-down/releases/tag/v6.1.0 -[6.0.2]: https://github.com/Level/encoding-down/compare/v6.0.1...v6.0.2 +[6.0.2]: https://github.com/Level/encoding-down/releases/tag/v6.0.2 -[6.0.1]: https://github.com/Level/encoding-down/compare/v6.0.0...v6.0.1 +[6.0.1]: https://github.com/Level/encoding-down/releases/tag/v6.0.1 -[6.0.0]: https://github.com/Level/encoding-down/compare/v5.0.4...v6.0.0 +[6.0.0]: https://github.com/Level/encoding-down/releases/tag/v6.0.0 -[5.0.4]: https://github.com/Level/encoding-down/compare/v5.0.3...v5.0.4 +[5.0.4]: https://github.com/Level/encoding-down/releases/tag/v5.0.4 -[5.0.3]: https://github.com/Level/encoding-down/compare/v5.0.2...v5.0.3 +[5.0.3]: https://github.com/Level/encoding-down/releases/tag/v5.0.3 -[5.0.2]: https://github.com/Level/encoding-down/compare/v5.0.1...v5.0.2 +[5.0.2]: https://github.com/Level/encoding-down/releases/tag/v5.0.2 -[5.0.1]: https://github.com/Level/encoding-down/compare/v5.0.0...v5.0.1 +[5.0.1]: https://github.com/Level/encoding-down/releases/tag/v5.0.1 -[5.0.0]: https://github.com/Level/encoding-down/compare/v4.0.1...v5.0.0 +[5.0.0]: https://github.com/Level/encoding-down/releases/tag/v5.0.0 -[4.0.1]: https://github.com/Level/encoding-down/compare/v4.0.0...v4.0.1 +[4.0.1]: https://github.com/Level/encoding-down/releases/tag/v4.0.1 -[4.0.0]: https://github.com/Level/encoding-down/compare/v3.0.1...v4.0.0 +[4.0.0]: https://github.com/Level/encoding-down/releases/tag/v4.0.0 -[3.0.1]: https://github.com/Level/encoding-down/compare/v3.0.0...v3.0.1 +[3.0.1]: https://github.com/Level/encoding-down/releases/tag/v3.0.1 -[3.0.0]: https://github.com/Level/encoding-down/compare/v2.3.4...v3.0.0 +[3.0.0]: https://github.com/Level/encoding-down/releases/tag/v3.0.0 -[2.3.4]: https://github.com/Level/encoding-down/compare/v2.3.3...v2.3.4 +[2.3.4]: https://github.com/Level/encoding-down/releases/tag/v2.3.4 -[2.3.3]: https://github.com/Level/encoding-down/compare/v2.3.2...v2.3.3 +[2.3.3]: https://github.com/Level/encoding-down/releases/tag/v2.3.3 -[2.3.2]: https://github.com/Level/encoding-down/compare/v2.3.1...v2.3.2 +[2.3.2]: https://github.com/Level/encoding-down/releases/tag/v2.3.2 -[2.3.1]: https://github.com/Level/encoding-down/compare/v2.3.0...v2.3.1 +[2.3.1]: https://github.com/Level/encoding-down/releases/tag/v2.3.1 -[2.3.0]: https://github.com/Level/encoding-down/compare/v2.2.1...v2.3.0 +[2.3.0]: https://github.com/Level/encoding-down/releases/tag/v2.3.0 -[2.2.1]: https://github.com/Level/encoding-down/compare/v2.2.0...v2.2.1 +[2.2.1]: https://github.com/Level/encoding-down/releases/tag/v2.2.1 -[2.2.0]: https://github.com/Level/encoding-down/compare/v2.1.5...v2.2.0 +[2.2.0]: https://github.com/Level/encoding-down/releases/tag/v2.2.0 -[2.1.5]: https://github.com/Level/encoding-down/compare/v2.1.4...v2.1.5 +[2.1.5]: https://github.com/Level/encoding-down/releases/tag/v2.1.5 -[2.1.4]: https://github.com/Level/encoding-down/compare/v2.1.3...v2.1.4 +[2.1.4]: https://github.com/Level/encoding-down/releases/tag/v2.1.4 -[2.1.3]: https://github.com/Level/encoding-down/compare/v2.1.2...v2.1.3 +[2.1.3]: https://github.com/Level/encoding-down/releases/tag/v2.1.3 -[2.1.2]: https://github.com/Level/encoding-down/compare/v2.1.1...v2.1.2 +[2.1.2]: https://github.com/Level/encoding-down/releases/tag/v2.1.2 -[2.1.1]: https://github.com/Level/encoding-down/compare/v2.1.0...v2.1.1 +[2.1.1]: https://github.com/Level/encoding-down/releases/tag/v2.1.1 -[2.1.0]: https://github.com/Level/encoding-down/compare/v2.0.8...v2.1.0 +[2.1.0]: https://github.com/Level/encoding-down/releases/tag/v2.1.0 -[2.0.8]: https://github.com/Level/encoding-down/compare/v2.0.7...v2.0.8 +[2.0.8]: https://github.com/Level/encoding-down/releases/tag/v2.0.8 -[2.0.7]: https://github.com/Level/encoding-down/compare/v2.0.6...v2.0.7 +[2.0.7]: https://github.com/Level/encoding-down/releases/tag/v2.0.7 -[2.0.6]: https://github.com/Level/encoding-down/compare/v2.0.5...v2.0.6 +[2.0.6]: https://github.com/Level/encoding-down/releases/tag/v2.0.6 -[2.0.5]: https://github.com/Level/encoding-down/compare/v2.0.4...v2.0.5 +[2.0.5]: https://github.com/Level/encoding-down/releases/tag/v2.0.5 -[2.0.4]: https://github.com/Level/encoding-down/compare/v2.0.3...v2.0.4 +[2.0.4]: https://github.com/Level/encoding-down/releases/tag/v2.0.4 -[2.0.3]: https://github.com/Level/encoding-down/compare/v2.0.2...v2.0.3 +[2.0.3]: https://github.com/Level/encoding-down/releases/tag/v2.0.3 -[2.0.2]: https://github.com/Level/encoding-down/compare/v2.0.1...v2.0.2 +[2.0.2]: https://github.com/Level/encoding-down/releases/tag/v2.0.2 -[2.0.1]: https://github.com/Level/encoding-down/compare/v2.0.0...v2.0.1 +[2.0.1]: https://github.com/Level/encoding-down/releases/tag/v2.0.1 -[2.0.0]: https://github.com/Level/encoding-down/compare/v1.0.0...v2.0.0 +[2.0.0]: https://github.com/Level/encoding-down/releases/tag/v2.0.0 diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md deleted file mode 100644 index 7dd380d..0000000 --- a/CONTRIBUTORS.md +++ /dev/null @@ -1,9 +0,0 @@ -# Contributors - -| Name | GitHub | Social | -| :------------------- | :----------------------------------------------------------- | :------------------------------------------------------------ | -| **Vincent Weevers** | [**@vweevers**](https://github.com/vweevers) | [**@vweevers@twitter**](https://twitter.com/vweevers) | -| **Lars-Magnus Skog** | [**@ralphtheninja**](https://github.com/ralphtheninja) | [**@ralph@social.weho.st**](https://social.weho.st/@ralph) | -| **Julian Gruber** | [**@juliangruber**](https://github.com/juliangruber) | [**@juliangruber@twitter**](https://twitter.com/juliangruber) | -| **Meirion Hughes** | [**@MeirionHughes**](https://github.com/MeirionHughes) | | -| **Huan LI** | [**@zixia**](https://github.com/zixia) | [**@zixia@twitter**](https://twitter.com/zixia) | diff --git a/LICENSE.md b/LICENSE similarity index 92% rename from LICENSE.md rename to LICENSE index 1315b2f..639af7d 100644 --- a/LICENSE.md +++ b/LICENSE @@ -1,6 +1,6 @@ -# The MIT License (MIT) +The MIT License (MIT) -**Copyright © 2012-present [Contributors](CONTRIBUTORS.md).** +Copyright © 2012 The contributors to encoding-down. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/README.md b/README.md index fbaf9af..c2e62c8 100644 --- a/README.md +++ b/README.md @@ -3,14 +3,13 @@ > An [`abstract-leveldown`][abstract-leveldown] implementation that wraps another store to encode keys and values. [![level badge][level-badge]](https://github.com/Level/awesome) -[![npm](https://img.shields.io/npm/v/encoding-down.svg?label=&logo=npm)](https://www.npmjs.com/package/encoding-down) +[![npm](https://img.shields.io/npm/v/encoding-down.svg)](https://www.npmjs.com/package/encoding-down) [![Node version](https://img.shields.io/node/v/encoding-down.svg)](https://www.npmjs.com/package/encoding-down) -[![Test](https://github.com/Level/encoding-down/actions/workflows/test.yml/badge.svg)](https://github.com/Level/encoding-down/actions/workflows/test.yml) -[![Coverage Status](https://codecov.io/gh/Level/encoding-down/branch/master/graph/badge.svg)](https://codecov.io/gh/Level/encoding-down) -[![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com) -[![npm](https://img.shields.io/npm/dm/encoding-down.svg?label=dl)](https://www.npmjs.com/package/encoding-down) -[![Backers on Open Collective](https://opencollective.com/level/backers/badge.svg?color=orange)](#backers) -[![Sponsors on Open Collective](https://opencollective.com/level/sponsors/badge.svg?color=orange)](#sponsors) +[![Test](https://img.shields.io/github/workflow/status/Level/encoding-down/Test?label=test)](https://github.com/Level/encoding-down/actions/workflows/test.yml) +[![Coverage](https://img.shields.io/codecov/c/github/Level/encoding-down?label=&logo=codecov&logoColor=fff)](https://codecov.io/gh/Level/encoding-down) +[![Standard](https://img.shields.io/badge/standard-informational?logo=javascript&logoColor=fff)](https://standardjs.com) +[![Common Changelog](https://common-changelog.org/badge.svg)](https://common-changelog.org) +[![Donate](https://img.shields.io/badge/donate-orange?logo=open-collective&logoColor=fff)](https://opencollective.com/level) ## Introduction @@ -23,11 +22,11 @@ Stores like [`leveldown`][leveldown] can only store strings and Buffers. Other t Without any options, `encoding-down` defaults to the `utf8` encoding. ```js -var levelup = require('levelup') -var leveldown = require('leveldown') -var encode = require('encoding-down') +const levelup = require('levelup') +const leveldown = require('leveldown') +const encode = require('encoding-down') -var db = levelup(encode(leveldown('./db1'))) +const db = levelup(encode(leveldown('./db1'))) db.put('example', Buffer.from('encoding-down'), function (err) { db.get('example', function (err, value) { @@ -39,7 +38,7 @@ db.put('example', Buffer.from('encoding-down'), function (err) { Can we store objects? Yes! ```js -var db = levelup(encode(leveldown('./db2'), { valueEncoding: 'json' })) +const db = levelup(encode(leveldown('./db2'), { valueEncoding: 'json' })) db.put('example', { awesome: true }, function (err) { db.get('example', function (err, value) { @@ -52,7 +51,7 @@ db.put('example', { awesome: true }, function (err) { How about storing Buffers, but getting back a hex-encoded string? ```js -var db = levelup(encode(leveldown('./db3'), { valueEncoding: 'hex' })) +const db = levelup(encode(leveldown('./db3'), { valueEncoding: 'hex' })) db.put('example', Buffer.from([0, 255]), function (err) { db.get('example', function (err, value) { @@ -64,7 +63,7 @@ db.put('example', Buffer.from([0, 255]), function (err) { What if we previously stored binary data? ```js -var db = levelup(encode(leveldown('./db4'), { valueEncoding: 'binary' })) +const db = levelup(encode(leveldown('./db4'), { valueEncoding: 'binary' })) db.put('example', Buffer.from([0, 255]), function (err) { db.get('example', function (err, value) { @@ -81,7 +80,7 @@ db.put('example', Buffer.from([0, 255]), function (err) { And what about keys? ```js -var db = levelup(encode(leveldown('./db5'), { keyEncoding: 'json' })) +const db = levelup(encode(leveldown('./db5'), { keyEncoding: 'json' })) db.put({ awesome: true }, 'example', function (err) { db.get({ awesome: true }, function (err, value) { @@ -91,7 +90,7 @@ db.put({ awesome: true }, 'example', function (err) { ``` ```js -var db = levelup(encode(leveldown('./db6'), { keyEncoding: 'binary' })) +const db = levelup(encode(leveldown('./db6'), { keyEncoding: 'binary' })) db.put(Buffer.from([0, 255]), 'example', function (err) { db.get('00ff', { keyEncoding: 'hex' }, function (err, value) { @@ -105,8 +104,8 @@ db.put(Buffer.from([0, 255]), 'example', function (err) { The [`level`][level] module conveniently bundles `encoding-down` and passes its `options` to `encoding-down`. This means you can simply do: ```js -var level = require('level') -var db = level('./db7', { valueEncoding: 'json' }) +const level = require('level') +const db = level('./db7', { valueEncoding: 'json' }) db.put('example', 42, function (err) { db.get('example', function (err, value) { @@ -132,11 +131,11 @@ Both encodings default to `'utf8'`. They can be a string (builtin `level-codec` Please refer to [`level-codec` documentation][encoding-format] for a precise description of the format. Here's a quick example with `level` and `async/await` just for fun: ```js -var level = require('level') -var lexint = require('lexicographic-integer') +const level = require('level') +const lexint = require('lexicographic-integer') async function main () { - var db = level('./db8', { + const db = level('./db8', { keyEncoding: { type: 'lexicographic-integer', encode: (n) => lexint.pack(n, 'hex'), @@ -158,10 +157,10 @@ main() With an npm-installed encoding (modularity ftw!) we can reduce the above to: ```js -var level = require('level') -var lexint = require('lexicographic-integer-encoding')('hex') +const level = require('level') +const lexint = require('lexicographic-integer-encoding')('hex') -var db = level('./db8', { +const db = level('./db8', { keyEncoding: lexint }) ``` @@ -176,19 +175,11 @@ See the [Contribution Guide](https://github.com/Level/community/blob/master/CONT ## Donate -To sustain [`Level`](https://github.com/Level) and its activities, become a backer or sponsor on [Open Collective](https://opencollective.com/level). Your logo or avatar will be displayed on our 28+ [GitHub repositories](https://github.com/Level) and [npm](https://www.npmjs.com/) packages. 💖 - -### Backers - -[![Open Collective backers](https://opencollective.com/level/backers.svg?width=890)](https://opencollective.com/level) - -### Sponsors - -[![Open Collective sponsors](https://opencollective.com/level/sponsors.svg?width=890)](https://opencollective.com/level) +Support us with a monthly donation on [Open Collective](https://opencollective.com/level) and help us continue our work. ## License -[MIT](LICENSE.md) © 2012-present [Contributors](CONTRIBUTORS.md). +[MIT](LICENSE) [level-badge]: https://leveljs.org/img/badge.svg diff --git a/package.json b/package.json index beb3ca4..96663b3 100644 --- a/package.json +++ b/package.json @@ -15,8 +15,6 @@ "files": [ "index.js", "CHANGELOG.md", - "CONTRIBUTORS.md", - "LICENSE.md", "UPGRADING.md" ], "dependencies": { @@ -30,15 +28,11 @@ "airtap-playwright": "^1.0.1", "dependency-check": "^3.3.0", "hallmark": "^3.1.0", - "level-community": "^3.0.0", "memdown": "^6.1.0", "nyc": "^15.1.0", "standard": "^16.0.3", "tape": "^5.0.1" }, - "hallmark": { - "community": "level-community" - }, "repository": "Level/encoding-down", "homepage": "https://github.com/Level/encoding-down", "keywords": [