Skip to content

Commit

Permalink
chore: tidy up project config
Browse files Browse the repository at this point in the history
  • Loading branch information
achingbrain committed Oct 30, 2023
1 parent 2e5e997 commit 721654b
Show file tree
Hide file tree
Showing 8 changed files with 89 additions and 88 deletions.
12 changes: 12 additions & 0 deletions .github/workflows/semantic-pull-request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: Semantic PR

on:
pull_request_target:
types:
- opened
- edited
- synchronize

jobs:
main:
uses: pl-strflt/.github/.github/workflows/[email protected]
13 changes: 13 additions & 0 deletions .github/workflows/stale.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: Close and mark stale issue

on:
schedule:
- cron: '0 0 * * *'

permissions:
issues: write
pull-requests: write

jobs:
stale:
uses: pl-strflt/.github/.github/workflows/[email protected]
29 changes: 0 additions & 29 deletions .github/workflows/typecheck.yml

This file was deleted.

13 changes: 6 additions & 7 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
.coverage
package-lock.json
node_modules
.DS_Store
yarn.lock
types
types/tsconfig.tsbuildinfo
*.log
build
dist
.docs
.coverage
node_modules
package-lock.json
yarn.lock
.vscode
51 changes: 15 additions & 36 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,45 +1,24 @@
# multiformats <!-- omit in toc -->

