From 316edff77801b49a58bfa512459557649a05dc2b Mon Sep 17 00:00:00 2001 From: Franck Royer Date: Wed, 5 May 2021 14:57:46 +1000 Subject: [PATCH] Move web-chat to examples folder --- .github/workflows/deploy-gh-pages.yml | 6 +-- .github/workflows/examples-ci.yml | 2 +- .github/workflows/webchat-ci.yml | 42 ----------------- README.md | 2 +- bors.toml | 2 +- {web-chat => examples/web-chat}/.cspell.json | 1 + {web-chat => examples/web-chat}/.gitignore | 0 .../web-chat}/.prettierignore | 0 examples/web-chat/README.md | 3 ++ .../web-chat}/package-lock.json | 13 ++---- {web-chat => examples/web-chat}/package.json | 2 +- .../web-chat}/public/index.html | 0 .../web-chat}/public/manifest.json | 0 .../web-chat}/public/robots.txt | 0 {web-chat => examples/web-chat}/src/App.css | 0 {web-chat => examples/web-chat}/src/App.tsx | 0 .../web-chat}/src/ChatList.tsx | 0 .../web-chat}/src/ChatMessage.ts | 0 .../web-chat}/src/MessageInput.tsx | 0 {web-chat => examples/web-chat}/src/Room.tsx | 0 .../web-chat}/src/WakuContext.ts | 0 .../web-chat}/src/WakuMock.test.ts | 0 .../web-chat}/src/WakuMock.ts | 0 .../web-chat}/src/command.ts | 2 +- {web-chat => examples/web-chat}/src/index.css | 0 {web-chat => examples/web-chat}/src/index.tsx | 0 .../web-chat}/src/react-app-env.d.ts | 0 .../web-chat}/src/setupTests.ts | 0 .../web-chat}/src/types/types.d.ts | 0 {web-chat => examples/web-chat}/tsconfig.json | 0 web-chat/README.md | 46 ------------------- 31 files changed, 17 insertions(+), 104 deletions(-) delete mode 100644 .github/workflows/webchat-ci.yml rename {web-chat => examples/web-chat}/.cspell.json (98%) rename {web-chat => examples/web-chat}/.gitignore (100%) rename {web-chat => examples/web-chat}/.prettierignore (100%) create mode 100644 examples/web-chat/README.md rename {web-chat => examples/web-chat}/package-lock.json (99%) rename {web-chat => examples/web-chat}/package.json (97%) rename {web-chat => examples/web-chat}/public/index.html (100%) rename {web-chat => examples/web-chat}/public/manifest.json (100%) rename {web-chat => examples/web-chat}/public/robots.txt (100%) rename {web-chat => examples/web-chat}/src/App.css (100%) rename {web-chat => examples/web-chat}/src/App.tsx (100%) rename {web-chat => examples/web-chat}/src/ChatList.tsx (100%) rename {web-chat => examples/web-chat}/src/ChatMessage.ts (100%) rename {web-chat => examples/web-chat}/src/MessageInput.tsx (100%) rename {web-chat => examples/web-chat}/src/Room.tsx (100%) rename {web-chat => examples/web-chat}/src/WakuContext.ts (100%) rename {web-chat => examples/web-chat}/src/WakuMock.test.ts (100%) rename {web-chat => examples/web-chat}/src/WakuMock.ts (100%) rename {web-chat => examples/web-chat}/src/command.ts (98%) rename {web-chat => examples/web-chat}/src/index.css (100%) rename {web-chat => examples/web-chat}/src/index.tsx (100%) rename {web-chat => examples/web-chat}/src/react-app-env.d.ts (100%) rename {web-chat => examples/web-chat}/src/setupTests.ts (100%) rename {web-chat => examples/web-chat}/src/types/types.d.ts (100%) rename {web-chat => examples/web-chat}/tsconfig.json (100%) delete mode 100644 web-chat/README.md diff --git a/.github/workflows/deploy-gh-pages.yml b/.github/workflows/deploy-gh-pages.yml index df78baa4ac..15c5a2dadd 100644 --- a/.github/workflows/deploy-gh-pages.yml +++ b/.github/workflows/deploy-gh-pages.yml @@ -37,14 +37,14 @@ jobs: - name: install using npm i run: npm install - working-directory: web-chat + working-directory: examples/web-chat - name: build web app run: npm run build - working-directory: web-chat + working-directory: examples/web-chat - name: Deploy web chat app on gh pages uses: peaceiris/actions-gh-pages@v3 with: github_token: ${{ secrets.GITHUB_TOKEN }} - publish_dir: ./web-chat/build + publish_dir: ./examples/web-chat/build diff --git a/.github/workflows/examples-ci.yml b/.github/workflows/examples-ci.yml index a9058f46eb..ac2a7c72cd 100644 --- a/.github/workflows/examples-ci.yml +++ b/.github/workflows/examples-ci.yml @@ -12,7 +12,7 @@ jobs: examples_build_and_test: strategy: matrix: - example: [ cli-chat ] + example: [ cli-chat, web-chat ] runs-on: ubuntu-latest steps: diff --git a/.github/workflows/webchat-ci.yml b/.github/workflows/webchat-ci.yml deleted file mode 100644 index 22eda8d492..0000000000 --- a/.github/workflows/webchat-ci.yml +++ /dev/null @@ -1,42 +0,0 @@ -name: Webchat CI - -on: - push: - branches: - - 'main' - - 'staging' - - 'trying' - pull_request: - -jobs: - web_chat_build_and_test: - runs-on: ubuntu-latest - steps: - - - name: Checkout code - uses: actions/checkout@v2 - - - name: Install NodeJS - uses: actions/setup-node@v2 - with: - node-version: '14' - - - name: Cache npm cache - uses: actions/cache@v2 - with: - path: ~/.npm - key: node-v1-${{ hashFiles('**/package-lock.json') }} - - - name: "[js-waku] install using npm ci" - uses: bahmutov/npm-install@v1 - - - name: "[js-waku] build" - run: npm run build - - - name: install using npm i - run: npm install - working-directory: web-chat - - - name: test - run: npm run test - working-directory: web-chat diff --git a/README.md b/README.md index 020d0263b5..d2b274bb87 100644 --- a/README.md +++ b/README.md @@ -46,7 +46,7 @@ To run a development version locally, do: 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 web-chat +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/js-waku ``` diff --git a/bors.toml b/bors.toml index 576c9d3f26..3df26d75ad 100644 --- a/bors.toml +++ b/bors.toml @@ -1,7 +1,7 @@ status = [ "build_and_test (14, ubuntu-latest)", "build_and_test (14, macos-latest)", - "web_chat_build_and_test", + "examples_build_and_test (web-chat)", "examples_build_and_test (cli-chat)" ] block_labels = ["work-in-progress"] diff --git a/web-chat/.cspell.json b/examples/web-chat/.cspell.json similarity index 98% rename from web-chat/.cspell.json rename to examples/web-chat/.cspell.json index 0fe9670cff..9f7eb6d59d 100644 --- a/web-chat/.cspell.json +++ b/examples/web-chat/.cspell.json @@ -46,6 +46,7 @@ "prettierignore", "protobuf", "protoc", + "reactjs", "rlnrelay", "sandboxed", "secio", diff --git a/web-chat/.gitignore b/examples/web-chat/.gitignore similarity index 100% rename from web-chat/.gitignore rename to examples/web-chat/.gitignore diff --git a/web-chat/.prettierignore b/examples/web-chat/.prettierignore similarity index 100% rename from web-chat/.prettierignore rename to examples/web-chat/.prettierignore diff --git a/examples/web-chat/README.md b/examples/web-chat/README.md new file mode 100644 index 0000000000..b1d1a966d2 --- /dev/null +++ b/examples/web-chat/README.md @@ -0,0 +1,3 @@ +# A React Web Chat App powered by js-waku + +See js-waku [README](../../README.md#web-chat-app-reactjs) for details. diff --git a/web-chat/package-lock.json b/examples/web-chat/package-lock.json similarity index 99% rename from web-chat/package-lock.json rename to examples/web-chat/package-lock.json index c1e1acb97d..7dee8bc327 100644 --- a/web-chat/package-lock.json +++ b/examples/web-chat/package-lock.json @@ -11,7 +11,7 @@ "react": "^16.14.0", "react-dom": "^16.14.0", "server-name-generator": "^1.0.5", - "waku": "../build/main/lib", + "waku": "../../build/main/lib", "web-vitals": "^1.1.1" }, "devDependencies": { @@ -30,10 +30,7 @@ "typescript": "^4.2.4" } }, - "../build/main/chat": { - "extraneous": true - }, - "../build/main/lib": {}, + "../../build/main/lib": {}, "node_modules/@babel/code-frame": { "version": "7.12.13", "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.12.13.tgz", @@ -9864,7 +9861,7 @@ "version": "1.2.7", "resolved": "https://registry.npmjs.org/core-js/-/core-js-1.2.7.tgz", "integrity": "sha1-ZSKUwUZR2yj6k70tX/KYOk8IxjY=", - "deprecated": "core-js@<3 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js@3." + "deprecated": "core-js@<3.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Please, upgrade your dependencies to the actual version of core-js." }, "node_modules/fbjs/node_modules/promise": { "version": "7.3.1", @@ -22886,7 +22883,7 @@ } }, "node_modules/waku": { - "resolved": "../build/main/lib", + "resolved": "../../build/main/lib", "link": true }, "node_modules/walker": { @@ -43271,7 +43268,7 @@ } }, "waku": { - "version": "file:../build/main/lib" + "version": "file:../../build/main/lib" }, "walker": { "version": "1.0.7", diff --git a/web-chat/package.json b/examples/web-chat/package.json similarity index 97% rename from web-chat/package.json rename to examples/web-chat/package.json index 21fe2aa312..92b466e5b4 100644 --- a/web-chat/package.json +++ b/examples/web-chat/package.json @@ -8,7 +8,7 @@ "react": "^16.14.0", "react-dom": "^16.14.0", "server-name-generator": "^1.0.5", - "waku": "../build/main/lib", + "waku": "../../build/main/lib", "web-vitals": "^1.1.1" }, "devDependencies": { diff --git a/web-chat/public/index.html b/examples/web-chat/public/index.html similarity index 100% rename from web-chat/public/index.html rename to examples/web-chat/public/index.html diff --git a/web-chat/public/manifest.json b/examples/web-chat/public/manifest.json similarity index 100% rename from web-chat/public/manifest.json rename to examples/web-chat/public/manifest.json diff --git a/web-chat/public/robots.txt b/examples/web-chat/public/robots.txt similarity index 100% rename from web-chat/public/robots.txt rename to examples/web-chat/public/robots.txt diff --git a/web-chat/src/App.css b/examples/web-chat/src/App.css similarity index 100% rename from web-chat/src/App.css rename to examples/web-chat/src/App.css diff --git a/web-chat/src/App.tsx b/examples/web-chat/src/App.tsx similarity index 100% rename from web-chat/src/App.tsx rename to examples/web-chat/src/App.tsx diff --git a/web-chat/src/ChatList.tsx b/examples/web-chat/src/ChatList.tsx similarity index 100% rename from web-chat/src/ChatList.tsx rename to examples/web-chat/src/ChatList.tsx diff --git a/web-chat/src/ChatMessage.ts b/examples/web-chat/src/ChatMessage.ts similarity index 100% rename from web-chat/src/ChatMessage.ts rename to examples/web-chat/src/ChatMessage.ts diff --git a/web-chat/src/MessageInput.tsx b/examples/web-chat/src/MessageInput.tsx similarity index 100% rename from web-chat/src/MessageInput.tsx rename to examples/web-chat/src/MessageInput.tsx diff --git a/web-chat/src/Room.tsx b/examples/web-chat/src/Room.tsx similarity index 100% rename from web-chat/src/Room.tsx rename to examples/web-chat/src/Room.tsx diff --git a/web-chat/src/WakuContext.ts b/examples/web-chat/src/WakuContext.ts similarity index 100% rename from web-chat/src/WakuContext.ts rename to examples/web-chat/src/WakuContext.ts diff --git a/web-chat/src/WakuMock.test.ts b/examples/web-chat/src/WakuMock.test.ts similarity index 100% rename from web-chat/src/WakuMock.test.ts rename to examples/web-chat/src/WakuMock.test.ts diff --git a/web-chat/src/WakuMock.ts b/examples/web-chat/src/WakuMock.ts similarity index 100% rename from web-chat/src/WakuMock.ts rename to examples/web-chat/src/WakuMock.ts diff --git a/web-chat/src/command.ts b/examples/web-chat/src/command.ts similarity index 98% rename from web-chat/src/command.ts rename to examples/web-chat/src/command.ts index e6ee0e4835..6704341da0 100644 --- a/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 '../../build/main/lib/waku'; +import Waku from 'waku/waku'; function help(): string[] { return [ diff --git a/web-chat/src/index.css b/examples/web-chat/src/index.css similarity index 100% rename from web-chat/src/index.css rename to examples/web-chat/src/index.css diff --git a/web-chat/src/index.tsx b/examples/web-chat/src/index.tsx similarity index 100% rename from web-chat/src/index.tsx rename to examples/web-chat/src/index.tsx diff --git a/web-chat/src/react-app-env.d.ts b/examples/web-chat/src/react-app-env.d.ts similarity index 100% rename from web-chat/src/react-app-env.d.ts rename to examples/web-chat/src/react-app-env.d.ts diff --git a/web-chat/src/setupTests.ts b/examples/web-chat/src/setupTests.ts similarity index 100% rename from web-chat/src/setupTests.ts rename to examples/web-chat/src/setupTests.ts diff --git a/web-chat/src/types/types.d.ts b/examples/web-chat/src/types/types.d.ts similarity index 100% rename from web-chat/src/types/types.d.ts rename to examples/web-chat/src/types/types.d.ts diff --git a/web-chat/tsconfig.json b/examples/web-chat/tsconfig.json similarity index 100% rename from web-chat/tsconfig.json rename to examples/web-chat/tsconfig.json diff --git a/web-chat/README.md b/web-chat/README.md deleted file mode 100644 index b87cb00449..0000000000 --- a/web-chat/README.md +++ /dev/null @@ -1,46 +0,0 @@ -# Getting Started with Create React App - -This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app). - -## Available Scripts - -In the project directory, you can run: - -### `npm start` - -Runs the app in the development mode.\ -Open [http://localhost:3000](http://localhost:3000) to view it in the browser. - -The page will reload if you make edits.\ -You will also see any lint errors in the console. - -### `npm test` - -Launches the test runner in the interactive watch mode.\ -See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information. - -### `npm run build` - -Builds the app for production to the `build` folder.\ -It correctly bundles React in production mode and optimizes the build for the best performance. - -The build is minified and the filenames include the hashes.\ -Your app is ready to be deployed! - -See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information. - -### `npm run eject` - -**Note: this is a one-way operation. Once you `eject`, you can’t go back!** - -If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project. - -Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own. - -You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it. - -## Learn More - -You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started). - -To learn React, check out the [React documentation](https://reactjs.org/).