Skip to content
This repository was archived by the owner on Oct 1, 2021. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 9 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
37 changes: 26 additions & 11 deletions .aegir.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,32 @@
'use strict'

module.exports = {
karma: {
// multi-bucket pinset migrations are slow
browserNoActivityTimeout: 240 * 1000
},
webpack: {
node: {
// this is needed until level stops using node buffers in browser code
Buffer: true,
const path = require('path')

// needed by cbor, binary-parse-stream and nofilter
stream: true
const esbuild = {
// this will inject all the named exports from 'node-globals.js' as globals
inject: [path.join(__dirname, 'scripts/node-globals.js')],
plugins: [
{
name: 'node built ins', // this will make the bundler resolve node builtins to the respective browser polyfill
setup (build) {
build.onResolve({ filter: /^stream$/ }, () => {
return { path: require.resolve('readable-stream') }
})
}
}
]
}

/** @type {import('aegir').PartialOptions} */
module.exports = {
test: {
browser: {
config: {
buildConfig: esbuild
}
}
},
build: {
config: esbuild
}
}
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
language: node_js
cache: npm
dist: bionic

branches:
only:
Expand Down Expand Up @@ -27,7 +28,6 @@ jobs:
include:
- stage: check
script:
- npx aegir commitlint --travis
- npx aegir dep-check
- npm run lint

Expand All @@ -41,7 +41,7 @@ jobs:
name: firefox
addons:
firefox: latest
script: npx aegir test -t browser -- --browsers FirefoxHeadless
script: npx aegir test -t browser -- --browser firefox

- stage: test
name: electron-main
Expand Down
2 changes: 1 addition & 1 deletion migrations/migration-9/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

const CID = require('cids')
const dagpb = require('ipld-dag-pb')
const cbor = require('cbor')
const cbor = require('borc')
const multicodec = require('multicodec')
const multibase = require('multibase')
const pinset = require('./pin-set')
Expand Down
14 changes: 9 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,13 @@
"docs": "aegir docs"
},
"dependencies": {
"cbor": "^6.0.1",
"borc": "^2.1.2",
"cids": "^1.0.0",
"datastore-core": "^3.0.0",
"debug": "^4.1.0",
"fnv1a": "^1.0.1",
"interface-datastore": "^3.0.3",
"ipld-dag-pb": "^0.20.0",
"ipld-dag-pb": "^0.21.0",
"it-length": "^1.0.1",
"multibase": "^3.0.0",
"multicodec": "^2.0.0",
Expand All @@ -58,17 +58,21 @@
"varint": "^6.0.0"
},
"devDependencies": {
"aegir": "^30.3.0",
"aegir": "^31.0.0",
"assert": "^2.0.0",
"datastore-car": "^1.2.0",
"datastore-fs": "^3.0.0",
"datastore-level": "^3.0.0",
"datastore-level": "^4.0.0",
"events": "^3.2.0",
"it-all": "^1.0.2",
"just-safe-set": "^2.1.0",
"level-5": "npm:level@^5.0.0",
"level-6": "npm:level@^6.0.0",
"ncp": "^2.0.0",
"readable-stream": "^3.6.0",
"rimraf": "^3.0.0",
"sinon": "^9.0.2"
"sinon": "^9.0.2",
"util": "^0.12.3"
},
"engines": {
"node": ">=10.0.0",
Expand Down
4 changes: 4 additions & 0 deletions scripts/node-globals.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// file: node-globals.js
// @ts-nocheck
export const { Buffer } = require('buffer')
export const process = require('process/browser')
2 changes: 1 addition & 1 deletion test/fixtures/repo.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict'

const loadFixture = require('aegir/fixtures')
const loadFixture = require('aegir/utils/fixtures')
const { CONFIG_KEY, VERSION_KEY, createStore } = require('../../src/utils')

async function createRepo (repoOptions, prefix) {
Expand Down
5 changes: 3 additions & 2 deletions test/migrations/migration-10-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,12 @@ const { createStore } = require('../../src/utils')
const migration = require('../../migrations/migration-10')
const Key = require('interface-datastore').Key
const fromString = require('uint8arrays/from-string')
const equals = require('uint8arrays/equals')
const Level5 = require('level-5')
const Level6 = require('level-6')

const keys = {
CIQCKN76QUQUGYCHIKGFE6V6P3GJ2W26YFFPQW6YXV7NFHH3QB2RI3I: 'hello',
CIQCKN76QUQUGYCHIKGFE6V6P3GJ2W26YFFPQW6YXV7NFHH3QB2RI3I: fromString('hello'),
CIQKKLBWAIBQZOIS5X7E32LQAL6236OUKZTMHPQSFIXPWXNZHQOV7JQ: fromString('derp')
}

Expand All @@ -36,7 +37,7 @@ async function validate (dir, backend, repoOptions) {
const key = new Key(`/${name}`)

expect(await store.has(key)).to.be.true(`Could not read key ${name}`)
expect(store.get(key)).to.eventually.equal(keys[name], `Could not read value for key ${keys[name]}`)
expect(equals(await store.get(key), keys[name])).to.be.true(`Could not read value for key ${keys[name]}`)
}

await store.close()
Expand Down
6 changes: 3 additions & 3 deletions test/migrations/migration-9-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
'use strict'

const { expect } = require('aegir/utils/chai')
const cbor = require('cbor')
const cbor = require('borc')
const migration = require('../../migrations/migration-9')
const { cidToKey, PIN_DS_KEY } = require('../../migrations/migration-9/utils')
const { createStore } = require('../../src/utils')
const CID = require('cids')
const CarDatastore = require('datastore-car')
const loadFixture = require('aegir/fixtures')
const loadFixture = require('aegir/utils/fixtures')
const multibase = require('multibase')

function pinToCid (key, pin) {
Expand Down Expand Up @@ -102,7 +102,7 @@ async function assertPinsetRootIsPresent (datastore, pinset) {

module.exports = (setup, cleanup, repoOptions) => {
describe('migration 9', function () {
this.timeout(480 * 1000)
this.timeout(1000 * 1000)

let dir
let datastore
Expand Down