Smaller build

This commit is contained in:
Gregory Schier 2016-04-20 22:47:03 -07:00
parent 3a8ec2e7db
commit 8a36c16711
9 changed files with 36 additions and 37 deletions

View File

@ -6,7 +6,8 @@
</head>
<body>
<div id="root"></div>
<script src="./node_modules/pouchdb/dist/pouchdb.js"></script>
<script src="./external/pouchdb.min.js"></script>
<script src="./external/pouchdb.find.min.js"></script>
<script>
(function () {
const script = document.createElement('script');

View File

@ -1,14 +1,10 @@
// import PouchDB from 'pouchdb';
import * as methods from '../constants/global';
import {generateId} from './util'
import pouchDBFind from 'pouchdb-find'
// Add plugins
// We have to include the web version of PouchDB in app.html because
// the NodeJS version defaults to LevelDB which is hard (impossible?)
// to get working in Electron apps
PouchDB.plugin(pouchDBFind);
let db = new PouchDB('insomnia.db', {adapter: 'websql'});
// For browser console debugging

2
app/external/pouchdb.find.min.js vendored Normal file

File diff suppressed because one or more lines are too long

11
app/external/pouchdb.min.js vendored Normal file

File diff suppressed because one or more lines are too long

View File

@ -7,9 +7,6 @@
"version": "3.0.0",
"main": "app.js",
"dependencies": {
"nunjucks": "^1.3.4",
"pouchdb": "^5.3.1",
"pouchdb-find": "^0.9.0",
"request": "^2.71.0"
}
}

View File

@ -12,6 +12,7 @@
"classnames": "^2.2.3",
"codemirror": "^5.12.0",
"jsonschema": "^1.1.0",
"nunjucks": "^1.3.4",
"react": "^0.14.7",
"react-dom": "^0.14.7",
"react-redux": "^4.4.1",
@ -32,8 +33,6 @@
"babel-preset-react-hmre": "^1.1.1",
"concurrently": "^2.0.0",
"css-loader": "^0.23.1",
"del": "^2.2.0",
"electron-builder": "^3.6.1",
"electron-packager": "^7.0.0",
"electron-prebuilt": "^0.37.6",
"express": "latest",
@ -41,7 +40,6 @@
"jest": "^0.1.40",
"jest-cli": "^0.9.2",
"json-loader": "^0.5.4",
"minimist": "latest",
"node-sass": "^3.4.2",
"react-addons-test-utils": "^0.14.7",
"react-hot-loader": "^1.3.0",
@ -52,23 +50,15 @@
"webpack": "^1.12.14",
"webpack-dev-middleware": "latest",
"webpack-dev-server": "^1.14.1",
"webpack-hot-middleware": "^2.10.0",
"webpack-target-electron-renderer": "^0.4.0"
},
"build": {
"app-bundle-id": "rest.insomnia.app",
"app-category-type": "public.app-category.productivity",
"iconUrl": "(windows only)"
"webpack-hot-middleware": "^2.10.0"
},
"scripts": {
"start-hot": "HOT=1 NODE_ENV=development electron -r babel-register ./app/app.js",
"hot-server": "node -r babel-register ./webpack/server.js",
"dev": "concurrently --kill-others \"npm run hot-server\" \"npm run start-hot\"",
"test": "jest $@",
"package": "./scripts/package",
"package-all": "npm run package -- --all",
"postinstall": "cd node_modules/leveldown && HOME=~/.electron-gyp node-gyp rebuild --target=0.36.10 --arch=x64 --dist-url=https://atom.io/download/atom-shell"
},
"package": "./scripts/package"
},
"jest": {
"unmockedModulePathPatterns": [
"<rootDir>/node_modules/redux-thunk",

View File

@ -1,13 +1,23 @@
#!/bin/bash
#? Package the app
echo "-- REMOVING DIST FOLDER --"
rm -r dist/*
echo "-- BUILDING PRODUCTION APP --"
NODE_ENV=production node -r babel-register ./node_modules/.bin/webpack --config ./webpack/webpack.config.production.js
cp app/package.json app/app.js dist/
echo "-- COPYING REMAINING FILES --"
cp -r app/package.json app/app.js app/external dist/
echo "-- INSTALLING PACKAGES --"
cp -r app/node_modules dist/
# cd dist/; NODE_ENV=production npm install; cd ..
echo "-- PACKAGING APP --"
node -r babel-register node_modules/electron-packager/cli.js \
dist \
Insomnia \

View File

@ -1,11 +0,0 @@
import packager from 'electron-packager'
const options = {
arch: 'x64',
platform: 'darwin',
dir: './dist'
};
packager(options, (err, appPaths) => {
console.log(err, appPaths);
});

View File

@ -1,5 +1,5 @@
import path from 'path';
import webpack from 'webpack';
import path from 'path'
import pkg from '../app/package.json'
export default {
devtool: 'source-map',
@ -60,7 +60,10 @@ export default {
packageMains: ['webpack', 'browser', 'web', 'browserify', ['jam', 'main'], 'main']
},
externals: [
'request'
...Object.keys(pkg.dependencies),
{
}
],
plugins: [],
target: 'electron-renderer'