From ee04117730d9aeee7f46e5901b4c69065740bb7e Mon Sep 17 00:00:00 2001 From: Franck Royer Date: Tue, 11 May 2021 11:03:57 +1000 Subject: [PATCH 1/5] Rename package to `web3-waku` --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 1c3fdf1e2d..9d2cb69b0e 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "name": "js-waku", + "name": "web3-waku", "version": "1.0.0", "description": "TypeScript implementation of the Waku v2 protocol", "main": "build/main/index.js", From 0e9f2c2ecce70e01d76a30cb46c721c5bee9d428 Mon Sep 17 00:00:00 2001 From: Franck Royer Date: Tue, 11 May 2021 11:18:23 +1000 Subject: [PATCH 2/5] Add CHANGELOG.md --- CHANGELOG.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 CHANGELOG.md diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000000..deea78fb7a --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,17 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [Unreleased] + +### Added +- Support of [Waku v2 Relay](https://rfc.vac.dev/spec/11/). +- Support of [Waku v2 Store](https://rfc.vac.dev/spec/13/). +- [Node Chat App example](./examples/cli-chat). +- [ReactJS Chat App example](./examples/web-chat). +- [Typedoc Documentation](https://status-im.github.io/js-waku/docs). + +[Unreleased]: https://github.com/olivierlacan/keep-a-changelog/compare/f46ce77f57c08866873b5c80acd052e0ddba8bc9..HEAD From 0974f313fdd3ada96b7d7634b964ccb994a5b2d1 Mon Sep 17 00:00:00 2001 From: Franck Royer Date: Tue, 11 May 2021 11:33:20 +1000 Subject: [PATCH 3/5] Exclude test files from build --- .eslintrc.json | 2 +- package.json | 1 + tsconfig.dev.json | 7 +++++++ tsconfig.json | 2 +- tsconfig.module.json | 2 +- 5 files changed, 11 insertions(+), 3 deletions(-) create mode 100644 tsconfig.dev.json diff --git a/.eslintrc.json b/.eslintrc.json index a83ecf731f..d1b0d68f29 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -1,7 +1,7 @@ { "root": true, "parser": "@typescript-eslint/parser", - "parserOptions": { "project": "./tsconfig.json" }, + "parserOptions": { "project": "./tsconfig.dev.json" }, "env": { "es6": true }, "ignorePatterns": ["node_modules", "build", "coverage", "proto"], "plugins": ["import", "eslint-comments", "functional"], diff --git a/package.json b/package.json index 9d2cb69b0e..1fcd5f920f 100644 --- a/package.json +++ b/package.json @@ -16,6 +16,7 @@ "build": "run-s build:*", "build:main": "tsc -p tsconfig.json", "build:module": "tsc -p tsconfig.module.json", + "build:dev": "tsc -p tsconfig.dev.json", "fix": "run-s fix:*", "fix:prettier": "prettier \"src/**/*.ts\" \"./*.json\" --write", "fix:lint": "eslint src --ext .ts --fix", diff --git a/tsconfig.dev.json b/tsconfig.dev.json new file mode 100644 index 0000000000..5cdf5d2ea6 --- /dev/null +++ b/tsconfig.dev.json @@ -0,0 +1,7 @@ +{ + "extends": "./tsconfig", + "compilerOptions": { + "noEmit": true + }, + "exclude": ["node_modules/**"] +} diff --git a/tsconfig.json b/tsconfig.json index ac42bdb78f..3edb3bcf13 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -46,7 +46,7 @@ "typeRoots": ["node_modules/@types", "src/types"] }, "include": ["src/**/*.ts"], - "exclude": ["node_modules/**"], + "exclude": ["node_modules/**", "src/**/*.spec.ts", "src/test_utils"], "compileOnSave": false, "ts-node": { "files": true diff --git a/tsconfig.module.json b/tsconfig.module.json index 79be3a5c40..6aa86a5569 100644 --- a/tsconfig.module.json +++ b/tsconfig.module.json @@ -5,5 +5,5 @@ "outDir": "build/module", "module": "esnext" }, - "exclude": ["node_modules/**"] + "exclude": ["node_modules/**", "src/**/*.spec.ts", "src/test_utils"] } From 28572fccff8f669ebcc6c6de7c99755ed3090e45 Mon Sep 17 00:00:00 2001 From: Franck Royer Date: Tue, 11 May 2021 12:00:42 +1000 Subject: [PATCH 4/5] Rename to web3-waku in examples --- examples/cli-chat/package-lock.json | 6 +++--- examples/cli-chat/package.json | 2 +- examples/cli-chat/src/chat.spec.ts | 2 +- examples/cli-chat/src/chat.ts | 2 +- examples/web-chat/package-lock.json | 18 +++++++++--------- examples/web-chat/package.json | 4 ++-- 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 +- 11 files changed, 22 insertions(+), 22 deletions(-) diff --git a/examples/cli-chat/package-lock.json b/examples/cli-chat/package-lock.json index 6ce0f93968..21040d61ad 100644 --- a/examples/cli-chat/package-lock.json +++ b/examples/cli-chat/package-lock.json @@ -11,7 +11,7 @@ "dependencies": { "libp2p-tcp": "^0.15.4", "prompt-sync": "^4.2.0", - "waku": "../../build/main" + "web3-waku": "../../build/main" }, "devDependencies": { "@istanbuljs/nyc-config-typescript": "^1.0.1", @@ -7509,7 +7509,7 @@ "integrity": "sha512-jkjy6pjU1fxUvI51P+gCsxg1u2n8LSt0W6KrCNQceaziKzff74GoWmjVG46KieVzybO1sttPQmYfrwSHey7GUA==", "dev": true }, - "node_modules/waku": { + "node_modules/web3-waku": { "resolved": "../../build/main", "link": true }, @@ -13563,7 +13563,7 @@ "integrity": "sha512-jkjy6pjU1fxUvI51P+gCsxg1u2n8LSt0W6KrCNQceaziKzff74GoWmjVG46KieVzybO1sttPQmYfrwSHey7GUA==", "dev": true }, - "waku": { + "web3-waku": { "version": "file:../../build/main" }, "which": { diff --git a/examples/cli-chat/package.json b/examples/cli-chat/package.json index 2da2cf186d..ae76a8881a 100644 --- a/examples/cli-chat/package.json +++ b/examples/cli-chat/package.json @@ -33,7 +33,7 @@ "dependencies": { "libp2p-tcp": "^0.15.4", "prompt-sync": "^4.2.0", - "waku": "../../build/main" + "web3-waku": "../../build/main" }, "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 542db920a4..ebc4491778 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'; +import { ChatMessage } from 'web3-waku'; import { formatMessage } from './chat'; diff --git a/examples/cli-chat/src/chat.ts b/examples/cli-chat/src/chat.ts index bd83d3def8..54a9f0abc4 100644 --- a/examples/cli-chat/src/chat.ts +++ b/examples/cli-chat/src/chat.ts @@ -3,7 +3,7 @@ import util from 'util'; import TCP from 'libp2p-tcp'; import { multiaddr, Multiaddr } from 'multiaddr'; -import { ChatMessage, StoreCodec, Waku, WakuMessage } from 'waku'; +import { ChatMessage, StoreCodec, Waku, WakuMessage } from 'web3-waku'; const ChatContentTopic = 'dingpu'; diff --git a/examples/web-chat/package-lock.json b/examples/web-chat/package-lock.json index c0578cdb3a..dc8a02bdbb 100644 --- a/examples/web-chat/package-lock.json +++ b/examples/web-chat/package-lock.json @@ -11,8 +11,8 @@ "react": "^16.14.0", "react-dom": "^16.14.0", "server-name-generator": "^1.0.5", - "waku": "../../build/main", - "web-vitals": "^1.1.1" + "web-vitals": "^1.1.1", + "web3-waku": "../../build/main" }, "devDependencies": { "@testing-library/jest-dom": "^5.11.10", @@ -22885,10 +22885,6 @@ "node": ">=10" } }, - "node_modules/waku": { - "resolved": "../../build/main", - "link": true - }, "node_modules/walker": { "version": "1.0.7", "resolved": "https://registry.npmjs.org/walker/-/walker-1.0.7.tgz", @@ -23230,6 +23226,10 @@ "resolved": "https://registry.npmjs.org/web-vitals/-/web-vitals-1.1.1.tgz", "integrity": "sha512-jYOaqu01Ny1NvMwJ3dBJDUOJ2PGWknZWH4AUnvFOscvbdHMERIKT2TlgiAey5rVyfOePG7so2JcXXZdSnBvioQ==" }, + "node_modules/web3-waku": { + "resolved": "../../build/main", + "link": true + }, "node_modules/webidl-conversions": { "version": "6.1.0", "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-6.1.0.tgz", @@ -43270,9 +43270,6 @@ "xml-name-validator": "^3.0.0" } }, - "waku": { - "version": "file:../../build/main" - }, "walker": { "version": "1.0.7", "resolved": "https://registry.npmjs.org/walker/-/walker-1.0.7.tgz", @@ -43571,6 +43568,9 @@ "resolved": "https://registry.npmjs.org/web-vitals/-/web-vitals-1.1.1.tgz", "integrity": "sha512-jYOaqu01Ny1NvMwJ3dBJDUOJ2PGWknZWH4AUnvFOscvbdHMERIKT2TlgiAey5rVyfOePG7so2JcXXZdSnBvioQ==" }, + "web3-waku": { + "version": "file:../../build/main" + }, "webidl-conversions": { "version": "6.1.0", "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-6.1.0.tgz", diff --git a/examples/web-chat/package.json b/examples/web-chat/package.json index fd0172eae6..63ff09d5fa 100644 --- a/examples/web-chat/package.json +++ b/examples/web-chat/package.json @@ -8,8 +8,8 @@ "react": "^16.14.0", "react-dom": "^16.14.0", "server-name-generator": "^1.0.5", - "waku": "../../build/main", - "web-vitals": "^1.1.1" + "web-vitals": "^1.1.1", + "web3-waku": "../../build/main" }, "devDependencies": { "@testing-library/jest-dom": "^5.11.10", diff --git a/examples/web-chat/src/App.tsx b/examples/web-chat/src/App.tsx index 5288b0b667..e2b5ba871b 100644 --- a/examples/web-chat/src/App.tsx +++ b/examples/web-chat/src/App.tsx @@ -2,7 +2,7 @@ import { multiaddr } from 'multiaddr'; import PeerId from 'peer-id'; import { useEffect, useState } from 'react'; import './App.css'; -import { ChatMessage, WakuMessage, StoreCodec, Waku } from 'waku'; +import { ChatMessage, WakuMessage, StoreCodec, Waku } from 'web3-waku'; import handleCommand from './command'; import Room from './Room'; import { WakuContext } from './WakuContext'; diff --git a/examples/web-chat/src/ChatList.tsx b/examples/web-chat/src/ChatList.tsx index a714f86c70..121fd2b62d 100644 --- a/examples/web-chat/src/ChatList.tsx +++ b/examples/web-chat/src/ChatList.tsx @@ -1,5 +1,5 @@ import { useEffect, useRef, useState } from 'react'; -import { ChatMessage } from 'waku'; +import { ChatMessage } from 'web3-waku'; import { Message, MessageText, diff --git a/examples/web-chat/src/Room.tsx b/examples/web-chat/src/Room.tsx index 25ff6f5859..accc5a70b6 100644 --- a/examples/web-chat/src/Room.tsx +++ b/examples/web-chat/src/Room.tsx @@ -1,4 +1,4 @@ -import { ChatMessage, WakuMessage } from 'waku'; +import { ChatMessage, WakuMessage } from 'web3-waku'; import { ChatContentTopic } from './App'; import ChatList from './ChatList'; import MessageInput from './MessageInput'; diff --git a/examples/web-chat/src/WakuContext.ts b/examples/web-chat/src/WakuContext.ts index eb72723e6d..83aad00f9f 100644 --- a/examples/web-chat/src/WakuContext.ts +++ b/examples/web-chat/src/WakuContext.ts @@ -1,5 +1,5 @@ import { createContext, useContext } from 'react'; -import { Waku } from 'waku'; +import { Waku } from 'web3-waku'; export type WakuContextType = { waku?: Waku; diff --git a/examples/web-chat/src/command.ts b/examples/web-chat/src/command.ts index d59eea32db..20936b35c8 100644 --- a/examples/web-chat/src/command.ts +++ b/examples/web-chat/src/command.ts @@ -1,6 +1,6 @@ import { multiaddr } from 'multiaddr'; import PeerId from 'peer-id'; -import { Waku } from 'waku'; +import { Waku } from 'web3-waku'; function help(): string[] { return [ From 7c6730b4a35ed18e6f02f72aab5937de996a784f Mon Sep 17 00:00:00 2001 From: Franck Royer Date: Tue, 11 May 2021 13:35:53 +1000 Subject: [PATCH 5/5] Remove `declare` keyword which removes the values from generated JS --- src/lib/waku_relay/constants.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lib/waku_relay/constants.ts b/src/lib/waku_relay/constants.ts index cba56b1b7c..9cfee5660c 100644 --- a/src/lib/waku_relay/constants.ts +++ b/src/lib/waku_relay/constants.ts @@ -16,7 +16,7 @@ export const RelayDefaultTopic = '/waku/2/default-waku/proto'; * We will send gossip to RelayGossipFactor * (total number of non-mesh peers), or * RelayDlazy, whichever is greater. */ -export declare const RelayGossipFactor = 0.25; +export const RelayGossipFactor = 0.25; /** * GossipsubHeartbeatInitialDelay is the short delay before the heartbeat timer begins @@ -74,4 +74,4 @@ export const RelayOpportunisticGraftPeers = 2; * default if your system is pushing more than 5000 messages in GossipsubHistoryGossip heartbeats; * with the defaults this is 1666 messages/s. */ -export declare const RelayMaxIHaveLength = 5000; +export const RelayMaxIHaveLength = 5000;