Skip to content

Commit ac7bce5

Browse files
authored
Merge pull request #53 from oslabs-beta/grpcTesting
Fix problems with webpackconfig that was preventing build
2 parents 7c4f217 + 8f00e87 commit ac7bce5

File tree

6 files changed

+52
-21
lines changed

6 files changed

+52
-21
lines changed

main.js

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,7 @@ function createWindow() {
168168
});
169169
}
170170
else {
171+
console.log('__dirname', __dirname);
171172
indexPath = url.format({// if we are not in dev mode load production build file
172173
protocol: 'file:',
173174
pathname: path.join(__dirname, 'dist', 'index.html'),
@@ -221,7 +222,7 @@ app.on('ready', () => {
221222
app.on('window-all-closed', () => {
222223
// On macOS it is common for applications and their menu bar
223224
// to stay active until the user quits explicitly with Cmd + Q
224-
if (process.platform !== 'darwin') {//darwin refers to macOS...
225+
if (process.platform !== 'darwin') {//darwin refers to macOS...
225226
app.quit();// If User is on mac exit the program when all windows are closed
226227
}
227228
});
@@ -287,13 +288,13 @@ ipcMain.on('export-collection', (event, args) => {
287288
return;
288289
}
289290

290-
// fileName is a string that contains the path and filename created in the save file dialog.
291+
// fileName is a string that contains the path and filename created in the save file dialog.
291292
fs.writeFile(resp.filePath, content, (err) => {
292293
if(err){
293294
console.log("An error ocurred creating the file "+ err.message)
294295
}
295296
})
296-
297+
297298
})})
298299

299300

@@ -349,10 +350,10 @@ ipcMain.on('import-collection', (event, args) => {
349350

350351
if (parsed) {
351352
// validate parsed data type and properties
352-
if (typeof parsed !== 'object' ||
353-
!parsed['id'] ||
354-
!parsed['name'] ||
355-
!parsed['reqResArray'] ||
353+
if (typeof parsed !== 'object' ||
354+
!parsed['id'] ||
355+
!parsed['name'] ||
356+
!parsed['reqResArray'] ||
356357
!parsed['created_at']) {
357358
options.message = 'Invalid File';
358359
options.detail = 'Please try again.';
@@ -368,7 +369,7 @@ ipcMain.on('import-collection', (event, args) => {
368369
})
369370

370371

371-
// ipcMain listener that
372+
// ipcMain listener that
372373
ipcMain.on('http1-fetch-message', (event, arg) => {
373374
const { method, headers, body } = arg.options;
374375

@@ -377,18 +378,18 @@ ipcMain.on('http1-fetch-message', (event, arg) => {
377378
const headers = response.headers.raw();
378379
// check if the endpoint sends SSE
379380
// add status code for regular http requests in the response header
380-
381+
381382
if (headers['content-type'][0].includes('stream')) {
382383
// invoke another func that fetches to SSE and reads stream
383384
// params: method, headers, body
384385
event.sender.send('http1-fetch-reply', { headers, body: { error: 'This Is An SSE endpoint' } })
385386
}
386387
else {
387388
headers[':status'] = response.status;
388-
389+
389390
const receivedCookie = headers['set-cookie'];
390391
headers.cookies = receivedCookie;
391-
392+
392393
const contents = /json/.test(response.headers.get('content-type')) ? response.json() : response.text();
393394
contents
394395
.then(body => {
@@ -441,7 +442,7 @@ ipcMain.on('open-gql', (event, args) => {
441442
const parsedRemainingCookieProperties = cookie.parse(thisCookie.slice(idx + 1));
442443

443444
const parsedCookie = {...parsedRemainingCookieProperties, name: keyValueArr[0], value: keyValueArr[1]};
444-
445+
445446
parsedCookies.push(parsedCookie);
446447
})
447448
reqResObj.response.cookies = parsedCookies;
@@ -487,4 +488,3 @@ ipcMain.on('open-gql', (event, args) => {
487488
});
488489
}
489490
});
490-

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "Swell",
3-
"version": "0.3.0",
3+
"version": "0.4.0",
44
"description": "Swell",
55
"main": "main.js",
66
"repository": "https://github.com/open-source-labs/Swell",
@@ -82,6 +82,31 @@
8282
"name": "Sam Parsons",
8383
"email": "samparsons269@gmail.com",
8484
"url": "https://github.com/sam-parsons"
85+
},
86+
{
87+
"name": "Dan Stein",
88+
"email": "50937807+danst3in@users.noreply.github.com",
89+
"url": "https://github.com/danst3in"
90+
},
91+
{
92+
"name": "Evan Grobar",
93+
"email": "egrobar@gmail.com",
94+
"url": "https://github.com/egrobar"
95+
},
96+
{
97+
"name": "Nancy Dao",
98+
"email": "nancyddao@gmail.com",
99+
"url": "https://github.com/nancyddao"
100+
},
101+
{
102+
"name": "Yoon Choi",
103+
"email": "choi.yoon333@gmail.com",
104+
"url": "https://github.com/cyoonique"
105+
},
106+
{
107+
"name": "Amruth Uppaluri",
108+
"email": "amruth@uppaluri.org",
109+
"url": "https://github.com/amuuth"
85110
}
86111
],
87112
"build": {
@@ -99,6 +124,7 @@
99124
"main.js",
100125
"httpserver.js"
101126
],
127+
"nodeVersion":"12.14.1",
102128
"nsis": {
103129
"createDesktopShortcut": "always"
104130
},
@@ -150,7 +176,7 @@
150176
"license": "MIT",
151177
"homepage": "http://www.getswell.io",
152178
"engines": {
153-
"node": ">=12.0.0",
179+
"node": ">=12.14.1",
154180
"npm": ">=6.0.0"
155181
},
156182
"dependencies": {

saveProto.proto

Lines changed: 0 additions & 1 deletion
This file was deleted.

src/client/controllers/grpcController.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ grpcController.openGrpcConnection = (reqResObj, connectionArray) => {
3838
if (reqResObj.response.headers === null) {
3939
reqResObj.response.headers = {};
4040
}
41-
41+
4242
// go through services object, find service where name matches our passed
4343
// in service, then grab the rpc list of that service, also save that service
4444
let rpcList;
@@ -183,7 +183,7 @@ grpcController.openGrpcConnection = (reqResObj, connectionArray) => {
183183
// request without overwrite
184184
reqResObj.connection = 'pending';
185185
reqResObj.connectionType = 'plain';
186-
reqResObj.timeReceived = Date.now();
186+
reqResObj.timeSent = Date.now();
187187
call.write(query);
188188
// add console log for completed write?
189189
}

webpack.build.config.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
const webpack = require('webpack');
22
const path = require('path');
33
const HtmlWebpackPlugin = require('html-webpack-plugin');
4-
const BabiliPlugin = require('babili-webpack-plugin');
54
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
5+
const TerserPlugin = require('terser-webpack-plugin');
6+
const nodeExternals = require('webpack-node-externals');
7+
68

79
// Any directories you will be adding code/files into,
810
// need to be added to this array so webpack will pick them up
@@ -46,6 +48,11 @@ module.exports = {
4648
],
4749
},
4850
target: 'electron-renderer',
51+
optimization: {
52+
minimize: true,
53+
minimizer: [new TerserPlugin({})],
54+
},
55+
externals: [nodeExternals()],
4956
plugins: [
5057
new HtmlWebpackPlugin(),
5158
new MiniCssExtractPlugin({
@@ -57,7 +64,6 @@ module.exports = {
5764
new webpack.DefinePlugin({
5865
'process.env.NODE_ENV': JSON.stringify('production'),
5966
}),
60-
new BabiliPlugin(),
6167
],
6268
stats: {
6369
colors: true,

0 commit comments

Comments
 (0)