|
1 | 1 | # How to use in development mode
|
2 | 2 |
|
3 |
| -**Mac Developers**: Install Xcode command line tools if you don't already have them. |
| 3 | +**Mac Developers**: Install Xcode command line tools if you don't already have them. |
4 | 4 |
|
5 |
| -**Windows Developers**: Install Node.js globally, may also have to run Spearmint in admin mode. |
| 5 | +**Windows Developers**: Install Node.js globally, may also have to run Spearmint in admin mode. |
| 6 | + |
| 7 | +As of January 2023, spearmint works with node version 19.4.0 electron-devtools-vendor must be at version 1.1 for now due to a bug. |
| 8 | +React must be version 17 due to a dependency for mui. Fix-path must be version 3.0.0 due to 4.0.0 only being usable with an import statement, which is not supported in electron.jsx. |
6 | 9 |
|
7 | 10 | 1. Fork and clone this repository.
|
8 |
| -2. Install node version 16.13: ```nvm install 16.13``` |
9 |
| -3. Use node version 16.13: ```nvm use 16.13``` |
10 |
| -4. ```npm install``` |
11 |
| -5. Create a .env file in the root directory of the project |
12 |
| -6. Insert the following lines of code into the .env file |
13 |
| - ``` |
14 |
| - APP_DEV=true |
15 |
| - BROWSER=non |
16 |
| - SKIP_PREFLIGHT_CHECK=true |
17 |
| - MONGO_LINK= |
18 |
| - ``` |
19 |
| -7. Set MONGO_LINK to your MongoDB URI (ex: mongodb://localhost:27017) |
20 |
| -8. Make sure your MongoDB is running if it's hosted locally. |
21 |
| -9. ```npm run rebuild``` (different from `npm rebuild` so please pay attention to that) |
22 |
| -10. ```npm run dev``` |
| 11 | + |
| 12 | +2. `npm install` |
| 13 | + |
| 14 | +3. Create a .env file in the root directory of the project |
| 15 | + |
| 16 | +4. Insert the following lines of code into the .env file |
| 17 | + |
| 18 | + ``` |
| 19 | + APP_DEV=true |
| 20 | + BROWSER=non |
| 21 | + SKIP_PREFLIGHT_CHECK=true |
| 22 | + MONGO_LINK=mongodb+srv://username:spearmint1234@cluster0.nzon2t8.mongodb.net/?retryWrites=true&w=majority |
| 23 | + ``` |
| 24 | + |
| 25 | +5. Set MONGO_LINK to your MongoDB URI or use the URI we provided (ex: mongodb://localhost:27017) |
| 26 | + |
| 27 | +6. Make sure your MongoDB is running if it's hosted locally. |
| 28 | + |
| 29 | +7. `npm run rebuild` (different from `npm rebuild` so please pay attention to that) |
| 30 | + |
| 31 | +8. `npm run dev` |
23 | 32 |
|
24 | 33 | # Tips for development mode
|
25 | 34 |
|
26 |
| -- To enable hot-module reloading, uncomment line 24 in the Electron.js file. |
27 |
| - ```// require('electron-reloader')(module);``` |
28 |
| -- To enable dev tools, uncomment line 72 in the Electron.js file: |
29 |
| - ```// mainWindow.webContents.openDevTools();``` |
| 35 | +- To enable hot-module reloading, uncomment line 23 in the electron.jsx file. |
30 | 36 |
|
| 37 | + // require('electron-reloader')(module); |
31 | 38 |
|
32 |
| -# Suggestions if you would like contriubute: |
33 |
| -1. Exporting test files in TypeScript: the tests currently export in JS. |
34 |
| -2. Convert codebase to TypeScript: currently, there are some files in TS, and others in JS. It would be great to convert all to TS. |
35 |
| -3. Dry refactoring of codebase: A lot of the folders and files for the frontend frameworks testing are the same, and the codebase would GREATLY benefit from refactoring and modularizing those. |
36 |
| -4. Persist user data: there is currently sign up and login functionality, including OAuth. However, V0.12.0 commented it out because there is currently no user data being persisted. A great feature would be to save tests to work on them later, or create templates for each user. |
37 |
| -5. A known issue/bug is some erratic behavior with the terminal. A more detailed issue will be opened for this. |
38 |
| -6. Add more customization to the tests themseleves such as chaining expects, add the ability to use siblings and children, etc., or having the ability to test more than one component in one test file. |
39 |
| -7. Try to fix the dependencies issues. Currently we have to run on node version 16.13 for the app to work. But if the packages incompatiblites are fixed that would be wonderful! |
| 39 | +- To enable Chrome Dev Tools, uncomment line 71 in the electron.jsx file: |
| 40 | + |
| 41 | + // mainWindow.webContents.openDevTools(); |
| 42 | + |
| 43 | +- To enable React Dev Tools, uncomment lines 285 to 289 in the electron.jsx file: |
40 | 44 |
|
41 |
| -Or please feel free to add any other features or fixes that you would like or are interested in. |
| 45 | + // .then(() => { |
| 46 | + // session.defaultSession.loadExtension(REACT_DEVELOPER_TOOLS, { allowFileAccess: true }) |
| 47 | + // .then((name) => console.log(`Added Extension: ${name}`)) |
| 48 | + // .catch((err) => console.log(`An error occurred adding an extension: ${err}`)); |
| 49 | + // }) |
42 | 50 |
|
| 51 | +# Suggestions if you would like contriubute: |
43 | 52 |
|
| 53 | +1. Exporting test files in TypeScript: the tests currently export in JS. |
| 54 | + |
| 55 | +2. Convert codebase to TypeScript: currently, there are some files in TS, and others in JS. It would be great to convert all to TS. |
| 56 | + |
| 57 | +3. Dry refactoring of codebase: A lot of the folders and files for the frontend frameworks testing are the same, and the codebase would GREATLY benefit from refactoring and modularizing those. |
| 58 | + |
| 59 | +4. Persist user data: there is currently sign up and login functionality. V0.13.0 commented out the login functionality because there is currently no user data being persisted. A great feature would be to save tests to work on them later, or create templates for each user. |
| 60 | + |
| 61 | +5. GitHub OAuth is functional, but Google OAuth is currently broken. If you are planning to persist user data, this is an excellent feature to resolve. |
| 62 | + |
| 63 | +6. Add more customization to the tests themseleves such as chaining expects, add the ability to use siblings and children, etc., or having the ability to test more than one component in one test file. |
| 64 | + |
| 65 | +7. Some of test cases needs improvement on UI as they do not have any styling or optimal user experience |
| 66 | + |
| 67 | +**_Please feel free to add any other features or fixes that you would like or are interested in._** |
44 | 68 |
|
45 | 69 | # Build and Run image on Docker
|
46 | 70 |
|
47 |
| -## Pre-requisites |
48 |
| -- Mongo: Mongodb is used for authentication functionality. If you didn't use locally hosted mongodb URI in .env file, you may skip to the X server section. |
| 71 | +## Pre-requisites |
| 72 | + |
| 73 | +- Mongo: Mongodb is used for authentication functionality. If you didn't use locally hosted mongodb URI in .env file, you may skip to the X server section. |
49 | 74 |
|
50 |
| - 1. Add `172.17.0.1` and `0.0.0.0` to the network interfaces of mongo config file. |
| 75 | + 1. Add `172.17.0.1` and `0.0.0.0` to the network interfaces of mongo config file. |
51 | 76 |
|
52 |
| - a. Open `mongod.cfg` (Usually located in C:\Program Files\MongoDB\Server\4.4\bin) |
| 77 | + a. Open `mongod.cfg` (Usually located in C:\Program Files\MongoDB\Server\4.4\bin) |
53 | 78 |
|
54 |
| - # network interfaces |
55 |
| - net: |
56 |
| - port: 27017 |
57 |
| - bindIp: 127.0.0.1, 172.17.0.1, 0.0.0.0 |
| 79 | + # network interfaces |
| 80 | + net: |
| 81 | + port: 27017 |
| 82 | + bindIp: 127.0.0.1, 172.17.0.1, 0.0.0.0 |
58 | 83 |
|
59 |
| - 2. Run mongo on port 27017 |
| 84 | + 2. Run mongo on port 27017 |
60 | 85 |
|
61 | 86 | - X server
|
62 | 87 |
|
63 |
| - 1. Download and run either [X410](https://x410.dev/) or [VcXsrv](https://sourceforge.net/projects/vcxsrv/) |
| 88 | + 1. Download and run either [X410](https://x410.dev/) or [VcXsrv](https://sourceforge.net/projects/vcxsrv/) |
64 | 89 |
|
65 |
| - * For X410, use the following configuration |
| 90 | + - For X410, use the following configuration |
66 | 91 |
|
67 |
| -  |
| 92 | +  |
68 | 93 |
|
69 |
| - * For VcXsrv: change the display number to 0, for other settings, use default. |
| 94 | + - For VcXsrv: change the display number to 0, for other settings, use default. |
70 | 95 |
|
71 |
| -  |
| 96 | +  |
72 | 97 |
|
| 98 | +## Running the image |
73 | 99 |
|
74 |
| -## Running the image |
75 |
| -After running the mongo on port 27017 and running the x server with display number of 0, follow the steps below. |
| 100 | +After running the mongo on port 27017 and running the x server with display number of 0, follow the steps below. |
76 | 101 |
|
77 |
| -1. Build the docker image by running the following command |
| 102 | +1. Build the docker image by running the following command |
78 | 103 |
|
79 | 104 | `docker build -t [image name] .`
|
80 | 105 |
|
81 |
| -2. Run the docker image by using the following command: |
| 106 | +2. Run the docker image by using the following command: |
| 107 | + |
| 108 | + `docker run -e DISPLAY='host.docker.internal:0.0' -it -v [directory of project to be tested]:/[directory to create volume] [image name]` |
| 109 | + |
| 110 | + - `-e DISPLAY='host.docker.internal:0.0'`: Set environment variable ‘display’ to host.docker.internal:0.0 |
| 111 | + |
| 112 | + - `-it`: Run container as interactive |
82 | 113 |
|
83 |
| - `docker run -e DISPLAY='host.docker.internal:0.0' -it -v [directory of project to be tested]:/[directory to create volume] [image name]` |
| 114 | + - `-v`: Creates a volume and mounts the testing application into the container. (ex: `-v [testing files]:[created volume]`) |
84 | 115 |
|
85 |
| - - `-e DISPLAY='host.docker.internal:0.0'`: Set environment variable ‘display’ to host.docker.internal:0.0 |
| 116 | + *Please note that once the spearmint container is running, you can only access the folders that you mounted here.` |
86 | 117 |
|
87 |
| - - `-it`: Run container as interactive |
| 118 | + **_Please note that the image uses root user, as shown in the Dockerfile._** |
88 | 119 |
|
89 |
| - - `-v`: Creates a volume and mounts the testing application into the container. (ex: `-v [testing files]:[created volume]`) |
| 120 | +# Resources for onboarding developers |
90 | 121 |
|
91 |
| - *Please note that once the spearmint container is running, you can only access the folders that you mounted here.` qGHP\ |
92 |
| -*Please note that the image uses root user, as shown in the Dockerfile. |
93 |
| - |
| 122 | +<div align="center" style="display:flex;flex-direction:column;"}> |
| 123 | + <div align> |
| 124 | + <a href="https://excalidraw.com/#room=9abc890c35d8e7d3f149,htwzR9k0SUhZzhwB3zjJ8A"> |
| 125 | + <img width="300" height="72" alt="Connect to the Dev Excalidraw" src="https://img.shields.io/badge/Excalidraw-181717?style=for-the-badge&logo"/> |
| 126 | + </a> |
| 127 | + <a href="https://discord.gg/5FNPTvZSTq"> |
| 128 | + <img width="300" height="72" src="https://img.shields.io/badge/Discord-%235865F2.svg?style=for-the-badge&logo=discord&logoColor=white"/> |
| 129 | + </a> |
| 130 | + <h3>Virtual whiteboard for sketching the structure/data flow of spearmint. Also inside the /public/spearmint.svg file</h3> |
| 131 | + <h3>Let's stay up to date, ask/answer questions, and connect with one another!</h3> |
| 132 | + <h3>Join the spearmint developer community Discord!</h3> |
| 133 | +</div> |
0 commit comments