Skip to content

Commit a90dca4

Browse files
deps(dev): bump aegir from 39.0.13 to 41.0.5 (#145)
Bumps [aegir](https://github.com/ipfs/aegir) from 39.0.13 to 41.0.5. - [Release notes](https://github.com/ipfs/aegir/releases) - [Changelog](https://github.com/ipfs/aegir/blob/master/CHANGELOG.md) - [Commits](ipfs/aegir@v39.0.13...v41.0.5) --- updated-dependencies: - dependency-name: aegir dependency-type: direct:development update-type: version-update:semver-major ... --------- Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: achingbrain <[email protected]>
1 parent 1b886c6 commit a90dca4

File tree

8 files changed

+92
-33
lines changed

8 files changed

+92
-33
lines changed

.github/dependabot.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ updates:
55
schedule:
66
interval: daily
77
time: "10:00"
8-
open-pull-requests-limit: 10
8+
open-pull-requests-limit: 20
99
commit-message:
1010
prefix: "deps"
1111
prefix-development: "deps(dev)"

.github/workflows/js-test-and-release.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@ on:
99

1010
permissions:
1111
contents: write
12+
id-token: write
1213
packages: write
14+
pull-requests: write
1315

1416
concurrency:
1517
group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.event_name == 'push' && github.sha || github.ref }}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
name: Semantic PR
2+
3+
on:
4+
pull_request_target:
5+
types:
6+
- opened
7+
- edited
8+
- synchronize
9+
10+
jobs:
11+
main:
12+
uses: pl-strflt/.github/.github/workflows/[email protected]

.github/workflows/stale.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
name: Close and mark stale issue
2+
3+
on:
4+
schedule:
5+
- cron: '0 0 * * *'
6+
7+
permissions:
8+
issues: write
9+
pull-requests: write
10+
11+
jobs:
12+
stale:
13+
uses: pl-strflt/.github/.github/workflows/[email protected]

README.md

