Skip to content

Commit 6dd56d9

Browse files
authored
Merge pull request #335 from oslabs-beta/main
Merging Swell v1.14 into OS labs main
2 parents 049a42f + 37f040c commit 6dd56d9

File tree

232 files changed

+5913
-8189
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

232 files changed

+5913
-8189
lines changed

.github/workflows/codeql-analysis.yml

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# You may wish to alter this file to override the set of languages analyzed,
2+
# or to provide custom queries or build logic.
3+
name: "Code scanning"
4+
5+
on:
6+
workflow_dispatch:
7+
push:
8+
branches: [ ci-feature, ci-draft, dev, main ]
9+
# paths: [ 'test/**', 'src/**', 'menu/**', 'main_process/**', 'build/**', '.github/workflows/**', 'webpack**' ]
10+
pull_request:
11+
branches: [ dev, main ]
12+
# paths: [ 'test/**', 'src/**', 'menu/**', 'main_process/**', 'build/**', '.github/workflows/**', 'webpack**' ]
13+
14+
jobs:
15+
analyze:
16+
name: Analyze code
17+
runs-on: ubuntu-latest
18+
permissions:
19+
actions: read
20+
contents: read
21+
security-events: write
22+
23+
strategy:
24+
fail-fast: false
25+
matrix:
26+
language: [ 'javascript', 'typescript' ]
27+
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ]
28+
# Learn more:
29+
# https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed
30+
steps:
31+
- name: Checkout repository
32+
uses: actions/checkout@v3
33+
34+
# Initializes the CodeQL tools for scanning.
35+
- name: Initialize CodeQL
36+
uses: github/codeql-action/init@v2
37+
with:
38+
languages: ${{ matrix.language }}
39+
# If you wish to specify custom queries, you can do so here or in a config file.
40+
# By default, queries listed here will override any specified in a config file.
41+
# Prefix the list here with "+" to use these queries and those in the config file.
42+
# queries: ./path/to/local/query, your-org/your-repo/queries@main
43+
44+
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
45+
# If this step fails, then you should remove it and run the build manually (see below)
46+
- name: Autobuild
47+
uses: github/codeql-action/autobuild@v2
48+
49+
# ℹ️ Command-line programs to run using the OS shell.
50+
# 📚 https://git.io/JvXDl
51+
52+
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
53+
# and modify them (or add more) to build your code if your project
54+
# uses a compiled language
55+
56+
#- run: |
57+
# make bootstrap
58+
# make release
59+
60+
- name: Perform CodeQL Analysis
61+
uses: github/codeql-action/analyze@v2

.github/workflows/unit-tests.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: Unit Tests
2+
3+
on: [pull_request]
4+
5+
jobs:
6+
tests:
7+
strategy:
8+
matrix:
9+
node-version: [16]
10+
os: [macos-latest, ubuntu-latest, windows-latest]
11+
runs-on: ${{ matrix.os }}
12+
steps:
13+
- name: Checkout repo
14+
uses: actions/checkout@v3
15+
- name: Use Node.js ${{ matrix.node-version }}
16+
uses: actions/setup-node@v3
17+
with:
18+
node-version: ${{ matrix.node-version }}
19+
- name: Install dependencies
20+
run: npm i && npm ci
21+
- name: Run unit tests
22+
uses: coactions/setup-xvfb@v1
23+
with:
24+
run: npm run test-jest

.travis.yml

Lines changed: 0 additions & 14 deletions
This file was deleted.

README.md

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,10 @@ Swell is a one-stop shop for sending and monitoring your API requests:
4141
- _WebSockets (WS)_: Swell enables connecting directly to WebSocket servers with an HTTP handshake, with developers able to send messages to the connected WS server directly. All outgoing and incoming messages are displayed in real time.
4242
<img src="./ReadMeGifs/Gifs/Websockets.gif" style="display: block; margin: 10px auto 30px;" />
4343

44+
- _gRPC_: Swell includes full support for all four streaming types of gRPC - unary, client stream, server stream, bidirectional stream.
45+
<!-- -TODO --- This needs to be updated -->
46+
<img src="./ReadMeGifs/Gifs/gRPC.gif" style="display: block; margin: 10px auto 30px;" />
47+
4448
## Additional features
4549

4650
- _Stress testing for HTTP/2 and GraphQL_: Test your server backend with Swell's stress testing feature to ensure your server can manage expected and unexpected loads accordingly
@@ -66,12 +70,9 @@ Swell is a one-stop shop for sending and monitoring your API requests:
6670
- _Mock Server_: Swell allows you to create your own HTTP/2 mock server to facilitate front-end development without depending on a fully built backend server.
6771
<img src="./ReadMeGifs/Gifs/MockServer.gif" style="display: block; margin: 10px auto 30px;" />
6872

