Darwin auto updates working (I think)

This commit is contained in:
Gregory Schier 2016-07-13 18:12:42 -07:00
parent 150c5caf55
commit b703400fe4
8 changed files with 57 additions and 15 deletions

View File

@ -2,18 +2,44 @@
// Don't npm install this (it breaks). Rely on the global one.
const electron = require('electron');
const appVersion = require('./package.json').version;
const autoUpdater = electron.autoUpdater;
const Menu = electron.Menu;
const app = electron.app; // Module to control application life.
const BrowserWindow = electron.BrowserWindow; // Module to create native browser window.
const IS_DEV = process.env.NODE_ENV === 'development';
const IS_MAC = process.platform === 'darwin';
let mainWindow = null;
let zoomFactor = 1;
// Enable this for CSS grid layout :)
electron.app.commandLine.appendSwitch('enable-experimental-web-platform-features');
if (!IS_DEV) {
autoUpdater.setFeedURL(
IS_MAC ?
`http://builds.insomnia.rest/builds/check/mac?v=${appVersion}` :
`http://builds.insomnia.rest/builds/check/windows?v=${appVersion}`
);
autoUpdater.checkForUpdates();
}
autoUpdater.on('update-not-available', () => {
console.log('-- Update Not Available --')
});
autoUpdater.on('update-available', () => {
console.log('-- Update Available --');
});
autoUpdater.on('update-downloaded', (e) => {
console.log('-- Update Downloaded --');
autoUpdater.quitAndInstall();
});
// Quit when all windows are closed (except on Mac).
app.on('window-all-closed', () => {
if (!IS_MAC) {

View File

@ -1,4 +1,4 @@
import * as appJson from '../app.json'
import * as appJson from '../package.json'
export function getVersion () {
return appJson.version;

View File

@ -54,7 +54,7 @@ function actuallySend (request, callback) {
// TODO: Handle cookies
let config = buildRequestConfig(request, {
jar: networkRequest.jar(),
followRedirect: false
followRedirect: true
}, true);
const startTime = Date.now();

View File

@ -1,7 +1,7 @@
{
"private": true,
"name": "insomnia",
"version": "3.0.0",
"version": "3.0.5",
"productName": "Insomnia REST Client",
"description": "The best REST API Client",
"homepage": "http://insomnia.rest",

View File

@ -36,7 +36,7 @@
"babel-preset-react-hmre": "^1.1.1",
"concurrently": "^2.0.0",
"css-loader": "^0.23.1",
"electron-packager": "^7.0.0",
"electron-packager": "^7.3.0",
"electron-prebuilt": "^1.2.6",
"express": "latest",
"file-loader": "^0.8.5",

View File

@ -10,7 +10,7 @@ NODE_ENV=production node -r babel-register ./node_modules/.bin/webpack --config
echo "-- COPYING REMAINING FILES --"
# Copy some things
cp app/app.json dist/package.json
cp app/package.json dist/package.json
cp app/app.js dist/
cp -r app/images dist/
cp -r app/external dist/

View File

@ -1,10 +1,13 @@
#!/bin/bash
#? Package the app
APP_NAME="Insomnia REST Client"
APP_ID="insomnia"
APP_NAME="Insomnia"
APP_ID="com.insomnia.app"
APP_VERSION=$(node -e "console.log(require('./dist/package.json').version)")
COMPANY_NAME="Gregory Schier"
OUT_DIR="build/darwin/v$APP_VERSION"
echo "-- PACKAGING APP --"
echo "-- PACKAGING v$APP_VERSION TO $OUT_DIR/... --"
node -r babel-register node_modules/electron-packager/cli.js \
dist \
@ -12,16 +15,29 @@ node -r babel-register node_modules/electron-packager/cli.js \
--platform=darwin \
--arch=x64 \
--asar \
--build-version=1 \
--app-version=3.0.0 \
--version-string.CompanyName=schier.co \
--app-version="$APP_VERSION" \
--version-string.CompanyName="$COMPANY_NAME" \
--version-string.ProductName="$APP_NAME" \
--version-string.FileDescription="FileDescription" \
--version-string.FileDescription="Beautiful HTTP Client" \
--version-string.OriginalFilename="$APP_ID" \
--version-string.InternalName="$APP_ID" \
--download.strictSSL=true \
--icon=assets/icon \
--out=build \
--out="$OUT_DIR" \
--app-bundle-id="$APP_ID" \
--app-category-type='public.app-category.developer-tools' \
--sign='Developer ID Application: Gregory Schier (7PU3P6ELJ8)' \
--osx-sign \
--overwrite
echo "-- PACKAGING COMPLETE --"
cd "$OUT_DIR"
DARWIN_DIR="$APP_NAME-darwin-x64"
ZIP_NAME="$APP_NAME-v$APP_VERSION.zip"
mv "$DARWIN_DIR/$APP_NAME.app" .
rm -r "$DARWIN_DIR"
zip -rqyX9 "$ZIP_NAME" "$APP_NAME.app"
rm -r "$APP_NAME.app"
echo "-- PACKAGED $APP_VERSION TO $OUT_DIR --"

View File

@ -1,5 +1,5 @@
import path from 'path'
import pkg from '../app/app.json'
import pkg from '../app/package.json'
export default {
devtool: 'source-map',