fix: update to aegir v31

This commit is contained in:
Hugo Dias 2021-02-22 15:42:03 +00:00
parent 4ee3e1973b
commit 1e1740f727
No known key found for this signature in database
GPG Key ID: 9F61AFCAB8C717A0
4 changed files with 36 additions and 14 deletions

View File

@ -1,5 +1,6 @@
'use strict' 'use strict'
const path = require('path')
const Libp2p = require('./src') const Libp2p = require('./src')
const { MULTIADDRS_WEBSOCKETS } = require('./test/fixtures/browser') const { MULTIADDRS_WEBSOCKETS } = require('./test/fixtures/browser')
const Peers = require('./test/fixtures/peers') const Peers = require('./test/fixtures/peers')
@ -47,16 +48,23 @@ const after = async () => {
await libp2p.stop() await libp2p.stop()
} }
/** @type {import('aegir').Options["build"]["config"]} */
const esbuild = {
inject: [path.join(__dirname, './scripts/node-globals.js')]
}
/** @type {import('aegir').PartialOptions} */
module.exports = { module.exports = {
bundlesize: { maxSize: '220kB' }, build: {
hooks: { bundlesizeMax: '220kB'
pre: before,
post: after
}, },
webpack: { test: {
node: { before,
// needed by bcrypto after,
Buffer: true browser: {
config: {
buildConfig: esbuild
}
} }
} }
} }

View File

@ -53,6 +53,12 @@
"browser": { "browser": {
"@motrix/nat-api": false "@motrix/nat-api": false
}, },
"eslintConfig": {
"extends": "ipfs",
"ignorePatterns": [
"!.aegir.js"
]
},
"dependencies": { "dependencies": {
"@motrix/nat-api": "^0.3.1", "@motrix/nat-api": "^0.3.1",
"abort-controller": "^3.0.0", "abort-controller": "^3.0.0",
@ -110,7 +116,7 @@
"devDependencies": { "devDependencies": {
"@nodeutils/defaults-deep": "^1.1.0", "@nodeutils/defaults-deep": "^1.1.0",
"abortable-iterator": "^3.0.0", "abortable-iterator": "^3.0.0",
"aegir": "^29.2.0", "aegir": "ipfs/aegir#feat/remove-webpack-karma",
"chai-bytes": "^0.1.2", "chai-bytes": "^0.1.2",
"chai-string": "^1.5.0", "chai-string": "^1.5.0",
"delay": "^4.4.0", "delay": "^4.4.0",
@ -141,7 +147,9 @@
"p-wait-for": "^3.2.0", "p-wait-for": "^3.2.0",
"rimraf": "^3.0.2", "rimraf": "^3.0.2",
"sinon": "^9.2.4", "sinon": "^9.2.4",
"uint8arrays": "^2.0.5" "uint8arrays": "^2.0.5",
"url": "^0.11.0",
"util": "^0.12.3"
}, },
"contributors": [ "contributors": [
"David Dias <daviddias.p@gmail.com>", "David Dias <daviddias.p@gmail.com>",

2
scripts/node-globals.js Normal file
View File

@ -0,0 +1,2 @@
// @ts-nocheck
export const { Buffer } = require('buffer')

View File

@ -22,8 +22,12 @@ module.exports = generate
module.exports.NONCE_LENGTH = 24 module.exports.NONCE_LENGTH = 24
module.exports.KEY_LENGTH = KEY_LENGTH module.exports.KEY_LENGTH = KEY_LENGTH
// @ts-ignore This condition will always return 'false' since the types 'Module | undefined' try {
if (require.main === module) { // @ts-ignore This condition will always return 'false' since the types 'Module | undefined'
// @ts-ignore if (require.main === module) {
generate(process.stdout) // @ts-ignore
generate(process.stdout)
}
} catch (error) {
} }