diff --git a/.github/dependabot.yml b/.github/dependabot.yml index de46e326..290ad028 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/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..8630dc5c --- /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/release.yml b/.github/workflows/release.yml deleted file mode 100644 index 16b1a2c9..00000000 --- a/.github/workflows/release.yml +++ /dev/null @@ -1,39 +0,0 @@ -name: Release RC -on: - push: - branches: - - master - -jobs: - release-rc: - name: Release RC - runs-on: ubuntu-latest - if: "!contains(github.event.head_commit.author.name, 'Github Actions')" - env: - NPM_TOKEN: ${{ secrets.NPM_TOKEN }} - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - steps: - - uses: actions/checkout@v2 - with: - fetch-depth: 0 - - name: Setup node - uses: actions/setup-node@v2 - with: - node-version: 16 - - name: Configure Git User - run: | - git config --global user.email "actions@github.com" - git config --global user.name "Github Actions" - - name: Authenticate with Registry - run: | - echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > .npmrc - env: - NPM_TOKEN: ${{ secrets.NPM_TOKEN }} - - name: Release - run: | - npm install - npm run build - npm run release:rc -- --yes - 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 b3625189..00000000 --- a/.github/workflows/test.yml +++ /dev/null @@ -1,91 +0,0 @@ -name: Test -on: - pull_request: - branches: - - master - -jobs: - check: - name: Check - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - uses: actions/setup-node@v2 - with: - node-version: 16 - - run: npm install - - run: npm run build - - run: npm run lint - - run: npm run depcheck -- -- -- -p - - run: npm run depcheck -- -- -- -- --unused - test-node: - needs: check - runs-on: ${{ matrix.os }} - name: Test ${{ matrix.project }} node ${{ matrix.node }} ${{ matrix.os }} - strategy: - matrix: - os: [windows-latest, ubuntu-latest, macos-latest] - node: [16] - project: - - ipfs-unixfs - - ipfs-unixfs-exporter - - ipfs-unixfs-importer - fail-fast: true - steps: - - uses: actions/checkout@v2 - - uses: actions/setup-node@v2 - with: - node-version: ${{ matrix.node }} - - run: npm install - - run: npm run build - - run: npm run test -- --scope=${{ matrix.project }} -- -- --cov -t node - test-browser: - needs: check - runs-on: ubuntu-latest - name: Test ${{ matrix.project }} ${{ matrix.browser }} ${{ matrix.type }} - strategy: - matrix: - project: - - ipfs-unixfs - - ipfs-unixfs-exporter - - ipfs-unixfs-importer - browser: - - chromium - - firefox - type: - - browser - - webworker - fail-fast: true - steps: - - uses: actions/checkout@v2 - - uses: actions/setup-node@v2 - with: - node-version: 16 - - run: npm install - - run: npm run build - - run: npm run test -- --scope=${{ matrix.project }} -- -- -t ${{ matrix.type }} -- --browser ${{ matrix.browser }} - test-electron: - needs: check - runs-on: ubuntu-latest - name: Test ${{ matrix.project }} ${{ matrix.type }} - strategy: - matrix: - project: - - ipfs-unixfs - - ipfs-unixfs-exporter - - ipfs-unixfs-importer - type: - - electron-main - - electron-renderer - fail-fast: true - steps: - - uses: actions/checkout@v2 - - uses: actions/setup-node@v2 - with: - node-version: 16 - - run: npm install - - run: npm run build - - run: npx lerna link # use publishConfig.directory - - uses: GabrielBB/xvfb-action@v1 - with: - run: npm run test -- --scope=${{ matrix.project }} -- -- -t ${{ matrix.type }} --bail -f ./dist/cjs/node-test/*.spec.js diff --git a/LICENSE b/LICENSE index b7cf9f52..20ce483c 100644 --- a/LICENSE +++ b/LICENSE @@ -1,22 +1,4 @@ -The MIT License (MIT) - -Copyright (c) 2016 David Dias - -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. +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-APACHE b/LICENSE-APACHE new file mode 100644 index 00000000..14478a3b --- /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 00000000..72dc60d8 --- /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/lerna.json b/lerna.json index bf001c38..aa6d0004 100644 --- a/lerna.json +++ b/lerna.json @@ -1,21 +1,12 @@ { - "lerna": "3.22.1", + "lerna": "4.0.0", "packages": [ "packages/*" ], "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 ceedff02..93cb3cdc 100644 --- a/package.json +++ b/package.json @@ -2,59 +2,39 @@ "name": "js-ipfs-unixfs", "version": "1.0.0", "description": "JS implementation of the IPFS UnixFS", + "license": "Apache-2.0 OR MIT", + "homepage": "https://github.com/ipfs/js-ipfs-unixfs#readme", + "repository": { + "type": "git", + "url": "git+https://github.com/ipfs/js-ipfs-unixfs.git" + }, + "bugs": { + "url": "https://github.com/ipfs/js-ipfs-unixfs/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", - "coverage": "lerna run coverage", - "prepare": "lerna run prepare", + "reset": "lerna run clean && rimraf ./node_modules ./package-lock.json packages/*/node_modules packages/*/package-lock.json packages/*/dist", + "test": "lerna run --concurrency 1 test -- --", + "test:node": "lerna run --concurrency 1 test:node -- --", + "test:chrome": "lerna run --concurrency 1 test:chrome -- --", + "test:chrome-webworker": "lerna --concurrency 1 run test:chrome-webworker -- --", + "test:firefox": "lerna run --concurrency 1 test:firefox -- --", + "test:firefox-webworker": "lerna run --concurrency 1 test:firefox-webworker -- --", + "test:electron-main": "lerna run --concurrency 1 test:electron-main -- --", + "test:electron-renderer": "lerna run --concurrency 1 test:electron-renderer -- --", "build": "lerna run build", - "clean": "lerna run clean", "lint": "lerna run lint", - "depcheck": "lerna run depcheck", - "release": "npm run update-contributors && lerna publish", - "release:rc": "lerna publish --canary --preid rc --dist-tag next", - "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" + "dep-check": "lerna run dep-check", + "release": "lerna exec --concurrency 1 -- semantic-release -e semantic-release-monorepo" }, - "devDependencies": { + "dependencies": { "lerna": "^4.0.0" }, - "repository": { - "type": "git", - "url": "git+https://github.com/ipfs/js-ipfs-unixfs.git" - }, - "private": true, - "contributors": [ - "achingbrain ", - "David Dias ", - "Friedel Ziegelmayer ", - "Stephen Whitmore ", - "Alan Shaw ", - "Pedro Teixeira ", - "nginnever ", - "Volker Mische ", - "Hugo Dias ", - "Vasco Santos ", - "Richard Schneider ", - "Dan Ordille ", - "ᴠɪᴄᴛᴏʀ ʙᴊᴇʟᴋʜᴏʟᴍ ", - "JGAntunes ", - "Marcin Rataj ", - "Richard Littauer ", - "SahidMiller ", - "Mithgol ", - "Irakli Gozalishvili ", - "Arpit Agarwal ", - "Hector Sanjuan ", - "Francisco Baio Dias ", - "Diogo Silva ", - "jbenet ", - "Bernard Mordan " - ], "workspaces": [ "packages/*" - ], - "engines": { - "node": ">=14.0.0", - "npm": ">=7.0.0" - } + ] } diff --git a/packages/ipfs-unixfs-exporter/LICENSE b/packages/ipfs-unixfs-exporter/LICENSE index b7cf9f52..20ce483c 100644 --- a/packages/ipfs-unixfs-exporter/LICENSE +++ b/packages/ipfs-unixfs-exporter/LICENSE @@ -1,22 +1,4 @@ -The MIT License (MIT) - -Copyright (c) 2016 David Dias - -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. +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-unixfs-exporter/LICENSE-APACHE b/packages/ipfs-unixfs-exporter/LICENSE-APACHE new file mode 100644 index 00000000..14478a3b --- /dev/null +++ b/packages/ipfs-unixfs-exporter/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/packages/ipfs-unixfs-exporter/LICENSE-MIT b/packages/ipfs-unixfs-exporter/LICENSE-MIT new file mode 100644 index 00000000..72dc60d8 --- /dev/null +++ b/packages/ipfs-unixfs-exporter/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/packages/ipfs-unixfs-exporter/package.json b/packages/ipfs-unixfs-exporter/package.json index 256cc8a7..6170862f 100644 --- a/packages/ipfs-unixfs-exporter/package.json +++ b/packages/ipfs-unixfs-exporter/package.json @@ -2,51 +2,175 @@ "name": "ipfs-unixfs-exporter", "version": "7.0.6", "description": "JavaScript implementation of the UnixFs exporter used by IPFS", - "leadMaintainer": "Alex Potsides ", - "main": "src/index.js", + "license": "Apache-2.0 OR MIT", + "homepage": "https://github.com/ipfs/js-ipfs-unixfs/tree/master/packages/ipfs-unixfs-exporter#readme", + "repository": { + "type": "git", + "url": "git+https://github.com/ipfs/js-ipfs-unixfs.git" + }, + "bugs": { + "url": "https://github.com/ipfs/js-ipfs-unixfs/issues" + }, + "keywords": [ + "IPFS" + ], + "engines": { + "node": ">=16.0.0", + "npm": ">=7.0.0" + }, "type": "module", - "browser": { - "fs": false + "types": "types/src/index.d.ts", + "typesVersions": { + "*": { + "*": [ + "types/*", + "types/src/*" + ], + "types/*": [ + "types/*", + "types/src/*" + ] + } + }, + "files": [ + "*", + "!**/*.tsbuildinfo", + "!**/browser-test", + "!**/node-test" + ], + "exports": { + ".": { + "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": { "prepare": "aegir build --no-bundle && cp -R types dist", "pretest": "aegir build --esm-tests", "test": "aegir test", + "test:node": "aegir test -t node --cov", + "test:chrome": "aegir test -t browser --cov", + "test:firefox": "aegir test -t browser -- --browser firefox", "build": "aegir build && cp -R types dist", "preleaseOnly": "npx json -I -f dist/package.json -e this.types='\"src/index.d.ts\"'", "clean": "rimraf ./dist", "lint": "aegir ts -p check && aegir lint", "coverage": "nyc -s npm run test -t node && nyc report --reporter=html", - "depcheck": "aegir dep-check -i @types/mocha -i @types/sinon -i nyc -i abort-controller -i rimraf -i copy -i util -i crypto-browserify -i events -i readable-stream -i interface-blockstore" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/ipfs/js-ipfs-unixfs.git" - }, - "keywords": [ - "IPFS" - ], - "license": "MIT", - "bugs": { - "url": "https://github.com/ipfs/js-ipfs-unixfs/issues" - }, - "engines": { - "node": ">=14.0.0", - "npm": ">=6.0.0" + "dep-check": "aegir dep-check -i @types/mocha -i @types/sinon -i nyc -i abort-controller -i rimraf -i copy -i util -i crypto-browserify -i events -i readable-stream -i interface-blockstore", + "release": "semantic-release" }, - "homepage": "https://github.com/ipfs/js-ipfs-unixfs#readme", - "publishConfig": { - "directory": "dist" + "dependencies": { + "@ipld/dag-cbor": "^6.0.4", + "@ipld/dag-pb": "^2.0.2", + "@multiformats/murmur3": "^1.0.3", + "err-code": "^3.0.1", + "hamt-sharding": "^2.0.0", + "interface-blockstore": "^1.0.0", + "ipfs-unixfs": "^6.0.0", + "it-last": "^1.0.5", + "multiformats": "^9.4.2", + "uint8arrays": "^3.0.0" }, "devDependencies": { "@types/mocha": "^8.2.1", "@types/sinon": "^10.0.0", "abort-controller": "^3.0.0", - "aegir": "^35.0.1", + "aegir": "^36.2.3", "copy": "^0.3.2", "crypto-browserify": "^3.12.0", "events": "^3.3.0", - "ipfs-unixfs-importer": "^9.0.6", + "ipfs-unixfs-importer": "^9.0.0", "it-all": "^1.0.5", "it-buffer-stream": "^2.0.0", "it-first": "^1.0.6", @@ -58,23 +182,11 @@ "sinon": "^11.1.1", "util": "^0.12.3" }, - "dependencies": { - "@ipld/dag-cbor": "^6.0.4", - "@ipld/dag-pb": "^2.0.2", - "@multiformats/murmur3": "^1.0.3", - "err-code": "^3.0.1", - "hamt-sharding": "^2.0.0", - "interface-blockstore": "^1.0.0", - "ipfs-unixfs": "^6.0.6", - "it-last": "^1.0.5", - "multiformats": "^9.4.2", - "uint8arrays": "^3.0.0" + "browser": { + "fs": false }, - "types": "types/src/index.d.ts", - "eslintConfig": { - "extends": "ipfs", - "parserOptions": { - "sourceType": "module" - } + "main": "src/index.js", + "publishConfig": { + "directory": "dist" } } diff --git a/packages/ipfs-unixfs-exporter/src/resolvers/unixfs-v1/content/file.js b/packages/ipfs-unixfs-exporter/src/resolvers/unixfs-v1/content/file.js index 6c95e5fd..ce020c21 100644 --- a/packages/ipfs-unixfs-exporter/src/resolvers/unixfs-v1/content/file.js +++ b/packages/ipfs-unixfs-exporter/src/resolvers/unixfs-v1/content/file.js @@ -41,7 +41,7 @@ async function * emitBytes (blockstore, node, start, end, streamPosition = 0, op try { file = UnixFS.unmarshal(node.Data) - } catch (err) { + } catch (/** @type {any} */ err) { throw errCode(err, 'ERR_NOT_UNIXFS') } diff --git a/packages/ipfs-unixfs-exporter/src/resolvers/unixfs-v1/index.js b/packages/ipfs-unixfs-exporter/src/resolvers/unixfs-v1/index.js index cdb79de3..1da18e6c 100644 --- a/packages/ipfs-unixfs-exporter/src/resolvers/unixfs-v1/index.js +++ b/packages/ipfs-unixfs-exporter/src/resolvers/unixfs-v1/index.js @@ -59,7 +59,7 @@ const unixFsResolver = async (cid, name, path, toResolve, resolve, depth, blocks try { unixfs = UnixFS.unmarshal(node.Data) - } catch (err) { + } catch (/** @type {any} */ err) { // non-UnixFS dag-pb node? It could happen. throw errCode(err, 'ERR_NOT_UNIXFS') } diff --git a/packages/ipfs-unixfs-exporter/test/exporter-subtree.spec.js b/packages/ipfs-unixfs-exporter/test/exporter-subtree.spec.js index eb0b99d9..55119885 100644 --- a/packages/ipfs-unixfs-exporter/test/exporter-subtree.spec.js +++ b/packages/ipfs-unixfs-exporter/test/exporter-subtree.spec.js @@ -95,7 +95,7 @@ describe('exporter subtree', () => { try { await exporter(`${imported.cid}/doesnotexist`, block) - } catch (err) { + } catch (/** @type {any} */ err) { expect(err.code).to.equal('ERR_NOT_FOUND') } }) diff --git a/packages/ipfs-unixfs-exporter/test/exporter.spec.js b/packages/ipfs-unixfs-exporter/test/exporter.spec.js index b9d45a4a..9c1de742 100644 --- a/packages/ipfs-unixfs-exporter/test/exporter.spec.js +++ b/packages/ipfs-unixfs-exporter/test/exporter.spec.js @@ -587,7 +587,7 @@ describe('exporter', () => { length }) throw new Error('Should not have got this far') - } catch (err) { + } catch (/** @type {any} */ err) { expect(err.message).to.equal('Length must be greater than or equal to 0') expect(err.code).to.equal('ERR_INVALID_PARAMS') } @@ -606,7 +606,7 @@ describe('exporter', () => { offset }) throw new Error('Should not have got this far') - } catch (err) { + } catch (/** @type {any} */ err) { expect(err.message).to.equal('Offset must be greater than or equal to 0') expect(err.code).to.equal('ERR_INVALID_PARAMS') } @@ -625,7 +625,7 @@ describe('exporter', () => { offset }) throw new Error('Should not have got this far') - } catch (err) { + } catch (/** @type {any} */ err) { expect(err.message).to.equal('Offset must be less than the file size') expect(err.code).to.equal('ERR_INVALID_PARAMS') } @@ -689,7 +689,7 @@ describe('exporter', () => { offset: -1 }) throw new Error('Should not have got this far') - } catch (err) { + } catch (/** @type {any} */ err) { expect(err.message).to.contain('Offset must be greater than or equal to 0') expect(err.code).to.equal('ERR_INVALID_PARAMS') } @@ -730,7 +730,7 @@ describe('exporter', () => { offset: 2, length: -1 }) - } catch (err) { + } catch (/** @type {any} */ err) { expect(err.message).to.contain('Length must be greater than or equal to 0') expect(err.code).to.equal('ERR_INVALID_PARAMS') } @@ -742,7 +742,7 @@ describe('exporter', () => { file: Uint8Array.from([0, 1, 2, 3, 4]), offset: 200 }) - } catch (err) { + } catch (/** @type {any} */ err) { expect(err.message).to.contain('Offset must be less than the file size') expect(err.code).to.equal('ERR_INVALID_PARAMS') } @@ -821,7 +821,7 @@ describe('exporter', () => { try { await exporter(hash, block) - } catch (err) { + } catch (/** @type {any} */ err) { expect(err.code).to.equal('ERR_NOT_FOUND') } }) @@ -967,7 +967,7 @@ describe('exporter', () => { try { await exporter(`${cid}/baz`, block) - } catch (err) { + } catch (/** @type {any} */ err) { expect(err.code).to.equal('ERR_NO_PROP') } }) @@ -994,7 +994,7 @@ describe('exporter', () => { try { await exporter(`${cid}`, block) - } catch (err) { + } catch (/** @type {any} */ err) { expect(err.code).to.equal('ERR_NO_RESOLVER') } }) @@ -1006,7 +1006,7 @@ describe('exporter', () => { try { await exporter(`${cid}/lol`, block) - } catch (err) { + } catch (/** @type {any} */ err) { expect(err.code).to.equal('ERR_NOT_FOUND') } }) @@ -1021,7 +1021,7 @@ describe('exporter', () => { try { await exporter(dagpbCid, block) - } catch (err) { + } catch (/** @type {any} */ err) { expect(err.code).to.equal('ERR_NOT_UNIXFS') } }) @@ -1055,7 +1055,7 @@ describe('exporter', () => { try { await all(exported.content()) - } catch (err) { + } catch (/** @type {any} */ err) { expect(err.code).to.equal('ERR_NOT_UNIXFS') } }) diff --git a/packages/ipfs-unixfs-exporter/test/importer.spec.js b/packages/ipfs-unixfs-exporter/test/importer.spec.js index ce1c4e06..2639f570 100644 --- a/packages/ipfs-unixfs-exporter/test/importer.spec.js +++ b/packages/ipfs-unixfs-exporter/test/importer.spec.js @@ -381,7 +381,7 @@ strategies.forEach((strategy) => { content: 7 }], block, options)) throw new Error('No error was thrown') - } catch (err) { + } catch (/** @type {any} */ err) { expect(err.code).to.equal('ERR_INVALID_CONTENT') } }) @@ -398,7 +398,7 @@ strategies.forEach((strategy) => { } }], block, options)) throw new Error('No error was thrown') - } catch (err) { + } catch (/** @type {any} */ err) { expect(err.code).to.equal('ERR_INVALID_CONTENT') } }) @@ -670,7 +670,7 @@ strategies.forEach((strategy) => { await block.get(file.cid) throw new Error('No error was thrown') - } catch (err) { + } catch (/** @type {any} */ err) { expect(err.code).to.equal('ERR_NOT_FOUND') } }) diff --git a/packages/ipfs-unixfs-importer/LICENSE b/packages/ipfs-unixfs-importer/LICENSE index b7cf9f52..20ce483c 100644 --- a/packages/ipfs-unixfs-importer/LICENSE +++ b/packages/ipfs-unixfs-importer/LICENSE @@ -1,22 +1,4 @@ -The MIT License (MIT) - -Copyright (c) 2016 David Dias - -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. +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-unixfs-importer/LICENSE-APACHE b/packages/ipfs-unixfs-importer/LICENSE-APACHE new file mode 100644 index 00000000..14478a3b --- /dev/null +++ b/packages/ipfs-unixfs-importer/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/packages/ipfs-unixfs-importer/LICENSE-MIT b/packages/ipfs-unixfs-importer/LICENSE-MIT new file mode 100644 index 00000000..72dc60d8 --- /dev/null +++ b/packages/ipfs-unixfs-importer/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/packages/ipfs-unixfs-importer/package.json b/packages/ipfs-unixfs-importer/package.json index 2a5fbe9c..a28ba538 100644 --- a/packages/ipfs-unixfs-importer/package.json +++ b/packages/ipfs-unixfs-importer/package.json @@ -2,55 +2,153 @@ "name": "ipfs-unixfs-importer", "version": "9.0.6", "description": "JavaScript implementation of the UnixFs importer used by IPFS", - "leadMaintainer": "Alex Potsides ", - "main": "src/index.js", + "license": "Apache-2.0 OR MIT", + "homepage": "https://github.com/ipfs/js-ipfs-unixfs/tree/master/packages/ipfs-unixfs-importer#readme", + "repository": { + "type": "git", + "url": "git+https://github.com/ipfs/js-ipfs-unixfs.git" + }, + "bugs": { + "url": "https://github.com/ipfs/js-ipfs-unixfs/issues" + }, + "keywords": [ + "IPFS" + ], + "engines": { + "node": ">=16.0.0", + "npm": ">=7.0.0" + }, "type": "module", - "browser": { - "fs": false + "types": "types/src/index.d.ts", + "typesVersions": { + "*": { + "*": [ + "types/*", + "types/src/*" + ], + "types/*": [ + "types/*", + "types/src/*" + ] + } + }, + "files": [ + "*", + "!**/*.tsbuildinfo", + "!**/browser-test", + "!**/node-test" + ], + "exports": { + ".": { + "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": { "prepare": "aegir build --no-bundle && cp -R types dist", "pretest": "aegir build --esm-tests", "test": "aegir test", + "test:node": "aegir test -t node --cov", + "test:chrome": "aegir test -t browser --cov", + "test:firefox": "aegir test -t browser -- --browser firefox", "build": "aegir build && cp -R types dist", "preleaseOnly": "npx json -I -f dist/package.json -e this.types='\"src/index.d.ts\"'", "clean": "rimraf ./dist", "lint": "aegir ts -p check && aegir lint", "coverage": "nyc -s npm run test -t node && nyc report --reporter=html", - "depcheck": "aegir dep-check -i @types/mocha -i nyc -i rimraf -i copy -i util -i crypto-browserify -i events -i readable-stream -i assert" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/ipfs/js-ipfs-unixfs.git" - }, - "keywords": [ - "IPFS" - ], - "license": "MIT", - "bugs": { - "url": "https://github.com/ipfs/js-ipfs-unixfs/issues" - }, - "engines": { - "node": ">=14.0.0", - "npm": ">=6.0.0" - }, - "homepage": "https://github.com/ipfs/js-ipfs-unixfs#readme", - "publishConfig": { - "directory": "dist" - }, - "devDependencies": { - "@types/mocha": "^8.2.1", - "aegir": "^35.0.1", - "assert": "^2.0.0", - "copy": "^0.3.2", - "crypto-browserify": "^3.12.0", - "events": "^3.3.0", - "it-buffer-stream": "^2.0.0", - "nyc": "^15.0.0", - "readable-stream": "^3.6.0", - "rimraf": "^3.0.2", - "util": "^0.12.3", - "wherearewe": "^1.0.0" + "de-pcheck": "aegir dep-check -i @types/mocha -i nyc -i rimraf -i copy -i util -i crypto-browserify -i events -i readable-stream -i assert", + "release": "semantic-release" }, "dependencies": { "@ipld/dag-pb": "^2.0.2", @@ -59,7 +157,7 @@ "err-code": "^3.0.1", "hamt-sharding": "^2.0.0", "interface-blockstore": "^1.0.0", - "ipfs-unixfs": "^6.0.6", + "ipfs-unixfs": "^6.0.0", "it-all": "^1.0.5", "it-batch": "^1.0.8", "it-first": "^1.0.6", @@ -69,11 +167,25 @@ "rabin-wasm": "^0.1.4", "uint8arrays": "^3.0.0" }, - "types": "types/src/index.d.ts", - "eslintConfig": { - "extends": "ipfs", - "parserOptions": { - "sourceType": "module" - } + "devDependencies": { + "@types/mocha": "^8.2.1", + "aegir": "^36.2.3", + "assert": "^2.0.0", + "copy": "^0.3.2", + "crypto-browserify": "^3.12.0", + "events": "^3.3.0", + "it-buffer-stream": "^2.0.0", + "nyc": "^15.0.0", + "readable-stream": "^3.6.0", + "rimraf": "^3.0.2", + "util": "^0.12.3", + "wherearewe": "^1.0.0" + }, + "browser": { + "fs": false + }, + "main": "src/index.js", + "publishConfig": { + "directory": "dist" } } diff --git a/packages/ipfs-unixfs-importer/test/builder-only-hash.spec.js b/packages/ipfs-unixfs-importer/test/builder-only-hash.spec.js index 6891d1be..b5dd9167 100644 --- a/packages/ipfs-unixfs-importer/test/builder-only-hash.spec.js +++ b/packages/ipfs-unixfs-importer/test/builder-only-hash.spec.js @@ -25,7 +25,7 @@ describe('builder: onlyHash', () => { await block.get((await nodes[0]()).cid) throw new Error('Should have errored') - } catch (err) { + } catch (/** @type {any} */ err) { expect(err.code).to.equal('ERR_NOT_FOUND') } }) diff --git a/packages/ipfs-unixfs-importer/test/chunker-rabin.spec.js b/packages/ipfs-unixfs-importer/test/chunker-rabin.spec.js index 990f7336..e10e85f0 100644 --- a/packages/ipfs-unixfs-importer/test/chunker-rabin.spec.js +++ b/packages/ipfs-unixfs-importer/test/chunker-rabin.spec.js @@ -96,7 +96,7 @@ describe('chunker: rabin', function () { try { await all(chunker(asAsyncIterable([]), opts)) throw new Error('Should have thrown') - } catch (err) { + } catch (/** @type {any} */ err) { expect(err.code).to.equal('ERR_INVALID_MIN_CHUNK_SIZE') } }) @@ -111,7 +111,7 @@ describe('chunker: rabin', function () { // @ts-expect-error invalid opts await all(chunker(asAsyncIterable([]), opts)) throw new Error('Should have thrown') - } catch (err) { + } catch (/** @type {any} */ err) { expect(err.code).to.equal('ERR_INVALID_AVG_CHUNK_SIZE') } }) diff --git a/packages/ipfs-unixfs/LICENSE b/packages/ipfs-unixfs/LICENSE index bb9cf402..20ce483c 100644 --- a/packages/ipfs-unixfs/LICENSE +++ b/packages/ipfs-unixfs/LICENSE @@ -1,21 +1,4 @@ -The MIT License (MIT) +This project is dual licensed under MIT and Apache-2.0. -Copyright (c) 2016 David Dias - -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. +MIT: https://www.opensource.org/licenses/mit +Apache-2.0: https://www.apache.org/licenses/license-2.0 diff --git a/packages/ipfs-unixfs/LICENSE-APACHE b/packages/ipfs-unixfs/LICENSE-APACHE new file mode 100644 index 00000000..14478a3b --- /dev/null +++ b/packages/ipfs-unixfs/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/packages/ipfs-unixfs/LICENSE-MIT b/packages/ipfs-unixfs/LICENSE-MIT new file mode 100644 index 00000000..72dc60d8 --- /dev/null +++ b/packages/ipfs-unixfs/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/packages/ipfs-unixfs/package.json b/packages/ipfs-unixfs/package.json index 77ce63fd..910fed22 100644 --- a/packages/ipfs-unixfs/package.json +++ b/packages/ipfs-unixfs/package.json @@ -2,11 +2,141 @@ "name": "ipfs-unixfs", "version": "6.0.6", "description": "JavaScript implementation of IPFS' unixfs (a Unix FileSystem representation on top of a MerkleDAG)", - "leadMaintainer": "Alex Potsides ", - "main": "src/index.js", + "license": "Apache-2.0 OR MIT", + "homepage": "https://github.com/ipfs/js-ipfs-unixfs/tree/master/packages/ipfs-unixfs#readme", + "repository": { + "type": "git", + "url": "git+https://github.com/ipfs/js-ipfs-unixfs.git" + }, + "bugs": { + "url": "https://github.com/ipfs/js-ipfs-unixfs/issues" + }, + "keywords": [ + "IPFS" + ], + "engines": { + "node": ">=16.0.0", + "npm": ">=7.0.0" + }, "type": "module", - "browser": { - "fs": false + "types": "types/src/index.d.ts", + "typesVersions": { + "*": { + "*": [ + "types/*", + "types/src/*" + ], + "types/*": [ + "types/*", + "types/src/*" + ] + } + }, + "files": [ + "*", + "!**/*.tsbuildinfo", + "!**/browser-test", + "!**/node-test" + ], + "exports": { + ".": { + "import": "./src/index.js" + } + }, + "eslintConfig": { + "extends": "ipfs", + "parserOptions": { + "sourceType": "module" + }, + "ignorePatterns": [ + "src/unixfs.d.ts" + ] + }, + "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": { "prepare": "aegir build --no-bundle && cp -R types dist", @@ -14,34 +144,23 @@ "prepare:proto-types": "pbts -o src/unixfs.d.ts src/unixfs.js", "pretest": "aegir build --esm-tests", "test": "aegir test", + "test:node": "aegir test -t node --cov", + "test:chrome": "aegir test -t browser --cov", + "test:firefox": "aegir test -t browser -- --browser firefox", "build": "aegir build && cp -R types dist", "clean": "rimraf ./dist", "lint": "aegir ts -p check && aegir lint", "coverage": "nyc -s aegir test -t node && nyc report --reporter=html", - "depcheck": "aegir dep-check -i mkdirp -i @types/mocha -i nyc -i npm-run-all -i copy -i util" + "dep-check": "aegir dep-check -i mkdirp -i @types/mocha -i nyc -i npm-run-all -i copy -i util", + "release": "semantic-release" }, - "repository": { - "type": "git", - "url": "git+https://github.com/ipfs/js-ipfs-unixfs.git" - }, - "keywords": [ - "IPFS" - ], - "license": "MIT", - "bugs": { - "url": "https://github.com/ipfs/js-ipfs-unixfs/issues" - }, - "engines": { - "node": ">=14.0.0", - "npm": ">=6.0.0" - }, - "homepage": "https://github.com/ipfs/js-ipfs-unixfs#readme", - "publishConfig": { - "directory": "dist" + "dependencies": { + "err-code": "^3.0.1", + "protobufjs": "^6.10.2" }, "devDependencies": { "@types/mocha": "^8.2.1", - "aegir": "^35.0.1", + "aegir": "^36.2.3", "copy": "^0.3.2", "mkdirp": "^1.0.4", "npm-run-all": "^4.1.5", @@ -49,18 +168,11 @@ "uint8arrays": "^3.0.0", "util": "^0.12.3" }, - "dependencies": { - "err-code": "^3.0.1", - "protobufjs": "^6.10.2" + "browser": { + "fs": false }, - "types": "types/src/index.d.ts", - "eslintConfig": { - "extends": "ipfs", - "parserOptions": { - "sourceType": "module" - }, - "ignorePatterns": [ - "src/unixfs.d.ts" - ] + "main": "src/index.js", + "publishConfig": { + "directory": "dist" } } diff --git a/packages/ipfs-unixfs/test/unixfs-format.spec.js b/packages/ipfs-unixfs/test/unixfs-format.spec.js index 7714282f..1dbca2c1 100644 --- a/packages/ipfs-unixfs/test/unixfs-format.spec.js +++ b/packages/ipfs-unixfs/test/unixfs-format.spec.js @@ -393,7 +393,7 @@ describe('unixfs-format', () => { new UnixFS({ type: 'bananas' }) - } catch (err) { + } catch (/** @type {any} */ err) { expect(err).to.have.property('code', 'ERR_INVALID_TYPE') done() } @@ -405,7 +405,7 @@ describe('unixfs-format', () => { try { entry.marshal() - } catch (err) { + } catch (/** @type {any} */ err) { expect(err).to.have.property('code', 'ERR_INVALID_TYPE') done() }