[![multiformats.io](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://multiformats.io)
[![codecov](https://img.shields.io/codecov/c/github/multiformats/js-multiformats.svg?style=flat-square)](https://codecov.io/gh/multiformats/js-multiformats)
[![CI](https://img.shields.io/github/actions/workflow/status/multiformats/js-multiformats/js-test-and-release.yml?branch=master\&style=flat-square)](https://github.com/multiformats/js-multiformats/actions/workflows/js-test-and-release.yml?query=branch%3Amaster)

> Interface for multihash, multicodec, multibase and CID
## Table of contents <!-- omit in toc -->

- [Install](#install)
- [Browser `<script>` tag](#browser-script-tag)
- [Interfaces](#interfaces)
- [Creating Blocks](#creating-blocks)
- [Multibase Encoders / Decoders / Codecs](#multibase-encoders--decoders--codecs)
- [Multicodec Encoders / Decoders / Codecs](#multicodec-encoders--decoders--codecs)
- [Multihash Hashers](#multihash-hashers)
- [Traversal](#traversal)
- [Legacy interface](#legacy-interface)
- [Implementations](#implementations)
- [Multibase codecs](#multibase-codecs)
- [Multihash hashers](#multihash-hashers-1)
- [IPLD codecs (multicodec)](#ipld-codecs-multicodec)
- [API Docs](#api-docs)
- [License](#license)
- [Contribution](#contribution)

## Install
# Install

```console
$ npm i multiformats
```

### Browser `<script>` tag
# Browser `<script>` tag

Loading this module through a script tag will make it's exports available as `Multiformats` in the global namespace.

```html
<script src="https://unpkg.com/multiformats/dist/index.min.js"></script>
```

## Interfaces
# Interfaces

This library defines common interfaces and low level building blocks for various interrelated multiformat technologies (multicodec, multihash, multibase, and CID). They can be used to implement custom base encoders / decoders / codecs, codec encoders /decoders and multihash hashers that comply to the interface that layers above assume.

Expand Down Expand Up @@ -80,7 +59,7 @@ block = await Block.decode({ bytes: block.bytes, codec, hasher })
block = await Block.create({ bytes: block.bytes, cid: block.cid, codec, hasher })
```

### Multibase Encoders / Decoders / Codecs
## Multibase Encoders / Decoders / Codecs

CIDs can be serialized to string representation using multibase encoders that implement [`MultibaseEncoder`](https://github.com/multiformats/js-multiformats/blob/master/src/bases/interface.ts) interface. This library provides quite a few implementations that can be imported:

Expand Down Expand Up @@ -123,7 +102,7 @@ v0.toV1().toString()
//> 'bafybeihdwdcefgh4dqkjv67uzcmw7ojee6xedzdetojuzjevtenxquvyku'
```

### Multicodec Encoders / Decoders / Codecs
## Multicodec Encoders / Decoders / Codecs

This library defines [`BlockEncoder`, `BlockDecoder` and `BlockCodec` interfaces](https://github.com/multiformats/js-multiformats/blob/master/src/codecs/interface.ts).
Codec implementations should conform to the `BlockCodec` interface which implements both `BlockEncoder` and `BlockDecoder`.
Expand All @@ -142,7 +121,7 @@ export const { name, code, encode, decode } = {
}
```

### Multihash Hashers
## Multihash Hashers

This library defines [`MultihashHasher` and `MultihashDigest` interfaces](https://github.com/multiformats/js-multiformats/blob/master/src/hashes/interface.ts) and convinient function for implementing them:

Expand All @@ -164,7 +143,7 @@ CID.create(1, json.code, hash)
//> CID(bagaaierasords4njcts6vs7qvdjfcvgnume4hqohf65zsfguprqphs3icwea)
```

### Traversal
## Traversal

This library contains higher-order functions for traversing graphs of data easily.

Expand Down Expand Up @@ -200,18 +179,18 @@ console.log(blocks)
//> [CID(bagaaierasords4njcts6vs7qvdjfcvgnume4hqohf65zsfguprqphs3icwea)]
```

## Legacy interface
# Legacy interface

[`blockcodec-to-ipld-format`](https://github.com/ipld/js-blockcodec-to-ipld-format) converts a multiformats [`BlockCodec`](https://github.com/multiformats/js-multiformats/blob/master/src/codecs/interface.ts#L21) into an
[`interface-ipld-format`](https://github.com/ipld/interface-ipld-format) for use with the [`ipld`](https://github.com/ipld/ipld) package. This can help bridge IPLD codecs implemented using the structure and interfaces defined here to existing code that assumes, or requires `interface-ipld-format`. This bridge also includes the relevant TypeScript definitions.

## Implementations
# Implementations

By default, no base encodings (other than base32 & base58btc), hash functions,
or codec implementations are exposed by `multiformats`, you need to
import the ones you need yourself.

### Multibase codecs
## Multibase codecs

| bases | import | repo |
| ------------------------------------------------------------- | --------------------------- | ------------------------------------------------------------------------------------------------- |
Expand All @@ -222,7 +201,7 @@ import the ones you need yourself.

Other (less useful) bases implemented in [multiformats/js-multiformats](https://github.com/multiformats/js-multiformats/tree/master/bases) include: `base2`, `base8`, `base10`, `base36` and `base256emoji`.

### Multihash hashers
## Multihash hashers

| hashes | import | repo |
| ------------------------------------------------------------------------------------------------------------------------------- | ------------------------------ | ------------------------------------------------------------------------------------------------------------------ |
Expand All @@ -232,7 +211,7 @@ Other (less useful) bases implemented in [multiformats/js-multiformats](https://
| `murmur3-128`, `murmur3-32` | `@multiformats/murmur3` | [multiformats/js-murmur3](https://github.com/multiformats/js-murmur3) |
| `blake2b-*`, `blake2s-*` | `@multiformats/blake2` | [multiformats/js-blake2](https://github.com/multiformats/js-blake2) |

### IPLD codecs (multicodec)
## IPLD codecs (multicodec)

| codec | import | repo |
| ---------- | -------------------------- | ------------------------------------------------------------------------------------------------------ |
Expand All @@ -243,17 +222,17 @@ Other (less useful) bases implemented in [multiformats/js-multiformats](https://
| `dag-pb` | `@ipld/dag-pb` | [ipld/js-dag-pb](https://github.com/ipld/js-dag-pb) |
| `dag-jose` | `dag-jose` | [ceramicnetwork/js-dag-jose](https://github.com/ceramicnetwork/js-dag-jose) |

## API Docs
# API Docs

- <https://multiformats.github.io/js-multiformats>

## License
# License

Licensed under either of

- Apache 2.0, ([LICENSE-APACHE](LICENSE-APACHE) / <http://www.apache.org/licenses/LICENSE-2.0>)
- MIT ([LICENSE-MIT](LICENSE-MIT) / <http://opensource.org/licenses/MIT>)

## Contribution
# Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.
23 changes: 8 additions & 15 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,6 @@
"ipld",
"multiformats"
],
"engines": {
"node": ">=16.0.0",
"npm": ">=7.0.0"
},
"type": "module",
"types": "./dist/src/index.d.ts",
"typesVersions": {
Expand All @@ -40,13 +36,9 @@
}
},
"files": [
"CHANGELOG.md",
"examples",
"LICENSE*",
"src",
"test",
"tsconfig.json",
"dist",
"!dist/test",
"!**/*.tsbuildinfo"
],
"exports": {
Expand Down Expand Up @@ -173,15 +165,10 @@
"import": "./dist/src/traversal.js"
}
},
"browser": {
"./hashes/sha1": "./dist/src/hashes/sha1-browser.js",
"./dist/src/hashes/sha1.js": "./dist/src/hashes/sha1-browser.js",
"./hashes/sha2": "./dist/src/hashes/sha2-browser.js",
"./dist/src/hashes/sha2.js": "./dist/src/hashes/sha2-browser.js"
},
"eslintConfig": {
"extends": "ipfs",
"parserOptions": {
"project": true,
"sourceType": "module"
}
},
Expand Down Expand Up @@ -300,5 +287,11 @@
"browser"
]
}
},
"browser": {
"./hashes/sha1": "./dist/src/hashes/sha1-browser.js",
"./dist/src/hashes/sha1.js": "./dist/src/hashes/sha1-browser.js",
"./hashes/sha2": "./dist/src/hashes/sha2-browser.js",
"./dist/src/hashes/sha2.js": "./dist/src/hashes/sha2-browser.js"
}
}
1 change: 0 additions & 1 deletion test/ts-use/tsconfig.tsbuildinfo

This file was deleted.

35 changes: 35 additions & 0 deletions typedoc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"entryPoints": [
"./src/index.ts",
"./src/bases/base10.ts",
"./src/bases/base16.ts",
"./src/bases/base2.ts",
"./src/bases/base256emoji.ts",
"./src/bases/base32.ts",
"./src/bases/base36.ts",
"./src/bases/base58.ts",
"./src/bases/base64.ts",
"./src/bases/base8.ts",
"./src/bases/identity.ts",
"./src/bases/interface.ts",
"./src/basics.ts",
"./src/block.ts",
"./src/block/interface.ts",
"./src/bytes.ts",
"./src/cid.ts",
"./src/codecs/interface.ts",
"./src/codecs/json.ts",
"./src/codecs/raw.ts",
"./src/hashes/digest.ts",
"./src/hashes/hasher.ts",
"./src/hashes/identity.ts",
"./src/hashes/interface.ts",
"./src/hashes/sha1.ts",
"./src/hashes/sha2.ts",
"./src/interface.ts",
"./src/link.ts",
"./src/link/interface.ts",
"./src/traversal.ts"
],
"includeVersion": true
}

0 comments on commit 721654b

Please sign in to comment.