diff --git a/.github/dependabot.yml b/.github/dependabot.yml index de46e326..0bc3b42d 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -4,5 +4,8 @@ updates: directory: "/" schedule: interval: daily - time: "11:00" + time: "10:00" open-pull-requests-limit: 10 + commit-message: + prefix: "deps" + prefix-development: "deps(dev)" diff --git a/.github/workflows/automerge.yml b/.github/workflows/automerge.yml new file mode 100644 index 00000000..d57c2a02 --- /dev/null +++ b/.github/workflows/automerge.yml @@ -0,0 +1,8 @@ +name: Automerge +on: [ pull_request ] + +jobs: + automerge: + uses: protocol/.github/.github/workflows/automerge.yml@master + with: + job: 'automerge' diff --git a/.github/workflows/js-test-and-release.yml b/.github/workflows/js-test-and-release.yml new file mode 100644 index 00000000..5a88d9ca --- /dev/null +++ b/.github/workflows/js-test-and-release.yml @@ -0,0 +1,145 @@ +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@81cd2dc8148241f03f5839d295e000b8f761e378 # v3.1.0 + with: + 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@81cd2dc8148241f03f5839d295e000b8f761e378 # v3.1.0 + with: + 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@81cd2dc8148241f03f5839d295e000b8f761e378 # v3.1.0 + with: + 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@81cd2dc8148241f03f5839d295e000b8f761e378 # v3.1.0 + with: + 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@81cd2dc8148241f03f5839d295e000b8f761e378 # v3.1.0 + with: + 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@81cd2dc8148241f03f5839d295e000b8f761e378 # v3.1.0 + with: + 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@81cd2dc8148241f03f5839d295e000b8f761e378 # v3.1.0 + with: + 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/test.yml b/.github/workflows/test.yml deleted file mode 100644 index bb93d80c..00000000 --- a/.github/workflows/test.yml +++ /dev/null @@ -1,178 +0,0 @@ -name: Test -on: - pull_request: - branches: - - master - -jobs: - build: - name: Build - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - uses: actions/setup-node@v2 - with: - node-version: 16 - - uses: actions/cache@v2 - env: - CACHE_NAME: cache-node-modules - with: - path: | - ~/.npm - ./node_modules - ./packages/*/node_modules - ./packages/*/dist - key: ${{ runner.os }}-build-${{ env.CACHE_NAME }}-${{ github.event.pull_request.head.sha }} - - name: Install Dependencies - if: steps.cache.outputs.cache-hit != 'true' - run: | - npm install - npm run build - npx lerna link - - check: - name: Check - needs: build - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - uses: actions/setup-node@v1 - with: - node-version: 16 - - uses: actions/cache@v2 - id: cache - env: - CACHE_NAME: cache-node-modules - with: - path: | - ~/.npm - ./node_modules - ./packages/*/node_modules - ./packages/*/dist - key: ${{ runner.os }}-build-${{ env.CACHE_NAME }}-${{ github.event.pull_request.head.sha }} - - name: Install Dependencies - if: steps.cache.outputs.cache-hit != 'true' - run: | - npm install - npm run build - - run: | - npm run lint - npm run dep-check -- -- -- -p - npm run dep-check -- -- -- -- --unused - - test-node: - needs: build - runs-on: ${{ matrix.os }} - name: Unit test ${{ matrix.project }} node ${{ matrix.node }} ${{ matrix.os }} - strategy: - matrix: - os: [windows-latest, ubuntu-latest, macos-latest] - node: [16] - project: - - ipfs-repo - - ipfs-repo-migrations - steps: - - uses: actions/checkout@v2 - with: - fetch-depth: 0 - - uses: actions/setup-node@v1 - with: - node-version: ${{ matrix.node }} - - uses: actions/cache@v2 - id: cache - env: - CACHE_NAME: cache-node-modules - with: - path: | - ~/.npm - ./node_modules - ./packages/*/node_modules - ./packages/*/dist - key: ${{ runner.os }}-build-${{ env.CACHE_NAME }}-${{ github.event.pull_request.head.sha }} - - name: Install Dependencies - if: steps.cache.outputs.cache-hit != 'true' - run: | - npm install - npm run build - - run: npm run test -- --since ${{ github.event.pull_request.base.sha }} --scope=${{ matrix.project }} -- -- --cov -t node - - test-browser: - needs: build - runs-on: ubuntu-latest - name: Unit test ${{ matrix.project }} ${{ matrix.browser }} ${{ matrix.type }} - strategy: - matrix: - project: - - ipfs-repo -# - ipfs-repo-migrations - browser: - - chromium - - firefox - type: - - browser - - webworker - steps: - - uses: actions/checkout@v2 - with: - fetch-depth: 0 - - uses: actions/setup-node@v1 - with: - node-version: 16 - - uses: actions/cache@v2 - id: cache - env: - CACHE_NAME: cache-node-modules - with: - path: | - ~/.npm - ./node_modules - ./packages/*/node_modules - ./packages/*/dist - key: ${{ runner.os }}-build-${{ env.CACHE_NAME }}-${{ github.event.pull_request.head.sha }} - - name: Install Dependencies - if: steps.cache.outputs.cache-hit != 'true' - run: | - npm install - npm run build - - run: npm run test -- --since ${{ github.event.pull_request.base.sha }} --scope=${{ matrix.project }} -- -- -t ${{ matrix.type }} -- --browser ${{ matrix.browser }} - -# test-electron: -# needs: build -# runs-on: ubuntu-latest -# name: test ${{ matrix.project }} ${{ matrix.type }} -# strategy: -# matrix: -# project: -# - ipfs-repo -# - ipfs-repo-migrations -# type: -# - electron-main -# - electron-renderer -# steps: -# - uses: actions/checkout@v2 -# with: -# fetch-depth: 0 -# - uses: actions/setup-node@v1 -# with: -# node-version: 16 -# - uses: actions/cache@v2 -# id: cache -# env: -# CACHE_NAME: cache-node-modules -# with: -# path: | -# ~/.npm -# ./node_modules -# ./packages/*/node_modules -# ./packages/*/dist -# key: ${{ runner.os }}-build-${{ env.CACHE_NAME }}-${{ github.event.pull_request.head.sha }} -# - name: Install Dependencies -# if: steps.cache.outputs.cache-hit != 'true' -# run: | -# npm install -# npm run build -# - run: npm install -# - run: npm run build -# - uses: GabrielBB/xvfb-action@v1 -# with: -# run: npm run test -- --since ${{ github.event.pull_request.base.sha }} --scope=${{ matrix.project }} -- -- -t ${{ matrix.type }} --bail diff --git a/LICENSE b/LICENSE new file mode 100644 index 00000000..20ce483c --- /dev/null +++ b/LICENSE @@ -0,0 +1,4 @@ +This project is dual licensed under MIT and Apache-2.0. + +MIT: https://www.opensource.org/licenses/mit +Apache-2.0: https://www.apache.org/licenses/license-2.0 diff --git a/LICENSE-MIT b/LICENSE-MIT index 749aa1ec..72dc60d8 100644 --- a/LICENSE-MIT +++ b/LICENSE-MIT @@ -16,4 +16,4 @@ 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 +THE SOFTWARE. diff --git a/README.md b/README.md index 2f5e5116..72c375bf 100644 --- a/README.md +++ b/README.md @@ -1,33 +1,35 @@ # ipfs-repo -[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://ipn.io) -[![](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) -[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs-repo)](https://travis-ci.com/ipfs/js-ipfs-unixfs) -[![Codecov](https://codecov.io/gh/ipfs/js-ipfs-repo/branch/master/graph/badge.svg)](https://codecov.io/gh/ipfs/js-ipfs-repo) -[![Style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard) +[![ipfs.io](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io) +[![IRC](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs) +[![Discord](https://img.shields.io/discord/806902334369824788?style=flat-square)](https://discord.gg/ipfs) +[![codecov](https://img.shields.io/codecov/c/github/ipfs/js-ipfs-repo.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs-repo) +[![CI](https://img.shields.io/github/workflow/status/ipfs/js-ipfs-repo/test%20&%20maybe%20release/master?style=flat-square)](https://github.com/ipfs/js-ipfs-repo/actions/workflows/js-test-and-release.yml) -> The repository where blocks are stored and a tool to perform migrations between different versions +> The repo and migration tools used by IPFS -## Lead Maintainer - -[Alex Potsides](https://github.com/achingbrain) - -## Table of Contents +## Table of contents - [Structure](#structure) +- [Lead Maintainer ](#lead-maintainer----omit-in-toc---) - [Development](#development) - [Publishing new versions](#publishing-new-versions) - [Using prerelease versions](#using-prerelease-versions) - [Contribute](#contribute) - [License](#license) +- [Contribute](#contribute-1) ## Structure -This project is broken into several modules, their purposes are: +- [`/packages/ipfs-repo`](./packages/ipfs-repo) IPFS Repo implementation +- [`/packages/ipfs-repo-migrations`](./packages/ipfs-repo-migrations) Migration framework for versioning of JS IPFS Repo + +## Lead Maintainer + +[Alex Potsides](https://github.com/achingbrain) -* [`/packages/ipfs-repo`](./packages/ipfs-repo) The repo implementation -* [`/packages/ipfs-repo-migrations`](./packages/ipfs-urepo-migrations) A tool for migrating between different repo versions +- [`/packages/ipfs-repo`](./packages/ipfs-repo) The repo implementation +- [`/packages/ipfs-repo-migrations`](./packages/ipfs-urepo-migrations) A tool for migrating between different repo versions ## Development @@ -61,4 +63,15 @@ This repository falls under the IPFS [Code of Conduct](https://github.com/ipfs/c ## License -[Apache-2.0](LICENSE-APACHE) OR [MIT](LICENSE-MIT) +Licensed under either of + +- Apache 2.0, ([LICENSE-APACHE](LICENSE-APACHE) / ) +- MIT ([LICENSE-MIT](LICENSE-MIT) / ) + +## Contribute + +Feel free to join in. All welcome. Open an [issue](https://github.com/ipfs/js-ipfs-unixfs-importer/issues)! + +This repository falls under the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md). + +[![](https://cdn.rawgit.com/jbenet/contribute-ipfs-gif/master/img/contribute.gif)](https://github.com/ipfs/community/blob/master/CONTRIBUTING.md) diff --git a/lerna.json b/lerna.json index bf001c38..d7a23368 100644 --- a/lerna.json +++ b/lerna.json @@ -1,21 +1,10 @@ { - "lerna": "3.22.1", - "packages": [ - "packages/*" - ], + "lerna": "4.0.0", + "useWorkspaces": true, "version": "independent", "command": { - "bootstrap": { - "hoist": true - }, "run": { "stream": true - }, - "publish": { - "message": "chore: publish", - "conventionalCommits": true, - "createRelease": "github", - "verifyAccess": false } } } diff --git a/package.json b/package.json index d0d75e9d..b60ba413 100644 --- a/package.json +++ b/package.json @@ -2,6 +2,20 @@ "name": "ipfs-repo", "version": "1.0.0", "description": "The repo and migration tools used by IPFS", + "license": "Apache-2.0 OR MIT", + "homepage": "https://github.com/ipfs/js-ipfs-repo#readme", + "repository": { + "type": "git", + "url": "git+https://github.com/ipfs/js-ipfs-repo.git" + }, + "bugs": { + "url": "https://github.com/ipfs/js-ipfs-repo/issues" + }, + "engines": { + "node": ">=16.0.0", + "npm": ">=7.0.0" + }, + "private": true, "scripts": { "reset": "lerna run clean && rimraf packages/*/node_modules node_modules packages/*/package-lock.json package-lock.json", "test": "lerna run test", @@ -16,55 +30,10 @@ "update-contributors": "aegir release --lint=false --test=false --bump=false --build=false --changelog=false --commit=false --tag=false --push=false --ghrelease=false --docs=false --publish=false" }, "devDependencies": { - "lerna": "^4.0.0", + "lerna": "^5.0.0", "rimraf": "^3.0.2" }, - "repository": { - "type": "git", - "url": "git+https://github.com/ipfs/js-ipfs-repo.git" - }, - "private": true, - "license": "(Apache-2.0 OR MIT)", - "contributors": [ - "David Dias ", - "achingbrain ", - "Jacob Heun ", - "dignifiedquire ", - "Hugo Dias ", - "Stephen Whitmore ", - "Alan Shaw ", - "Adam Uhlíř ", - "Vasco Santos ", - "Hector Sanjuan ", - "Pau Ramon Revilla ", - "Richard Schneider ", - "Lars-Magnus Skog ", - "Francisco Baio Dias ", - "Dmitriy Ryajov ", - "Pedro Santos ", - "nginnever ", - "ᴠɪᴄᴛᴏʀ ʙᴊᴇʟᴋʜᴏʟᴍ ", - "Andrew Nesbitt ", - "Brian Hoffman ", - "Bryan Stenson ", - "Hannah Howard ", - "Henrique Dias ", - "Jonah Weissman ", - "Jonathan ", - "Joshua <62268199+minimalsm@users.noreply.github.com>", - "Justin Chase ", - "Linus Unnebäck ", - "Marcus Bernales ", - "Pedro Teixeira ", - "Richard Littauer ", - "Steef Min ", - "Volker Mische " - ], "workspaces": [ "packages/*" - ], - "engines": { - "node": ">=14.0.0", - "npm": ">=7.0.0" - } + ] } diff --git a/packages/ipfs-repo-migrations/LICENSE b/packages/ipfs-repo-migrations/LICENSE new file mode 100644 index 00000000..20ce483c --- /dev/null +++ b/packages/ipfs-repo-migrations/LICENSE @@ -0,0 +1,4 @@ +This project is dual licensed under MIT and Apache-2.0. + +MIT: https://www.opensource.org/licenses/mit +Apache-2.0: https://www.apache.org/licenses/license-2.0 diff --git a/packages/ipfs-repo-migrations/LICENSE-MIT b/packages/ipfs-repo-migrations/LICENSE-MIT index 749aa1ec..72dc60d8 100644 --- a/packages/ipfs-repo-migrations/LICENSE-MIT +++ b/packages/ipfs-repo-migrations/LICENSE-MIT @@ -16,4 +16,4 @@ 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 +THE SOFTWARE. diff --git a/packages/ipfs-repo-migrations/README.md b/packages/ipfs-repo-migrations/README.md index 7181fcca..9c44cfb4 100644 --- a/packages/ipfs-repo-migrations/README.md +++ b/packages/ipfs-repo-migrations/README.md @@ -1,29 +1,18 @@ -# Migration tool for JS IPFS Repo - -[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs-repo-migrations)](https://travis-ci.com/ipfs/js-ipfs-repo-migrations) -[![codecov](https://codecov.io/gh/ipfs/js-ipfs-repo-migrations/branch/master/graph/badge.svg)](https://codecov.io/gh/ipfs/js-ipfs-repo-migrations) -[![Dependency Status](https://david-dm.org/ipfs/js-ipfs-repo-migrations.svg?style=flat-square)](https://david-dm.org/ipfs/js-ipfs-repo-migrations) -[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://ipn.io) -[![](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) -[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard) -![](https://img.shields.io/badge/npm-%3E%3D6.0.0-orange.svg?style=flat-square) -![](https://img.shields.io/badge/Node.js-%3E%3D10.0.0-orange.svg?style=flat-square) +# ipfs-repo-migrations -> Migration framework for versioning of JS IPFS Repo - -This package is inspired by the [go-ipfs repo migration tool](https://github.com/ipfs/fs-repo-migrations/) - -## Lead Maintainer +[![ipfs.io](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io) +[![IRC](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs) +[![Discord](https://img.shields.io/discord/806902334369824788?style=flat-square)](https://discord.gg/ipfs) +[![codecov](https://img.shields.io/codecov/c/github/ipfs/js-ipfs-repo.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs-repo) +[![CI](https://img.shields.io/github/workflow/status/ipfs/js-ipfs-repo/test%20&%20maybe%20release/master?style=flat-square)](https://github.com/ipfs/js-ipfs-repo/actions/workflows/js-test-and-release.yml) -[Alex Potsides](http://github.com/achingbrain) +> Migration framework for versioning of JS IPFS Repo -## Table of Contents +## Table of contents -- [Background](#background) - [Install](#install) - - [npm](#npm) +- [Lead Maintainer ](#lead-maintainer----omit-in-toc---) +- [Background](#background) - [Use in Node.js](#use-in-nodejs) - [Use in a browser with browserify, webpack or any other bundler](#use-in-a-browser-with-browserify-webpack-or-any-other-bundler) - [Usage](#usage) @@ -51,6 +40,19 @@ This package is inspired by the [go-ipfs repo migration tool](https://github.com - [Module versioning notes](#module-versioning-notes) - [Contribute](#contribute) - [License](#license) +- [Contribute](#contribute-1) + +## Install + +```console +$ npm i ipfs-repo-migrations +``` + +This package is inspired by the [go-ipfs repo migration tool](https://github.com/ipfs/fs-repo-migrations/) + +## Lead Maintainer + +[Alex Potsides](http://github.com/achingbrain) ## Background @@ -60,15 +62,12 @@ So the IPFS repo is versioned, and this package provides a framework to create m from one version of IPFS repo to the next/previous version. This framework: - * Handles locking/unlocking of repository - * Defines migrations API - * Executes and reports migrations in both directions: forward and backward - * Simplifies creation of new migrations - * Works on the browser too! - -## Install -### npm +- Handles locking/unlocking of repository +- Defines migrations API +- Executes and reports migrations in both directions: forward and backward +- Simplifies creation of new migrations +- Works on the browser too! ```sh > npm install ipfs-repo-migrations @@ -118,22 +117,23 @@ Executes a forward migration to a specific version, or to the latest version if **Arguments:** - * `path` (string, mandatory) - path to the repo to be migrated - * `repoOptions` (object, mandatory) - options that are passed to migrations, that use them to construct the datastore. (options are the same as for IPFSRepo). - * `toVersion` (int, mandatory) - version to which the repo should be migrated. - * `options` (object, optional) - options for the migration - * `options.ignoreLock` (bool, optional) - if true will not lock the repo when applying migrations. Use with caution. - * `options.onProgress` (function, optional) - callback that is called during each migration to report progress. - * `options.isDryRun` (bool, optional) - flag that indicates if it is a dry run that should give the same output as running a migration but without making any actual changes. +- `path` (string, mandatory) - path to the repo to be migrated +- `repoOptions` (object, mandatory) - options that are passed to migrations, that use them to construct the datastore. (options are the same as for IPFSRepo). +- `toVersion` (int, mandatory) - version to which the repo should be migrated. +- `options` (object, optional) - options for the migration +- `options.ignoreLock` (bool, optional) - if true will not lock the repo when applying migrations. Use with caution. +- `options.onProgress` (function, optional) - callback that is called during each migration to report progress. +- `options.isDryRun` (bool, optional) - flag that indicates if it is a dry run that should give the same output as running a migration but without making any actual changes. #### `onProgress(version, percent, message)` Signature of the progress callback. **Arguments:** - * `migration` (object) - object of migration that just successfully finished running. See [Architecture of migrations](#architecture-of-migrations) for details. - * `counter` (int) - index of current migration. - * `totalMigrations` (int) - total count of migrations that will be run. + +- `migration` (object) - object of migration that just successfully finished running. See [Architecture of migrations](#architecture-of-migrations) for details. +- `counter` (int) - index of current migration. +- `totalMigrations` (int) - total count of migrations that will be run. ### `.revert(path, repoOptions, toVersion, {ignoreLock, onProgress, isDryRun}) -> Promise` @@ -141,13 +141,13 @@ Executes backward migration to a specific version. **Arguments:** - * `path` (string, mandatory) - path to the repo to be reverted - * `repoOptions` (object, mandatory) - options that are passed to migrations, that use them to construct the datastore. (options are the same as for IPFSRepo). - * `toVersion` (int, mandatory) - version to which the repo should be reverted to. - * `options` (object, optional) - options for the reversion - * `options.ignoreLock` (bool, optional) - if true will not lock the repo when applying migrations. Use with caution. - * `options.onProgress` (function, optional) - callback that is called during each migration to report progress. - * `options.isDryRun` (bool, optional) - flag that indicates if it is a dry run that should give the same output as running a migration but without making any actual changes. +- `path` (string, mandatory) - path to the repo to be reverted +- `repoOptions` (object, mandatory) - options that are passed to migrations, that use them to construct the datastore. (options are the same as for IPFSRepo). +- `toVersion` (int, mandatory) - version to which the repo should be reverted to. +- `options` (object, optional) - options for the reversion +- `options.ignoreLock` (bool, optional) - if true will not lock the repo when applying migrations. Use with caution. +- `options.onProgress` (function, optional) - callback that is called during each migration to report progress. +- `options.isDryRun` (bool, optional) - flag that indicates if it is a dry run that should give the same output as running a migration but without making any actual changes. ### `getLatestMigrationVersion() -> int` @@ -177,26 +177,28 @@ All migrations are collected in `/migrations/index.js`, which should not be edit Each migration must follow this API. It must export an object in its `index.js` that has following properties: - * `version` (int) - Number that represents the version which the repo will migrate to (eg. `8` will move the repo to version 8). - * `description` (string) - Brief description of what the migrations does. - * `migrate` (function) - Function that performs the migration (see signature of this function below) - * `revert` (function) - If defined then this function will revert the migration to the previous version. Otherwise it is assumed that it is not possible to revert this migration. +- `version` (int) - Number that represents the version which the repo will migrate to (eg. `8` will move the repo to version 8). +- `description` (string) - Brief description of what the migrations does. +- `migrate` (function) - Function that performs the migration (see signature of this function below) +- `revert` (function) - If defined then this function will revert the migration to the previous version. Otherwise it is assumed that it is not possible to revert this migration. #### `.migrate(repoPath, repoOptions)` -_Do not confuse this function with the `require('ipfs-repo-migrations').migrate()` function that drives the whole migration process!_ +*Do not confuse this function with the `require('ipfs-repo-migrations').migrate()` function that drives the whole migration process!* Arguments: - * `repoPath` (string) - absolute path to the root of the repo - * `repoOptions` (object, optional) - object containing `IPFSRepo` options, that should be used to construct a datastore instance. + +- `repoPath` (string) - absolute path to the root of the repo +- `repoOptions` (object, optional) - object containing `IPFSRepo` options, that should be used to construct a datastore instance. #### `.revert(repoPath, repoOptions)` -_Do not confuse this function with the `require('ipfs-repo-migrations').revert()` function that drives the whole backward migration process!_ +*Do not confuse this function with the `require('ipfs-repo-migrations').revert()` function that drives the whole backward migration process!* Arguments: - * `repoPath` (string) - path to the root of the repo - * `repoOptions` (object, optional) - object containing `IPFSRepo` options, that should be used to construct the datastore instance. + +- `repoPath` (string) - path to the root of the repo +- `repoOptions` (object, optional) - object containing `IPFSRepo` options, that should be used to construct the datastore instance. ### Browser vs. NodeJS environments @@ -204,9 +206,7 @@ The migration might need to perform specific tasks in browser or NodeJS environm migration file `/migrations/migration-/index_browser.js` which have to follow the same API is described before. Then add entry in `package.json` to the `browser` field as follow: -``` -'./migrations/migration-/index.js': './migrations/migration-/index_browser.js' -``` + './migrations/migration-/index.js': './migrations/migration-/index_browser.js' In browser environments then `index.js` will be replaced with `index_browser.js`. @@ -214,15 +214,16 @@ Simple migrations should not need to distinguish between these environments as the datastore implementation will handle the main differences. There are currently two main datastore implementations: - 1. [`datastore-fs`](https://github.com/ipfs/js-datastore-fs) that is backed by file system and is used mainly in the NodeJS environment - 2. [`datastore-idb`](https://github.com/ipfs/js-datastore-idb) that is backed by LevelDB and is used mainly in the browser environment - Both implementations share the same API and hence are interchangeable. +1. [`datastore-fs`](https://github.com/ipfs/js-datastore-fs) that is backed by file system and is used mainly in the NodeJS environment +2. [`datastore-idb`](https://github.com/ipfs/js-datastore-idb) that is backed by LevelDB and is used mainly in the browser environment + +Both implementations share the same API and hence are interchangeable. - When the migration is run in a browser environment, `datastore-fs` is automatically replaced with `datastore-idb` even - when it is directly imported (`require('datastore-fs')` will return `datastore-idb` in a browser). - So with simple migrations you shouldn't worry about the difference between `datastore-fs` and `datastore-idb` - and by default use the `datastore-fs` package (as the replace mechanism does not work vice versa). +When the migration is run in a browser environment, `datastore-fs` is automatically replaced with `datastore-idb` even +when it is directly imported (`require('datastore-fs')` will return `datastore-idb` in a browser). +So with simple migrations you shouldn't worry about the difference between `datastore-fs` and `datastore-idb` +and by default use the `datastore-fs` package (as the replace mechanism does not work vice versa). ### Guidelines @@ -243,11 +244,11 @@ together with the repo version that `IPFSRepo` expects. Then the updated version ### Tests If a migration affects any of the following functionality, it must provide tests for the following functions - to work under the version of the repo that it migrates to: +to work under the version of the repo that it migrates to: -* `/src/repo/version.js`:`getVersion()` - retrieving repository's version -* `/src/repo/lock.js`:`lock()` - locking repository that uses file system -* `/src/repo/lock-memory.js`:`lock()` - locking repository that uses memory +- `/src/repo/version.js`:`getVersion()` - retrieving repository's version +- `/src/repo/lock.js`:`lock()` - locking repository that uses file system +- `/src/repo/lock-memory.js`:`lock()` - locking repository that uses memory Every migration must have test coverage. Tests for migrations should be placed in the `/test/migrations/` folder. Most probably you will have to plug the tests into `browser.js`/`node.js` if they require specific bootstrapping on each platform. @@ -267,11 +268,11 @@ This will create an empty migration with the next version. ### Migrations matrix -| IPFS repo version | JS IPFS version | -| -----------------: |:----------------:| -| 7 | v0.0.0 | -| 8 | v0.48.0 | -| 9 | v0.49.0 | +| IPFS repo version | JS IPFS version | +| ----------------: | :-------------: | +| 7 | v0.0.0 | +| 8 | v0.48.0 | +| 9 | v0.49.0 | ### Migrations @@ -312,4 +313,15 @@ This repository falls under the IPFS [Code of Conduct](https://github.com/ipfs/c ## License -[Apache-2.0](LICENSE-APACHE) OR [MIT](LICENSE-MIT) +Licensed under either of + +- Apache 2.0, ([LICENSE-APACHE](LICENSE-APACHE) / ) +- MIT ([LICENSE-MIT](LICENSE-MIT) / ) + +## Contribute + +Feel free to join in. All welcome. Open an [issue](https://github.com/ipfs/js-ipfs-unixfs-importer/issues)! + +This repository falls under the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md). + +[![](https://cdn.rawgit.com/jbenet/contribute-ipfs-gif/master/img/contribute.gif)](https://github.com/ipfs/community/blob/master/CONTRIBUTING.md) diff --git a/packages/ipfs-repo-migrations/package.json b/packages/ipfs-repo-migrations/package.json index 934726a3..9130dafd 100644 --- a/packages/ipfs-repo-migrations/package.json +++ b/packages/ipfs-repo-migrations/package.json @@ -2,41 +2,147 @@ "name": "ipfs-repo-migrations", "version": "12.0.1", "description": "Migration framework for versioning of JS IPFS Repo", + "license": "Apache-2.0 OR MIT", + "homepage": "https://github.com/ipfs/js-ipfs-repo/tree/master/packages/ipfs-repo-migrations#readme", + "repository": { + "type": "git", + "url": "git+https://github.com/ipfs/js-ipfs-repo.git" + }, + "bugs": { + "url": "https://github.com/ipfs/js-ipfs-repo/issues" + }, "keywords": [ "IPFS", "libp2p", "migrations" ], - "homepage": "https://github.com/ipfs/js-ipfs-repo/tree/master/packages/ipfs-repo-migrations", - "bugs": { - "url": "https://github.com/ipfs/js-ipfs-repo/issues/" + "engines": { + "node": ">=16.0.0", + "npm": ">=7.0.0" }, - "license": "(Apache-2.0 OR MIT)", - "main": "src/index.js", - "types": "types/src/index.d.ts", "type": "module", + "types": "./dist/src/index.d.ts", + "typesVersions": { + "*": { + "*": [ + "*", + "dist/*", + "dist/src/*", + "dist/src/*/index" + ], + "src/*": [ + "*", + "dist/*", + "dist/src/*", + "dist/src/*/index" + ] + } + }, "files": [ - "*", + "src", + "dist", + "!dist/test", "!**/*.tsbuildinfo" ], + "exports": { + ".": { + "types": "./dist/src/index.d.ts", + "import": "./src/index.js" + } + }, "eslintConfig": { "extends": "ipfs", "parserOptions": { "sourceType": "module" } }, - "publishConfig": { - "directory": "dist" - }, - "browser": { - "datastore-fs": "datastore-level" - }, - "repository": { - "type": "git", - "url": "https://github.com/ipfs/js-ipfs-repo.git" + "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": "docs", + "release": "patch" + }, + { + "type": "test", + "release": "patch" + }, + { + "type": "deps", + "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": "Documentation" + }, + { + "type": "deps", + "section": "Dependencies" + }, + { + "type": "test", + "section": "Tests" + } + ] + } + } + ], + "@semantic-release/changelog", + "@semantic-release/npm", + "@semantic-release/github", + "@semantic-release/git" + ] }, "scripts": { - "clean": "rimraf types dist", + "clean": "aegir clean", "generate": "run-s generate:*:*", "generate:proto:pins": "pbjs -t static-module -w es6 --force-number --no-verify --no-delimited --no-create --no-beautify --no-defaults --lint eslint-disable -o migrations/migration-9/pin.js migrations/migration-9/pin.proto", "generate:proto-types:pins": "pbts -o migrations/migration-9/pin.d.ts migrations/migration-9/pin.js", @@ -50,19 +156,17 @@ "generate:proto-types:envelope": "pbts -o migrations/migration-12/pb/envelope.d.ts migrations/migration-12/pb/envelope.js", "generate:proto:peer-record": "pbjs -t static-module -w es6 --force-number --no-verify --no-delimited --no-create --no-beautify --no-defaults --lint eslint-disable -o migrations/migration-12/pb/peer-record.js migrations/migration-12/pb/peer-record.proto", "generate:proto-types:peer-record": "pbts -o migrations/migration-12/pb/peer-record.d.ts migrations/migration-12/pb/peer-record.js", - "prepublishOnly": "npm run build", "build": "aegir build", - "pretest": "aegir build --esm-tests", "test": "aegir test", - "lint": "aegir ts -p check && aegir lint", + "test:node": "aegir test -t node --cov", + "test:chrome": "aegir test -t browser --cov", + "lint": "aegir lint", "release": "aegir release", - "release-minor": "aegir release --type minor", - "release-major": "aegir release --type major", - "dep-check": "aegir dep-check -i interface-blockstore -i assert -i events -i npm-run-all -i util" + "dep-check": "aegir dep-check -i interface-blockstore -i npm-run-all" }, "dependencies": { - "@ipld/dag-pb": "^2.0.0", - "cborg": "^1.3.1", + "@ipld/dag-pb": "^2.1.0", + "cborg": "^1.3.4", "datastore-core": "^7.0.0", "debug": "^4.1.0", "fnv1a": "^1.0.1", @@ -70,7 +174,7 @@ "interface-datastore": "^6.0.2", "it-length": "^1.0.1", "multiaddr": "^10.0.1", - "multiformats": "^9.0.0", + "multiformats": "^9.0.4", "protobufjs": "^6.10.2", "uint8arrays": "^3.0.0", "varint": "^6.0.0" @@ -80,21 +184,25 @@ "@types/debug": "^4.1.5", "@types/rimraf": "^3.0.2", "@types/varint": "^6.0.0", - "aegir": "^36.0.1", - "assert": "^2.0.0", + "aegir": "^37.5.0", "aws-sdk": "^2.884.0", "blockstore-core": "^1.0.2", "blockstore-datastore-adapter": "^2.0.1", "datastore-fs": "^7.0.0", "datastore-level": "^8.0.0", "datastore-s3": "^9.0.0", - "events": "^3.2.0", "just-safe-set": "^2.1.0", "level-5": "npm:level@^5.0.0", "level-6": "npm:level@^6.0.0", "npm-run-all": "^4.1.5", - "rimraf": "^3.0.0", - "sinon": "^12.0.1", - "util": "^0.12.3" + "rimraf": "^3.0.2", + "sinon": "^12.0.1" + }, + "browser": { + "datastore-fs": "datastore-level" + }, + "main": "src/index.js", + "publishConfig": { + "directory": "dist" } } diff --git a/packages/ipfs-repo-migrations/test/fixtures/mock-s3.js b/packages/ipfs-repo-migrations/test/fixtures/mock-s3.js index 00ecea8c..d4fb8bc1 100644 --- a/packages/ipfs-repo-migrations/test/fixtures/mock-s3.js +++ b/packages/ipfs-repo-migrations/test/fixtures/mock-s3.js @@ -1,5 +1,5 @@ -import { expect } from 'aegir/utils/chai.js' +import { expect } from 'aegir/chai' import sinon from 'sinon' import { Buffer } from 'buffer' import AWS from 'aws-sdk' diff --git a/packages/ipfs-repo-migrations/test/fixtures/repo.js b/packages/ipfs-repo-migrations/test/fixtures/repo.js index a434c91e..7e84c05b 100644 --- a/packages/ipfs-repo-migrations/test/fixtures/repo.js +++ b/packages/ipfs-repo-migrations/test/fixtures/repo.js @@ -1,5 +1,5 @@ -import loadFixture from 'aegir/utils/fixtures.js' +import loadFixture from 'aegir/fixtures' import { CONFIG_KEY, VERSION_KEY } from '../../src/utils.js' /** diff --git a/packages/ipfs-repo-migrations/test/index.spec.js b/packages/ipfs-repo-migrations/test/index.spec.js index bbfee317..f9d86a3a 100644 --- a/packages/ipfs-repo-migrations/test/index.spec.js +++ b/packages/ipfs-repo-migrations/test/index.spec.js @@ -1,6 +1,6 @@ /* eslint-env mocha */ -import { expect } from 'aegir/utils/chai.js' +import { expect } from 'aegir/chai' import sinon from 'sinon' import { MemoryBlockstore } from 'blockstore-core/memory' import { MemoryDatastore } from 'datastore-core/memory' diff --git a/packages/ipfs-repo-migrations/test/init-test.js b/packages/ipfs-repo-migrations/test/init-test.js index 9a153de7..78c02715 100644 --- a/packages/ipfs-repo-migrations/test/init-test.js +++ b/packages/ipfs-repo-migrations/test/init-test.js @@ -1,6 +1,6 @@ /* eslint-env mocha */ -import { expect } from 'aegir/utils/chai.js' +import { expect } from 'aegir/chai' import { CONFIG_KEY, VERSION_KEY } from '../src/utils.js' import { isRepoInitialized } from '../src/repo/init.js' import { fromString as uint8ArrayFromString } from 'uint8arrays/from-string' diff --git a/packages/ipfs-repo-migrations/test/integration-test.js b/packages/ipfs-repo-migrations/test/integration-test.js index 6b7283d1..4743fb9e 100644 --- a/packages/ipfs-repo-migrations/test/integration-test.js +++ b/packages/ipfs-repo-migrations/test/integration-test.js @@ -1,6 +1,6 @@ /* eslint-env mocha */ -import { expect } from 'aegir/utils/chai.js' +import { expect } from 'aegir/chai' import * as migrator from '../src/index.js' import migrations from './test-migrations/index.js' import { VERSION_KEY, CONFIG_KEY } from '../src/utils.js' diff --git a/packages/ipfs-repo-migrations/test/migrations/migration-10-test.js b/packages/ipfs-repo-migrations/test/migrations/migration-10-test.js index 8fa6925f..03cc4bec 100644 --- a/packages/ipfs-repo-migrations/test/migrations/migration-10-test.js +++ b/packages/ipfs-repo-migrations/test/migrations/migration-10-test.js @@ -1,7 +1,7 @@ /* eslint-env mocha */ /* eslint-disable max-nested-callbacks */ -import { expect } from 'aegir/utils/chai.js' +import { expect } from 'aegir/chai' import { CID } from 'multiformats/cid' import { BaseBlockstore } from 'blockstore-core/base' import { migration } from '../../migrations/migration-10/index.js' diff --git a/packages/ipfs-repo-migrations/test/migrations/migration-11-test.js b/packages/ipfs-repo-migrations/test/migrations/migration-11-test.js index 10b414df..a8195f18 100644 --- a/packages/ipfs-repo-migrations/test/migrations/migration-11-test.js +++ b/packages/ipfs-repo-migrations/test/migrations/migration-11-test.js @@ -1,7 +1,7 @@ /* eslint-env mocha */ /* eslint-disable max-nested-callbacks */ -import { expect } from 'aegir/utils/chai.js' +import { expect } from 'aegir/chai' import { CID } from 'multiformats/cid' import { migration } from '../../migrations/migration-11/index.js' import { Key } from 'interface-datastore/key' diff --git a/packages/ipfs-repo-migrations/test/migrations/migration-12-test.js b/packages/ipfs-repo-migrations/test/migrations/migration-12-test.js index 08069f2c..6ce66041 100644 --- a/packages/ipfs-repo-migrations/test/migrations/migration-12-test.js +++ b/packages/ipfs-repo-migrations/test/migrations/migration-12-test.js @@ -1,7 +1,7 @@ /* eslint-env mocha */ /* eslint-disable max-nested-callbacks */ -import { expect } from 'aegir/utils/chai.js' +import { expect } from 'aegir/chai' import { migration } from '../../migrations/migration-12/index.js' import { fromString as uint8ArrayFromString } from 'uint8arrays/from-string' import { toString as uint8ArrayToString } from 'uint8arrays/to-string' diff --git a/packages/ipfs-repo-migrations/test/migrations/migration-8-test.js b/packages/ipfs-repo-migrations/test/migrations/migration-8-test.js index 166380bf..a3d5e86a 100644 --- a/packages/ipfs-repo-migrations/test/migrations/migration-8-test.js +++ b/packages/ipfs-repo-migrations/test/migrations/migration-8-test.js @@ -1,7 +1,7 @@ /* eslint-env mocha */ /* eslint-disable max-nested-callbacks */ -import { expect } from 'aegir/utils/chai.js' +import { expect } from 'aegir/chai' import { fromString as uint8ArrayFromString } from 'uint8arrays/from-string' import { migration } from '../../migrations/migration-8/index.js' import { Key } from 'interface-datastore/key' diff --git a/packages/ipfs-repo-migrations/test/migrations/migration-9-test.js b/packages/ipfs-repo-migrations/test/migrations/migration-9-test.js index f0828da6..b5f610d9 100644 --- a/packages/ipfs-repo-migrations/test/migrations/migration-9-test.js +++ b/packages/ipfs-repo-migrations/test/migrations/migration-9-test.js @@ -1,13 +1,13 @@ /* eslint-env mocha */ /* eslint-disable max-nested-callbacks */ -import { expect } from 'aegir/utils/chai.js' +import { expect } from 'aegir/chai' import * as cbor from 'cborg' import { migration } from '../../migrations/migration-9/index.js' import { PIN_DS_KEY } from '../../migrations/migration-9/utils.js' import { CID } from 'multiformats/cid' import { CarReader } from '@ipld/car' -import loadFixture from 'aegir/utils/fixtures.js' +import loadFixture from 'aegir/fixtures' import * as dagPb from '@ipld/dag-pb' import * as mhd from 'multiformats/hashes/digest' import { base32 } from 'multiformats/bases/base32' diff --git a/packages/ipfs-repo-migrations/test/version-test.js b/packages/ipfs-repo-migrations/test/version-test.js index 00547c73..495f9a5c 100644 --- a/packages/ipfs-repo-migrations/test/version-test.js +++ b/packages/ipfs-repo-migrations/test/version-test.js @@ -1,6 +1,6 @@ /* eslint-env mocha */ -import { expect } from 'aegir/utils/chai.js' +import { expect } from 'aegir/chai' import { VERSION_KEY, CONFIG_KEY } from '../src/utils.js' import * as version from '../src/repo/version.js' import { fromString as uint8ArrayFromString } from 'uint8arrays/from-string' diff --git a/packages/ipfs-repo-migrations/tsconfig.json b/packages/ipfs-repo-migrations/tsconfig.json index 5160b3c3..86f70192 100644 --- a/packages/ipfs-repo-migrations/tsconfig.json +++ b/packages/ipfs-repo-migrations/tsconfig.json @@ -1,7 +1,8 @@ { "extends": "aegir/src/config/tsconfig.aegir.json", "compilerOptions": { - "outDir": "types" + "outDir": "dist", + "emitDeclarationOnly": true }, "include": [ "src", diff --git a/packages/ipfs-repo/.aegir.cjs b/packages/ipfs-repo/.aegir.js similarity index 73% rename from packages/ipfs-repo/.aegir.cjs rename to packages/ipfs-repo/.aegir.js index 23b14d8a..d4d67e38 100644 --- a/packages/ipfs-repo/.aegir.cjs +++ b/packages/ipfs-repo/.aegir.js @@ -1,7 +1,6 @@ -'use strict' /** @type {import('aegir').PartialOptions} */ -module.exports = { +export default { build: { bundlesizeMax: '47kB' } diff --git a/packages/ipfs-repo/LICENSE b/packages/ipfs-repo/LICENSE new file mode 100644 index 00000000..20ce483c --- /dev/null +++ b/packages/ipfs-repo/LICENSE @@ -0,0 +1,4 @@ +This project is dual licensed under MIT and Apache-2.0. + +MIT: https://www.opensource.org/licenses/mit +Apache-2.0: https://www.apache.org/licenses/license-2.0 diff --git a/packages/ipfs-repo/LICENSE-MIT b/packages/ipfs-repo/LICENSE-MIT index 749aa1ec..72dc60d8 100644 --- a/packages/ipfs-repo/LICENSE-MIT +++ b/packages/ipfs-repo/LICENSE-MIT @@ -16,4 +16,4 @@ 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 +THE SOFTWARE. diff --git a/packages/ipfs-repo/README.md b/packages/ipfs-repo/README.md index 654f4ad6..f3698d78 100644 --- a/packages/ipfs-repo/README.md +++ b/packages/ipfs-repo/README.md @@ -1,26 +1,17 @@ -# IPFS Repo JavaScript Implementation +# ipfs-repo -[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://ipn.io) -[![](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) -[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs-repo)](https://travis-ci.com/ipfs/js-ipfs-repo) -[![codecov](https://codecov.io/gh/ipfs/js-ipfs-repo/branch/master/graph/badge.svg)](https://codecov.io/gh/ipfs/js-ipfs-repo) [![Dependency Status](https://david-dm.org/ipfs/js-ipfs-repo.svg?style=flat-square)](https://david-dm.org/ipfs/js-ipfs-repo) -[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard) +[![ipfs.io](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io) +[![IRC](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs) +[![Discord](https://img.shields.io/discord/806902334369824788?style=flat-square)](https://discord.gg/ipfs) +[![codecov](https://img.shields.io/codecov/c/github/ipfs/js-ipfs-repo.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs-repo) +[![CI](https://img.shields.io/github/workflow/status/ipfs/js-ipfs-repo/test%20&%20maybe%20release/master?style=flat-square)](https://github.com/ipfs/js-ipfs-repo/actions/workflows/js-test-and-release.yml) -> Implementation of the IPFS repo spec (https://github.com/ipfs/specs/blob/master/REPO.md) in JavaScript +> IPFS Repo implementation -This is the implementation of the [IPFS repo spec](https://github.com/ipfs/specs/blob/master/REPO.md) in JavaScript. - -## Lead Maintainer - -[Alex Potsides](https://github.com/achingbrain) - -## Table of Contents +## Table of contents -- [Background](#background) - [Install](#install) - - [npm](#npm) +- [Background](#background) - [Usage](#usage) - [API](#api) - [Setup](#setup) @@ -67,6 +58,19 @@ This is the implementation of the [IPFS repo spec](https://github.com/ipfs/specs - [Migrations](#migrations) - [Contribute](#contribute) - [License](#license) +- [Contribute](#contribute-1) + +## Install + +```console +$ npm i ipfs-repo +``` + +This is the implementation of the [IPFS repo spec](https://github.com/ipfs/specs/blob/master/REPO.md) in JavaScript. + +## Lead Maintainer + +[Alex Potsides](https://github.com/achingbrain) ## Background @@ -106,10 +110,6 @@ Here is the architectural reasoning for this repo: This provides a well defined interface for creating and interacting with an IPFS repo. -## Install - -### npm - ```sh > npm install ipfs-repo ``` @@ -134,15 +134,13 @@ console.log('repo is ready') This now has created the following structure, either on disk or as an in memory representation: -``` -├── blocks -│   ├── SHARDING -│ └── _README -├── config -├── datastore -├── keys -└── version -``` + ├── blocks + │ ├── SHARDING + │ └── _README + ├── config + ├── datastore + ├── keys + └── version ## API @@ -154,16 +152,16 @@ Creates an IPFS Repo. Arguments: -* `path` (string, mandatory): the path for this repo -* `options` (object, optional): may contain the following values - * `autoMigrate` (bool, defaults to `true`): controls automatic migrations of repository. - * `onMigrationProgress` (function(version, percentComplete, message)): callback function to be notified of migration progress - * `lock` ([Lock](#lock) or string *Deprecated*): what type of lock to use. Lock has to be acquired when opening. string can be `"fs"` or `"memory"`. - * `storageBackends` (object, optional): may contain the following values, which should each be a class implementing the [datastore interface](https://github.com/ipfs/interface-datastore#readme): - * `root` (defaults to [`datastore-fs`](https://github.com/ipfs/js-datastore-fs#readme) in Node.js and [`datastore-level`](https://github.com/ipfs/js-datastore-level#readme) in the browser). Defines the back-end type used for gets and puts of values at the root (`repo.set()`, `repo.get()`) - * `blocks` (defaults to [`datastore-fs`](https://github.com/ipfs/js-datastore-fs#readme) in Node.js and [`datastore-level`](https://github.com/ipfs/js-datastore-level#readme) in the browser). Defines the back-end type used for gets and puts of values at `repo.blocks`. - * `keys` (defaults to [`datastore-fs`](https://github.com/ipfs/js-datastore-fs#readme) in Node.js and [`datastore-level`](https://github.com/ipfs/js-datastore-level#readme) in the browser). Defines the back-end type used for gets and puts of encrypted keys at `repo.keys` - * `datastore` (defaults to [`datastore-level`](https://github.com/ipfs/js-datastore-level#readme)). Defines the back-end type used as the key-value store used for gets and puts of values at `repo.datastore`. +- `path` (string, mandatory): the path for this repo +- `options` (object, optional): may contain the following values + - `autoMigrate` (bool, defaults to `true`): controls automatic migrations of repository. + - `onMigrationProgress` (function(version, percentComplete, message)): callback function to be notified of migration progress + - `lock` ([Lock](#lock) or string *Deprecated*): what type of lock to use. Lock has to be acquired when opening. string can be `"fs"` or `"memory"`. + - `storageBackends` (object, optional): may contain the following values, which should each be a class implementing the [datastore interface](https://github.com/ipfs/interface-datastore#readme): + - `root` (defaults to [`datastore-fs`](https://github.com/ipfs/js-datastore-fs#readme) in Node.js and [`datastore-level`](https://github.com/ipfs/js-datastore-level#readme) in the browser). Defines the back-end type used for gets and puts of values at the root (`repo.set()`, `repo.get()`) + - `blocks` (defaults to [`datastore-fs`](https://github.com/ipfs/js-datastore-fs#readme) in Node.js and [`datastore-level`](https://github.com/ipfs/js-datastore-level#readme) in the browser). Defines the back-end type used for gets and puts of values at `repo.blocks`. + - `keys` (defaults to [`datastore-fs`](https://github.com/ipfs/js-datastore-fs#readme) in Node.js and [`datastore-level`](https://github.com/ipfs/js-datastore-level#readme) in the browser). Defines the back-end type used for gets and puts of encrypted keys at `repo.keys` + - `datastore` (defaults to [`datastore-level`](https://github.com/ipfs/js-datastore-level#readme)). Defines the back-end type used as the key-value store used for gets and puts of values at `repo.datastore`. ```js const repo = createRepo('path/to/repo') @@ -197,49 +195,49 @@ Root repo: Put a value at the root of the repo -* `key` can be a Uint8Array, a string or a [Key][] +- `key` can be a Uint8Array, a string or a [Key][] #### `Promise repo.get(key)` Get a value at the root of the repo -* `key` can be a Uint8Array, a string or a [Key][] +- `key` can be a Uint8Array, a string or a [Key][] ### Blocks #### `Promise repo.blocks.put(block:Block)` -* `block` should be of type [Block][] +- `block` should be of type [Block][] #### `AsyncIterator repo.blocks.putMany(source:AsyncIterable)` Put many blocks. -* `source` should be an AsyncIterable that yields entries of type [Block][] +- `source` should be an AsyncIterable that yields entries of type [Block][] #### `Promise repo.blocks.get(cid:CID)` Get block. -* `cid` is the content id of type [CID][] +- `cid` is the content id of type [CID][] #### `AsyncIterable repo.blocks.getMany(source:AsyncIterable)` Get many blocks -* `source` should be an AsyncIterable that yields entries of type [CID][] +- `source` should be an AsyncIterable that yields entries of type [CID][] #### `Promise repo.blocks.has (cid:CID)` Indicate if a block is present for the passed CID -* `cid` should be of the type [CID][] +- `cid` should be of the type [CID][] #### `Promise repo.blocks.delete (cid:CID)` Deletes a block -* `cid` should be of the type [CID][] +- `cid` should be of the type [CID][] #### `AsyncIterator repo.blocks.query (query)` @@ -247,19 +245,19 @@ Query what blocks are available in blockstore. If `query.keysOnly` is true, the returned iterator will yield [CID][]s, otherwise it will yield [Block][]s -* `query` is a object as specified in [interface-datastore](https://github.com/ipfs/interface-datastore#query). +- `query` is a object as specified in [interface-datastore](https://github.com/ipfs/interface-datastore#query). Datastore: #### `Promise repo.blocks.delete(cid:CID)` -* `cid` should be of the type [CID][] +- `cid` should be of the type [CID][] Delete a block #### `AsyncIterator repo.blocks.deleteMany(source:AsyncIterable)` -* `source` should be an Iterable or AsyncIterable that yields entries of the type [CID][] +- `source` should be an Iterable or AsyncIterable that yields entries of the type [CID][] Delete many blocks @@ -277,7 +275,7 @@ Instead of using `repo.set('config')` this exposes an API that allows you to set Set a config value. `value` can be any object that is serializable to JSON. -* `key` is a string specifying the object path. Example: +- `key` is a string specifying the object path. Example: ```js await repo.config.set('a.b.c', 'c value') @@ -293,7 +291,7 @@ Set the whole config value. `value` can be any object that is serializable to JS Get a config value. Returned promise resolves to the same type that was set before. -* `key` is a string specifying the object path. Example: +- `key` is a string specifying the object path. Example: ```js const value = await repo.config.get('a.b.c') @@ -328,7 +326,7 @@ Gets the API address. Sets the API address. -* `value` should be a [Multiaddr][] or a String representing a valid one. +- `value` should be a [Multiaddr][] or a String representing a valid one. ### Status @@ -403,7 +401,18 @@ This repository falls under the IPFS [Code of Conduct](https://github.com/ipfs/c ## License -[Apache-2.0](LICENSE-APACHE) OR [MIT](LICENSE-MIT) +Licensed under either of + +- Apache 2.0, ([LICENSE-APACHE](LICENSE-APACHE) / ) +- MIT ([LICENSE-MIT](LICENSE-MIT) / ) + +## Contribute + +Feel free to join in. All welcome. Open an [issue](https://github.com/ipfs/js-ipfs-unixfs-importer/issues)! + +This repository falls under the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md). + +[![](https://cdn.rawgit.com/jbenet/contribute-ipfs-gif/master/img/contribute.gif)](https://github.com/ipfs/community/blob/master/CONTRIBUTING.md) [CID]: https://github.com/multiformats/js-cid [Key]: https://github.com/ipfs/interface-datastore#keys diff --git a/packages/ipfs-repo/package.json b/packages/ipfs-repo/package.json index 846ec0f3..1824fa03 100644 --- a/packages/ipfs-repo/package.json +++ b/packages/ipfs-repo/package.json @@ -2,105 +2,183 @@ "name": "ipfs-repo", "version": "14.0.1", "description": "IPFS Repo implementation", - "leadMaintainer": "Alex Potsides ", + "license": "Apache-2.0 OR MIT", + "homepage": "https://github.com/ipfs/js-ipfs-repo/tree/master/packages/ipfs-repo#readme", + "repository": { + "type": "git", + "url": "git+https://github.com/ipfs/js-ipfs-repo.git" + }, + "bugs": { + "url": "https://github.com/ipfs/js-ipfs-repo/issues" + }, + "keywords": [ + "IPFS", + "datastore", + "libp2p" + ], + "engines": { + "node": ">=16.0.0", + "npm": ">=7.0.0" + }, "type": "module", - "main": "src/index.js", - "types": "types/src/index.d.ts", + "types": "./dist/src/index.d.ts", "typesVersions": { "*": { "*": [ - "types/*", - "types/src/*" + "*", + "dist/*", + "dist/src/*", + "dist/src/*/index" ], - "types/*": [ - "types/*", - "types/src/*" + "src/*": [ + "*", + "dist/*", + "dist/src/*", + "dist/src/*/index" ] } }, "files": [ - "*", + "src", + "dist", + "!dist/test", "!**/*.tsbuildinfo" ], - "eslintConfig": { - "extends": "ipfs", - "parserOptions": { - "sourceType": "module" - } - }, - "publishConfig": { - "directory": "dist" - }, "exports": { ".": { + "types": "./dist/src/index.d.ts", "import": "./src/index.js" }, "./constants": { + "types": "./src/constants.d.ts", "import": "./src/constants.js" }, "./errors": { + "types": "./src/errors.d.ts", "import": "./src/errors.js" }, - "./pin-types": { - "import": "./src/pin-types.js" + "./locks/fs": { + "types": "./src/locks/fs.d.ts", + "browser": "./src/locks/memory.js", + "import": "./src/locks/fs.js" }, "./locks/memory": { + "types": "./src/locks/memory.d.ts", "import": "./src/locks/memory.js" }, - "./locks/fs": { - "browser": "./src/locks/memory.js", - "import": "./src/locks/fs.js" + "./pin-types": { + "types": "./src/pin-types.d.ts", + "import": "./src/pin-types.js" }, "./utils/blockstore": { + "types": "./src/utils/blockstore.d.ts", "import": "./src/utils/blockstore.js" }, "./utils/level": { + "types": "./src/utils/level.d.ts", "import": "./src/utils/level.js" } }, - "browser": { - "rimraf": false + "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": "docs", + "release": "patch" + }, + { + "type": "test", + "release": "patch" + }, + { + "type": "deps", + "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": "Documentation" + }, + { + "type": "deps", + "section": "Dependencies" + }, + { + "type": "test", + "section": "Tests" + } + ] + } + } + ], + "@semantic-release/changelog", + "@semantic-release/npm", + "@semantic-release/github", + "@semantic-release/git" + ] }, "scripts": { - "clean": "rimraf dist types", - "lint": "aegir ts -p check && aegir lint", - "prepublishOnly": "npm run build", - "build": "aegir build --no-bundle", - "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", + "clean": "aegir clean", + "lint": "aegir lint", + "build": "aegir build", + "release": "aegir release", "test": "aegir test", - "dep-check": "aegir dep-check -i rimraf -i interface-blockstore -i assert -i events -i npm-run-all -i util" - }, - "repository": { - "type": "git", - "url": "https://github.com/ipfs/js-ipfs-repo.git" - }, - "keywords": [ - "IPFS", - "libp2p", - "datastore" - ], - "license": "(Apache-2.0 OR MIT)", - "homepage": "https://github.com/ipfs/js-ipfs-repo/tree/master/packages/ipfs-repo", - "devDependencies": { - "@ipld/dag-cbor": "^6.0.4", - "@types/bytes": "^3.1.0", - "@types/debug": "^4.1.5", - "@types/proper-lockfile": "^4.1.1", - "@types/rimraf": "^3.0.0", - "aegir": "^36.0.1", - "assert": "^2.0.0", - "blockstore-core": "^1.0.2", - "blockstore-datastore-adapter": "^2.0.1", - "events": "^3.3.0", - "ipfs-utils": "^8.1.3", - "it-all": "^1.0.2", - "just-range": "^2.1.0", - "rimraf": "^3.0.0", - "sinon": "^12.0.1", - "util": "^0.12.3" + "test:node": "aegir test -t node --cov", + "test:chrome": "aegir test -t browser --cov", + "dep-check": "aegir dep-check -i interface-blockstore" }, "dependencies": { "@ipld/dag-pb": "^2.1.0", @@ -111,7 +189,7 @@ "err-code": "^3.0.1", "interface-blockstore": "^2.0.2", "interface-datastore": "^6.0.2", - "ipfs-repo-migrations": "^12.0.1", + "ipfs-repo-migrations": "^12.0.0", "it-drain": "^1.0.1", "it-filter": "^1.0.2", "it-first": "^1.0.2", @@ -129,5 +207,27 @@ "proper-lockfile": "^4.0.0", "sort-keys": "^4.2.0", "uint8arrays": "^3.0.0" + }, + "devDependencies": { + "@ipld/dag-cbor": "^6.0.4", + "@types/bytes": "^3.1.0", + "@types/debug": "^4.1.5", + "@types/proper-lockfile": "^4.1.1", + "@types/rimraf": "^3.0.2", + "aegir": "^37.5.0", + "blockstore-core": "^1.0.2", + "blockstore-datastore-adapter": "^2.0.1", + "ipfs-utils": "^8.1.3", + "it-all": "^1.0.2", + "just-range": "^2.1.0", + "rimraf": "^3.0.2", + "sinon": "^12.0.1" + }, + "browser": { + "rimraf": false + }, + "main": "src/index.js", + "publishConfig": { + "directory": "dist" } } diff --git a/packages/ipfs-repo/src/config.js b/packages/ipfs-repo/src/config.js index 0577caaf..b1ac484e 100644 --- a/packages/ipfs-repo/src/config.js +++ b/packages/ipfs-repo/src/config.js @@ -30,7 +30,7 @@ export function config (store) { /** * Get the current configuration from the repo. * - * @param {Object} [options] - options + * @param {object} [options] - options * @param {AbortSignal} [options.signal] - abort this config read * @returns {Promise} */ @@ -47,7 +47,7 @@ export function config (store) { * Get the value for the passed configuration key from the repo. * * @param {string} key - the config key to get - * @param {Object} [options] - options + * @param {object} [options] - options * @param {AbortSignal} [options.signal] - abort this config read */ async get (key, options = {}) { @@ -70,7 +70,7 @@ export function config (store) { * * @param {string} key - the config key to be written * @param {any} [value] - the config value to be written - * @param {Object} [options] - options + * @param {object} [options] - options * @param {AbortSignal} [options.signal] - abort this config write */ set (key, value, options = {}) { @@ -93,7 +93,7 @@ export function config (store) { * Set the current configuration for this repo. * * @param {Config} [value] - the config value to be written - * @param {Object} [options] - options + * @param {object} [options] - options * @param {AbortSignal} [options.signal] - abort this config write */ replace (value, options = {}) { diff --git a/packages/ipfs-repo/src/pin-manager.js b/packages/ipfs-repo/src/pin-manager.js index 21e20c76..9decacc9 100644 --- a/packages/ipfs-repo/src/pin-manager.js +++ b/packages/ipfs-repo/src/pin-manager.js @@ -44,7 +44,7 @@ function invalidPinTypeErr (type) { */ export class PinManager { /** - * @param {Object} config + * @param {object} config * @param {import('interface-datastore').Datastore} config.pinstore * @param {import('interface-blockstore').Blockstore} config.blockstore * @param {import('./types').loadCodec} config.loadCodec diff --git a/packages/ipfs-repo/test/api-addr-test.js b/packages/ipfs-repo/test/api-addr-test.js index 3154b936..97eab1ef 100644 --- a/packages/ipfs-repo/test/api-addr-test.js +++ b/packages/ipfs-repo/test/api-addr-test.js @@ -1,6 +1,6 @@ /* eslint-env mocha */ -// import { expect } from 'aegir/utils/chai.js' +// import { expect } from 'aegir/chai' // const apiAddr from '../src/api-addr') // import { fromString as uint8ArrayFromString } from 'uint8arrays/from-string' diff --git a/packages/ipfs-repo/test/blockstore-test.js b/packages/ipfs-repo/test/blockstore-test.js index 2070b866..f55d5ef2 100644 --- a/packages/ipfs-repo/test/blockstore-test.js +++ b/packages/ipfs-repo/test/blockstore-test.js @@ -1,7 +1,7 @@ /* eslint max-nested-callbacks: ["error", 8] */ /* eslint-env mocha */ -import { expect } from 'aegir/utils/chai.js' +import { expect } from 'aegir/chai' import { CID } from 'multiformats/cid' import range from 'just-range' import tempDir from 'ipfs-utils/src/temp-dir.js' diff --git a/packages/ipfs-repo/test/blockstore-utils-test.js b/packages/ipfs-repo/test/blockstore-utils-test.js index 7e6c2c9c..36b2c471 100644 --- a/packages/ipfs-repo/test/blockstore-utils-test.js +++ b/packages/ipfs-repo/test/blockstore-utils-test.js @@ -1,6 +1,6 @@ /* eslint-env mocha */ -import { expect } from 'aegir/utils/chai.js' +import { expect } from 'aegir/chai' import { Key } from 'interface-datastore/key' import { CID } from 'multiformats/cid' import * as raw from 'multiformats/codecs/raw' diff --git a/packages/ipfs-repo/test/config-test.js b/packages/ipfs-repo/test/config-test.js index a38335c9..824d60c9 100644 --- a/packages/ipfs-repo/test/config-test.js +++ b/packages/ipfs-repo/test/config-test.js @@ -1,6 +1,6 @@ /* eslint-env mocha */ -import { expect } from 'aegir/utils/chai.js' +import { expect } from 'aegir/chai' /** * @param {import('../src/types').IPFSRepo} repo diff --git a/packages/ipfs-repo/test/datastore-test.js b/packages/ipfs-repo/test/datastore-test.js index 838c62be..94c386a8 100644 --- a/packages/ipfs-repo/test/datastore-test.js +++ b/packages/ipfs-repo/test/datastore-test.js @@ -1,7 +1,7 @@ /* eslint max-nested-callbacks: ["error", 8] */ /* eslint-env mocha */ -import { expect } from 'aegir/utils/chai.js' +import { expect } from 'aegir/chai' import range from 'just-range' import { Key } from 'interface-datastore/key' import { fromString as uint8ArrayFromString } from 'uint8arrays/from-string' diff --git a/packages/ipfs-repo/test/is-initialized.js b/packages/ipfs-repo/test/is-initialized.js index d8da5e72..ee9ca96c 100644 --- a/packages/ipfs-repo/test/is-initialized.js +++ b/packages/ipfs-repo/test/is-initialized.js @@ -1,7 +1,7 @@ /* eslint max-nested-callbacks: ["error", 8] */ /* eslint-env mocha */ -import { expect } from 'aegir/utils/chai.js' +import { expect } from 'aegir/chai' import tempDir from 'ipfs-utils/src/temp-dir.js' import { createRepo } from '../src/index.js' import { loadCodec } from './fixtures/load-codec.js' diff --git a/packages/ipfs-repo/test/keystore-test.js b/packages/ipfs-repo/test/keystore-test.js index 41bc4208..ab0c1e8b 100644 --- a/packages/ipfs-repo/test/keystore-test.js +++ b/packages/ipfs-repo/test/keystore-test.js @@ -1,7 +1,7 @@ /* eslint max-nested-callbacks: ["error", 8] */ /* eslint-env mocha */ -import { expect } from 'aegir/utils/chai.js' +import { expect } from 'aegir/chai' /** * @param {import('../src/types').IPFSRepo} repo diff --git a/packages/ipfs-repo/test/lock-test.js b/packages/ipfs-repo/test/lock-test.js index f5df5c97..5bf936d5 100644 --- a/packages/ipfs-repo/test/lock-test.js +++ b/packages/ipfs-repo/test/lock-test.js @@ -1,6 +1,6 @@ /* eslint-env mocha */ -import { expect } from 'aegir/utils/chai.js' +import { expect } from 'aegir/chai' import { createRepo } from '../src/index.js' import { MemoryLock } from '../src/locks/memory.js' import { LockExistsError } from '../src/errors.js' diff --git a/packages/ipfs-repo/test/migrations-test.js b/packages/ipfs-repo/test/migrations-test.js index a28120bf..08127c73 100644 --- a/packages/ipfs-repo/test/migrations-test.js +++ b/packages/ipfs-repo/test/migrations-test.js @@ -1,7 +1,7 @@ /* eslint max-nested-callbacks: ["error", 8] */ /* eslint-env mocha */ -import { expect } from 'aegir/utils/chai.js' +import { expect } from 'aegir/chai' import sinon from 'sinon' import { InvalidRepoVersionError } from '../src/errors.js' import { createRepo } from '../src/index.js' diff --git a/packages/ipfs-repo/test/options-test.js b/packages/ipfs-repo/test/options-test.js index efc8bf5a..1f97d132 100644 --- a/packages/ipfs-repo/test/options-test.js +++ b/packages/ipfs-repo/test/options-test.js @@ -1,6 +1,6 @@ /* eslint-env mocha */ -import { expect } from 'aegir/utils/chai.js' +import { expect } from 'aegir/chai' import sinon from 'sinon' import tempDir from 'ipfs-utils/src/temp-dir.js' import rimraf from 'rimraf' diff --git a/packages/ipfs-repo/test/pins-test.js b/packages/ipfs-repo/test/pins-test.js index d6efd8be..67a52b46 100644 --- a/packages/ipfs-repo/test/pins-test.js +++ b/packages/ipfs-repo/test/pins-test.js @@ -1,7 +1,7 @@ /* eslint max-nested-callbacks: ["error", 8] */ /* eslint-env mocha */ -import { expect } from 'aegir/utils/chai.js' +import { expect } from 'aegir/chai' import * as dagPb from '@ipld/dag-pb' import * as dagCbor from '@ipld/dag-cbor' import { sha256 } from 'multiformats/hashes/sha2' diff --git a/packages/ipfs-repo/test/repo-test.js b/packages/ipfs-repo/test/repo-test.js index 699f34b0..701780fe 100644 --- a/packages/ipfs-repo/test/repo-test.js +++ b/packages/ipfs-repo/test/repo-test.js @@ -1,6 +1,6 @@ /* eslint-env mocha */ -import { expect } from 'aegir/utils/chai.js' +import { expect } from 'aegir/chai' import sinon from 'sinon' import tempDir from 'ipfs-utils/src/temp-dir.js' import { createRepo } from '../src/index.js' diff --git a/packages/ipfs-repo/test/stat-test.js b/packages/ipfs-repo/test/stat-test.js index 9195387d..7748be4a 100644 --- a/packages/ipfs-repo/test/stat-test.js +++ b/packages/ipfs-repo/test/stat-test.js @@ -1,6 +1,6 @@ /* eslint-env mocha */ -import { expect } from 'aegir/utils/chai.js' +import { expect } from 'aegir/chai' import { CID } from 'multiformats/cid' import { fromString as uint8ArrayFromString } from 'uint8arrays/from-string' diff --git a/packages/ipfs-repo/tsconfig.json b/packages/ipfs-repo/tsconfig.json index 12bc73a3..799c3d68 100644 --- a/packages/ipfs-repo/tsconfig.json +++ b/packages/ipfs-repo/tsconfig.json @@ -1,10 +1,16 @@ { - "extends": "aegir/src/config/tsconfig.aegir.json", - "compilerOptions": { - "outDir": "types" - }, - "include": [ - "src", - "test" - ] + "extends": "aegir/src/config/tsconfig.aegir.json", + "compilerOptions": { + "outDir": "dist", + "emitDeclarationOnly": true + }, + "include": [ + "src", + "test" + ], + "references": [ + { + "path": "../ipfs-repo-migrations" + } + ] }