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

Commit

Permalink
feat: convert to typescript (#32)
Browse files Browse the repository at this point in the history
- Converts to typescript
- Only named exports
- No more CJS, only ESM
- Runs tests on all supported environments
- Adds auto-publish
- Adds dependabot

BREAKING CHANGE: switch to named exports, ESM only
  • Loading branch information
achingbrain authored Feb 18, 2022
1 parent 2aa4307 commit 89cc2ef
Show file tree
Hide file tree
Showing 28 changed files with 512 additions and 445 deletions.
8 changes: 8 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
version: 2
updates:
- package-ecosystem: npm
directory: "/"
schedule:
interval: daily
time: "10:00"
open-pull-requests-limit: 10
23 changes: 3 additions & 20 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,21 +1,4 @@
MIT License
This project is dual licensed under MIT and Apache-2.0.

Copyright (c) 2017 libp2p

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
MIT: https://www.opensource.org/licenses/mit
Apache-2.0: https://www.apache.org/licenses/license-2.0
5 changes: 5 additions & 0 deletions LICENSE-APACHE
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
19 changes: 19 additions & 0 deletions LICENSE-MIT
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
The MIT License (MIT)

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
23 changes: 16 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,13 @@
[![Discourse posts](https://img.shields.io/discourse/https/discuss.libp2p.io/posts.svg)](https://discuss.libp2p.io)
[![standard-readme compliant](https://img.shields.io/badge/standard--readme-OK-green.svg?style=flat-square)](https://github.com/RichardLitt/standard-readme)
[![Coverage Status](https://coveralls.io/repos/github/libp2p/js-libp2p-record/badge.svg?branch=master)](https://coveralls.io/github/libp2p/js-libp2p-record?branch=master)
[![Travis CI](https://travis-ci.org/libp2p/js-libp2p-record.svg?branch=master)](https://travis-ci.org/libp2p/js-libp2p-record)
[![Circle CI](https://circleci.com/gh/libp2p/js-libp2p-record.svg?style=svg)](https://circleci.com/gh/libp2p/js-libp2p-record)
[![Build Status](https://github.com/libp2p/js-libp2p-record/actions/workflows/js-test-and-release.yml/badge.svg?branch=main)](https://github.com/libp2p/js-libp2p-record/actions/workflows/js-test-and-release.yml)
[![Dependency Status](https://david-dm.org/libp2p/js-libp2p-record.svg?style=flat-square)](https://david-dm.org/libp2p/js-libp2p-record) [![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%3D6.0.0-orange.svg?style=flat-square)

> JavaScript implementation of libp2p record.
## Lead Maintainer

[Vasco Santos](https://github.com/vasco-santos).

## Description

Implementation of [go-libp2p-record](https://github.com/libp2p/go-libp2p-record) in JavaScript.
Expand All @@ -26,6 +21,20 @@ Implementation of [go-libp2p-record](https://github.com/libp2p/go-libp2p-record)

See https://libp2p.github.io/js-libp2p-record/

## Contribute

The libp2p implementation in JavaScript is a work in progress. As such, there are a few things you can do right now to help out:

- Go through the modules and **check out existing issues**. This is especially useful for modules in active development. Some knowledge of IPFS/libp2p may be required, as well as the infrastructure behind it - for instance, you may need to read up on p2p and more complex operations like muxing to be able to help technically.
- **Perform code reviews**. More eyes will help a) speed the project along b) ensure quality and c) reduce possible future bugs.

## License

MIT
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)

### Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.
197 changes: 146 additions & 51 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,79 +1,174 @@
{
"name": "libp2p-record",
"name": "@libp2p/record",
"version": "0.10.6",
"description": "libp2p record implementation",
"leadMaintainer": "Vasco Santos <vasco.santos@moxy.studio>",
"main": "src/index.js",
"scripts": {
"test": "aegir test",
"lint": "aegir lint",
"test:node": "aegir test -t node",
"test:browser": "aegir test -t browser -t webworker",
"prepare": "npm run build",
"build": "run-s build:*",
"build:types": "aegir build --no-bundle",
"build:proto": "pbjs -t static-module -w commonjs -r libp2p-record --force-number --no-verify --no-delimited --no-create --no-beautify --no-defaults --lint eslint-disable -o src/record/record.js ./src/record/record.proto",
"build:proto-types": "pbts -o src/record/record.d.ts src/record/record.js",
"docs": "aegir docs",
"release": "aegir release",
"release-minor": "aegir release --type minor",
"release-major": "aegir release --type major",
"coverage": "aegir coverage"
},
"author": "Friedel Ziegelmayer <dignifiedquire@gmail.com>",
"license": "Apache-2.0 OR MIT",
"homepage": "https://github.com/libp2p/js-libp2p-record#readme",
"repository": {
"type": "git",
"url": "https://github.com/libp2p/js-libp2p-record.git"
"url": "git+https://github.com/libp2p/js-libp2p-record.git"
},
"bugs": {
"url": "https://github.com/libp2p/js-libp2p-record/issues"
},
"keywords": [
"IPFS"
],
"engines": {
"node": ">=14.0.0"
"node": ">=16.0.0",
"npm": ">=7.0.0"
},
"pre-push": [
"lint"
],
"author": "Friedel Ziegelmayer <dignifiedquire@gmail.com>",
"license": "MIT",
"bugs": {
"url": "https://github.com/libp2p/js-libp2p-record/issues"
"type": "module",
"types": "./dist/src/index.d.ts",
"typesVersions": {
"*": {
"*": [
"*",
"dist/*",
"dist/src/*",
"dist/src/*/index"
],
"src/*": [
"*",
"dist/*",
"dist/src/*",
"dist/src/*/index"
]
}
},
"homepage": "https://github.com/libp2p/js-libp2p-record",
"files": [
"src",
"dist"
"dist/src",
"!dist/test",
"!**/*.tsbuildinfo"
],
"exports": {
".": {
"import": "./dist/src/index.js"
},
"./selectors": {
"import": "./dist/src/selectors.js"
},
"./validators": {
"import": "./dist/src/validators.js"
}
},
"eslintConfig": {
"extends": "ipfs",
"parserOptions": {
"sourceType": "module"
},
"ignorePatterns": [
"src/record/record.d.ts"
"src/record.d.ts"
]
},
"types": "dist/src/index.d.ts",
"devDependencies": {
"aegir": "^35.0.1",
"libp2p-crypto": "^0.19.6",
"libp2p-interfaces": "^1.0.1",
"npm-run-all": "^4.1.5",
"peer-id": "^0.15.2",
"util": "^0.12.4"
"release": {
"branches": [
"master"
],
"plugins": [
[
"@semantic-release/commit-analyzer",
{
"preset": "conventionalcommits",
"releaseRules": [
{
"breaking": true,
"release": "major"
},
{
"revert": true,
"release": "patch"
},
{
"type": "feat",
"release": "minor"
},
{
"type": "fix",
"release": "patch"
},
{
"type": "chore",
"release": "patch"
},
{
"type": "docs",
"release": "patch"
},
{
"type": "test",
"release": "patch"
},
{
"scope": "no-release",
"release": false
}
]
}
],
[
"@semantic-release/release-notes-generator",
{
"preset": "conventionalcommits",
"presetConfig": {
"types": [
{
"type": "feat",
"section": "Features"
},
{
"type": "fix",
"section": "Bug Fixes"
},
{
"type": "chore",
"section": "Trivial Changes"
},
{
"type": "docs",
"section": "Trivial Changes"
},
{
"type": "test",
"section": "Tests"
}
]
}
}
],
"@semantic-release/changelog",
"@semantic-release/npm",
"@semantic-release/github",
"@semantic-release/git"
]
},
"scripts": {
"lint": "aegir lint",
"pretest": "npm run build",
"test": "aegir test -f ./dist/test",
"test:node": "npm run test -- -t node",
"test:chrome": "npm run test -- -t browser",
"test:chrome-webworker": "npm run test -- -t webworker",
"test:firefox": "npm run test -- -t browser -- --browser firefox",
"test:firefox-webworker": "npm run test -- -t webworker -- --browser firefox",
"build": "tsc",
"postbuild": "npm run build:copy-proto-files",
"generate:proto": "pbjs -t static-module -w es6 -r libp2p-record --force-number --no-verify --no-delimited --no-create --no-beautify --no-defaults --lint eslint-disable -o src/record/record.js ./src/record/record.proto",
"generate:proto-types": "pbts -o src/record/record.d.ts src/record/record.js",
"build:copy-proto-files": "cp src/record* dist/src",
"release": "semantic-release"
},
"dependencies": {
"err-code": "^3.0.1",
"multiformats": "^9.4.5",
"protobufjs": "^6.11.2",
"uint8arrays": "^3.0.0"
},
"contributors": [
"Vasco Santos <vasco.santos@moxy.studio>",
"David Dias <daviddias.p@gmail.com>",
"Alex Potsides <alex@achingbrain.net>",
"Hugo Dias <hugomrdias@gmail.com>",
"Jacob Heun <jacobheun@gmail.com>",
"Friedel Ziegelmayer <dignifiedquire@gmail.com>",
"ᴠɪᴄᴛᴏʀ ʙᴊᴇʟᴋʜᴏʟᴍ <victorbjelkholm@gmail.com>",
"Matt Joiner <anacrolix@gmail.com>",
"dirkmc <dirkmdev@gmail.com>",
"Alan Shaw <alan.shaw@protocol.ai>"
]
"devDependencies": {
"@libp2p/crypto": "^0.22.7",
"@libp2p/interfaces": "^1.3.3",
"aegir": "^36.1.3"
}
}
7 changes: 0 additions & 7 deletions src/index.js

This file was deleted.

Loading

0 comments on commit 89cc2ef

Please sign in to comment.