69-
- _gRPC_: Swell includes full support for all four streaming types of gRPC - unary, client stream, server stream, bidirectional stream.
70-
<img src="./ReadMeGifs/Gifs/gRPC-responses.gif" style="display: block; margin: 10px auto 30px;" />
71-
7273
- _tRPC_: Swell includes full support for all methods of TypeScript Remote Procedure Calls including batch call support for queries and mutations.
73-
<img src="./ReadMeGifs/Gifs/tRPC-query.gif" style="display: block; margin: 10px auto 30px;" />
74-
<img src="./ReadMeGifs/Gifs/tRPC-subscription.gif" style="display: block; margin: 10px auto 30px;" />
74+
<img src="./ReadMeGifs/Gifs/tRPC.gif" style="display: block; margin: 10px auto 30px;" />
75+
<!-- <img src="./ReadMeGifs/Gifs/tRPC-subscription.gif" style="display: block; margin: 10px auto 30px;" /> -->
7576

7677
Calls are currently being made using Swell's own TRPCProxyClient generated from the URL provided by the user.
7778
Batch requests must be entered one request per line. Swell will treat each line of code entered into the editor as a separate request before batching and returning responses.
@@ -133,6 +134,10 @@ Feel free to check out the `DEV-README.md` in the `docs` folder.
133134

134135
## Authors
135136

