Skip to content

Commit 5c9d61d

Browse files
committed
Fix packaging
1 parent 0450c8a commit 5c9d61d

File tree

4 files changed

+15
-5
lines changed

4 files changed

+15
-5
lines changed

package.json

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "electron-react-s3-tool",
33
"version": "0.1.0",
44
"private": true,
5-
"main": "electron.js",
5+
"main": "public/electron.js",
66
"homepage": "./",
77
"dependencies": {
88
"async-child-process": "^1.1.1",
@@ -28,6 +28,7 @@
2828
"eslint-plugin-react": "7.4.0",
2929
"extract-text-webpack-plugin": "3.0.2",
3030
"file-loader": "1.1.5",
31+
"fix-path": "^2.1.0",
3132
"fs-extra": "3.0.1",
3233
"html-webpack-plugin": "2.29.0",
3334
"jest": "20.0.4",
@@ -52,7 +53,7 @@
5253
"dev": "nf start",
5354
"dist": "build",
5455
"electron": "electron .",
55-
"package": "npm run react-build && build --publish never",
56+
"package": "npm run react-build && build --em.main=build/electron.js --publish never",
5657
"react-build": "node scripts/build.js",
5758
"start": "node scripts/start.js",
5859
"test": "node scripts/test.js --env=jsdom"
@@ -107,6 +108,10 @@
107108
},
108109
"build": {
109110
"appId": "yourappid",
111+
"files": [
112+
"build/**/*",
113+
"node_modules/**/*"
114+
],
110115
"dmg": {
111116
"contents": [
112117
{

electron.js renamed to public/electron.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ app.on('ready', function() {
2626
});
2727

2828
// For debugging
29-
mainWindow.webContents.openDevTools();
29+
// mainWindow.webContents.openDevTools();
3030

3131
const startUrl = process.env.ELECTRON_START_URL || url.format({
3232
pathname: path.join(__dirname, '/../build/index.html'),

src/App.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import './App.css';
66

77
const remote = window.require('electron').remote;
88
const execAsync = window.require('async-child-process').execAsync;
9+
const fixPath = window.require('fix-path');
910

1011
class App extends Component {
1112
constructor(props) {
@@ -33,8 +34,10 @@ class App extends Component {
3334
}
3435

3536
downloadBucket() {
37+
fixPath();
3638
return execAsync(`aws s3 sync s3://${this.state.selectedBucket} ${this.state.downloadDirectory}`).then(results => {
37-
console.log(results);
39+
console.log(results);
40+
// TODO: Killing the app should kill this process
3841
// return results.stdout;
3942
});
4043
}

src/components/BucketSelector.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { Button, Form, FormGroup, Label, Input, FormText } from 'reactstrap';
33
// import { PropagateLoader } from 'react-spinners';
44

55
const execAsync = window.require('async-child-process').execAsync;
6+
const fixPath = window.require('fix-path');
67

78
class BucketSelector extends Component {
89
constructor(props) {
@@ -22,6 +23,7 @@ class BucketSelector extends Component {
2223
}
2324

2425
getBuckets() {
26+
fixPath();
2527
return execAsync("aws s3 ls").then(results => {
2628
return this.parseBuckets(results.stdout);
2729
});
@@ -50,7 +52,7 @@ class BucketSelector extends Component {
5052
<FormGroup>
5153
<Label for="exampleSelect">Select A Bucket</Label>
5254
<Input type="select" name="select" id="exampleSelect" onChange={this.handleBucketChange}>
53-
<option value="" disabled selected>{this.state.loading ? 'Loading' : 'Select an S3 bucket'}</option>
55+
<option value="" disabled selected>{this.state.loading ? 'Loading...' : 'Select an S3 bucket'}</option>
5456
{bucketOptions}
5557
</Input>
5658
</FormGroup>

0 commit comments

Comments
 (0)