From 8344486d6971e0b2f49ceaa6dbc63f6469e8ed12 Mon Sep 17 00:00:00 2001 From: Alex Potsides Date: Wed, 19 Jan 2022 13:07:55 +0000 Subject: [PATCH 1/2] chore: switch to unified ci (#99) BREAKING CHANGE: updates project config to use unified ci --- .github/dependabot.yml | 2 +- .github/workflows/js-test-and-release.yml | 152 +++++++++++++++++ .github/workflows/main.yml | 69 -------- LICENSE | 23 +-- LICENSE-APACHE | 5 + LICENSE-MIT | 19 +++ README.md | 6 +- package.json | 197 ++++++++++++++++------ src/index.js | 10 +- 9 files changed, 328 insertions(+), 155 deletions(-) create mode 100644 .github/workflows/js-test-and-release.yml delete mode 100644 .github/workflows/main.yml create mode 100644 LICENSE-APACHE create mode 100644 LICENSE-MIT diff --git a/.github/dependabot.yml b/.github/dependabot.yml index de46e32..290ad02 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -4,5 +4,5 @@ updates: directory: "/" schedule: interval: daily - time: "11:00" + time: "10:00" open-pull-requests-limit: 10 diff --git a/.github/workflows/js-test-and-release.yml b/.github/workflows/js-test-and-release.yml new file mode 100644 index 0000000..8630dc5 --- /dev/null +++ b/.github/workflows/js-test-and-release.yml @@ -0,0 +1,152 @@ +name: test & maybe release +on: + push: + branches: + - master # with #262 - ${{{ github.default_branch }}} + pull_request: + branches: + - master # with #262 - ${{{ github.default_branch }}} + +jobs: + + check: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-node@v2 + with: + node-version: lts/* + - uses: ipfs/aegir/actions/cache-node-modules@master + - run: npm run --if-present lint + - run: npm run --if-present dep-check + + test-node: + needs: check + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [windows-latest, ubuntu-latest, macos-latest] + node: [16] + fail-fast: true + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-node@v2 + with: + node-version: ${{ matrix.node }} + - uses: ipfs/aegir/actions/cache-node-modules@master + - run: npm run --if-present test:node + - uses: codecov/codecov-action@f32b3a3741e1053eb607407145bc9619351dc93b # v2.1.0 + with: + directory: ./.nyc_output + flags: node + + test-chrome: + needs: check + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-node@v2 + with: + node-version: lts/* + - uses: ipfs/aegir/actions/cache-node-modules@master + - run: npm run --if-present test:chrome + - uses: codecov/codecov-action@f32b3a3741e1053eb607407145bc9619351dc93b # v2.1.0 + with: + directory: ./.nyc_output + flags: chrome + + test-chrome-webworker: + needs: check + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-node@v2 + with: + node-version: lts/* + - uses: ipfs/aegir/actions/cache-node-modules@master + - run: npm run --if-present test:chrome-webworker + - uses: codecov/codecov-action@f32b3a3741e1053eb607407145bc9619351dc93b # v2.1.0 + with: + directory: ./.nyc_output + flags: chrome-webworker + + test-firefox: + needs: check + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-node@v2 + with: + node-version: lts/* + - uses: ipfs/aegir/actions/cache-node-modules@master + - run: npm run --if-present test:firefox + - uses: codecov/codecov-action@f32b3a3741e1053eb607407145bc9619351dc93b # v2.1.0 + with: + directory: ./.nyc_output + flags: firefox + + test-firefox-webworker: + needs: check + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-node@v2 + with: + node-version: lts/* + - uses: ipfs/aegir/actions/cache-node-modules@master + - run: npm run --if-present test:firefox-webworker + - uses: codecov/codecov-action@f32b3a3741e1053eb607407145bc9619351dc93b # v2.1.0 + with: + directory: ./.nyc_output + flags: firefox-webworker + + test-electron-main: + needs: check + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-node@v2 + with: + node-version: lts/* + - uses: ipfs/aegir/actions/cache-node-modules@master + - run: npx xvfb-maybe npm run --if-present test:electron-main + - uses: codecov/codecov-action@f32b3a3741e1053eb607407145bc9619351dc93b # v2.1.0 + with: + directory: ./.nyc_output + flags: electron-main + + test-electron-renderer: + needs: check + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-node@v2 + with: + node-version: lts/* + - uses: ipfs/aegir/actions/cache-node-modules@master + - run: npx xvfb-maybe npm run --if-present test:electron-renderer + - uses: codecov/codecov-action@f32b3a3741e1053eb607407145bc9619351dc93b # v2.1.0 + with: + directory: ./.nyc_output + flags: electron-renderer + + release: + needs: [test-node, test-chrome, test-chrome-webworker, test-firefox, test-firefox-webworker, test-electron-main, test-electron-renderer] + runs-on: ubuntu-latest + if: github.event_name == 'push' && github.ref == 'refs/heads/master' # with #262 - 'refs/heads/${{{ github.default_branch }}}' + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 0 + - uses: actions/setup-node@v2 + with: + node-version: lts/* + - uses: ipfs/aegir/actions/cache-node-modules@master + - uses: ipfs/aegir/actions/docker-login@master + with: + docker-token: ${{ secrets.DOCKER_TOKEN }} + docker-username: ${{ secrets.DOCKER_USERNAME }} + - run: npm run --if-present release + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml deleted file mode 100644 index 3b0afed..0000000 --- a/.github/workflows/main.yml +++ /dev/null @@ -1,69 +0,0 @@ -name: ci -on: - push: - branches: - - master - pull_request: - branches: - - master - -jobs: - check: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - run: npm install - - run: npx aegir lint - - uses: gozala/typescript-error-reporter-action@v1.0.8 - - run: npx aegir build - - run: npx aegir dep-check - - uses: ipfs/aegir/actions/bundle-size@master - name: size - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - test-node: - needs: check - runs-on: ${{ matrix.os }} - strategy: - matrix: - os: [windows-latest, ubuntu-latest, macos-latest] - node: [14, 16] - fail-fast: true - steps: - - uses: actions/checkout@v2 - - uses: actions/setup-node@v1 - with: - node-version: ${{ matrix.node }} - - run: npm install - - run: npx nyc --reporter=lcov aegir test -t node -- --bail - - uses: codecov/codecov-action@v1 - test-chrome: - needs: check - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - run: npm install - - run: npx aegir test -t browser -t webworker --bail - test-firefox: - needs: check - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - run: npm install - - run: npx aegir test -t browser -t webworker --bail -- --browsers FirefoxHeadless - test-electron-main: - needs: check - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - run: npm install - - run: npm run pretest - - run: npx xvfb-maybe aegir test -t electron-main --bail -f dist/cjs/node-test/*js - test-electron-renderer: - needs: check - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - run: npm install - - run: npm run pretest - - run: npx xvfb-maybe aegir test -t electron-renderer --bail -f dist/cjs/browser-test/*js diff --git a/LICENSE b/LICENSE index 15ede75..20ce483 100644 --- a/LICENSE +++ b/LICENSE @@ -1,21 +1,4 @@ -MIT License +This project is dual licensed under MIT and Apache-2.0. -Copyright (c) 2017 IPFS - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -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. \ No newline at end of file +MIT: https://www.opensource.org/licenses/mit +Apache-2.0: https://www.apache.org/licenses/license-2.0 diff --git a/LICENSE-APACHE b/LICENSE-APACHE new file mode 100644 index 0000000..14478a3 --- /dev/null +++ b/LICENSE-APACHE @@ -0,0 +1,5 @@ +Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at + +http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. diff --git a/LICENSE-MIT b/LICENSE-MIT new file mode 100644 index 0000000..72dc60d --- /dev/null +++ b/LICENSE-MIT @@ -0,0 +1,19 @@ +The MIT License (MIT) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +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. diff --git a/README.md b/README.md index 523cfbc..799c58d 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ [![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/) [![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs) [![standard-readme compliant](https://img.shields.io/badge/standard--readme-OK-green.svg?style=flat-square)](https://github.com/RichardLitt/standard-readme) -[![Build Status](https://flat.badgen.net/travis/ipfs/js-datastore-level)](https://travis-ci.com/ipfs/js-datastore-level) +[![Build Status](https://github.com/ipfs/js-datastore-level/actions/workflows/js-test-and-release.yml/badge.svg?branch=master)](https://github.com/ipfs/js-datastore-level/actions/workflows/js-test-and-release.yml) [![Codecov](https://codecov.io/gh/ipfs/js-datastore-level/branch/master/graph/badge.svg)](https://codecov.io/gh/ipfs/js-datastore-level) [![Dependency Status](https://david-dm.org/ipfs/js-datastore-level.svg?style=flat-square)](https://david-dm.org/ipfs/js-datastore-level) [![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard) @@ -14,10 +14,6 @@ > Datastore implementation with [levelup](https://github.com/level/levelup) backend. -## Lead Maintainer - -[Alex Potsides](https://github.com/achingbrain) - ## Table of Contents - [Install](#install) diff --git a/package.json b/package.json index f79bd06..50d6bf2 100644 --- a/package.json +++ b/package.json @@ -2,10 +2,44 @@ "name": "datastore-level", "version": "7.0.1", "description": "Datastore implementation with level(up|down) backend", - "leadMaintainer": "Pedro Teixeira ", + "author": "Friedel Ziegelmayer", + "license": "Apache-2.0 OR MIT", + "homepage": "https://github.com/ipfs/js-datastore-level#readme", + "repository": { + "type": "git", + "url": "git+https://github.com/ipfs/js-datastore-level.git" + }, + "bugs": { + "url": "https://github.com/ipfs/js-datastore-level/issues" + }, + "keywords": [ + "datastore", + "interface", + "ipfs", + "key-value", + "leveldb", + "leveldown", + "levelup" + ], + "engines": { + "node": ">=16.0.0", + "npm": ">=7.0.0" + }, "main": "src/index.js", "type": "module", "types": "types/src/index.d.ts", + "typesVersions": { + "*": { + "*": [ + "types/*", + "types/src/*" + ], + "types/*": [ + "types/*", + "types/src/*" + ] + } + }, "files": [ "*", "!**/*.tsbuildinfo" @@ -15,39 +49,116 @@ "import": "./src/index.js" } }, + "eslintConfig": { + "extends": "ipfs", + "parserOptions": { + "sourceType": "module" + } + }, + "release": { + "branches": [ + "master" + ], + "plugins": [ + [ + "@semantic-release/commit-analyzer", + { + "preset": "conventionalcommits", + "releaseRules": [ + { + "breaking": true, + "release": "major" + }, + { + "revert": true, + "release": "patch" + }, + { + "type": "feat", + "release": "minor" + }, + { + "type": "fix", + "release": "patch" + }, + { + "type": "chore", + "release": "patch" + }, + { + "type": "docs", + "release": "patch" + }, + { + "type": "test", + "release": "patch" + }, + { + "scope": "no-release", + "release": false + } + ] + } + ], + [ + "@semantic-release/release-notes-generator", + { + "preset": "conventionalcommits", + "presetConfig": { + "types": [ + { + "type": "feat", + "section": "Features" + }, + { + "type": "fix", + "section": "Bug Fixes" + }, + { + "type": "chore", + "section": "Trivial Changes" + }, + { + "type": "docs", + "section": "Trivial Changes" + }, + { + "type": "test", + "section": "Tests" + } + ] + } + } + ], + "@semantic-release/changelog", + [ + "@semantic-release/npm", + { + "pkgRoot": "dist" + } + ], + "@semantic-release/github", + "@semantic-release/git" + ] + }, "scripts": { "clean": "rimraf dist types", "prepare": "aegir build --no-bundle && cp -R types dist", "lint": "aegir ts -p check && aegir lint", - "build": "aegir build", - "release": "aegir release --target node", - "release-minor": "aegir release --type minor --target node", - "release-major": "aegir release --type major --target node", - "pretest": "aegir build --esm-tests", + "build": "aegir build --esm-tests", + "release": "semantic-release", "test": "aegir test", + "test:node": "aegir test -t node", + "test:chrome": "aegir test -t browser", + "test:chrome-webworker": "aegir test -t webworker", + "test:firefox": "aegir test -t browser -- --browser firefox", + "test:firefox-webworker": "aegir test -t webworker -- --browser firefox", + "test:electron-main": "aegir test -t electron-main -f dist/cjs/node-test/*js", + "test:electron-renderer": "aegir test -t electron-renderer -f dist/cjs/node-test/*js", "dep-check": "aegir dep-check -i rimraf" }, - "repository": { - "type": "git", - "url": "git+https://github.com/ipfs/js-datastore-level.git" - }, - "keywords": [ - "interface", - "key-value", - "ipfs", - "datastore", - "leveldb", - "levelup", - "leveldown" - ], - "author": "Friedel Ziegelmayer", - "license": "MIT", - "bugs": { - "url": "https://github.com/ipfs/js-datastore-level/issues" - }, - "homepage": "https://github.com/ipfs/js-datastore-level#readme", "dependencies": { - "datastore-core": "^6.0.5", + "datastore-core": "^7.0.0", "interface-datastore": "^6.0.2", "it-filter": "^1.0.2", "it-map": "^1.0.5", @@ -56,40 +167,16 @@ "level": "^7.0.0" }, "devDependencies": { - "@ipld/dag-cbor": "^6.0.5", + "@ipld/dag-cbor": "^7.0.0", "@types/rimraf": "^3.0.2", - "aegir": "^35.0.3", + "aegir": "^36.1.3", "assert": "^2.0.0", "buffer": "^6.0.3", "interface-datastore-tests": "^2.0.3", - "ipfs-utils": "^8.1.6", - "level-mem": "^5.0.1", + "ipfs-utils": "^9.0.4", + "level-mem": "^6.0.1", "multiformats": "^9.2.0", "rimraf": "^3.0.0", "util": "^0.12.3" - }, - "eslintConfig": { - "extends": "ipfs", - "parserOptions": { - "sourceType": "module" - } - }, - "contributors": [ - "achingbrain ", - "David Dias ", - "Jacob Heun ", - "Friedel Ziegelmayer ", - "Alan Shaw ", - "Pedro Teixeira ", - "Hector Sanjuan ", - "Hugo Dias ", - "Carson Farmer ", - "Vasco Santos ", - "ᴠɪᴄᴛᴏʀ ʙᴊᴇʟᴋʜᴏʟᴍ ", - "Bryan Stenson ", - "Jan Klosinski ", - "Michael Burns <5170+mburns@users.noreply.github.com>", - "Richard Schneider ", - "Rod Vagg " - ] + } } diff --git a/src/index.js b/src/index.js index d217df5..836941d 100644 --- a/src/index.js +++ b/src/index.js @@ -78,7 +78,7 @@ export class LevelDatastore extends BaseDatastore { } else { this.db = await this._initDb() } - } catch (err) { + } catch (/** @type {any} */ err) { throw Errors.dbOpenFailedError(err) } } @@ -90,7 +90,7 @@ export class LevelDatastore extends BaseDatastore { async put (key, value) { try { await this.db.put(key.toString(), value) - } catch (err) { + } catch (/** @type {any} */ err) { throw Errors.dbWriteFailedError(err) } } @@ -103,7 +103,7 @@ export class LevelDatastore extends BaseDatastore { let data try { data = await this.db.get(key.toString()) - } catch (err) { + } catch (/** @type {any} */ err) { if (err.notFound) throw Errors.notFoundError(err) throw Errors.dbWriteFailedError(err) } @@ -117,7 +117,7 @@ export class LevelDatastore extends BaseDatastore { async has (key) { try { await this.db.get(key.toString()) - } catch (err) { + } catch (/** @type {any} */ err) { if (err.notFound) return false throw err } @@ -131,7 +131,7 @@ export class LevelDatastore extends BaseDatastore { async delete (key) { try { await this.db.del(key.toString()) - } catch (err) { + } catch (/** @type {any} */ err) { throw Errors.dbDeleteFailedError(err) } } From 38f44058dd6be858e757a1c90b8edb31590ec0bc Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Wed, 19 Jan 2022 13:17:38 +0000 Subject: [PATCH 2/2] chore(release): 8.0.0 [skip ci] MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## [8.0.0](https://github.com/ipfs/js-datastore-level/compare/v7.0.1...v8.0.0) (2022-01-19) ### ⚠ BREAKING CHANGES * updates project config to use unified ci ### Trivial Changes * switch to unified ci ([#99](https://github.com/ipfs/js-datastore-level/issues/99)) ([8344486](https://github.com/ipfs/js-datastore-level/commit/8344486d6971e0b2f49ceaa6dbc63f6469e8ed12)) --- CHANGELOG.md | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0a0a56e..ee22bf3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,14 @@ +## [8.0.0](https://github.com/ipfs/js-datastore-level/compare/v7.0.1...v8.0.0) (2022-01-19) + + +### ⚠ BREAKING CHANGES + +* updates project config to use unified ci + +### Trivial Changes + +* switch to unified ci ([#99](https://github.com/ipfs/js-datastore-level/issues/99)) ([8344486](https://github.com/ipfs/js-datastore-level/commit/8344486d6971e0b2f49ceaa6dbc63f6469e8ed12)) + ## [7.0.1](https://github.com/ipfs/js-datastore-level/compare/v7.0.0...v7.0.1) (2021-09-09) @@ -271,6 +282,3 @@ * key handling ([682f8b3](https://github.com/ipfs/js-datastore-level/commit/682f8b3)) * working interop with go ([f5e03c6](https://github.com/ipfs/js-datastore-level/commit/f5e03c6)) - - -