Lines changed: 21 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -4,32 +4,13 @@
44
[![codecov](https://img.shields.io/codecov/c/github/multiformats/js-multiaddr-to-uri.svg?style=flat-square)](https://codecov.io/gh/multiformats/js-multiaddr-to-uri)
55
[![CI](https://img.shields.io/github/actions/workflow/status/multiformats/js-multiaddr-to-uri/js-test-and-release.yml?branch=master\&style=flat-square)](https://github.com/multiformats/js-multiaddr-to-uri/actions/workflows/js-test-and-release.yml?query=branch%3Amaster)
66

7-
> Convert a Multiaddr to a URI /dnsaddr/ipfs.io/http -> <http://ipfs.io>
7+
> Convert a Multiaddr to a URI
88
9-
## Table of contents <!-- omit in toc -->
9+
# About
1010

11-
- [Install](#install)
12-
- [Browser `<script>` tag](#browser-script-tag)
13-
- [Usage](#usage)
14-
- [API Docs](#api-docs)
15-
- [License](#license)
16-
- [Contribution](#contribution)
11+
This module allows easy conversion of Multiaddrs to URLs.
1712

18-
## Install
19-
20-
```console
21-
$ npm i @multiformats/multiaddr-to-uri
22-
```
23-
24-
### Browser `<script>` tag
25-
26-
Loading this module through a script tag will make it's exports available as `MultiformatsMultiaddrToUri` in the global namespace.
27-
28-
```html
29-
<script src="https://unpkg.com/@multiformats/multiaddr-to-uri/dist/index.min.js"></script>
30-
```
31-
32-
## Usage
13+
## Example - Converting multiaddrs to URLs
3314

3415
```js
3516
import { multiaddrToUri } from '@multiformats/multiaddr-to-uri'
@@ -54,17 +35,31 @@ Note:
5435
- is not a valid multiaddr
5536
- is not supported as a URI e.g. circuit
5637

57-
## API Docs
38+
# Install
39+
40+
```console
41+
$ npm i @multiformats/multiaddr-to-uri
42+
```
43+
44+
## Browser `<script>` tag
45+
46+
Loading this module through a script tag will make it's exports available as `MultiformatsMultiaddrToUri` in the global namespace.
47+
48+
```html
49+
<script src="https://unpkg.com/@multiformats/multiaddr-to-uri/dist/index.min.js"></script>
50+
```
51+
52+
# API Docs
5853

5954
- <https://multiformats.github.io/js-multiaddr-to-uri>
6055

61-
## License
56+
# License
6257

6358
Licensed under either of
6459

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

68-
## Contribution
63+
# Contribution
6964

7065
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.

package.json

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@multiformats/multiaddr-to-uri",
33
"version": "9.0.7",
4-
"description": "Convert a Multiaddr to a URI /dnsaddr/ipfs.io/http -> http://ipfs.io",
4+
"description": "Convert a Multiaddr to a URI",
55
"author": "Alan Shaw",
66
"license": "Apache-2.0 OR MIT",
77
"homepage": "https://github.com/multiformats/js-multiaddr-to-uri#readme",
@@ -12,15 +12,15 @@
1212
"bugs": {
1313
"url": "https://github.com/multiformats/js-multiaddr-to-uri/issues"
1414
},
15+
"publishConfig": {
16+
"access": "public",
17+
"provenance": true
18+
},
1519
"keywords": [
1620
"URL",
1721
"multiaddr",
1822
"toString"
1923
],
20-
"engines": {
21-
"node": ">=16.0.0",
22-
"npm": ">=7.0.0"
23-
},
2424
"type": "module",
2525
"types": "./dist/src/index.d.ts",
2626
"files": [
@@ -38,6 +38,7 @@
3838
"eslintConfig": {
3939
"extends": "ipfs",
4040
"parserOptions": {
41+
"project": true,
4142
"sourceType": "module"
4243
}
4344
},
@@ -146,6 +147,6 @@
146147
"@multiformats/multiaddr": "^12.0.0"
147148
},
148149
"devDependencies": {
149-
"aegir": "^39.0.7"
150+
"aegir": "^42.2.2"
150151
}
151152
}

src/index.ts

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,34 @@
1+
/**
2+
* @packageDocumentation
3+
*
4+
* This module allows easy conversion of Multiaddrs to URLs.
5+
*
6+
* @example Converting multiaddrs to URLs
7+
*
8+
* ```js
9+
* import { multiaddrToUri } from '@multiformats/multiaddr-to-uri'
10+
*
11+
* console.log(multiaddrToUri('/dnsaddr/protocol.ai/https'))
12+
* // -> https://protocol.ai
13+
*
14+
* console.log(multiaddrToUri('/ip4/127.0.0.1/tcp/8080'))
15+
* // -> http://127.0.0.1:8080
16+
*
17+
* console.log(multiaddrToUri('/ip4/127.0.0.1/tcp/8080', { assumeHttp: false }))
18+
* // -> tcp://127.0.0.1:8080
19+
* ```
20+
*
21+
* Note:
22+
*
23+
* - When `/tcp` is the last (terminating) protocol HTTP is assumed by default (implicit `assumeHttp: true`)
24+
* - this means produced URIs will start with `http://` instead of `tcp://`
25+
* - passing `{ assumeHttp: false }` disables this behavior
26+
* - Might be lossy - e.g. a DNSv6 multiaddr
27+
* - Can throw if the passed multiaddr:
28+
* - is not a valid multiaddr
29+
* - is not supported as a URI e.g. circuit
30+
*/
31+
132
import { multiaddr, protocols } from '@multiformats/multiaddr'
233
import type { Multiaddr, StringTuple } from '@multiformats/multiaddr'
334

typedoc.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"entryPoints": [
3+
"./src/index.ts"
4+
]
5+
}

0 commit comments

Comments
 (0)