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

Commit 0d3b6ab

Browse files
authored
feat!: publish as ESM only (#131)
BREAKING CHANGE: this module used to be published as ESM/CJS now it is just ESM
1 parent f5b456e commit 0d3b6ab

13 files changed

+147
-258
lines changed

.aegir.cjs

-32
This file was deleted.

.aegir.js

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
/** @type {import('aegir').PartialOptions} */
2+
export default {
3+
build: {
4+
bundlesizeMax: '67KB'
5+
}
6+
}

.github/dependabot.yml

+3
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,6 @@ updates:
66
interval: daily
77
time: "10:00"
88
open-pull-requests-limit: 10
9+
commit-message:
10+
prefix: "deps"
11+
prefix-development: "deps(dev)"

README.md

+33-24
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,27 @@
1-
# js-datastore-level <!-- omit in toc -->
1+
# datastore-level <!-- omit in toc -->
22

3-
[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://ipn.io)
4-
[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)
5-
[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)
6-
[![standard-readme compliant](https://img.shields.io/badge/standard--readme-OK-green.svg?style=flat-square)](https://github.com/RichardLitt/standard-readme)
7-
[![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)
8-
[![Codecov](https://codecov.io/gh/ipfs/js-datastore-level/branch/master/graph/badge.svg)](https://codecov.io/gh/ipfs/js-datastore-level)
9-
[![Dependency Status](https://david-dm.org/ipfs/js-datastore-level.svg?style=flat-square)](https://david-dm.org/ipfs/js-datastore-level)
10-
[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)
11-
![](https://img.shields.io/badge/npm-%3E%3D3.0.0-orange.svg?style=flat-square)
12-
![](https://img.shields.io/badge/Node.js-%3E%3D8.0.0-orange.svg?style=flat-square)
3+
[![ipfs.io](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io)
4+
[![IRC](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)
5+
[![Discord](https://img.shields.io/discord/806902334369824788?style=flat-square)](https://discord.gg/ipfs)
6+
[![codecov](https://img.shields.io/codecov/c/github/ipfs/js-datastore-level.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-datastore-level)
7+
[![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)
138

9+
> Datastore implementation with level(up|down) backend
1410
15-
> Datastore implementation with [levelup](https://github.com/level/levelup) backend.
16-
17-
## Table of Contents <!-- omit in toc -->
11+
## Table of contents <!-- omit in toc -->
1812

1913
- [Install](#install)
2014
- [Usage](#usage)
2115
- [Browser Shimming Leveldown](#browser-shimming-leveldown)
2216
- [Database names](#database-names)
2317
- [Contribute](#contribute)
2418
- [License](#license)
19+
- [Contribute](#contribute-1)
2520

2621
## Install
2722

28-
```
29-
$ npm install datastore-level
23+
```console
24+
$ npm i datastore-level
3025
```
3126

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

40-
// another leveldown compliant backend like memdown
41-
const memStore = new LevelDatastore('my/mem/store', {
42-
db: require('level-mem')
43-
})
35+
// another leveldown compliant backend like memory-level
36+
const memStore = new LevelDatastore(
37+
new MemoryLevel({
38+
keyEncoding: 'utf8',
39+
valueEncoding: 'view'
40+
})
41+
)
4442
```
4543

4644
### Browser Shimming Leveldown
4745

48-
`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`.
46+
`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`.
4947

5048
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.
5149

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

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

7573
## License
7674

77-
[MIT](LICENSE)
75+
Licensed under either of
76+
77+
- Apache 2.0, ([LICENSE-APACHE](LICENSE-APACHE) / <http://www.apache.org/licenses/LICENSE-2.0>)
78+
- MIT ([LICENSE-MIT](LICENSE-MIT) / <http://opensource.org/licenses/MIT>)
79+
80+
## Contribute
81+
82+
Feel free to join in. All welcome. Open an [issue](https://github.com/ipfs/js-ipfs-unixfs-importer/issues)!
83+
84+
This repository falls under the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).
85+
86+
[![](https://cdn.rawgit.com/jbenet/contribute-ipfs-gif/master/img/contribute.gif)](https://github.com/ipfs/community/blob/master/CONTRIBUTING.md)

package.json

+39-37
Original file line numberDiff line numberDiff line change
@@ -25,27 +25,33 @@
2525
"node": ">=16.0.0",
2626
"npm": ">=7.0.0"
2727
},
28-
"main": "src/index.js",
2928
"type": "module",
30-
"types": "types/src/index.d.ts",
29+
"types": "./dist/src/index.d.ts",
3130
"typesVersions": {
3231
"*": {
3332
"*": [
34-
"types/*",
35-
"types/src/*"
33+
"*",
34+
"dist/*",
35+
"dist/src/*",
36+
"dist/src/*/index"
3637
],
37-
"types/*": [
38-
"types/*",
39-
"types/src/*"
38+
"src/*": [
39+
"*",
40+
"dist/*",
41+
"dist/src/*",
42+
"dist/src/*/index"
4043
]
4144
}
4245
},
4346
"files": [
44-
"*",
47+
"src",
48+
"dist",
49+
"!dist/test",
4550
"!**/*.tsbuildinfo"
4651
],
4752
"exports": {
4853
".": {
54+
"types": "./dist/src/index.d.ts",
4955
"import": "./src/index.js"
5056
}
5157
},
@@ -82,15 +88,15 @@
8288
"release": "patch"
8389
},
8490
{
85-
"type": "chore",
91+
"type": "docs",
8692
"release": "patch"
8793
},
8894
{
89-
"type": "docs",
95+
"type": "test",
9096
"release": "patch"
9197
},
9298
{
93-
"type": "test",
99+
"type": "deps",
94100
"release": "patch"
95101
},
96102
{
@@ -120,7 +126,11 @@
120126
},
121127
{
122128
"type": "docs",
123-
"section": "Trivial Changes"
129+
"section": "Documentation"
130+
},
131+
{
132+
"type": "deps",
133+
"section": "Dependencies"
124134
},
125135
{
126136
"type": "test",
@@ -131,52 +141,44 @@
131141
}
132142
],
133143
"@semantic-release/changelog",
134-
[
135-
"@semantic-release/npm",
136-
{
137-
"pkgRoot": "dist"
138-
}
139-
],
144+
"@semantic-release/npm",
140145
"@semantic-release/github",
141146
"@semantic-release/git"
142147
]
143148
},
144149
"scripts": {
145-
"clean": "rimraf dist types",
146-
"prepare": "aegir build --no-bundle && cp -R types dist",
147-
"lint": "aegir ts -p check && aegir lint",
148-
"build": "aegir build --esm-tests",
149-
"release": "semantic-release",
150+
"clean": "aegir clean",
151+
"lint": "aegir lint",
152+
"build": "aegir build",
153+
"release": "aegir release",
150154
"test": "aegir test",
151-
"test:node": "aegir test -t node",
152-
"test:chrome": "aegir test -t browser",
155+
"test:node": "aegir test -t node --cov",
156+
"test:chrome": "aegir test -t browser --cov",
153157
"test:chrome-webworker": "aegir test -t webworker",
154158
"test:firefox": "aegir test -t browser -- --browser firefox",
155159
"test:firefox-webworker": "aegir test -t webworker -- --browser firefox",
156-
"test:electron-main": "aegir test -t electron-main -f dist/cjs/node-test/*js",
157-
"test:electron-renderer": "aegir test -t electron-renderer -f dist/cjs/node-test/*js",
158-
"dep-check": "aegir dep-check -i rimraf"
160+
"test:electron-main": "aegir test -t electron-main",
161+
"dep-check": "aegir dep-check"
159162
},
160163
"dependencies": {
161-
"datastore-core": "^7.0.0",
162-
"interface-datastore": "^6.0.2",
164+
"abstract-level": "^1.0.3",
165+
"datastore-core": "^8.0.1",
166+
"interface-datastore": "^7.0.0",
163167
"it-filter": "^1.0.2",
164168
"it-map": "^1.0.5",
165169
"it-sort": "^1.0.0",
166170
"it-take": "^1.0.1",
167-
"level": "^7.0.0"
171+
"level": "^8.0.0"
168172
},
169173
"devDependencies": {
170174
"@ipld/dag-cbor": "^7.0.0",
171175
"@types/rimraf": "^3.0.2",
172-
"aegir": "^36.1.3",
173-
"assert": "^2.0.0",
174-
"buffer": "^6.0.3",
175-
"interface-datastore-tests": "^2.0.3",
176+
"aegir": "^37.5.1",
177+
"interface-datastore-tests": "^3.0.0",
176178
"ipfs-utils": "^9.0.4",
177179
"level-mem": "^6.0.1",
180+
"memory-level": "^1.0.0",
178181
"multiformats": "^9.2.0",
179-
"rimraf": "^3.0.0",
180-
"util": "^0.12.3"
182+
"rimraf": "^3.0.2"
181183
}
182184
}

scripts/immediate.js

-1
This file was deleted.

scripts/node-globals.js

-3
This file was deleted.

0 commit comments

Comments
 (0)