Skip to content
This repository has been archived by the owner on Sep 3, 2021. It is now read-only.

fix: update to aegir 31 and others deps #141

Merged
merged 4 commits into from
Mar 2, 2021
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 28 additions & 16 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,14 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: yarn
- run: yarn lint
- run: yarn build
- uses: gozala/[email protected]
- run: yarn aegir dep-check -- -i aegir
- run: npm install
- run: npx aegir lint
- run: npx aegir ts -p check
# or
# - uses: gozala/[email protected]
- run: npx aegir build
- run: npx aegir dep-check
- uses: ipfs/aegir/actions/bundle-size@master
name: size
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
test-node:
Expand All @@ -34,34 +35,45 @@ jobs:
- uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node }}
- run: yarn
- run: npx nyc --reporter=lcov npm run test:node -- --bail
- run: npm install
- run: npx aegir test -t node --bail --cov
- uses: codecov/codecov-action@v1
test-chrome:
needs: check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: yarn
- run: yarn aegir test -t browser -t webworker
- uses: microsoft/playwright-github-action@v1
- run: npm install
- run: npx aegir test -t browser -t webworker --bail --cov
- uses: codecov/codecov-action@v1
test-firefox:
needs: check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: yarn
- run: yarn aegir test -t browser -t webworker -- --browsers FirefoxHeadless
- uses: microsoft/playwright-github-action@v1
- run: npm install
- run: npx aegir test -t browser -t webworker --bail -- --browser firefox
test-webkit:
needs: check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: microsoft/playwright-github-action@v1
- run: npm install
- run: npx aegir test -t browser -t webworker --bail -- --browser webkit
test-electron-main:
needs: check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: yarn
- run: npx xvfb-maybe yarn aegir test -t electron-main --bail
- run: npm install
- run: npx xvfb-maybe aegir test -t electron-main --bail
test-electron-renderer:
needs: check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: yarn
- run: npx xvfb-maybe yarn aegir test -t electron-renderer --bail
- run: npm install
- run: npx xvfb-maybe aegir test -t electron-renderer --bail
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@
"url": "https://github.com/multiformats/js-cid/issues"
},
"dependencies": {
"multibase": "^3.0.1",
"multicodec": "^2.1.0",
"multihashes": "^3.1.0",
"uint8arrays": "^2.0.5"
"multibase": "^4.0.1",
"multicodec": "^2.1.1",
"multihashes": "^4.0.1",
"uint8arrays": "^2.1.3"
},
"devDependencies": {
"@sinonjs/samsam": "^5.3.0",
Expand Down
8 changes: 4 additions & 4 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
const mh = require('multihashes')
const multibase = require('multibase')
const multicodec = require('multicodec')
const { baseTable: codecs } = require('multicodec/src/base-table.js')
const { baseTable: codecs } = require('multicodec/src/generated-table')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should stop using non-public APIs. We broke the world once, I don't want it to break it again.

If there is no code to name mapping in js-multicodec, we should add it properly to the public API. I can have a look later this week.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cids exports code to name?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AFAICT it only changed the file name nothing else

const CIDUtil = require('./cid-util')
const uint8ArrayConcat = require('uint8arrays/concat')
const uint8ArrayToString = require('uint8arrays/to-string')
Expand All @@ -12,7 +12,7 @@ const uint8ArrayEquals = require('uint8arrays/equals')
const codecInts = /** @type {CodecName[]} */(Object.keys(codecs)).reduce((p, name) => {
p[codecs[name]] = name
return p
}, /** @type {Record<CodecNumber, CodecName>} */({}))
}, /** @type {Record<CodecCode, CodecName>} */({}))

const symbol = Symbol.for('@ipld/js-cid/CID')

Expand All @@ -26,7 +26,7 @@ const symbol = Symbol.for('@ipld/js-cid/CID')
* @typedef {0|1} CIDVersion
* @typedef {import('multibase').BaseNameOrCode} BaseNameOrCode
* @typedef {import('multicodec').CodecName} CodecName
* @typedef {import('multicodec').CodecNumber} CodecNumber
* @typedef {import('multicodec').CodecCode} CodecCode
*/

/**
Expand Down Expand Up @@ -221,7 +221,7 @@ class CID {
/**
* The codec of the CID in its number form.
*
* @returns {CodecNumber}
* @returns {CodecCode}
*/
get code () {
return codecs[this.codec]
Expand Down
2 changes: 1 addition & 1 deletion test/index.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ describe('CID', () => {
expect(() => {
new CID(1, 'this-codec-doesnt-exist', hash).toBaseEncodedString()
}).to.throw(
'Codec `this-codec-doesnt-exist` not found'
'Codec "this-codec-doesnt-exist" not found'
)
})

Expand Down