Skip to content

Commit 469f1d6

Browse files
committed
updated changelog, readme, and move DEV_PORT to config.js
1 parent ca3e032 commit 469f1d6

File tree

11 files changed

+43
-23
lines changed

11 files changed

+43
-23
lines changed

CHANGE_LOG.md

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,19 @@
99
- Next.js projects will generate the right code needed for exporting a Next.js application
1010
- Link & Image elements have been added
1111
- Link components are able to couple with a page to enable SSR
12+
- Next Link components have a drop down menu to quickly and easily link pages
1213
- Current canvas can be saved as a page to be coupled with a Next.js Link element
13-
- Image element can accept special attribute that allow for it to optimize performance
14+
- Files are exported with the appropriate Next.js imports and structure
1415
- Added Redux and began migrating some state over for ease of development (debugging & readability)
1516
- Fixed bug causing electron to crash when closing the window rather than going to file > exit
1617
- Fixed bug causing app to crash when project was changed to either Next.js or Gatsby.js
1718
- Fixed GitHub OAuth
1819
- added Passport.js & Passport-Github libraries for strategies which takes care of all the credential exchanges and session information
1920
- linked electron front end to talk to backend to exchange credentials
2021
- Fixed code preview not displaying properly
22+
- Fixed demo render preview so that changes in the canvas appears instantly
23+
- any links in the demo render preview can now be clicked on and it will take you to its related page
24+
- Properties of each component now persist in the customization tab
2125
- Fixed dark mode not syncing properly across pages
2226

2327
**Version 11.0.0 Stretch Features:**
@@ -28,5 +32,15 @@
2832
- This will improve performance by reducing the amount of unneccessary re-render. The context API causes certain pieces of state to be needlessly coupled
2933
- Debugging is much easier by the use of Redux dev tools which allow time travel debugging
3034
- Code will be easier to read and thus data flow will be easier to visualize
31-
- Tried to implement peer to peer communication via webRTC with redux swarmlog but was not successful. Look into websockets.
35+
- Don't move **everything** onto Redux. ie: Material UI uses the context API to handle theme changes
36+
- Enable remote work similar to vscode's live share
37+
- Tried to implement peer to peer communication via webRTC with redux swarmlog but was not successful
38+
- Look into using websockets
39+
- Think about security. What features needs to be implemented for secure sharing?
40+
- Transfer actions through websockets via Redux middleware (Thunk)?
3241
- Save project (state) onto local storage for guests
42+
- Redesign UI to be more flexible
43+
- Read material ui docs for best practices.
44+
- creation panel should be redesigned. Its react component structure is too fragmented.
45+
- Add missing Next.js features
46+
- Image components need sizing & loading options to capitalize on Next.js' Image optimization

