-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Changes: fix: fix possible undefined datastores - split datastore instantiation from opening - add it-pushable types - add just-range types - add proper-lockfile types - fix lock.close we werent waiting for the promise - adds types - removes fake async - fixes tests for async errors that now are sync - adds local types for merge-options Co-authored-by: achingbrain <[email protected]>
- Loading branch information
1 parent
a9ea5aa
commit 1f8ba76
Showing
38 changed files
with
750 additions
and
327 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,32 @@ | ||
'use strict' | ||
const path = require('path') | ||
|
||
module.exports = { | ||
webpack: { | ||
node: { | ||
// this is needed until level stops using node buffers in browser code | ||
Buffer: true, | ||
/** @type {import('aegir').Options["build"]["config"]} */ | ||
const esbuild = { | ||
inject: [path.join(__dirname, 'scripts/node-globals.js')], | ||
plugins: [ | ||
{ | ||
name: 'node built ins', | ||
setup (build) { | ||
build.onResolve({ filter: /^stream$/ }, () => { | ||
return { path: require.resolve('readable-stream') } | ||
}) | ||
} | ||
} | ||
] | ||
} | ||
|
||
// needed by binary-parse-stream | ||
stream: true | ||
/** @type {import('aegir').PartialOptions} */ | ||
module.exports = { | ||
test: { | ||
browser: { | ||
config: { | ||
buildConfig: esbuild | ||
} | ||
} | ||
}, | ||
build: { | ||
bundlesizeMax: '130kB', | ||
config: esbuild | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
name: ci | ||
on: | ||
push: | ||
branches: | ||
- master | ||
pull_request: | ||
branches: | ||
- master | ||
|
||
jobs: | ||
check: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- 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 | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
test-node: | ||
needs: check | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
os: [windows-latest, ubuntu-latest, macos-latest] | ||
node: [14, 15] | ||
fail-fast: true | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/setup-node@v1 | ||
with: | ||
node-version: ${{ matrix.node }} | ||
- 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 | ||
- uses: microsoft/playwright-github-action@v1 | ||
- run: npm install | ||
- run: npx aegir test -t browser -t webworker --bail # add --cov later when its fixed | ||
- uses: codecov/codecov-action@v1 | ||
test-firefox: | ||
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 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 --timeout 10000 -- --browser webkit | ||
# test-electron-main: | ||
# needs: check | ||
# runs-on: ubuntu-latest | ||
# steps: | ||
# - uses: actions/checkout@v2 | ||
# - 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: npm install | ||
# - run: npx xvfb-maybe aegir test -t electron-renderer --bail |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,7 @@ | |
"description": "IPFS Repo implementation", | ||
"leadMaintainer": "Alex Potsides <[email protected]>", | ||
"main": "src/index.js", | ||
"types": "dist/src/index.d.ts", | ||
"files": [ | ||
"src", | ||
"dist" | ||
|
@@ -15,16 +16,17 @@ | |
"./src/default-options.js": "./src/default-options-browser.js" | ||
}, | ||
"scripts": { | ||
"prepare": "aegir build --no-bundle", | ||
"test": "aegir test", | ||
"test:node": "aegir test -t node", | ||
"test:browser": "aegir test -t browser", | ||
"test:webworker": "aegir test -t webworker", | ||
"build": "aegir build", | ||
"lint": "aegir lint", | ||
"release": "aegir release --docs", | ||
"release-minor": "aegir release --type minor --docs", | ||
"release-major": "aegir release --type major --docs", | ||
"coverage": "nyc -s npm run test:node && nyc report --reporter=html", | ||
"release": "aegir release", | ||
"release-minor": "aegir release --type minor", | ||
"release-major": "aegir release --type major", | ||
"coverage": "aegir test -t node --cov && nyc report --reporter=html", | ||
"dep-check": "aegir dep-check", | ||
"docs": "aegir docs" | ||
}, | ||
|
@@ -39,43 +41,62 @@ | |
], | ||
"homepage": "https://github.com/ipfs/js-ipfs-repo", | ||
"engines": { | ||
"node": ">=10.0.0", | ||
"npm": ">=3.0.0" | ||
"node": ">=14.0.0", | ||
"npm": ">=6.0.0" | ||
}, | ||
"devDependencies": { | ||
"aegir": "^30.0.1", | ||
"@types/bytes": "^3.1.0", | ||
"@types/debug": "^4.1.5", | ||
"@types/memdown": "^3.0.0", | ||
"@types/ncp": "^2.0.4", | ||
"@types/proper-lockfile": "^4.1.1", | ||
"@types/rimraf": "^3.0.0", | ||
"aegir": "^31.0.1", | ||
"assert": "^2.0.0", | ||
"events": "^3.3.0", | ||
"it-all": "^1.0.2", | ||
"it-drain": "^1.0.1", | ||
"it-first": "^1.0.2", | ||
"just-range": "^2.1.0", | ||
"memdown": "^5.1.0", | ||
"multihashing-async": "^2.0.0", | ||
"multihashing-async": "^2.1.0", | ||
"ncp": "^2.0.0", | ||
"process": "^0.11.10", | ||
"readable-stream": "^3.6.0", | ||
"rimraf": "^3.0.0", | ||
"sinon": "^9.0.2" | ||
"sinon": "^9.0.2", | ||
"url": "^0.11.0", | ||
"util": "^0.12.3" | ||
}, | ||
"dependencies": { | ||
"bignumber.js": "^9.0.0", | ||
"bytes": "^3.1.0", | ||
"cids": "^1.0.0", | ||
"cids": "^1.1.6", | ||
"datastore-core": "^3.0.0", | ||
"datastore-fs": "^3.0.0", | ||
"datastore-level": "^4.0.0", | ||
"debug": "^4.1.0", | ||
"err-code": "^2.0.0", | ||
"err-code": "^3.0.1", | ||
"interface-datastore": "^3.0.3", | ||
"ipfs-repo-migrations": "^6.0.0", | ||
"ipfs-repo-migrations": "^7.0.1", | ||
"ipfs-utils": "^6.0.0", | ||
"ipld-block": "^0.11.0", | ||
"it-map": "^1.0.2", | ||
"it-pushable": "^1.4.0", | ||
"just-safe-get": "^2.0.0", | ||
"just-safe-set": "^2.1.0", | ||
"multibase": "^3.0.0", | ||
"merge-options": "^3.0.4", | ||
"multibase": "^4.0.1", | ||
"p-queue": "^6.0.0", | ||
"proper-lockfile": "^4.0.0", | ||
"sort-keys": "^4.0.0", | ||
"uint8arrays": "^2.0.5" | ||
"uint8arrays": "^2.1.3" | ||
}, | ||
"eslintConfig": { | ||
"extends": "ipfs", | ||
"ignorePatterns": [ | ||
"!.aegir.js" | ||
] | ||
}, | ||
"license": "MIT", | ||
"contributors": [ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
// @ts-nocheck | ||
export const { Buffer } = require('buffer') | ||
export const process = require('process/browser') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,25 @@ | ||
'use strict' | ||
|
||
exports.create = function createBackend (name, path, options) { | ||
/** | ||
* @typedef {import("interface-datastore").Datastore} Datastore | ||
* @typedef {import("./types").Backends} Backends | ||
* @typedef {Required<import("./types").Options>} Options | ||
*/ | ||
|
||
/** | ||
* | ||
* @param {Backends} name | ||
* @param {string} path | ||
* @param {Options} options | ||
* @returns {Datastore} | ||
*/ | ||
function createBackend (name, path, options) { | ||
const Ctor = options.storageBackends[name] | ||
const backendOptions = Object.assign({}, options.storageBackendOptions[name] || {}) | ||
// @ts-ignore we don't have a signature for the constructor | ||
return new Ctor(path, backendOptions) | ||
} | ||
|
||
module.exports = { | ||
create: createBackend | ||
} |
Oops, something went wrong.