Skip to content
This repository was archived by the owner on Mar 23, 2023. It is now read-only.

feat!: publish as ESM only #131

Merged
merged 2 commits into from
Aug 12, 2022
Merged
Show file tree
Hide file tree
Changes from all 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
32 changes: 0 additions & 32 deletions .aegir.cjs

This file was deleted.

6 changes: 6 additions & 0 deletions .aegir.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/** @type {import('aegir').PartialOptions} */
export default {
build: {
bundlesizeMax: '67KB'
}
}
3 changes: 3 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,6 @@ updates:
interval: daily
time: "10:00"
open-pull-requests-limit: 10
commit-message:
prefix: "deps"
prefix-development: "deps(dev)"
57 changes: 33 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,32 +1,27 @@
# js-datastore-level <!-- omit in toc -->
# datastore-level <!-- omit in toc -->

[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://ipn.io)
[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)
[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)
[![standard-readme compliant](https://img.shields.io/badge/standard--readme-OK-green.svg?style=flat-square)](https://github.com/RichardLitt/standard-readme)
[![Build Status](https://github.com/ipfs/js-datastore-level/actions/workflows/js-test-and-release.yml/badge.svg?branch=master)](https://github.com/ipfs/js-datastore-level/actions/workflows/js-test-and-release.yml)
[![Codecov](https://codecov.io/gh/ipfs/js-datastore-level/branch/master/graph/badge.svg)](https://codecov.io/gh/ipfs/js-datastore-level)
[![Dependency Status](https://david-dm.org/ipfs/js-datastore-level.svg?style=flat-square)](https://david-dm.org/ipfs/js-datastore-level)
[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)
![](https://img.shields.io/badge/npm-%3E%3D3.0.0-orange.svg?style=flat-square)
![](https://img.shields.io/badge/Node.js-%3E%3D8.0.0-orange.svg?style=flat-square)
[![ipfs.io](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io)
[![IRC](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)
[![Discord](https://img.shields.io/discord/806902334369824788?style=flat-square)](https://discord.gg/ipfs)
[![codecov](https://img.shields.io/codecov/c/github/ipfs/js-datastore-level.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-datastore-level)
[![CI](https://img.shields.io/github/workflow/status/ipfs/js-datastore-level/test%20&%20maybe%20release/master?style=flat-square)](https://github.com/ipfs/js-datastore-level/actions/workflows/js-test-and-release.yml)

> Datastore implementation with level(up|down) backend

> Datastore implementation with [levelup](https://github.com/level/levelup) backend.

## Table of Contents <!-- omit in toc -->
## Table of contents <!-- omit in toc -->

- [Install](#install)
- [Usage](#usage)
- [Browser Shimming Leveldown](#browser-shimming-leveldown)
- [Database names](#database-names)
- [Contribute](#contribute)
- [License](#license)
- [Contribute](#contribute-1)

## Install

```
$ npm install datastore-level
```console
$ npm i datastore-level
```

## Usage
Expand All @@ -37,15 +32,18 @@ import { LevelDatastore } from 'datastore-level'
// Default using level as backend for node or the browser
const store = new LevelDatastore('path/to/store')

// another leveldown compliant backend like memdown
const memStore = new LevelDatastore('my/mem/store', {
db: require('level-mem')
})
// another leveldown compliant backend like memory-level
const memStore = new LevelDatastore(
new MemoryLevel({
keyEncoding: 'utf8',
valueEncoding: 'view'
})
)
```

### Browser Shimming Leveldown

`LevelStore` uses the `level` module to automatically use `level.js` if a modern bundler is used which can detect bundle targets based on the `pkg.browser` property in your `package.json`.
`LevelStore` uses the `level` module to automatically use `level` if a modern bundler is used which can detect bundle targets based on the `pkg.browser` property in your `package.json`.

If you are using a bundler that does not support `pkg.browser`, you will need to handle the shimming yourself, as was the case with versions of `LevelStore` 0.7.0 and earlier.

Expand All @@ -55,8 +53,8 @@ If you are using a bundler that does not support `pkg.browser`, you will need to

```javascript
import leveljs from 'level-js'
import browserStore = new LevelDatastore('my/db/name', {
db: (path) => leveljs(path, {
import browserStore = new LevelDatastore(
new Level('my/db/name', {
prefix: 'IDBWrapper-'
})
})
Expand All @@ -74,4 +72,15 @@ This repository falls under the IPFS [Code of Conduct](https://github.com/ipfs/c

## License

[MIT](LICENSE)
Licensed under either of

- Apache 2.0, ([LICENSE-APACHE](LICENSE-APACHE) / <http://www.apache.org/licenses/LICENSE-2.0>)
- MIT ([LICENSE-MIT](LICENSE-MIT) / <http://opensource.org/licenses/MIT>)

## Contribute

Feel free to join in. All welcome. Open an [issue](https://github.com/ipfs/js-ipfs-unixfs-importer/issues)!

This repository falls under the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).

[![](https://cdn.rawgit.com/jbenet/contribute-ipfs-gif/master/img/contribute.gif)](https://github.com/ipfs/community/blob/master/CONTRIBUTING.md)
76 changes: 39 additions & 37 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,27 +25,33 @@
"node": ">=16.0.0",
"npm": ">=7.0.0"
},
"main": "src/index.js",
"type": "module",
"types": "types/src/index.d.ts",
"types": "./dist/src/index.d.ts",
"typesVersions": {
"*": {
"*": [
"types/*",
"types/src/*"
"*",
"dist/*",
"dist/src/*",
"dist/src/*/index"
],
"types/*": [
"types/*",
"types/src/*"
"src/*": [
"*",
"dist/*",
"dist/src/*",
"dist/src/*/index"
]
}
},
"files": [
"*",
"src",
"dist",
"!dist/test",
"!**/*.tsbuildinfo"
],
"exports": {
".": {
"types": "./dist/src/index.d.ts",
"import": "./src/index.js"
}
},
Expand Down Expand Up @@ -82,15 +88,15 @@
"release": "patch"
},
{
"type": "chore",
"type": "docs",
"release": "patch"
},
{
"type": "docs",
"type": "test",
"release": "patch"
},
{
"type": "test",
"type": "deps",
"release": "patch"
},
{
Expand Down Expand Up @@ -120,7 +126,11 @@
},
{
"type": "docs",
"section": "Trivial Changes"
"section": "Documentation"
},
{
"type": "deps",
"section": "Dependencies"
},
{
"type": "test",
Expand All @@ -131,52 +141,44 @@
}
],
"@semantic-release/changelog",
[
"@semantic-release/npm",
{
"pkgRoot": "dist"
}
],
"@semantic-release/npm",
"@semantic-release/github",
"@semantic-release/git"
]
},
"scripts": {
"clean": "rimraf dist types",
"prepare": "aegir build --no-bundle && cp -R types dist",
"lint": "aegir ts -p check && aegir lint",
"build": "aegir build --esm-tests",
"release": "semantic-release",
"clean": "aegir clean",
"lint": "aegir lint",
"build": "aegir build",
"release": "aegir release",
"test": "aegir test",
"test:node": "aegir test -t node",
"test:chrome": "aegir test -t browser",
"test:node": "aegir test -t node --cov",
"test:chrome": "aegir test -t browser --cov",
"test:chrome-webworker": "aegir test -t webworker",
"test:firefox": "aegir test -t browser -- --browser firefox",
"test:firefox-webworker": "aegir test -t webworker -- --browser firefox",
"test:electron-main": "aegir test -t electron-main -f dist/cjs/node-test/*js",
"test:electron-renderer": "aegir test -t electron-renderer -f dist/cjs/node-test/*js",
"dep-check": "aegir dep-check -i rimraf"
"test:electron-main": "aegir test -t electron-main",
"dep-check": "aegir dep-check"
},
"dependencies": {
"datastore-core": "^7.0.0",
"interface-datastore": "^6.0.2",
"abstract-level": "^1.0.3",
"datastore-core": "^8.0.1",
"interface-datastore": "^7.0.0",
"it-filter": "^1.0.2",
"it-map": "^1.0.5",
"it-sort": "^1.0.0",
"it-take": "^1.0.1",
"level": "^7.0.0"
"level": "^8.0.0"
},
"devDependencies": {
"@ipld/dag-cbor": "^7.0.0",
"@types/rimraf": "^3.0.2",
"aegir": "^36.1.3",
"assert": "^2.0.0",
"buffer": "^6.0.3",
"interface-datastore-tests": "^2.0.3",
"aegir": "^37.5.1",
"interface-datastore-tests": "^3.0.0",
"ipfs-utils": "^9.0.4",
"level-mem": "^6.0.1",
"memory-level": "^1.0.0",
"multiformats": "^9.2.0",
"rimraf": "^3.0.0",
"util": "^0.12.3"
"rimraf": "^3.0.2"
}
}
1 change: 0 additions & 1 deletion scripts/immediate.js

This file was deleted.

3 changes: 0 additions & 3 deletions scripts/node-globals.js

This file was deleted.

Loading