app/electron/main.js

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ const electron = require('electron');
55
@actions: codes for Github Oauth has been commented out because of lack of functionality.
66
*/
77
require('dotenv').config();
8+
const { DEV_PORT } = require('../../config');
89
const path = require('path');
910
const {
1011
app,
@@ -213,7 +214,7 @@ app.on('web-contents-created', (event, contents) => {
213214
const validOrigins = [
214215
selfHost,
215216
'https://reactype-caret.herokuapp.com',
216-
`http://localhost:${process.env.DEV_PORT}`,
217+
`http://localhost:${DEV_PORT}`,
217218
'https://reactype.herokuapp.com',
218219
'https://github.com',
219220
'https://nextjs.org',
@@ -237,7 +238,7 @@ app.on('web-contents-created', (event, contents) => {
237238
const validOrigins = [
238239
selfHost,
239240
'https://reactype-caret.herokuapp.com',
240-
`http://localhost:${process.env.DEV_PORT}`,
241+
`http://localhost:${DEV_PORT}`,
241242
'https://reactype.herokuapp.com',
242243
'https://github.com',
243244
'https://nextjs.org',
@@ -280,7 +281,7 @@ app.on('web-contents-created', (event, contents) => {
280281
const validOrigins = [
281282
selfHost,
282283
'https://reactype-caret.herokuapp.com',
283-
`http://localhost:${process.env.DEV_PORT}`,
284+
`http://localhost:${DEV_PORT}`,
284285
'https://reactype.herokuapp.com',
285286
'https://nextjs.org',
286287
'https://developer.mozilla.org',
@@ -345,7 +346,7 @@ ipcMain.on('choose_app_dir', event => {
345346
// define serverURL for cookie and auth purposes based on environment
346347
let serverUrl = 'https://reactype-caret.herokuapp.com';
347348
if (isDev) {
348-
serverUrl = `http://localhost:${process.env.DEV_PORT}`;
349+
serverUrl = `http://localhost:${DEV_PORT}`;
349350
}
350351

351352
// // for github oauth login in production, since cookies are not accessible through document.cookie on local filesystem, we need electron to grab the cookie that is set from oauth, this listens for an set cookie event from the renderer process then sends back the cookie
@@ -375,8 +376,7 @@ ipcMain.on('delete_cookie', event => {
375376

376377
// opens new window for github oauth when button on sign in page is clicked
377378
ipcMain.on('github', event => {
378-
console.log('inside main.js in electron');
379-
const githubURL = `http://localhost:${process.env.DEV_PORT}/auth/github`;
379+
const githubURL = `http://localhost:${DEV_PORT}/auth/github`;
380380
const options = {
381381
client_id: process.env.GITHUB_ID,
382382
client_secret: process.env.GITHUB_SECRET,
@@ -403,7 +403,7 @@ ipcMain.on('github', event => {
403403
const raw_code = /code=([^&]\*)/.exec(url) || null;
404404
const code = raw_code && raw_code.length > 1 ? raw_code[1] : null;
405405
const error = /\?error=(.+)\$/.exec(url);
406-
406+
407407
if (code || error) {
408408
// Close the browser if code found or error
409409
authWindow.destroy();
@@ -442,9 +442,7 @@ ipcMain.on('github', event => {
442442
if (isDev) {
443443
redirectUrl = 'http://localhost:8080/';
444444
}
445-
console.log(callbackUrl === redirectUrl);
446-
console.log('callbackUrl', callbackUrl);
447-
console.log('redirectUrl', redirectUrl);
445+
448446
if (callbackUrl === redirectUrl) {
449447
dialog.showMessageBox({
450448
type: 'info',

app/src/components/login/SignIn.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,6 @@ const SignIn: React.FC<LoginInt & RouteComponentProps> = props => {
175175
e: React.MouseEvent<HTMLButtonElement, MouseEvent>
176176
) => {
177177
e.preventDefault();
178-
console.log('window api', window.api);
179178
window.api.github();
180179
props.history.push('/');
181180
}

app/src/components/main/AddLink.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ function AddLink({ id, onClickHandler, linkDisplayed }) {
1414
const [state, dispatch] = useContext(StateContext);
1515
const [link, setLink] = useState('')
1616

17+
//this function allows the link to be functional when it's nested
1718
function deepIterate(arr) {
1819
const output = [];
1920
for(let i = 0; i < arr.length; i++) {

app/src/containers/CustomizationPanel.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ const CustomizationPanel = ({ isThemeLight }): JSX.Element => {
6161
currFocus?.attributes?.compLink && setCompLink(currFocus.attributes.compLink);
6262
}, [state]);
6363

64-
//Miko -- save properties of nested div
64+
//this function allows properties to persist and appear in nested divs
6565
function deepIterate(arr) {
6666
const output = [];
6767
for(let i = 0; i < arr.length; i++) {

app/src/helperFunctions/auth.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
const fetch = require('node-fetch');
22
const isDev = process.env.NODE_ENV === 'development';
3+
const {DEV_PORT} = require('../../../config');
34
let serverURL = 'https://reactype-caret.herokuapp.com';
45
if (isDev) {
5-
serverURL = `http://localhost:${process.env.DEV_PORT}`;
6+
serverURL = `http://localhost:${DEV_PORT}`;
67
}
78
export const sessionIsCreated = (
89
username: string,

app/src/helperFunctions/projectGetSaveDel.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
const isDev = process.env.NODE_ENV === 'development';
2+
const {DEV_PORT} = require('../../../config');
23
let serverURL = 'https://reactype-caret.herokuapp.com';
34
if (isDev) {
4-
serverURL = `http://localhost:${process.env.DEV_PORT}`;
5+
serverURL = `http://localhost:${DEV_PORT}`;
56
}
67
export const getProjects = (): Promise<any> => {
78
let userId = window.localStorage.getItem('ssid');

server/README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515

1616
Redeployment should also be done with only the server subtree and not the entire repo. See this <a href="https://medium.com/@shalandy/deploy-git-subdirectory-to-heroku-ea05e95fce1f">article</a> about deploying just a subdirectory.
1717

18-
If `npm` is your package manager, you just need to run the script `npm run dev` and it will start the server on `http://localhost:${process.env.DEV_PORT}` for your development environment.
18+
If `npm` is your package manager, you just need to run the script `npm run dev` and it will start the server on `http://localhost:${DEV_PORT}` for your development environment.
19+
DEV_PORT can be defined in the config.js file on the root directory.
20+
You will also need to define your server address(MONGO_DB_DEV), github OAuth ID (GITHUB_ID) & Secret (GITHUB_SECRET) in a dotenv file in the root directory as well.
1921

2022
Endpoint testing is currently integrated with Jest and Supertest as well and can be run by `npm run test` or `npm run test:watch` for watch mode.

server/models/reactypeModels.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@
1111
const mongoose = require('mongoose');
1212
const bcrypt = require('bcryptjs');
1313
require('dotenv').config();
14-
const mongoURI = process.env.MONGO_DB_NEW;
14+
const mongoURI = process.env.MONGO_DB_DEV;
1515
const URI =
16-
process.env.NODE_ENV === 'production' ? mongoURI : process.env.MONGO_DB_NEW;
16+
process.env.NODE_ENV === 'production' ? mongoURI : process.env.MONGO_DB_DEV;
1717

1818
const SALT_WORK_FACTOR = 10;
1919
// connect to mongo db

server/server.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ const express = require('express');
33
const cookieParser = require('cookie-parser');
44
const passport = require('passport');
55
const GitHubStrategy = require('passport-github2').Strategy;
6+
const { DEV_PORT } = require('../config');
67

78
const path = require('path');
89
const cors = require('cors');
@@ -13,7 +14,7 @@ const projectController = require('./controllers/projectController');
1314

1415
const app = express();
1516

16-
const PORT = process.env.PORT || process.env.DEV_PORT;
17+
const PORT = process.env.PORT || DEV_PORT;
1718
const isDev = process.env.NODE_ENV === 'development';
1819
const isProd = process.env.NODE_ENV === 'production';
1920
const isTest = process.env.NODE_ENV === 'test';
@@ -45,7 +46,9 @@ passport.use(
4546
{
4647
clientID: process.env.GITHUB_ID,
4748
clientSecret: process.env.GITHUB_SECRET,
48-
callbackURL: `http://localhost:${process.env.DEV_PORT}/github/callback`
49+
callbackURL: isDev
50+
? `http://localhost:${DEV_PORT}/github/callback`
51+
: `https://reactype-caret.herokuapp.com/github/callback`
4952
},
5053
function(accessToken, refreshToken, profile, done) {
5154
console.log(profile);

webpack.development.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ const merge = require('webpack-merge');
44
const base = require('./webpack.config');
55
const path = require('path');
66
const nonce = require('./app/src/utils/createNonce')();
7+
const {DEV_PORT} = require('./config');
78

89
// merges webpack.config.js with development specific configs
910
module.exports = merge(base, {
@@ -22,10 +23,10 @@ module.exports = merge(base, {
2223
},
2324
proxy: {
2425
'/demoRender': {
25-
target: `http://localhost:${process.env.DEV_PORT}/`
26+
target: `http://localhost:${DEV_PORT}/`
2627
},
2728
'/user-styles': {
28-
target: `http://localhost:${process.env.DEV_PORT}/`
29+
target: `http://localhost:${DEV_PORT}/`
2930
}
3031
}
3132
},

0 commit comments

Comments
 (0)