From 8ab55f2bc6be51c07798f1b414cbf6f8e8b169c3 Mon Sep 17 00:00:00 2001 From: Franck Royer Date: Thu, 13 May 2021 19:56:01 +1000 Subject: [PATCH 1/2] reset-hard to install examples --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index b622915370..3e15605f78 100644 --- a/package.json +++ b/package.json @@ -48,7 +48,7 @@ "doc:json": "typedoc src/ --exclude **/*.spec.ts --json build/docs/typedoc.json", "doc:publish": "gh-pages -m \"[ci skip] Updates\" -d build/docs", "version": "standard-version", - "reset-hard": "git clean -dfx && git reset --hard && npm i", + "reset-hard": "git clean -dfx && git reset --hard && npm i && npm run build && for d in examples/*; do (cd $d; npm i); done", "prepare-release": "run-s reset-hard test cov:check doc:html version doc:publish" }, "engines": { From 065593b0cf5ffbce428b3d5f0604b3fb8f41469a Mon Sep 17 00:00:00 2001 From: Franck Royer Date: Thu, 13 May 2021 16:49:29 +1000 Subject: [PATCH 2/2] Revert naming to js-waku To align with go-waku and nim-waku and keep bors working. --- .github/workflows/add-action-project.yml | 4 +-- .github/workflows/deploy-gh-pages.yml | 6 ++-- .github/workflows/examples-ci.yml | 4 +-- CHANGELOG.md | 1 + CONTRIBUTING.md | 8 ++--- README.md | 38 ++++++++++++------------ examples/cli-chat/README.md | 4 +-- examples/cli-chat/package-lock.json | 22 +++++++------- examples/cli-chat/package.json | 10 +++---- examples/cli-chat/src/chat.spec.ts | 2 +- examples/cli-chat/src/chat.ts | 4 +-- examples/web-chat/README.md | 4 +-- examples/web-chat/package-lock.json | 16 +++++----- examples/web-chat/package.json | 8 ++--- examples/web-chat/public/index.html | 2 +- examples/web-chat/public/manifest.json | 2 +- examples/web-chat/src/App.tsx | 2 +- examples/web-chat/src/ChatList.tsx | 2 +- examples/web-chat/src/Room.tsx | 2 +- examples/web-chat/src/WakuContext.ts | 2 +- examples/web-chat/src/command.ts | 2 +- package-lock.json | 4 +-- package.json | 4 +-- src/test_utils/index.ts | 2 +- 24 files changed, 78 insertions(+), 77 deletions(-) diff --git a/.github/workflows/add-action-project.yml b/.github/workflows/add-action-project.yml index 3557a9e9ce..5ecdd10d8b 100644 --- a/.github/workflows/add-action-project.yml +++ b/.github/workflows/add-action-project.yml @@ -1,4 +1,4 @@ -name: Add new issues to waku-js project board +name: Add new issues to js-waku project board on: issues: @@ -10,6 +10,6 @@ jobs: steps: - uses: alex-page/github-project-automation-plus@v0.6.0 with: - project: waku-js + project: js-waku column: New repo-token: ${{ secrets.GH_ACTION_PROJECT_MGMT }} diff --git a/.github/workflows/deploy-gh-pages.yml b/.github/workflows/deploy-gh-pages.yml index e0b98c2542..050a87edb6 100644 --- a/.github/workflows/deploy-gh-pages.yml +++ b/.github/workflows/deploy-gh-pages.yml @@ -15,7 +15,7 @@ jobs: - name: Set git author identity run: | - git config user.name "GitHub Action On waku-js Repo" + git config user.name "GitHub Action On js-waku Repo" git config user.email "franck+ghpages@status.im" - name: Install NodeJS @@ -29,10 +29,10 @@ jobs: path: ~/.npm key: node-v1-${{ hashFiles('**/package-lock.json') }} - - name: "[waku-js] install using npm ci" + - name: "[js-waku] install using npm ci" uses: bahmutov/npm-install@v1 - - name: "[waku-js] build" + - name: "[js-waku] build" run: npm run build - name: install using npm i diff --git a/.github/workflows/examples-ci.yml b/.github/workflows/examples-ci.yml index 3d602669ae..ac2a7c72cd 100644 --- a/.github/workflows/examples-ci.yml +++ b/.github/workflows/examples-ci.yml @@ -30,10 +30,10 @@ jobs: path: ~/.npm key: examples-node-v1-${{ hashFiles('**/package-lock.json') }} - - name: "[waku-js] install using npm ci" + - name: "[js-waku] install using npm ci" uses: bahmutov/npm-install@v1 - - name: "[waku-js] build" + - name: "[js-waku] build" run: npm run build - name: ${{ matrix.example }} install using npm i diff --git a/CHANGELOG.md b/CHANGELOG.md index ba9725419e..e993913632 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed - Enable passing `string`s to `addPeerToAddressBook`. - Use `addPeerToAddressBook` in examples and usage doc. +- Settle on `js-waku` name across the board. ## [0.1.0] - 2021-05-12 diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 6ba69f00cb..4c9612ad08 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -2,10 +2,10 @@ Contributors are welcomed! -We try to keep a number of [`good first issue`](https://github.com/status-im/waku-js/labels/good%20first%20issue) for new contributors. -If you feel confident, you can also check out the [`help wanted`](https://github.com/status-im/waku-js/labels/help%20wanted) issues. +We try to keep a number of [`good first issue`](https://github.com/status-im/js-waku/labels/good%20first%20issue) for new contributors. +If you feel confident, you can also check out the [`help wanted`](https://github.com/status-im/js-waku/labels/help%20wanted) issues. -To have an idea of the work in the pipeline, feel free to view the [waku-js project board](https://github.com/status-im/waku-js/projects/1). +To have an idea of the work in the pipeline, feel free to view the [js-waku project board](https://github.com/status-im/js-waku/projects/1). This project board is to prioritize the work of core contributors so do not be deterred by issues in the `Icebox` or bottom of the `Backlog`. Do note that we have a [CI](./.github/workflows/ci.yml) powered by GitHub Action. @@ -25,7 +25,7 @@ To build and test this repository, you need: To ensure interoperability with [nim-waku](https://github.com/status-im/nim-waku/), some tests are run against a nim-waku node. This is why `nim-waku` is present as a [git submodule](https://git-scm.com/book/en/v2/Git-Tools-Submodules), which itself contain several submodules. -At this stage, it is not possible to exclude nim-waku tests, hence `git submodule update --init --recursive` is run before testing (see [`pretest` script](https://github.com/status-im/waku-js/blob/main/package.json)). +At this stage, it is not possible to exclude nim-waku tests, hence `git submodule update --init --recursive` is run before testing (see [`pretest` script](https://github.com/status-im/js-waku/blob/main/package.json)). To build nim-waku, you also need [Rust](https://www.rust-lang.org/tools/install). diff --git a/README.md b/README.md index 347e969458..63cf3693d3 100644 --- a/README.md +++ b/README.md @@ -1,19 +1,19 @@ -# WakuJS +# js-waku A JavaScript implementation of the [Waku v2 protocol](https://rfc.vac.dev/spec/10/). ## Usage -Install `waku-js` package: +Install `js-waku` package: ```shell -npm install waku-js +npm install js-waku ``` Start a waku node: ```javascript -import { Waku } from 'waku-js'; +import { Waku } from 'js-waku'; const waku = await Waku.create(); ``` @@ -49,7 +49,7 @@ waku.relay.addObserver((msg) => { Send a message on the waku relay network: ```javascript -import { WakuMessage } from 'waku-js'; +import { WakuMessage } from 'js-waku'; const msg = WakuMessage.fromUtf8String("Here is a message!", "waku/2/my-cool-app/proto") await waku.relay.send(msg); @@ -78,7 +78,7 @@ waku.store.queryHistory(storePeerId, ["waku/2/my-cool-app/proto"], ``` Find more [examples](#examples) below -or checkout the latest `main` branch documentation at [https://status-im.github.io/waku-js/docs/](https://status-im.github.io/waku-js/docs/). +or checkout the latest `main` branch documentation at [https://status-im.github.io/js-waku/docs/](https://status-im.github.io/js-waku/docs/). Docs can also be generated locally using: @@ -89,7 +89,7 @@ npm run doc ## Waku Protocol Support -You can track progress on the [project board](https://github.com/status-im/waku-js/projects/1). +You can track progress on the [project board](https://github.com/status-im/js-waku/projects/1). - ✔: Supported - 🚧: Implementation in progress @@ -113,28 +113,28 @@ You can track progress on the [project board](https://github.com/status-im/waku- ## Bugs, Questions & Features -If you encounter any bug or would like to propose new features, feel free to [open an issue](https://github.com/status-im/waku-js/issues/new/). +If you encounter any bug or would like to propose new features, feel free to [open an issue](https://github.com/status-im/js-waku/issues/new/). -For support, questions & more general topics, please join the discussion on the [Vac forum](https://forum.vac.dev/tag/waku-js) (use _\#js-waku_ tag). +For support, questions & more general topics, please join the discussion on the [Vac forum](https://forum.vac.dev/tag/js-waku) (use _\#js-waku_ tag). ## Examples ## Web Chat App (ReactJS) A ReactJS chat app is provided as a showcase of the library used in the browser. -A deployed version is available at https://status-im.github.io/waku-js/ +A deployed version is available at https://status-im.github.io/js-waku/ -Find the code in the [examples folder](https://github.com/status-im/waku-js/tree/main/examples/web-chat). +Find the code in the [examples folder](https://github.com/status-im/js-waku/tree/main/examples/web-chat). To run a development version locally, do: ```shell -git clone https://github.com/status-im/waku-js/ ; cd waku-js -npm install # Install dependencies for waku-js -npm run build # Build waku-js +git clone https://github.com/status-im/js-waku/ ; cd js-waku +npm install # Install dependencies for js-waku +npm run build # Build js-waku cd examples/web-chat npm install # Install dependencies for the web app -npm run start # Start development server to serve the web app on http://localhost:3000/waku-js +npm run start # Start development server to serve the web app on http://localhost:3000/js-waku ``` Use `/help` to see the available commands. @@ -144,7 +144,7 @@ Use `/help` to see the available commands. A node chat app is provided as a working example of the library. It is interoperable with the [nim-waku chat app example](https://github.com/status-im/nim-waku/blob/master/examples/v2/chat2.nim). -Find the code in the [examples folder](https://github.com/status-im/waku-js/tree/main/examples/cli-chat). +Find the code in the [examples folder](https://github.com/status-im/js-waku/tree/main/examples/cli-chat). To run the chat app, first ensure you have [Node.js](https://nodejs.org/en/) v14 or above: @@ -155,9 +155,9 @@ node --version Then, install and run: ```shell -git clone https://github.com/status-im/waku-js/ ; cd waku-js -npm install # Install dependencies for waku-js -npm run build # Build waku-js +git clone https://github.com/status-im/js-waku/ ; cd js-waku +npm install # Install dependencies for js-waku +npm run build # Build js-waku cd examples/cli-chat npm install # Install dependencies for the cli app npm run start -- --staticNode /ip4/134.209.139.210/tcp/30303/p2p/16Uiu2HAmPLe7Mzm8TsYUubgCAW1aJoeFScxrLj8ppHFivPo97bUZ diff --git a/examples/cli-chat/README.md b/examples/cli-chat/README.md index af3671430f..14a50e890a 100644 --- a/examples/cli-chat/README.md +++ b/examples/cli-chat/README.md @@ -1,3 +1,3 @@ -# A NodeJS CLI Chat App powered by waku-js +# A NodeJS CLI Chat App powered by js-waku -See waku-js [README](../../README.md#cli-chat-app-nodejs) for details. +See js-waku [README](../../README.md#cli-chat-app-nodejs) for details. diff --git a/examples/cli-chat/package-lock.json b/examples/cli-chat/package-lock.json index e9d945ef23..db5dd591de 100644 --- a/examples/cli-chat/package-lock.json +++ b/examples/cli-chat/package-lock.json @@ -1,17 +1,17 @@ { - "name": "waku-js-cli-chat", + "name": "js-waku-cli-chat", "version": "0.1.0", "lockfileVersion": 2, "requires": true, "packages": { "": { - "name": "waku-js-cli-chat", + "name": "js-waku-cli-chat", "version": "0.1.0", "license": "MIT OR Apache-2.0", "dependencies": { + "js-waku": "../../build/main", "libp2p-tcp": "^0.15.4", - "prompt-sync": "^4.2.0", - "waku-js": "../../build/main" + "prompt-sync": "^4.2.0" }, "devDependencies": { "@istanbuljs/nyc-config-typescript": "^1.0.1", @@ -4437,6 +4437,10 @@ "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", "dev": true }, + "node_modules/js-waku": { + "resolved": "../../build/main", + "link": true + }, "node_modules/js-yaml": { "version": "3.14.1", "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.1.tgz", @@ -7509,10 +7513,6 @@ "integrity": "sha512-jkjy6pjU1fxUvI51P+gCsxg1u2n8LSt0W6KrCNQceaziKzff74GoWmjVG46KieVzybO1sttPQmYfrwSHey7GUA==", "dev": true }, - "node_modules/waku-js": { - "resolved": "../../build/main", - "link": true - }, "node_modules/which": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", @@ -11205,6 +11205,9 @@ "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", "dev": true }, + "js-waku": { + "version": "file:../../build/main" + }, "js-yaml": { "version": "3.14.1", "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.1.tgz", @@ -13563,9 +13566,6 @@ "integrity": "sha512-jkjy6pjU1fxUvI51P+gCsxg1u2n8LSt0W6KrCNQceaziKzff74GoWmjVG46KieVzybO1sttPQmYfrwSHey7GUA==", "dev": true }, - "waku-js": { - "version": "file:../../build/main" - }, "which": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", diff --git a/examples/cli-chat/package.json b/examples/cli-chat/package.json index 2119f51d6a..87324dd4cc 100644 --- a/examples/cli-chat/package.json +++ b/examples/cli-chat/package.json @@ -1,9 +1,9 @@ { - "name": "waku-js-cli-chat", + "name": "js-waku-cli-chat", "version": "0.1.0", - "description": "A NodeJS CLI Chat App powered by waku-js", + "description": "A NodeJS CLI Chat App powered by js-waku", "main": "./index.ts", - "repository": "https://github.com/status-im/waku-js", + "repository": "https://github.com/status-im/js-waku", "license": "MIT OR Apache-2.0", "keywords": [ "waku", @@ -31,9 +31,9 @@ "node": ">=14" }, "dependencies": { + "js-waku": "../../build/main", "libp2p-tcp": "^0.15.4", - "prompt-sync": "^4.2.0", - "waku-js": "../../build/main" + "prompt-sync": "^4.2.0" }, "devDependencies": { "@istanbuljs/nyc-config-typescript": "^1.0.1", diff --git a/examples/cli-chat/src/chat.spec.ts b/examples/cli-chat/src/chat.spec.ts index da45574dca..da305066ff 100644 --- a/examples/cli-chat/src/chat.spec.ts +++ b/examples/cli-chat/src/chat.spec.ts @@ -1,5 +1,5 @@ import { expect } from 'chai'; -import { ChatMessage } from 'waku-js'; +import { ChatMessage } from 'js-waku'; import { formatMessage } from './chat'; diff --git a/examples/cli-chat/src/chat.ts b/examples/cli-chat/src/chat.ts index 7f9215700b..893fd40cad 100644 --- a/examples/cli-chat/src/chat.ts +++ b/examples/cli-chat/src/chat.ts @@ -1,9 +1,9 @@ import readline from 'readline'; import util from 'util'; +import { ChatMessage, StoreCodec, Waku, WakuMessage } from 'js-waku'; import TCP from 'libp2p-tcp'; import { multiaddr, Multiaddr } from 'multiaddr'; -import { ChatMessage, StoreCodec, Waku, WakuMessage } from 'waku-js'; const ChatContentTopic = 'dingpu'; @@ -25,7 +25,7 @@ export default async function startChat(): Promise { output: process.stdout, }); - let nick = 'waku-js'; + let nick = 'js-waku'; try { const question = util.promisify(rl.question).bind(rl); // Looks like wrong type definition of promisify is picked. diff --git a/examples/web-chat/README.md b/examples/web-chat/README.md index e0002bb506..b1d1a966d2 100644 --- a/examples/web-chat/README.md +++ b/examples/web-chat/README.md @@ -1,3 +1,3 @@ -# A React Web Chat App powered by waku-js +# A React Web Chat App powered by js-waku -See waku-js [README](../../README.md#web-chat-app-reactjs) for details. +See js-waku [README](../../README.md#web-chat-app-reactjs) for details. diff --git a/examples/web-chat/package-lock.json b/examples/web-chat/package-lock.json index babdc594c0..2024100e28 100644 --- a/examples/web-chat/package-lock.json +++ b/examples/web-chat/package-lock.json @@ -8,10 +8,10 @@ "version": "0.1.0", "dependencies": { "@livechat/ui-kit": "*", + "js-waku": "../../build/main", "react": "^16.14.0", "react-dom": "^16.14.0", "server-name-generator": "^1.0.5", - "waku-js": "../../build/main", "web-vitals": "^1.1.1" }, "devDependencies": { @@ -14537,6 +14537,10 @@ "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==" }, + "node_modules/js-waku": { + "resolved": "../../build/main", + "link": true + }, "node_modules/js-yaml": { "version": "3.14.1", "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.1.tgz", @@ -22885,10 +22889,6 @@ "node": ">=10" } }, - "node_modules/waku-js": { - "resolved": "../../build/main", - "link": true - }, "node_modules/walker": { "version": "1.0.7", "resolved": "https://registry.npmjs.org/walker/-/walker-1.0.7.tgz", @@ -36512,6 +36512,9 @@ "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==" }, + "js-waku": { + "version": "file:../../build/main" + }, "js-yaml": { "version": "3.14.1", "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.1.tgz", @@ -43270,9 +43273,6 @@ "xml-name-validator": "^3.0.0" } }, - "waku-js": { - "version": "file:../../build/main" - }, "walker": { "version": "1.0.7", "resolved": "https://registry.npmjs.org/walker/-/walker-1.0.7.tgz", diff --git a/examples/web-chat/package.json b/examples/web-chat/package.json index 95283d8e74..180eb49ea1 100644 --- a/examples/web-chat/package.json +++ b/examples/web-chat/package.json @@ -2,13 +2,13 @@ "name": "web-chat", "version": "0.1.0", "private": true, - "homepage": "/waku-js", + "homepage": "/js-waku", "dependencies": { "@livechat/ui-kit": "*", + "js-waku": "../../build/main", "react": "^16.14.0", "react-dom": "^16.14.0", "server-name-generator": "^1.0.5", - "waku-js": "../../build/main", "web-vitals": "^1.1.1" }, "devDependencies": { @@ -38,8 +38,8 @@ "test:spelling": "cspell \"{README.md,.github/*.md,src/**/*.{ts,tsx},public/**/*.html}\" -c ../../.cspell.json", "fix:prettier": "prettier \"src/**/*.{ts,tsx}\" \"./*.json\" --write", "fix:lint": "eslint src --ext .ts --ext .tsx --fix", - "waku-js:build": "cd ../; npm run build", - "predeploy": "run-s waku-js:build build", + "js-waku:build": "cd ../; npm run build", + "predeploy": "run-s js-waku:build build", "deploy": "gh-pages -d build" }, "eslintConfig": { diff --git a/examples/web-chat/public/index.html b/examples/web-chat/public/index.html index 82c8e1bf6e..a620c9fec6 100644 --- a/examples/web-chat/public/index.html +++ b/examples/web-chat/public/index.html @@ -7,7 +7,7 @@