From cd0b3f343b26bc6e79daad916ca894f32e338788 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 16 Oct 2023 10:45:01 +0000 Subject: [PATCH 1/2] deps(dev): bump aegir from 39.0.13 to 41.0.5 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](https://github.com/ipfs/aegir/compare/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] --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 2d4f0e2..125b6bc 100644 --- a/package.json +++ b/package.json @@ -146,6 +146,6 @@ "@multiformats/multiaddr": "^12.0.0" }, "devDependencies": { - "aegir": "^39.0.7" + "aegir": "^41.0.5" } } From f6b07e57b5e00d77acc270fe7bf380ae039b92a3 Mon Sep 17 00:00:00 2001 From: achingbrain Date: Mon, 5 Feb 2024 17:40:10 +0100 Subject: [PATCH 2/2] chore: update project --- .github/dependabot.yml | 2 +- .github/workflows/js-test-and-release.yml | 2 + .github/workflows/semantic-pull-request.yml | 12 ++++++ .github/workflows/stale.yml | 13 ++++++ README.md | 47 +++++++++------------ package.json | 13 +++--- src/index.ts | 31 ++++++++++++++ typedoc.json | 5 +++ 8 files changed, 92 insertions(+), 33 deletions(-) create mode 100644 .github/workflows/semantic-pull-request.yml create mode 100644 .github/workflows/stale.yml create mode 100644 typedoc.json diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 0bc3b42..d401a77 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -5,7 +5,7 @@ updates: schedule: interval: daily time: "10:00" - open-pull-requests-limit: 10 + open-pull-requests-limit: 20 commit-message: prefix: "deps" prefix-development: "deps(dev)" diff --git a/.github/workflows/js-test-and-release.yml b/.github/workflows/js-test-and-release.yml index 2c7a14b..359eb97 100644 --- a/.github/workflows/js-test-and-release.yml +++ b/.github/workflows/js-test-and-release.yml @@ -9,7 +9,9 @@ on: permissions: contents: write + id-token: write packages: write + pull-requests: write concurrency: group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.event_name == 'push' && github.sha || github.ref }} diff --git a/.github/workflows/semantic-pull-request.yml b/.github/workflows/semantic-pull-request.yml new file mode 100644 index 0000000..bd00f09 --- /dev/null +++ b/.github/workflows/semantic-pull-request.yml @@ -0,0 +1,12 @@ +name: Semantic PR + +on: + pull_request_target: + types: + - opened + - edited + - synchronize + +jobs: + main: + uses: pl-strflt/.github/.github/workflows/reusable-semantic-pull-request.yml@v0.3 diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml new file mode 100644 index 0000000..16d65d7 --- /dev/null +++ b/.github/workflows/stale.yml @@ -0,0 +1,13 @@ +name: Close and mark stale issue + +on: + schedule: + - cron: '0 0 * * *' + +permissions: + issues: write + pull-requests: write + +jobs: + stale: + uses: pl-strflt/.github/.github/workflows/reusable-stale-issue.yml@v0.3 diff --git a/README.md b/README.md index f84444d..21a7353 100644 --- a/README.md +++ b/README.md @@ -4,32 +4,13 @@ [![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) [![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) -> Convert a Multiaddr to a URI /dnsaddr/ipfs.io/http -> +> Convert a Multiaddr to a URI -## Table of contents +# About -- [Install](#install) - - [Browser ` -``` - -## Usage +## Example - Converting multiaddrs to URLs ```js import { multiaddrToUri } from '@multiformats/multiaddr-to-uri' @@ -54,17 +35,31 @@ Note: - is not a valid multiaddr - is not supported as a URI e.g. circuit -## API Docs +# Install + +```console +$ npm i @multiformats/multiaddr-to-uri +``` + +## Browser ` +``` + +# API Docs - -## License +# License Licensed under either of - Apache 2.0, ([LICENSE-APACHE](LICENSE-APACHE) / ) - MIT ([LICENSE-MIT](LICENSE-MIT) / ) -## Contribution +# 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. diff --git a/package.json b/package.json index 125b6bc..03a5e96 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@multiformats/multiaddr-to-uri", "version": "9.0.7", - "description": "Convert a Multiaddr to a URI /dnsaddr/ipfs.io/http -> http://ipfs.io", + "description": "Convert a Multiaddr to a URI", "author": "Alan Shaw", "license": "Apache-2.0 OR MIT", "homepage": "https://github.com/multiformats/js-multiaddr-to-uri#readme", @@ -12,15 +12,15 @@ "bugs": { "url": "https://github.com/multiformats/js-multiaddr-to-uri/issues" }, + "publishConfig": { + "access": "public", + "provenance": true + }, "keywords": [ "URL", "multiaddr", "toString" ], - "engines": { - "node": ">=16.0.0", - "npm": ">=7.0.0" - }, "type": "module", "types": "./dist/src/index.d.ts", "files": [ @@ -38,6 +38,7 @@ "eslintConfig": { "extends": "ipfs", "parserOptions": { + "project": true, "sourceType": "module" } }, @@ -146,6 +147,6 @@ "@multiformats/multiaddr": "^12.0.0" }, "devDependencies": { - "aegir": "^41.0.5" + "aegir": "^42.2.2" } } diff --git a/src/index.ts b/src/index.ts index 00cacbd..fb01a8a 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,3 +1,34 @@ +/** + * @packageDocumentation + * + * This module allows easy conversion of Multiaddrs to URLs. + * + * @example Converting multiaddrs to URLs + * + * ```js + * import { multiaddrToUri } from '@multiformats/multiaddr-to-uri' + * + * console.log(multiaddrToUri('/dnsaddr/protocol.ai/https')) + * // -> https://protocol.ai + * + * console.log(multiaddrToUri('/ip4/127.0.0.1/tcp/8080')) + * // -> http://127.0.0.1:8080 + * + * console.log(multiaddrToUri('/ip4/127.0.0.1/tcp/8080', { assumeHttp: false })) + * // -> tcp://127.0.0.1:8080 + * ``` + * + * Note: + * + * - When `/tcp` is the last (terminating) protocol HTTP is assumed by default (implicit `assumeHttp: true`) + * - this means produced URIs will start with `http://` instead of `tcp://` + * - passing `{ assumeHttp: false }` disables this behavior + * - Might be lossy - e.g. a DNSv6 multiaddr + * - Can throw if the passed multiaddr: + * - is not a valid multiaddr + * - is not supported as a URI e.g. circuit + */ + import { multiaddr, protocols } from '@multiformats/multiaddr' import type { Multiaddr, StringTuple } from '@multiformats/multiaddr' diff --git a/typedoc.json b/typedoc.json new file mode 100644 index 0000000..f599dc7 --- /dev/null +++ b/typedoc.json @@ -0,0 +1,5 @@ +{ + "entryPoints": [ + "./src/index.ts" + ] +}