From becbf6a57eab5c6e4ff3056e1dec7c1dfd3384ee Mon Sep 17 00:00:00 2001 From: Russell Dempsey <1173416+SgtPooki@users.noreply.github.com> Date: Wed, 29 Nov 2023 23:15:59 -0800 Subject: [PATCH] docs: update README --- README.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 0dd672b7..9b346534 100644 --- a/README.md +++ b/README.md @@ -58,34 +58,34 @@ import 'ipld-explorer-components/dist/components/loader/Loader.css' ### Adding another codec -**NOTE:** PRs adding an old IPLDFormat codec would need the old `blockcodec-to-ipld-format` tool which has many out of date deps. We will only accept PRs for adding BlockCodec interface codecs. +**NOTE:** PRs adding an old IPLDFormat codec would need the old `blockcodec-to-ipld-format` tool, which has many out-of-date deps. We will only accept PRs for adding BlockCodec interface codecs. -To add another codec you will need to update all locations containing the comment `// #WhenAddingNewCodec`: +To add another codec, you will need to update all locations containing the comment `// #WhenAddingNewCodec`: 1. Add a dependency on the codec to this package (if it's not already in multiformats or other package) 1. Add the codec in the switch statement in [./src/lib/codec-importer.ts](./src/lib/codec-importer.ts) 1. Update [./src/lib/get-codec-name-from-code.ts](./src/lib/get-codec-name-from-code.ts) to return the codec name for your codec 1. Add a unit test to [./src/lib/resolve-ipld-path.test.js](./src/lib/resolve-ipld-path.test.js) and ensure that calling `resolveIpldPath` returns the expected results - * If the default `resolveFn` in [./src/lib/get-codec-for-cid.ts](./src/lib/get-codec-for-cid.ts) doesn't resolve your paths correctly, you will need to add a resolver method for your codec to the `codecResolverMap` in [./src/lib/get-codec-for-cid.ts](./src/lib/get-codec-for-cid.ts) + * If the default `resolveFn` in [./src/lib/get-codec-for-cid.ts](./src/lib/get-codec-for-cid.ts) doesn't resolve your paths correctly, you will need to add a resolver method for your codec to the `codecResolverMap` in [./src/lib/get-codec-for-cid.ts](./src/lib/get-codec-for-cid.ts) see https://github.com/ipfs/ipld-explorer-components/pull/360#discussion_r1206251817 for history. ### Adding another hasher -To add another hasher you will need to update all locations containing the comment `// #WhenAddingNewHasher`: +To add another hasher, you will need to update all locations containing the comment `// #WhenAddingNewHasher`: 1. Add a dependency on the hasher to this package (if it's not already in multiformats or other package) 1. Add the hasher in the switch statement in [./src/lib/get-codec-for-cid.ts](./src/lib/get-codec-for-cid.ts) 1. Update [./src/lib/hash-importer.ts](./src/lib/hash-importer.ts) - - Update `SupportedHashers` to include your hasher type - - Update `getHasherForCode` to return your hasher + - Update `SupportedHashers` to include your hasher type + - Update `getHasherForCode` to return your hasher 1. Update the hasher codes used by the `hashers` property passed to Helia init in [./src/lib/init-helia.ts](./src/lib/init-helia.ts) see https://github.com/ipfs/ipld-explorer-components/pull/395 for an example. ### Redux-bundler requirements -These components use [redux-bundler](https://reduxbundler.com/) and your app will need to use a redux-bundler provider in order to propogate the properties and selectors. You can find a basic example of this in ./dev/devPage.jsx. +These components use [redux-bundler](https://reduxbundler.com/), and your app will need to use a redux-bundler provider to propagate the properties and selectors. You can find a basic example in ./dev/devPage.jsx. In short, these components export two bundles found in ./src/bundles: `explore` and `heliaBundle`. The explore bundle and components herein have a few redux-bundler selector dependencies that you need to make sure exist and are called properly. @@ -95,7 +95,7 @@ In short, these components export two bundles found in ./src/bundles: `explore` | explore & other bundles | selectHelia | The explore bundle gets the Helia node via this selector | | Main page (or any) | doInitHelia | A consuming app needs to call this selector to tell the bundle that provides the Helia node to instantiate it. | -If you don't want to use the `heliaBundle`, i.e. like we won't in ipfs-webui, then you will need to make sure you adapt the selectors as appropriate. +If you don't want to use the `heliaBundle`, you must adapt the selectors appropriately. ## Contribute