Merge branch 'master' into fix-quotes

This commit is contained in:
joshaber 2016-05-27 13:59:24 -04:00
commit 0b98bafce0
6 changed files with 50 additions and 50 deletions

View file

@ -3,6 +3,9 @@ notifications:
on_success: never
on_failure: change
os:
- osx
branches:
only:
- master
@ -21,17 +24,14 @@ addons:
packages:
- g++-4.8
cache:
directories:
- node_modules
install:
- npm install
before_script:
- export DISPLAY=:99.0; sh -e /etc/init.d/xvfb start
script:
- npm run lint
- npm run build:prod
- npm test
cache:
directories:
- node_modules

View file

@ -6,16 +6,8 @@ Just playin around with some computering.
npm install
```
If you want hot loading:
To build and run the app:
```
# Start the dev server
npm start
```
Or if you don't care:
```
npm run build
npm run dev
```

View file

@ -1,24 +0,0 @@
'use strict'
const express = require('express')
const webpack = require('webpack')
const config = require('./webpack.development')
const app = express()
const compiler = webpack(config)
const port = process.env.PORT || 3000
app.use(require('webpack-dev-middleware')(compiler, {
publicPath: config.output.publicPath
}))
app.use(require('webpack-hot-middleware')(compiler))
app.listen(port, 'localhost', err => {
if (err) {
console.log(err)
return
}
console.log(`Listening at http://localhost:${port}`)
})

View file

@ -13,9 +13,7 @@
"scripts": {
"test": "electron-mocha --renderer --require ts-node/register test/*.ts test/*.tsx",
"postinstall": "typings install",
"start-server": "node dev_server.js",
"start": "npm run build:dev && npm-run-all --parallel run start-server",
"run": "env NODE_ENV=development node script/run",
"start": "npm run build:dev && node script/start",
"compile:dev": "tsc && env NODE_ENV=development webpack --config webpack.development.js",
"compile:prod": "tsc && env NODE_ENV=production webpack --config webpack.production.js",
"build:dev": "npm run compile:dev && env NODE_ENV=development node script/build",
@ -50,12 +48,11 @@
"chai": "^3.5.0",
"electron-mocha": "2.1.0",
"electron-packager": "^7.0.1",
"electron-prebuilt": "^1.1.2",
"electron-prebuilt": "1.1.3",
"electron-winstaller": "^2.3.0",
"express": "^4.13.4",
"fs-extra": "^0.30.0",
"mocha": "^2.4.5",
"npm-run-all": "^1.8.0",
"react-addons-test-utils": "^15.0.2",
"ts-loader": "^0.8.2",
"ts-node": "^0.7.2",

View file

@ -1,5 +1,3 @@
#!/usr/bin/env node
'use strict'
const path = require('path')
@ -7,15 +5,19 @@ const cp = require('child_process')
const distInfo = require('./dist-info')
const distPath = distInfo.getDistPath()
const productName = distInfo.getProductName()
let binaryPath = ''
if (process.platform === 'darwin') {
binaryPath = path.join(distPath, 'GitHub.app', 'Contents', 'MacOS', 'GitHub')
binaryPath = path.join(distPath, `${productName}.app`, 'Contents', 'MacOS', `${productName}`)
} else if (process.platform === 'win32') {
binaryPath = path.join(distPath, 'GitHub')
binaryPath = path.join(distPath, `${productName}`)
} else {
console.error(`I dunno how to run on ${process.arch} :(`)
process.exit(1)
}
cp.spawn(binaryPath, [], {env: process.env})
module.exports = function () {
const env = Object.assign({}, process.env, {NODE_ENV: 'development'})
return cp.spawn(binaryPath, [], {env})
}

33
script/start Normal file
View file

@ -0,0 +1,33 @@
#!/usr/bin/env node
'use strict'
const express = require('express')
const webpack = require('webpack')
const config = require('../webpack.development')
const run = require('./run')
const server = express()
const compiler = webpack(config)
const port = process.env.PORT || 3000
server.use(require('webpack-dev-middleware')(compiler, {
publicPath: config.output.publicPath
}))
server.use(require('webpack-hot-middleware')(compiler))
server.listen(port, 'localhost', err => {
if (err) {
console.log(err)
process.exit(1)
return
}
console.log(`Server running at http://localhost:${port}`)
const runningApp = run()
runningApp.on('close', () => {
process.exit(0)
})
})