From a3c111094305feefc1ca67ee2b68738707bb68d7 Mon Sep 17 00:00:00 2001 From: achingbrain Date: Thu, 11 Aug 2022 14:35:14 +0100 Subject: [PATCH] deps!: update aegir to 37.x.x BREAKING CHANGE: This module used to be dual published as CJS/ESM, now it is just ESM --- .github/dependabot.yml | 3 + README.md | 54 ++++++++----- lerna.json | 4 +- packages/ipfs-unixfs-exporter/.aegir.cjs | 39 ---------- packages/ipfs-unixfs-exporter/.aegir.js | 7 ++ packages/ipfs-unixfs-exporter/README.md | 78 +++++++++++-------- packages/ipfs-unixfs-exporter/package.json | 72 +++++++++-------- .../test/exporter-sharded.spec.js | 2 +- .../test/exporter-subtree.spec.js | 2 +- .../test/exporter.spec.js | 2 +- .../test/import-export-dir-sharding.spec.js | 2 +- .../test/import-export-nested-dir.spec.js | 2 +- .../test/import-export.spec.js | 4 +- .../test/importer.spec.js | 4 +- packages/ipfs-unixfs-exporter/tsconfig.json | 9 +-- packages/ipfs-unixfs-importer/.aegir.cjs | 39 ---------- packages/ipfs-unixfs-importer/.aegir.js | 7 ++ packages/ipfs-unixfs-importer/README.md | 50 ++++++++---- packages/ipfs-unixfs-importer/package.json | 71 +++++++++-------- .../test/builder-balanced.spec.js | 2 +- .../test/builder-flat.spec.js | 2 +- .../test/builder-only-hash.spec.js | 2 +- .../test/builder-trickle-dag.spec.js | 2 +- .../ipfs-unixfs-importer/test/builder.spec.js | 2 +- .../test/chunker-custom.spec.js | 2 +- .../test/chunker-fixed-size.spec.js | 2 +- .../test/chunker-rabin.spec.js | 2 +- .../test/hash-parity-with-go-ipfs.spec.js | 2 +- .../ipfs-unixfs-importer/test/utils.spec.js | 2 +- packages/ipfs-unixfs-importer/tsconfig.json | 9 +-- .../ipfs-unixfs/{.aegir.cjs => .aegir.js} | 6 +- packages/ipfs-unixfs/README.md | 50 +++++++----- packages/ipfs-unixfs/package.json | 78 ++++++++++--------- .../ipfs-unixfs/test/unixfs-format.spec.js | 4 +- packages/ipfs-unixfs/tsconfig.json | 5 +- 35 files changed, 308 insertions(+), 315 deletions(-) delete mode 100644 packages/ipfs-unixfs-exporter/.aegir.cjs create mode 100644 packages/ipfs-unixfs-exporter/.aegir.js delete mode 100644 packages/ipfs-unixfs-importer/.aegir.cjs create mode 100644 packages/ipfs-unixfs-importer/.aegir.js rename packages/ipfs-unixfs/{.aegir.cjs => .aegir.js} (58%) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 290ad028..0bc3b42d 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -6,3 +6,6 @@ updates: interval: daily time: "10:00" open-pull-requests-limit: 10 + commit-message: + prefix: "deps" + prefix-development: "deps(dev)" diff --git a/README.md b/README.md index 28feb266..99ed075a 100644 --- a/README.md +++ b/README.md @@ -1,36 +1,39 @@ -# ipfs-unixfs +# js-ipfs-unixfs -[![](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-unixfs)](https://travis-ci.com/ipfs/js-ipfs-unixfs) -[![Codecov](https://codecov.io/gh/ipfs/js-ipfs-unixfs/branch/master/graph/badge.svg)](https://codecov.io/gh/ipfs/js-ipfs-unixfs) -[![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-unixfs.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs-unixfs) +[![CI](https://img.shields.io/github/workflow/status/ipfs/js-ipfs-unixfs/test%20&%20maybe%20release/master?style=flat-square)](https://github.com/ipfs/js-ipfs-unixfs/actions/workflows/js-test-and-release.yml) -> JavaScript implementation of IPFS' UnixFS (a representation of a Unix file system on top of a MerkleDAG) +> JS implementation of the IPFS UnixFS -The UnixFS spec can be found at [ipfs/specs/UNIXFS.md](https://github.com/ipfs/specs/blob/master/UNIXFS.md) - -## 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-unixfs`](./packages/ipfs-unixfs) JavaScript implementation of IPFS' unixfs (a Unix FileSystem representation on top of a MerkleDAG) +- [`/packages/ipfs-unixfs-exporter`](./packages/ipfs-unixfs-exporter) JavaScript implementation of the UnixFs exporter used by IPFS +- [`/packages/ipfs-unixfs-importer`](./packages/ipfs-unixfs-importer) JavaScript implementation of the UnixFs importer used by IPFS -* [`/packages/ipfs-unixfs`](./packages/ipfs-unixfs) Serialization/deserialization of UnixFS objects to protocol buffers -* [`/packages/ipfs-unixfs-importer`](./packages/ipfs-unixfs-importer) Builds DAGs from files and directories -* [`/packages/ipfs-unixfs-exporter`](./packages/ipfs-unixfs-exporter) Exports DAGs +The UnixFS spec can be found at [ipfs/specs/UNIXFS.md](https://github.com/ipfs/specs/blob/master/UNIXFS.md) + +## Lead Maintainer + +[Alex Potsides](https://github.com/achingbrain) + +- [`/packages/ipfs-unixfs`](./packages/ipfs-unixfs) Serialization/deserialization of UnixFS objects to protocol buffers +- [`/packages/ipfs-unixfs-importer`](./packages/ipfs-unixfs-importer) Builds DAGs from files and directories +- [`/packages/ipfs-unixfs-exporter`](./packages/ipfs-unixfs-exporter) Exports DAGs ## Development @@ -64,4 +67,15 @@ This repository falls under the IPFS [Code of Conduct](https://github.com/ipfs/c ## License -[MIT](LICENSE) +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 aa6d0004..d7a23368 100644 --- a/lerna.json +++ b/lerna.json @@ -1,8 +1,6 @@ { "lerna": "4.0.0", - "packages": [ - "packages/*" - ], + "useWorkspaces": true, "version": "independent", "command": { "run": { diff --git a/packages/ipfs-unixfs-exporter/.aegir.cjs b/packages/ipfs-unixfs-exporter/.aegir.cjs deleted file mode 100644 index 7c48d0be..00000000 --- a/packages/ipfs-unixfs-exporter/.aegir.cjs +++ /dev/null @@ -1,39 +0,0 @@ -'use strict' - -/** @type {import('aegir').Options["build"]["config"]} */ -const buildConfig = { - plugins: [ - { - name: 'node built ins', - setup (build) { - build.onResolve({ filter: /^stream$/ }, () => { - return { path: require.resolve('readable-stream') } - }) - build.onResolve({ filter: /^crypto$/ }, () => { - return { path: require.resolve('crypto-browserify') } - }) - build.onResolve({ filter: /^cborg$/ }, () => { - return { path: require.resolve('cborg') } - }) - } - } - ] -} - -/** @type {import('aegir').PartialOptions} */ -module.exports = { - build: { - bundlesizeMax: '34KB', - config: buildConfig - }, - test: { - browser: { - config: { - buildConfig - } - } - }, - ts: { - copyTo: 'types' - } -} diff --git a/packages/ipfs-unixfs-exporter/.aegir.js b/packages/ipfs-unixfs-exporter/.aegir.js new file mode 100644 index 00000000..c3a96d38 --- /dev/null +++ b/packages/ipfs-unixfs-exporter/.aegir.js @@ -0,0 +1,7 @@ + +/** @type {import('aegir').PartialOptions} */ +export default { + build: { + bundlesizeMax: '31KB' + } +} diff --git a/packages/ipfs-unixfs-exporter/README.md b/packages/ipfs-unixfs-exporter/README.md index 5ad2df74..8c4ac08f 100644 --- a/packages/ipfs-unixfs-exporter/README.md +++ b/packages/ipfs-unixfs-exporter/README.md @@ -1,42 +1,41 @@ -# ipfs-unixfs-exporter +# ipfs-unixfs-exporter + +[![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-unixfs.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs-unixfs) +[![CI](https://img.shields.io/github/workflow/status/ipfs/js-ipfs-unixfs/test%20&%20maybe%20release/master?style=flat-square)](https://github.com/ipfs/js-ipfs-unixfs/actions/workflows/js-test-and-release.yml) + +> JavaScript implementation of the UnixFs exporter used by IPFS + +## Table of contents + +- [Install](#install) +- [Lead Maintainer](#lead-maintainer) +- [Usage](#usage) + - [Example](#example) + - [API](#api) + - [`exporter(cid, blockstore, options)`](#exportercid-blockstore-options) + - [UnixFSEntry](#unixfsentry) + - [Raw entries](#raw-entries) + - [CBOR entries](#cbor-entries) + - [`entry.content({ offset, length })`](#entrycontent-offset-length-) + - [`walkPath(cid, blockstore)`](#walkpathcid-blockstore) + - [`recursive(cid, blockstore)`](#recursivecid-blockstore) +- [Contribute](#contribute) +- [License](#license) +- [Contribute](#contribute-1) -[![](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) -[![Build Status](https://flat.badgen.net/travis/ipfs/js-ipfs-unixfs)](https://travis-ci.com/ipfs/js-ipfs-unixfs) -[![Codecov](https://codecov.io/gh/ipfs/js-ipfs-unixfs/branch/master/graph/badge.svg)](https://codecov.io/gh/ipfs/js-ipfs-unixfs) +## Install -> Exports UnixFS and other DAGs from IPFS +```console +$ npm i ipfs-unixfs-exporter +``` ## Lead Maintainer [Alex Potsides](https://github.com/achingbrain) -## Table of Contents - -- [ipfs-unixfs-exporter](#ipfs-unixfs-exporter) - - [Lead Maintainer](#lead-maintainer) - - [Table of Contents](#table-of-contents) - - [Install](#install) - - [Usage](#usage) - - [Example](#example) - - [API](#api) - - [`exporter(cid, blockstore, options)`](#exportercid-blockstore-options) - - [UnixFSEntry](#unixfsentry) - - [Raw entries](#raw-entries) - - [CBOR entries](#cbor-entries) - - [`entry.content({ offset, length })`](#entrycontent-offset-length-) - - [`walkPath(cid, blockstore)`](#walkpathcid-blockstore) - - [`recursive(cid, blockstore)`](#recursivecid-blockstore) - - [Contribute](#contribute) - - [License](#license) - -## Install - -``` -> npm install ipfs-unixfs-exporter -``` - ## Usage ### Example @@ -238,7 +237,9 @@ for await (const child of recursive('Qmfoo/foo/bar', blockstore)) { ``` [dag API]: https://github.com/ipfs/interface-ipfs-core/blob/master/SPEC/DAG.md + [blockstore]: https://github.com/ipfs/js-ipfs-interfaces/tree/master/packages/interface-blockstore#readme + [UnixFS]: https://github.com/ipfs/specs/tree/master/unixfs ## Contribute @@ -251,4 +252,15 @@ This repository falls under the IPFS [Code of Conduct](https://github.com/ipfs/c ## License -[MIT](LICENSE) +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-unixfs-exporter/package.json b/packages/ipfs-unixfs-exporter/package.json index a9787a0b..31198e57 100644 --- a/packages/ipfs-unixfs-exporter/package.json +++ b/packages/ipfs-unixfs-exporter/package.json @@ -19,15 +19,32 @@ "npm": ">=7.0.0" }, "type": "module", - "types": "types/src/index.d.ts", + "types": "./dist/src/index.d.ts", + "typesVersions": { + "*": { + "*": [ + "*", + "dist/*", + "dist/src/*", + "dist/src/*/index" + ], + "src/*": [ + "*", + "dist/*", + "dist/src/*", + "dist/src/*/index" + ] + } + }, "files": [ - "*", - "!**/*.tsbuildinfo", - "!**/browser-test", - "!**/node-test" + "src", + "dist", + "!dist/test", + "!**/*.tsbuildinfo" ], "exports": { ".": { + "types": "./dist/src/index.d.ts", "import": "./src/index.js" } }, @@ -64,15 +81,15 @@ "release": "patch" }, { - "type": "chore", + "type": "docs", "release": "patch" }, { - "type": "docs", + "type": "test", "release": "patch" }, { - "type": "test", + "type": "deps", "release": "patch" }, { @@ -102,7 +119,11 @@ }, { "type": "docs", - "section": "Trivial Changes" + "section": "Documentation" + }, + { + "type": "deps", + "section": "Dependencies" }, { "type": "test", @@ -113,29 +134,21 @@ } ], "@semantic-release/changelog", - [ - "@semantic-release/npm", - { - "pkgRoot": "dist" - } - ], + "@semantic-release/npm", "@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 ./types", - "lint": "aegir ts -p check && aegir lint", - "dep-check": "aegir dep-check -i @types/sinon -i nyc -i rimraf -i copy -i util -i crypto-browserify -i events -i readable-stream -i interface-blockstore", - "release": "semantic-release" + "build": "aegir build", + "clean": "aegir clean", + "lint": "aegir lint", + "dep-check": "aegir dep-check -i interface-blockstore", + "release": "aegir release" }, "dependencies": { "@ipld/dag-cbor": "^7.0.2", @@ -152,27 +165,18 @@ "devDependencies": { "@types/sinon": "^10.0.0", "abort-controller": "^3.0.0", - "aegir": "^36.2.3", + "aegir": "^37.5.0", "blockstore-core": "^1.0.5", - "copy": "^0.3.2", "crypto-browserify": "^3.12.0", - "events": "^3.3.0", "ipfs-unixfs-importer": "^9.0.0", "it-all": "^1.0.5", "it-buffer-stream": "^2.0.0", "it-first": "^1.0.6", "merge-options": "^3.0.4", "native-abort-controller": "^1.0.3", - "readable-stream": "^3.6.0", - "rimraf": "^3.0.2", - "sinon": "^14.0.0", - "util": "^0.12.3" + "sinon": "^14.0.0" }, "browser": { "fs": false - }, - "main": "src/index.js", - "publishConfig": { - "directory": "dist" } } diff --git a/packages/ipfs-unixfs-exporter/test/exporter-sharded.spec.js b/packages/ipfs-unixfs-exporter/test/exporter-sharded.spec.js index b4e6bfd9..6b2738dd 100644 --- a/packages/ipfs-unixfs-exporter/test/exporter-sharded.spec.js +++ b/packages/ipfs-unixfs-exporter/test/exporter-sharded.spec.js @@ -1,5 +1,5 @@ /* eslint-env mocha */ -import { expect } from 'aegir/utils/chai.js' +import { expect } from 'aegir/chai' import { UnixFS } from 'ipfs-unixfs' import all from 'it-all' import last from 'it-last' diff --git a/packages/ipfs-unixfs-exporter/test/exporter-subtree.spec.js b/packages/ipfs-unixfs-exporter/test/exporter-subtree.spec.js index 55119885..86ffc82d 100644 --- a/packages/ipfs-unixfs-exporter/test/exporter-subtree.spec.js +++ b/packages/ipfs-unixfs-exporter/test/exporter-subtree.spec.js @@ -1,5 +1,5 @@ /* eslint-env mocha */ -import { expect } from 'aegir/utils/chai.js' +import { expect } from 'aegir/chai' import { importer } from 'ipfs-unixfs-importer' import all from 'it-all' import last from 'it-last' diff --git a/packages/ipfs-unixfs-exporter/test/exporter.spec.js b/packages/ipfs-unixfs-exporter/test/exporter.spec.js index 9c1de742..c61b010c 100644 --- a/packages/ipfs-unixfs-exporter/test/exporter.spec.js +++ b/packages/ipfs-unixfs-exporter/test/exporter.spec.js @@ -1,6 +1,6 @@ /* eslint-env mocha */ -import { expect } from 'aegir/utils/chai.js' +import { expect } from 'aegir/chai' import { UnixFS } from 'ipfs-unixfs' import { CID } from 'multiformats/cid' import * as dagPb from '@ipld/dag-pb' diff --git a/packages/ipfs-unixfs-exporter/test/import-export-dir-sharding.spec.js b/packages/ipfs-unixfs-exporter/test/import-export-dir-sharding.spec.js index cb7c309b..c0b5e9c8 100644 --- a/packages/ipfs-unixfs-exporter/test/import-export-dir-sharding.spec.js +++ b/packages/ipfs-unixfs-exporter/test/import-export-dir-sharding.spec.js @@ -2,7 +2,7 @@ import { importer } from 'ipfs-unixfs-importer' import { exporter } from '../src/index.js' -import { expect } from 'aegir/utils/chai.js' +import { expect } from 'aegir/chai' import all from 'it-all' import last from 'it-last' import blockApi from './helpers/block.js' diff --git a/packages/ipfs-unixfs-exporter/test/import-export-nested-dir.spec.js b/packages/ipfs-unixfs-exporter/test/import-export-nested-dir.spec.js index 746e4971..f465a3d2 100644 --- a/packages/ipfs-unixfs-exporter/test/import-export-nested-dir.spec.js +++ b/packages/ipfs-unixfs-exporter/test/import-export-nested-dir.spec.js @@ -1,5 +1,5 @@ /* eslint-env mocha */ -import { expect } from 'aegir/utils/chai.js' +import { expect } from 'aegir/chai' import all from 'it-all' import { importer } from 'ipfs-unixfs-importer' import { exporter } from '../src/index.js' diff --git a/packages/ipfs-unixfs-exporter/test/import-export.spec.js b/packages/ipfs-unixfs-exporter/test/import-export.spec.js index 12644ef8..7e03ce18 100644 --- a/packages/ipfs-unixfs-exporter/test/import-export.spec.js +++ b/packages/ipfs-unixfs-exporter/test/import-export.spec.js @@ -1,7 +1,7 @@ /* eslint-env mocha */ /* eslint max-nested-callbacks: ["error", 5] */ -import { expect } from 'aegir/utils/chai.js' -import loadFixture from 'aegir/utils/fixtures.js' +import { expect } from 'aegir/chai' +import loadFixture from 'aegir/fixtures' import blockApi from './helpers/block.js' import asAsyncIterable from './helpers/as-async-iterable.js' diff --git a/packages/ipfs-unixfs-exporter/test/importer.spec.js b/packages/ipfs-unixfs-exporter/test/importer.spec.js index 192557fd..d97cc068 100644 --- a/packages/ipfs-unixfs-exporter/test/importer.spec.js +++ b/packages/ipfs-unixfs-exporter/test/importer.spec.js @@ -3,11 +3,11 @@ import { importer } from 'ipfs-unixfs-importer' import { exporter, recursive } from '../src/index.js' import extend from 'merge-options' -import { expect } from 'aegir/utils/chai.js' +import { expect } from 'aegir/chai' import sinon from 'sinon' import { UnixFS, parseMtime } from 'ipfs-unixfs' import collectLeafCids from './helpers/collect-leaf-cids.js' -import loadFixture from 'aegir/utils/fixtures.js' +import loadFixture from 'aegir/fixtures' import all from 'it-all' import first from 'it-first' import blockApi from './helpers/block.js' diff --git a/packages/ipfs-unixfs-exporter/tsconfig.json b/packages/ipfs-unixfs-exporter/tsconfig.json index c490e3c1..7665b90f 100644 --- a/packages/ipfs-unixfs-exporter/tsconfig.json +++ b/packages/ipfs-unixfs-exporter/tsconfig.json @@ -1,18 +1,13 @@ { "extends": "aegir/src/config/tsconfig.aegir.json", "compilerOptions": { - "outDir": "types", - "module": "es2020", - "importsNotUsedAsValues": "preserve" + "outDir": "dist", + "emitDeclarationOnly": true }, "include": [ "src", "test" ], - "exclude": [ - "dist", - "node_modules" - ], "references": [ { "path": "../ipfs-unixfs" diff --git a/packages/ipfs-unixfs-importer/.aegir.cjs b/packages/ipfs-unixfs-importer/.aegir.cjs deleted file mode 100644 index 6abe4ea8..00000000 --- a/packages/ipfs-unixfs-importer/.aegir.cjs +++ /dev/null @@ -1,39 +0,0 @@ -'use strict' - -/** @type {import('aegir').Options["build"]["config"]} */ -const buildConfig = { - plugins: [ - { - name: 'node built ins', - setup (build) { - build.onResolve({ filter: /^stream$/ }, () => { - return { path: require.resolve('readable-stream') } - }) - build.onResolve({ filter: /^crypto$/ }, () => { - return { path: require.resolve('crypto-browserify') } - }) - build.onResolve({ filter: /^cborg$/ }, () => { - return { path: require.resolve('cborg') } - }) - } - } - ] -} - -/** @type {import('aegir').PartialOptions} */ -module.exports = { - build: { - bundlesizeMax: '44KB', - config: buildConfig - }, - test: { - browser: { - config: { - buildConfig - } - } - }, - ts: { - copyTo: 'types' - } -} diff --git a/packages/ipfs-unixfs-importer/.aegir.js b/packages/ipfs-unixfs-importer/.aegir.js new file mode 100644 index 00000000..35115765 --- /dev/null +++ b/packages/ipfs-unixfs-importer/.aegir.js @@ -0,0 +1,7 @@ + +/** @type {import('aegir').PartialOptions} */ +export default { + build: { + bundlesizeMax: '43KB' + } +} diff --git a/packages/ipfs-unixfs-importer/README.md b/packages/ipfs-unixfs-importer/README.md index 0697cf25..0f2f4592 100644 --- a/packages/ipfs-unixfs-importer/README.md +++ b/packages/ipfs-unixfs-importer/README.md @@ -1,34 +1,36 @@ # ipfs-unixfs-importer -[![](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) -[![Build Status](https://flat.badgen.net/travis/ipfs/js-ipfs-unixfs)](https://travis-ci.com/ipfs/js-ipfs-unixfs) -[![Codecov](https://codecov.io/gh/ipfs/js-ipfs-unixfs/branch/master/graph/badge.svg)](https://codecov.io/gh/ipfs/js-ipfs-unixfs) +[![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-unixfs.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs-unixfs) +[![CI](https://img.shields.io/github/workflow/status/ipfs/js-ipfs-unixfs/test%20&%20maybe%20release/master?style=flat-square)](https://github.com/ipfs/js-ipfs-unixfs/actions/workflows/js-test-and-release.yml) -> JavaScript implementation of the layout and chunking mechanisms used by IPFS to handle Files +> JavaScript implementation of the UnixFs importer used by IPFS -## Lead Maintainer - -[Alex Potsides](https://github.com/achingbrain) - -## Table of Contents +## Table of contents - [Install](#install) +- [Lead Maintainer ](#lead-maintainer----omit-in-toc---) - [Usage](#usage) - [Example](#example) - [API](#api) - - [const stream = importer(source, blockstore [, options])](#const-stream--importersource-blockstore--options) + - [const stream = importer(source, blockstore \[, options\])](#const-stream--importersource-blockstore--options) - [Overriding internals](#overriding-internals) - [Contribute](#contribute) - [License](#license) +- [Contribute](#contribute-1) ## Install -``` -> npm install ipfs-unixfs-importer +```console +$ npm i ipfs-unixfs-importer ``` +## Lead Maintainer + +[Alex Potsides](https://github.com/achingbrain) + ## Usage ### Example @@ -96,7 +98,7 @@ When run, metadata about DAGNodes in the created tree is printed until the root: import { importer } from 'ipfs-unixfs-importer' ``` -#### const stream = importer(source, blockstore [, options]) +#### const stream = importer(source, blockstore \[, options]) The `importer` function returns an async iterator takes a source async iterator that yields objects of the form: @@ -137,7 +139,7 @@ The input's file paths and directory structure will be preserved in the [`dag-pb - `progress` (function): a function that will be called with the byte length of chunks as a file is added to ipfs. - `onlyHash` (boolean, defaults to false): Only chunk and hash - do not write to disk - `hashAlg` (string): multihash hashing algorithm to use -- `cidVersion` (integer, default 0): the CID version to use when storing the data (storage keys are based on the CID, _including_ it's version) +- `cidVersion` (integer, default 0): the CID version to use when storing the data (storage keys are based on the CID, *including* it's version) - `rawLeaves` (boolean, defaults to false): When a file would span multiple DAGNodes, if this is true the leaf nodes will not be wrapped in `UnixFS` protobufs and will instead contain the raw file bytes - `leafType` (string, defaults to `'file'`) what type of UnixFS node leaves should be - can be `'file'` or `'raw'` (ignored when `rawLeaves` is `true`) - `blockWriteConcurrency` (positive integer, defaults to 10) How many blocks to hash and write to the block store concurrently. For small numbers of large files this should be high (e.g. 50). @@ -166,8 +168,11 @@ Several aspects of the importer are overridable by specifying functions as part - It should yield an object with the properties `{ cid, path, unixfs, size }` where `cid` is a `CID`, `path` is a string, `unixfs` is a UnixFS entry and `size` is a `Number`. [blockstore]: https://github.com/ipfs/js-ipfs-interfaces/tree/master/packages/interface-blockstore#readme + [UnixFS]: https://github.com/ipfs/specs/tree/master/unixfs + [IPLD]: https://github.com/ipld/js-ipld + [CID]: https://github.com/multiformats/js-cid ## Contribute @@ -180,4 +185,15 @@ This repository falls under the IPFS [Code of Conduct](https://github.com/ipfs/c ## License -[MIT](LICENSE) +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-unixfs-importer/package.json b/packages/ipfs-unixfs-importer/package.json index 44e359c5..6388cbe0 100644 --- a/packages/ipfs-unixfs-importer/package.json +++ b/packages/ipfs-unixfs-importer/package.json @@ -19,15 +19,32 @@ "npm": ">=7.0.0" }, "type": "module", - "types": "types/src/index.d.ts", + "types": "./dist/src/index.d.ts", + "typesVersions": { + "*": { + "*": [ + "*", + "dist/*", + "dist/src/*", + "dist/src/*/index" + ], + "src/*": [ + "*", + "dist/*", + "dist/src/*", + "dist/src/*/index" + ] + } + }, "files": [ - "*", - "!**/*.tsbuildinfo", - "!**/browser-test", - "!**/node-test" + "src", + "dist", + "!dist/test", + "!**/*.tsbuildinfo" ], "exports": { ".": { + "types": "./dist/src/index.d.ts", "import": "./src/index.js" } }, @@ -64,15 +81,15 @@ "release": "patch" }, { - "type": "chore", + "type": "docs", "release": "patch" }, { - "type": "docs", + "type": "test", "release": "patch" }, { - "type": "test", + "type": "deps", "release": "patch" }, { @@ -102,7 +119,11 @@ }, { "type": "docs", - "section": "Trivial Changes" + "section": "Documentation" + }, + { + "type": "deps", + "section": "Dependencies" }, { "type": "test", @@ -113,29 +134,21 @@ } ], "@semantic-release/changelog", - [ - "@semantic-release/npm", - { - "pkgRoot": "dist" - } - ], + "@semantic-release/npm", "@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 ./types", - "lint": "aegir ts -p check && aegir lint", - "dep-check": "aegir dep-check -i rimraf -i copy -i util -i crypto-browserify -i events -i readable-stream -i assert -i interface-blockstore", - "release": "semantic-release" + "build": "aegir build", + "clean": "aegir clean", + "lint": "aegir lint", + "dep-check": "aegir dep-check -i interface-blockstore", + "release": "aegir release" }, "dependencies": { "@ipld/dag-pb": "^2.0.2", @@ -155,23 +168,13 @@ "uint8arrays": "^3.0.0" }, "devDependencies": { - "aegir": "^36.2.3", + "aegir": "^37.5.0", "assert": "^2.0.0", "blockstore-core": "^1.0.5", - "copy": "^0.3.2", - "crypto-browserify": "^3.12.0", - "events": "^3.3.0", "it-buffer-stream": "^2.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-balanced.spec.js b/packages/ipfs-unixfs-importer/test/builder-balanced.spec.js index 8403ea30..dc9d5ba6 100644 --- a/packages/ipfs-unixfs-importer/test/builder-balanced.spec.js +++ b/packages/ipfs-unixfs-importer/test/builder-balanced.spec.js @@ -1,5 +1,5 @@ /* eslint-env mocha */ -import { expect } from 'aegir/utils/chai.js' +import { expect } from 'aegir/chai' import builder from '../src/dag-builder/file/balanced.js' import { CID } from 'multiformats/cid' import defaultOptions from '../src/options.js' diff --git a/packages/ipfs-unixfs-importer/test/builder-flat.spec.js b/packages/ipfs-unixfs-importer/test/builder-flat.spec.js index 032ada55..0a95bc48 100644 --- a/packages/ipfs-unixfs-importer/test/builder-flat.spec.js +++ b/packages/ipfs-unixfs-importer/test/builder-flat.spec.js @@ -1,6 +1,6 @@ /* eslint-env mocha */ -import { expect } from 'aegir/utils/chai.js' +import { expect } from 'aegir/chai' import builder from '../src/dag-builder/file/flat.js' /** 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 b5dd9167..f10a78b6 100644 --- a/packages/ipfs-unixfs-importer/test/builder-only-hash.spec.js +++ b/packages/ipfs-unixfs-importer/test/builder-only-hash.spec.js @@ -1,6 +1,6 @@ /* eslint-env mocha */ -import { expect } from 'aegir/utils/chai.js' +import { expect } from 'aegir/chai' import builder from '../src/dag-builder/index.js' import all from 'it-all' import blockApi from './helpers/block.js' diff --git a/packages/ipfs-unixfs-importer/test/builder-trickle-dag.spec.js b/packages/ipfs-unixfs-importer/test/builder-trickle-dag.spec.js index f0adf6d4..1b68db12 100644 --- a/packages/ipfs-unixfs-importer/test/builder-trickle-dag.spec.js +++ b/packages/ipfs-unixfs-importer/test/builder-trickle-dag.spec.js @@ -1,6 +1,6 @@ /* eslint-env mocha */ -import { expect } from 'aegir/utils/chai.js' +import { expect } from 'aegir/chai' import builder from '../src/dag-builder/file/trickle.js' import asAsyncIterable from './helpers/as-async-iterable.js' diff --git a/packages/ipfs-unixfs-importer/test/builder.spec.js b/packages/ipfs-unixfs-importer/test/builder.spec.js index f2ea3370..f39fb794 100644 --- a/packages/ipfs-unixfs-importer/test/builder.spec.js +++ b/packages/ipfs-unixfs-importer/test/builder.spec.js @@ -1,5 +1,5 @@ /* eslint-env mocha */ -import { expect } from 'aegir/utils/chai.js' +import { expect } from 'aegir/chai' import * as mh from 'multiformats/hashes/digest' import { sha256, sha512 } from 'multiformats/hashes/sha2' import { decode } from '@ipld/dag-pb' diff --git a/packages/ipfs-unixfs-importer/test/chunker-custom.spec.js b/packages/ipfs-unixfs-importer/test/chunker-custom.spec.js index 55d6d833..96666dfd 100644 --- a/packages/ipfs-unixfs-importer/test/chunker-custom.spec.js +++ b/packages/ipfs-unixfs-importer/test/chunker-custom.spec.js @@ -1,6 +1,6 @@ /* eslint-env mocha */ import { importer } from '../src/index.js' -import { expect } from 'aegir/utils/chai.js' +import { expect } from 'aegir/chai' import * as rawCodec from 'multiformats/codecs/raw' import { sha256 } from 'multiformats/hashes/sha2' diff --git a/packages/ipfs-unixfs-importer/test/chunker-fixed-size.spec.js b/packages/ipfs-unixfs-importer/test/chunker-fixed-size.spec.js index ab446a3e..cab1bc0c 100644 --- a/packages/ipfs-unixfs-importer/test/chunker-fixed-size.spec.js +++ b/packages/ipfs-unixfs-importer/test/chunker-fixed-size.spec.js @@ -1,6 +1,6 @@ /* eslint-env mocha */ import chunker from '../src/chunker/fixed-size.js' -import { expect } from 'aegir/utils/chai.js' +import { expect } from 'aegir/chai' import all from 'it-all' import { fromString as uint8ArrayFromString } from 'uint8arrays/from-string' import { concat as uint8ArrayConcat } from 'uint8arrays/concat' diff --git a/packages/ipfs-unixfs-importer/test/chunker-rabin.spec.js b/packages/ipfs-unixfs-importer/test/chunker-rabin.spec.js index e10e85f0..d6f779f5 100644 --- a/packages/ipfs-unixfs-importer/test/chunker-rabin.spec.js +++ b/packages/ipfs-unixfs-importer/test/chunker-rabin.spec.js @@ -1,7 +1,7 @@ /* eslint-env mocha */ import chunker from '../src/chunker/rabin.js' -import { expect } from 'aegir/utils/chai.js' +import { expect } from 'aegir/chai' import all from 'it-all' import { fromString as uint8ArrayFromString } from 'uint8arrays/from-string' import { concat as uint8ArrayConcat } from 'uint8arrays/concat' diff --git a/packages/ipfs-unixfs-importer/test/hash-parity-with-go-ipfs.spec.js b/packages/ipfs-unixfs-importer/test/hash-parity-with-go-ipfs.spec.js index 3cc2c5f7..e8eb1ec2 100644 --- a/packages/ipfs-unixfs-importer/test/hash-parity-with-go-ipfs.spec.js +++ b/packages/ipfs-unixfs-importer/test/hash-parity-with-go-ipfs.spec.js @@ -1,7 +1,7 @@ /* eslint-env mocha */ import { importer } from '../src/index.js' -import { expect } from 'aegir/utils/chai.js' +import { expect } from 'aegir/chai' import randomByteStream from './helpers/finite-pseudorandom-byte-stream.js' import first from 'it-first' import blockApi from './helpers/block.js' diff --git a/packages/ipfs-unixfs-importer/test/utils.spec.js b/packages/ipfs-unixfs-importer/test/utils.spec.js index 3943bae6..58a9b9d3 100644 --- a/packages/ipfs-unixfs-importer/test/utils.spec.js +++ b/packages/ipfs-unixfs-importer/test/utils.spec.js @@ -1,6 +1,6 @@ /* eslint-env mocha */ -import { expect } from 'aegir/utils/chai.js' +import { expect } from 'aegir/chai' import toPathComponents from '../src/utils/to-path-components.js' describe('toPathComponents', () => { diff --git a/packages/ipfs-unixfs-importer/tsconfig.json b/packages/ipfs-unixfs-importer/tsconfig.json index c69a39ac..6655a440 100644 --- a/packages/ipfs-unixfs-importer/tsconfig.json +++ b/packages/ipfs-unixfs-importer/tsconfig.json @@ -1,18 +1,13 @@ { "extends": "aegir/src/config/tsconfig.aegir.json", "compilerOptions": { - "outDir": "types", - "module": "es2020", - "importsNotUsedAsValues": "preserve" + "outDir": "dist", + "emitDeclarationOnly": true }, "include": [ "src", "test" ], - "exclude": [ - "dist", - "node_modules" - ], "references": [ { "path": "../ipfs-unixfs" diff --git a/packages/ipfs-unixfs/.aegir.cjs b/packages/ipfs-unixfs/.aegir.js similarity index 58% rename from packages/ipfs-unixfs/.aegir.cjs rename to packages/ipfs-unixfs/.aegir.js index 6622ba0a..e2cfcdb4 100644 --- a/packages/ipfs-unixfs/.aegir.cjs +++ b/packages/ipfs-unixfs/.aegir.js @@ -1,11 +1,7 @@ -'use strict' /** @type {import('aegir').PartialOptions} */ -module.exports = { +export default { build: { bundlesizeMax: '11KB' - }, - ts: { - copyTo: 'types' } } diff --git a/packages/ipfs-unixfs/README.md b/packages/ipfs-unixfs/README.md index 2b2b759f..5dd27577 100644 --- a/packages/ipfs-unixfs/README.md +++ b/packages/ipfs-unixfs/README.md @@ -1,23 +1,17 @@ -# ipfs-unixfs JavaScript Implementation +# ipfs-unixfs -[![](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) -[![Build Status](https://flat.badgen.net/travis/ipfs/js-ipfs-unixfs)](https://travis-ci.com/ipfs/js-ipfs-unixfs) -[![Codecov](https://codecov.io/gh/ipfs/js-ipfs-unixfs/branch/master/graph/badge.svg)](https://codecov.io/gh/ipfs/js-ipfs-unixfs) +[![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-unixfs.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs-unixfs) +[![CI](https://img.shields.io/github/workflow/status/ipfs/js-ipfs-unixfs/test%20&%20maybe%20release/master?style=flat-square)](https://github.com/ipfs/js-ipfs-unixfs/actions/workflows/js-test-and-release.yml) -> JavaScript implementation of IPFS' UnixFS (a Unix FileSystem files representation on top of a MerkleDAG) +> JavaScript implementation of IPFS' unixfs (a Unix FileSystem representation on top of a MerkleDAG) -The UnixFS spec can be found inside the [ipfs/specs repository](http://github.com/ipfs/specs) - -## Lead Maintainer - -[Alex Potsides](https://github.com/achingbrain) - -## Table of Contents +## Table of contents - [Install](#install) - - [npm](#npm) +- [Lead Maintainer ](#lead-maintainer----omit-in-toc---) - [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) - [Use in a browser Using a script tag](#use-in-a-browser-using-a-script-tag) @@ -26,7 +20,7 @@ The UnixFS spec can be found inside the [ipfs/specs repository](http://github.co - [Create a file composed by several blocks](#create-a-file-composed-by-several-blocks) - [Create a directory that contains several files](#create-a-directory-that-contains-several-files) - [API](#api) - - [UnixFS Data Structure](#unixfs-data-structure) + - - [UnixFS Data Structure](#unixfs-data-structure) - [create an unixfs Data element](#create-an-unixfs-data-element) - [add and remove a block size to the block size list](#add-and-remove-a-block-size-to-the-block-size-list) - [get total fileSize](#get-total-filesize) @@ -35,10 +29,19 @@ The UnixFS spec can be found inside the [ipfs/specs repository](http://github.co - [has an mtime been set?](#has-an-mtime-been-set) - [Contribute](#contribute) - [License](#license) +- [Contribute](#contribute-1) ## Install -### npm +```console +$ npm i ipfs-unixfs +``` + +The UnixFS spec can be found inside the [ipfs/specs repository](http://github.com/ipfs/specs) + +## Lead Maintainer + +[Alex Potsides](https://github.com/achingbrain) ```sh > npm i ipfs-unixfs @@ -203,4 +206,15 @@ This repository falls under the IPFS [Code of Conduct](https://github.com/ipfs/c ## License -[MIT](LICENSE) +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-unixfs/package.json b/packages/ipfs-unixfs/package.json index 1fa42d8d..54d69430 100644 --- a/packages/ipfs-unixfs/package.json +++ b/packages/ipfs-unixfs/package.json @@ -19,15 +19,32 @@ "npm": ">=7.0.0" }, "type": "module", - "types": "types/src/index.d.ts", + "types": "./dist/src/index.d.ts", + "typesVersions": { + "*": { + "*": [ + "*", + "dist/*", + "dist/src/*", + "dist/src/*/index" + ], + "src/*": [ + "*", + "dist/*", + "dist/src/*", + "dist/src/*/index" + ] + } + }, "files": [ - "*", - "!**/*.tsbuildinfo", - "!**/browser-test", - "!**/node-test" + "src", + "dist", + "!dist/test", + "!**/*.tsbuildinfo" ], "exports": { ".": { + "types": "./dist/src/index.d.ts", "import": "./src/index.js" } }, @@ -67,15 +84,15 @@ "release": "patch" }, { - "type": "chore", + "type": "docs", "release": "patch" }, { - "type": "docs", + "type": "test", "release": "patch" }, { - "type": "test", + "type": "deps", "release": "patch" }, { @@ -105,7 +122,11 @@ }, { "type": "docs", - "section": "Trivial Changes" + "section": "Documentation" + }, + { + "type": "deps", + "section": "Dependencies" }, { "type": "test", @@ -116,48 +137,35 @@ } ], "@semantic-release/changelog", - [ - "@semantic-release/npm", - { - "pkgRoot": "dist" - } - ], + "@semantic-release/npm", "@semantic-release/github", "@semantic-release/git" ] }, "scripts": { - "prepare": "aegir build --no-bundle && cp -R types dist", - "prepare:proto": "pbjs -t static-module -w es6 -r ipfs-unixfs --force-number --no-verify --no-delimited --no-create --no-beautify --no-defaults --lint eslint-disable -o src/unixfs.js ./src/unixfs.proto", - "prepare:proto-types": "pbts -o src/unixfs.d.ts src/unixfs.js", - "pretest": "aegir build --esm-tests", + "generate": "npm run generate:proto && generate:proto-types", + "generate:proto": "pbjs -t static-module -w es6 -r ipfs-unixfs --force-number --no-verify --no-delimited --no-create --no-beautify --no-defaults --lint eslint-disable -o src/unixfs.js ./src/unixfs.proto", + "generate:proto-types": "pbts -o src/unixfs.d.ts src/unixfs.js", "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 ./types", - "lint": "aegir ts -p check && aegir lint", - "dep-check": "aegir dep-check -i mkdirp -i npm-run-all -i copy -i util", - "release": "semantic-release" + "build": "aegir build", + "clean": "aegir clean", + "lint": "aegir lint", + "dep-check": "aegir dep-check", + "release": "aegir release" }, "dependencies": { "err-code": "^3.0.1", - "protobufjs": "^6.10.2" + "protobufjs": "^7.0.0" }, "devDependencies": { - "aegir": "^36.2.3", - "copy": "^0.3.2", - "mkdirp": "^1.0.4", - "npm-run-all": "^4.1.5", - "uint8arrays": "^3.0.0", - "util": "^0.12.3" + "aegir": "^37.5.0", + "protobufjs-cli": "^1.0.0", + "uint8arrays": "^3.0.0" }, "browser": { "fs": false - }, - "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 1dbca2c1..19e2c06b 100644 --- a/packages/ipfs-unixfs/test/unixfs-format.spec.js +++ b/packages/ipfs-unixfs/test/unixfs-format.spec.js @@ -1,9 +1,9 @@ /* eslint-env mocha */ -import { expect } from 'aegir/utils/chai.js' +import { expect } from 'aegir/chai' /** @type {(path: string) => Uint8Array} */ -import loadFixture from 'aegir/utils/fixtures.js' +import loadFixture from 'aegir/fixtures' import { fromString as uint8ArrayFromString } from 'uint8arrays/from-string' import { UnixFS } from '../src/index.js' diff --git a/packages/ipfs-unixfs/tsconfig.json b/packages/ipfs-unixfs/tsconfig.json index 7c8a6394..e429c4a3 100644 --- a/packages/ipfs-unixfs/tsconfig.json +++ b/packages/ipfs-unixfs/tsconfig.json @@ -1,15 +1,14 @@ { "extends": "aegir/src/config/tsconfig.aegir.json", "compilerOptions": { - "outDir": "types" + "outDir": "dist", + "emitDeclarationOnly": true }, "include": [ "src", "test" ], "exclude": [ - "dist", - "node_modules", "src/unixfs.js" ] }