137+
- **Timmy Zhu** - [timzhu15](https://github.com/timzhu15)
138+
- **Christina Walton** - [CElizOwens](https://github.com/CElizOwens)
139+
- **Akeem Smith** - [AkeemESmith](https://github.com/AkeemESmith)
140+
- **William Murphy** - [olsoninoslo](https://github.com/olsoninoslo)
136141
- **Chris Suzukida** - [csuzukida](https://github.com/csuzukida)
137142
- **Fred Kim** - [Fredkim21](https://https://github.com/Fredkim21)
138143
- **Jason Huang** - [jjhuang3](https://https://github.com/jjhuang3)

ReadMeGifs/Gifs/CopyToComposer.gif

-331 KB
Binary file not shown.
Binary file not shown.

ReadMeGifs/Gifs/Response History.gif

-1.33 MB
Binary file not shown.

ReadMeGifs/Gifs/WS.gif

-3.13 MB
Binary file not shown.

ReadMeGifs/Gifs/Webhook.gif

-1.42 MB
Binary file not shown.

ReadMeGifs/Gifs/gRPC.gif

1.14 MB
Loading

ReadMeGifs/Gifs/tRPC-UI.gif

-581 KB
Binary file not shown.

ReadMeGifs/Gifs/tRPC-query.gif

-757 KB
Binary file not shown.

ReadMeGifs/Gifs/tRPC-subscription.gif

-1.41 MB
Binary file not shown.

ReadMeGifs/Gifs/tRPC.gif

1.21 MB
Loading

docs/DEV-README.md

Lines changed: 35 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ If you are considering contributing to Swell in the context of a group or medium
1414
- Express
1515
- Webpack
1616
- Client-side storage (IndexedDB)
17+
- GitHub Actions (CI/CD)
1718
- Testing
1819
- Unit testing with Jest
1920
- End-to-end (E2E) testing with Playwright and Mocha
@@ -28,8 +29,6 @@ If you are considering contributing to Swell in the context of a group or medium
2829
- WebRTC
2930
- OpenAPI
3031

31-
---
32-
3332
## How to download and test the application locally?
3433

3534
1. Fork and/or clone the repository into your local machine
@@ -38,7 +37,7 @@ If you are considering contributing to Swell in the context of a group or medium
3837
- `npm run dev`
3938
3. Wait for the electron application to start up (it may take a bit)
4039

41-
There is E2E testing available via `npm run test`. Note that not all tests in the E2E test suite work currently. Please refer to `./test/testSuite.js` for more details.
40+
There is E2E testing available via `npm run test`. Note that not all tests in the E2E test suite work currently. Please refer to `./test/testSuite.js` and `./test/subSuites` for more details.
4241

4342
---
4443

@@ -71,11 +70,11 @@ From a functionality standpoint:
7170
- GraphQL stress testing with `Query`
7271
- Mock server for HTTP/2 (`Express`)
7372
- Ability to store historical requests and create/delete workspaces
73+
- Frontend conversion to TypeScript
74+
- From a codebase standpoint:
7475

75-
From a codebase standpoint:
76-
77-
- Partial conversion to TypeScript
78-
- Conversion to Redux toolkit _almost_ complete
76+
- Increase quality of TypeScript and continue converstion
77+
- Conversion to Redux toolkit _almost_ complete (need to implement hooks like useSelector and useAppDispatch)
7978
- Most working E2E testing (more details in `./test/testSuite.js`)
8079

8180
---
@@ -85,15 +84,21 @@ From a codebase standpoint:
8584
### _Continue reducing the size and complexity of the codebase_
8685

8786
This codebase has an interesting combination of over-modularization and code de-centralization/duplication occurring at the same time. For example - each type of API endpoint composer window (top right section of the app) is its own module/file, but a lot of the code inside is duplicated (see `Http2Composer.tsx` and `GraphQLComposer.tsx`).
88-
87+
The reason many iteration groups have stayed away is becuase one would need to craft a function/component that is flexible enough to handle the population of the reqRes object and dispatch of the state to the vairous slices. This is not an easy task, and may take the entire iteration time allotted. It would be a worthy
8988
The impacts to the product are:
9089

9190
- The codebase can be incredibly difficult to navigate if you are not familiar with the structure
91+
- That being said, the file structure has been extensively modified to make the navigation much easier.
92+
The most challenging aspects are the understanding how state flows through the application, from the front-end to main_process, controllers, etc.
93+
This is the most important thnig to understant when iterating on Swell
9294
- The app is slow to load in all environments (production, development, test)
95+
- Adding multiple entry points to for the build process would greatly improve this, but be careful because you can end up makiing performance much worse in the process
9396

9497
**Some of us have found [ReacTree](https://reactree.dev/) VS Code extension incredibly helpful in visualizing the UI components. Utilizing the extension could be your entry into understanding the structure of the codebase.**
9598

96-
As you iterate the product, keep in mind the footprint your new feature could add to the codebase. Could you re-use some of the existing modules? Can you even refactor and/or remove the obsolete code to help maintain the health of the codebase?
99+
As you iterate the product, keep in mind the footprint your new feature(s) could add to the codebase. Could you re-use some of the existing modules? Can you even refactor and/or remove the obsolete code to help maintain the health of the codebase?
100+
101+
There are many parts of the codebase that break DRY principles, and with a such a large application, really keep in mind that when you add features it is completely necessary. Past iterators added an experimental feature(s) without it fully working and the next team(s) would add there own experiemental feature. Fixing features the past teams couldn't get to not only is a great way to learn these technologies, but is a great thing to talk to in interviews. " I fixed the webRTC feature that has been stagnant for 5 years", "I addressed the technical debt and reoganized the state...", or "Increasesed the quality of typeScript". These all show maturity as a developer and will allow to focus the entire time of OSP on the 20% problems.
97102

98103
### _Ensure consistent redux state management_
99104

@@ -103,7 +108,8 @@ The redux state initiation and management for various API endpoints in this code
103108

104109
For the following technologies - if you reference the gifs in `readme` and try to replicate the steps in the application you may not get the same result:
105110

106-
- gRPC
111+
<!-- - gRPC -->
112+
107113
- tRPC
108114
- OpenAPI
109115

@@ -117,11 +123,13 @@ Moreover, the application lacks instructions on how to utilize some of the more
117123

118124
Lastly, when making the app smaller on windows desktop or using a computer with smaller screen size, some of the buttons are partially cut out. It would be great to establish a minimum size for each section and/or input field so the application can auto-resize elegantly.
119125

120-
### _Continue conversion to TypeScript, Material UI and Redux toolkit_
126+
You will notice that there are a few places where MUI is used. Material UI is a huge component library that is popular, though figuring out how to lessen Swells depence on it would go a long way to reducing it's bloat.
121127

122-
Conversion to Material UI allows a more consistent component style and promotes semantic HTML language throughout the application. TypeScript provides strong typing to improve code quality, maintainability and reduce runtime errors. Redux toolkit reduces the amount of boilerplate requires to use Redux within the application and provide a centralized environment for state initialization and management.
128+
### _Continue conversion to TypeScript and Redux toolkit_
123129

124-
### _Enhance HTTP/2 Mock server functionality; expand feature to GraphQL_
130+
TypeScript provides strong typing to improve code quality, maintainability and reduce runtime errors. Redux toolkit reduces the amount of boilerplate requires to use Redux within the application and provide a centralized environment for state initialization and management.
131+
132+
### _Enhance HTTP/2 Mock server functionality_
125133

126134
Currently, the HTTP/2 mock server has the ability to create a server that is accessible outside of the application, and create any endpoint that the user chooses. There could be a lot of potential to enhance the current mock server to include features such as:
127135

@@ -130,30 +138,36 @@ Currently, the HTTP/2 mock server has the ability to create a server that is acc
130138
- the ability to mock HTML responses (or remove the HTML option from the BodyEntryForm component)
131139
- Connect the headers and cookies to the mock endpoint creation
132140

133-
Moreover, the mock server functionality can be extended to GraphQL as well so that is something that can be considered in the future.
134-
135141
### _WebRTC STUN/TURN server input is read-only_
136142

137143
The `RTCConfiguration` format required for WebRTC STUN/TURN server is an object with `iceServers` as the key and an array of objects as the value. With the current input format on the application, it is very difficult and error-prone to attempt to format the user input correctly. Based on research it seems like many other alternatives that test STUN/TURN servers separate each key/value into its input text box (similar to how key/value pairs for headers are done for HTTP/2 in Swell). Our assumption is that this way the application can have better control formatting `RTCConfiguration`. If anyone is considering advancing the current WebRTC functionalities in the future, this should be a priority so we can fully enable the ability to test any STUN/TURN servers using Swell.
138144

139145
### _Incomplete E2E testing coverage_
140146

141-
Some of the following features either have broken, or no E2E testing coverage in the repository:
147+
Some of the following features either have broken, incomplete, or no E2E testing coverage in the repository:
142148

143-
- gRPC
144149
- tRPC
145150
- OpenAPI
146151
- Mock server
147152

148153
Future iteration should consider fix or add E2E testing coverage for these features.
149154

150-
### _Broken Travis CI build_
155+
### _CD pipeline is incomplete_
156+
157+
Continuous Integration has been implemented using GitHub Actions. If you would like to edit workflows or add new ones to the pipeline, here is the process that we employed to test new workflows before using them on critical branches like main and dev:
158+
159+
- Create two test branches (ex: ci-draft and ci-main)
160+
- Define a workflow in a yaml file and test its execution by pushing it to ci-draft and/or opening a pull request to merge ci-draft into ci-main depending on the triggers you have defined in the workflow
161+
- Make any necessary adjustments to the workflow and continue testing it on ci-draft and ci-main until the workflow is functioning as intended
162+
- Finally, open a pull request to merge the new workflow into the dev and/or main branches
163+
164+
The idea is to troubleshoot new workflows before applying them to the dev or main branches.
151165

152-
The [Travis CI link](https://travis-ci.org/open-source-labs/Swell) is not functional. A broken CI/CD pipeline blocks the ability to automatically package and release new iterations of the application, so it would be great if we can rebuild CI/CD using alternative services like GitHub Actions.
166+
A Continuous Deployment pipeline would be an advantageous addition, as its absence blocks the ability to automatically package and release new iterations of the application. The groundwork for it is there (see the “scripts” and “build” properties in package.json) but packaging for Linux will need some attention, as outlined in the next section.
153167

154168
---
155169

156-
## How can I package and release the application without a functional CI/CD pipeline?
170+
## How can I package and release the application without a functional CD pipeline?
157171

158172
There are a few options to package an electron app for production. Some of the most popular options are electron forge and electron builder, and Swell uses electron builder currently.
159173

@@ -163,7 +177,7 @@ While electron builder supports [multi-platform build](https://www.electron.buil
163177

164178
For Mac users, running `npm run package-mac` and `npm run package-win` (as defined in `package.json`) would allow you to package the Swell app for Mac and Windows environment. If you try to package for the linux environment (i.e. `npm run package-all`, `npm run package-linux`, `npm run gh-publish`), you will run into issues requiring `snapcraft` and `multipass` to create a linux virtual machine in order to package the application. You can try to install `snapcraft` and `multipass` via `brew` per instructions, but there has not been much success locally.
165179

166-
The only remaining option to build a linux package for MacOS users is via a CI/CD tool like Travis CI or GitHub Actions but the pipeline is not functional in the Swell repository. **To work around this limitation without building a new CI/CD pipeline, we recommend you ask a developer with a WSL or Linux environment to help you package the application.**
180+
The only remaining option to build a Linux package for MacOS users is via the CI/CD pipeline but the CD portion is not yet implemented in the Swell repository. **To work around this limitation without building a CD pipeline, we recommend you ask a developer with a WSL or Linux environment to help you package the application.**
167181

168182
- Ask the developer to clone the project into their local WSL/Linux environment. **The user does not need the ability to open the electron application.**
169183
- run `npm install && npm run package-linux`

grpc_mockData/protos/helloworld.proto

Lines changed: 0 additions & 15 deletions
This file was deleted.

0 commit comments

Comments
 (0)