From 69376bdbbb6884f0f90a4d770f0ddef34e1cb85c Mon Sep 17 00:00:00 2001 From: Max Claus Nunes Date: Sun, 5 Jun 2016 09:48:29 -0300 Subject: [PATCH 1/7] Use clang from Ubuntu package It is a temp fix for the issue #184. The clang installed is the 3.5 or 3.4. We should move back to 3.7 version once there is some update package avaliable. Because seems the latest version has a much faster perfomance. --- .travis.yml | 9 ++++++--- package.json | 17 ++++++++--------- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/.travis.yml b/.travis.yml index bda05afb..3b71fdcd 100644 --- a/.travis.yml +++ b/.travis.yml @@ -27,15 +27,18 @@ addons: apt: sources: - ubuntu-toolchain-r-test - - llvm-toolchain-precise-3.7 + #- llvm-toolchain-precise-3.8 packages: - libgnome-keyring-dev - icnsutils - - clang-3.7 + #- clang-3.8 + - clang + - graphicsmagick install: +- clang --version - nvm install 6 -- npm install npm -g +# - npm install npm -g - npm prune - npm install diff --git a/package.json b/package.json index 05b99c5e..26df512e 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,4 @@ { - "license": "MIT", "scripts": { "postinstall": "install-app-deps", "dev:webpack": "webpack-dev-server --config ./webpack.dev.config.js", @@ -10,10 +9,10 @@ "clean:win": "rimraf dist/win* dist/Sqlectron-win*", "clean:linux": "rimraf dist/Sqlectron-linux-* dist/*.deb", "compile": "rimraf app/out && cross-env NODE_ENV=production babel-node scripts/compile.js -v", - "build:osx": "npm run clean:osx && build --platform darwin", - "build:linux": "npm run clean:linux && build --platform linux --arch all", - "build:win": "npm run clean:win && build --platform win32 --arch all", - "dist": "npm run compile && build --arch all", + "build:osx": "npm run clean:osx && build --osx", + "build:linux": "npm run clean:linux && build --linux --x64 --ia32", + "build:win": "npm run clean:win && build --windows --x64 --ia32", + "dist": "npm run compile && build --x64 --ia32", "dist:osx": "npm run compile && npm run build:osx", "dist:winlinux": "npm run compile && npm run build:linux && npm run build:win" }, @@ -38,12 +37,12 @@ }, "devDependencies": { "autoprefixer-loader": "^3.1.0", - "babel": "^5.8.29", - "babel-core": "^5.8.29", + "babel": "^5.8.38", + "babel-core": "^5.8.38", "babel-eslint": "^4.1.3", - "babel-loader": "^5.3.2", + "babel-loader": "^5.4.0", "babel-plugin-react-transform": "^1.1.1", - "babel-runtime": "^5.8.29", + "babel-runtime": "^5.8.38", "brace": "^0.7.0", "breakpoint-sass": "^2.6.1", "classnames": "^2.2.5", From 19c5dd253b7c488f6aeb91270abe5816cea5ec69 Mon Sep 17 00:00:00 2001 From: Max Claus Nunes Date: Sun, 5 Jun 2016 13:20:10 -0300 Subject: [PATCH 2/7] Upgrade babel and react trasnform --- .babelrc | 15 +++------------ app/package.json | 9 ++++++--- package.json | 14 +++++++++----- src/browser/main.js | 6 +++--- src/browser/remote.js | 4 +--- src/browser/update-checker.js | 4 ++-- src/renderer/store/configure.js | 8 +++----- webpack.dev.config.js | 2 +- webpack.prod.config.js | 2 +- 9 files changed, 29 insertions(+), 35 deletions(-) diff --git a/.babelrc b/.babelrc index 50b36b0e..f5704c30 100644 --- a/.babelrc +++ b/.babelrc @@ -1,18 +1,9 @@ { - "stage": 0, - "optional": ["runtime"], + "presets": ["es2015", "stage-0", "react"], + "plugins": ["transform-runtime"], "env": { "development": { - "plugins": ["react-transform"], - "extra": { - "react-transform": { - "transforms": [{ - "transform": "react-transform-hmr", - "imports": ["react"], - "locals": ["module"] - }] - } - } + "presets": ["react-hmre"] } } } diff --git a/app/package.json b/app/package.json index 024e6cb4..11f3b808 100644 --- a/app/package.json +++ b/app/package.json @@ -16,9 +16,12 @@ }, "dependencies": { "axios": "^0.7.0", - "babel": "^5.8.29", - "babel-core": "^5.8.29", - "babel-runtime": "^5.8.29", + "babel-core": "^6.9.1", + "babel-plugin-transform-runtime": "^6.9.0", + "babel-polyfill": "^6.9.1", + "babel-preset-es2015": "^6.9.0", + "babel-preset-react": "^6.5.0", + "babel-preset-stage-0": "^6.5.0", "debug": "^2.2.0", "sqlectron-core": "^6.0.1" } diff --git a/package.json b/package.json index 26df512e..2b565fb5 100644 --- a/package.json +++ b/package.json @@ -37,12 +37,16 @@ }, "devDependencies": { "autoprefixer-loader": "^3.1.0", - "babel": "^5.8.38", - "babel-core": "^5.8.38", + "babel-cli": "^6.9.0", + "babel-core": "^6.6.5", "babel-eslint": "^4.1.3", - "babel-loader": "^5.4.0", - "babel-plugin-react-transform": "^1.1.1", - "babel-runtime": "^5.8.38", + "babel-loader": "^6.2.4", + "babel-plugin-transform-runtime": "^6.9.0", + "babel-polyfill": "^6.9.1", + "babel-preset-es2015": "^6.9.0", + "babel-preset-react": "^6.5.0", + "babel-preset-react-hmre": "^1.1.1", + "babel-preset-stage-0": "^6.5.0", "brace": "^0.7.0", "breakpoint-sass": "^2.6.1", "classnames": "^2.2.5", diff --git a/src/browser/main.js b/src/browser/main.js index f16af884..5dd5c90e 100644 --- a/src/browser/main.js +++ b/src/browser/main.js @@ -5,14 +5,14 @@ var devMode = (process.argv || []).indexOf('--dev') !== -1; // enables ES6+ support if (devMode) { - require('babel/register'); + require('babel-register'); // load the app dependencies var PATH_APP_NODE_MODULES = path.join(__dirname, '..', '..', 'app', 'node_modules'); require('module').globalPaths.push(PATH_APP_NODE_MODULES); -} else { - require('babel/polyfill'); } +require('babel-polyfill'); + // starts the electron app require('./app'); diff --git a/src/browser/remote.js b/src/browser/remote.js index 665900ad..9ec89413 100644 --- a/src/browser/remote.js +++ b/src/browser/remote.js @@ -4,6 +4,4 @@ import { remote } from 'electron'; /** * Exposes to the renderer process any used API running on main process */ -export default { - sqlectron: remote.require('sqlectron-core'), -}; +export const sqlectron = remote.require('sqlectron-core'); diff --git a/src/browser/update-checker.js b/src/browser/update-checker.js index f8523742..ae83e88c 100644 --- a/src/browser/update-checker.js +++ b/src/browser/update-checker.js @@ -1,7 +1,7 @@ import axios from 'axios'; +import createDebug from './debug'; - -const debug = require('./debug')('gh-update-checker'); +const debug = createDebug('gh-update-checker'); const WAIT_2_SECS = 2000; diff --git a/src/renderer/store/configure.js b/src/renderer/store/configure.js index 3c1199f2..74278d47 100644 --- a/src/renderer/store/configure.js +++ b/src/renderer/store/configure.js @@ -23,11 +23,9 @@ export default function configureStore(initialState) { const store = createStoreWithMiddleware(rootReducer, initialState); if (module.hot) { - // Enable Webpack hot module replacement for reducers - module.hot.accept('../reducers', () => { - const nextReducer = require('../reducers'); - store.replaceReducer(nextReducer); - }); + module.hot.accept('../reducers', () => + store.replaceReducer(require('../reducers').default) + ); } return store; diff --git a/webpack.dev.config.js b/webpack.dev.config.js index 2f68e956..85cec5d6 100644 --- a/webpack.dev.config.js +++ b/webpack.dev.config.js @@ -2,7 +2,7 @@ var path = require('path'); var webpack = require('webpack'); var HtmlWebpackPlugin = require('html-webpack-plugin'); -require('babel/polyfill'); +require('babel-polyfill'); module.exports = { debug: true, diff --git a/webpack.prod.config.js b/webpack.prod.config.js index 4403b18a..bce0c1e6 100644 --- a/webpack.prod.config.js +++ b/webpack.prod.config.js @@ -2,7 +2,7 @@ var path = require('path'); var webpack = require('webpack'); var HtmlWebpackPlugin = require('html-webpack-plugin'); -require('babel/polyfill'); +require('babel-polyfill'); module.exports = { devtool: 'eval-source-map', From a47e952f3ee2111caf0f2eee5998b96204c8c11e Mon Sep 17 00:00:00 2001 From: Max Claus Nunes Date: Sun, 5 Jun 2016 13:22:04 -0300 Subject: [PATCH 3/7] Remove not used script and depenency --- package.json | 1 - scripts/publish-releases.sh | 64 ------------------------------------- 2 files changed, 65 deletions(-) delete mode 100755 scripts/publish-releases.sh diff --git a/package.json b/package.json index 2b565fb5..5f1a2a94 100644 --- a/package.json +++ b/package.json @@ -56,7 +56,6 @@ "del": "^2.2.0", "denodeify": "^1.2.1", "electron-builder": "next", - "electron-packager": "^5.2.1", "electron-prebuilt": "^1.2.1", "eslint": "^1.7.3", "eslint-config-airbnb": "^0.1.0", diff --git a/scripts/publish-releases.sh b/scripts/publish-releases.sh deleted file mode 100755 index f3ccf803..00000000 --- a/scripts/publish-releases.sh +++ /dev/null @@ -1,64 +0,0 @@ -#!/bin/bash -set -e - -release_file() { - NAME="$1.zip" - FILE="$2" - TYPE="$3" - - echo "==> Releasing file $NAME" - - if [[ "$TYPE" == "installer" ]]; then - zip -qj9 "installers/compressed/$NAME" "installers/$FILE" - else - cd releases - zip -qr9 "../installers/compressed/$NAME" "$FILE" - cd - - fi - - # github-release (https://github.com/aktau/github-release) - github-release upload \ - --user "sqlectron" \ - --repo "sqlectron-gui" \ - --tag "$PACKAGE_VERSION" \ - --name "$NAME" \ - --file "installers/compressed/$NAME" -} - -# Version key/value should be on his own line -PACKAGE_VERSION=$(cat app/package.json \ - | grep version \ - | head -1 \ - | awk -F: '{ print $2 }' \ - | sed 's/[ ",]//g') - - -PACKAGE_VERSION="v$PACKAGE_VERSION" -LATEST_LOCAL_GIT_TAG=$(git describe --abbrev=0 --tags) - -if [ ! "$PACKAGE_VERSION" == "$LATEST_LOCAL_GIT_TAG" ]; then - echo "==> Skipping publish" - echo " The git tag must be the same of the package.json" - echo "==> Version:" - echo " package.json: $PACKAGE_VERSION" - echo " git local tag: $LATEST_LOCAL_GIT_TAG" - exit 1 -fi - -echo "==> Ensure the git tag is pushed" -git push origin $PACKAGE_VERSION - -if [[ -z "$GITHUB_TOKEN" ]]; then - echo "Missing GitHub Token" - exit 1 -fi - -echo "==> Publishing release $PACKAGE_VERSION" -rm -rf installers/compressed -mkdir -p installers/compressed - -release_file "Sqlectron-darwin-x64" "osx/Sqlectron.dmg" "installer" -release_file "Sqlectron-win32-ia32" "win/32/Sqlectron Setup.exe" "installer" -release_file "Sqlectron-win32-x64" "win/64/Sqlectron Setup.exe" "installer" -release_file "Sqlectron-linux-ia32" "Sqlectron-linux-ia32" -release_file "Sqlectron-linux-x64" "Sqlectron-linux-x64" From a2462f547aaad495bc44cb13a90af326b25c9016 Mon Sep 17 00:00:00 2001 From: Max Claus Nunes Date: Sun, 5 Jun 2016 15:26:42 -0300 Subject: [PATCH 4/7] Upgrade all webpack loaders Before upgrading was cusing some errors in the build. --- package.json | 9 +++++---- src/renderer/index.html | 4 ++-- webpack.dev.config.js | 1 - webpack.prod.config.js | 1 - 4 files changed, 7 insertions(+), 8 deletions(-) diff --git a/package.json b/package.json index 5f1a2a94..159aa0d3 100644 --- a/package.json +++ b/package.json @@ -36,7 +36,7 @@ } }, "devDependencies": { - "autoprefixer-loader": "^3.1.0", + "autoprefixer-loader": "^3.2.0", "babel-cli": "^6.9.0", "babel-core": "^6.6.5", "babel-eslint": "^4.1.3", @@ -63,9 +63,10 @@ "file-loader": "^0.8.5", "fixed-data-table": "^0.6.0", "history": "^1.12.6", - "html-webpack-plugin": "^1.6.2", + "html-webpack-plugin": "^2.19.0", "imports-loader": "^0.6.5", "jquery": "^2.2.0", + "json-loader": "^0.5.4", "lodash": "^3.10.1", "minimist": "^1.2.0", "node-sass": "^3.4.2", @@ -83,9 +84,9 @@ "redux-logger": "^2.2.1", "redux-thunk": "^1.0.0", "rimraf": "^2.5.2", - "sass-loader": "^3.1.2", + "sass-loader": "^3.2.0", "spawn-auto-restart": "^2.0.1", - "style-loader": "^0.13.0", + "style-loader": "^0.13.1", "url-loader": "^0.5.7", "webpack": "^1.13.1", "webpack-dev-middleware": "^1.6.1", diff --git a/src/renderer/index.html b/src/renderer/index.html index 1c427745..01fc8fd6 100644 --- a/src/renderer/index.html +++ b/src/renderer/index.html @@ -117,8 +117,8 @@
- {% if (o.htmlWebpackPlugin.options.hot) { %} + <% if (htmlWebpackPlugin.options.hot) { %> - {% } %} + <% } %> diff --git a/webpack.dev.config.js b/webpack.dev.config.js index 85cec5d6..9a4a15f1 100644 --- a/webpack.dev.config.js +++ b/webpack.dev.config.js @@ -58,7 +58,6 @@ module.exports = { new HtmlWebpackPlugin({ hot: true, template: 'src/renderer/index.html', - inject: 'body', }), new webpack.DefinePlugin({ 'process.env.NODE_ENV': JSON.stringify('development'), diff --git a/webpack.prod.config.js b/webpack.prod.config.js index bce0c1e6..be923302 100644 --- a/webpack.prod.config.js +++ b/webpack.prod.config.js @@ -87,7 +87,6 @@ module.exports = { }), new HtmlWebpackPlugin({ template: 'src/renderer/index.html', - inject: 'body', }), new webpack.ProvidePlugin({ Radium: 'radium', From 0ffb422dc7c177027999fd8d643a15c9595be85c Mon Sep 17 00:00:00 2001 From: Max Claus Nunes Date: Sun, 5 Jun 2016 13:21:39 -0300 Subject: [PATCH 5/7] Move script of compile files to NPM scripts --- package.json | 4 +++- scripts/compile.js | 57 ---------------------------------------------- 2 files changed, 3 insertions(+), 58 deletions(-) delete mode 100644 scripts/compile.js diff --git a/package.json b/package.json index 159aa0d3..8959f6c1 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,9 @@ "clean:osx": "rimraf dist/Sqlectron-darwin-*", "clean:win": "rimraf dist/win* dist/Sqlectron-win*", "clean:linux": "rimraf dist/Sqlectron-linux-* dist/*.deb", - "compile": "rimraf app/out && cross-env NODE_ENV=production babel-node scripts/compile.js -v", + "compile": "rimraf app/out && cross-env NODE_ENV=production && npm run compile:browser && npm run compile:renderer", + "compile:browser": "babel ./src/browser -d app/out/browser", + "compile:renderer": "webpack --progress --display-error-details --config ./webpack.prod.config", "build:osx": "npm run clean:osx && build --osx", "build:linux": "npm run clean:linux && build --linux --x64 --ia32", "build:win": "npm run clean:win && build --windows --x64 --ia32", diff --git a/scripts/compile.js b/scripts/compile.js deleted file mode 100644 index 54c22d30..00000000 --- a/scripts/compile.js +++ /dev/null @@ -1,57 +0,0 @@ -import { exec } from 'child_process'; -import { join } from 'path'; -import denodeify from 'denodeify'; -import webpack from 'webpack'; -import del from 'del'; -import webpackConfig from '../webpack.prod.config'; - -/** - * Script arguments: - * =============================================== - * -v verbose (default=false) - */ -const argv = require('minimist')(process.argv.slice(2), { boolean: ['v'] }); -const ROOT_PATH = join(__dirname, '..'); -const BUILD_PATH = join(ROOT_PATH, 'app/out'); - - -/** - * Build browser code with babel - */ -async function buildBrowserCode() { - const browserBuildPath = join(BUILD_PATH, 'browser'); - return denodeify(exec).call(exec, `babel ./src/browser -d ${browserBuildPath}`, { cwd: ROOT_PATH }); -} - - -/** - * Build assets through webpack - */ -async function buildRendererCode() { - const stats = await denodeify(webpack).call(webpack, webpackConfig); - if (argv.v) { - console.log(stats.toString({ colors: true })); - } -} - - -/** - * Executes the whole build process - */ -(async function startPack() { - try { - console.log('> cleaning old distribution files'); - await del([ BUILD_PATH ]); - - console.log('> building browser code with babel'); - await buildBrowserCode(); - - console.log('> building renderer code with webpack'); - await buildRendererCode(); - - console.log('>> success'); - } catch (err) { - console.log('>> error', err.stack || err); - process.exit(1); - } -})(); From c5b5763e84c6d8837810b212617c6a695e13434e Mon Sep 17 00:00:00 2001 From: Max Claus Nunes Date: Sun, 5 Jun 2016 15:28:06 -0300 Subject: [PATCH 6/7] Fix build with latest electron-builder --- package.json | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/package.json b/package.json index 8959f6c1..bbbf82af 100644 --- a/package.json +++ b/package.json @@ -8,14 +8,13 @@ "clean:osx": "rimraf dist/Sqlectron-darwin-*", "clean:win": "rimraf dist/win* dist/Sqlectron-win*", "clean:linux": "rimraf dist/Sqlectron-linux-* dist/*.deb", - "compile": "rimraf app/out && cross-env NODE_ENV=production && npm run compile:browser && npm run compile:renderer", - "compile:browser": "babel ./src/browser -d app/out/browser", - "compile:renderer": "webpack --progress --display-error-details --config ./webpack.prod.config", + "compile": "rimraf app/out && npm run compile:browser && npm run compile:renderer", + "compile:browser": "cross-env NODE_ENV=production babel ./src/browser -d app/out/browser", + "compile:renderer": "cross-env NODE_ENV=production webpack --progress --display-error-details --config ./webpack.prod.config", "build:osx": "npm run clean:osx && build --osx", - "build:linux": "npm run clean:linux && build --linux --x64 --ia32", - "build:win": "npm run clean:win && build --windows --x64 --ia32", - "dist": "npm run compile && build --x64 --ia32", - "dist:osx": "npm run compile && npm run build:osx", + "build:linux": "npm run clean:linux && build --linux", + "build:win": "npm run clean:win && build --windows", + "dist": "npm run compile && build", "dist:winlinux": "npm run compile && npm run build:linux && npm run build:win" }, "build": { From 2cf14f4b3c656cbbd06059bb4de626fe13fc2bc0 Mon Sep 17 00:00:00 2001 From: Max Claus Nunes Date: Sun, 5 Jun 2016 17:55:40 -0300 Subject: [PATCH 7/7] Ignore cache on appveyor on package.json changes --- appveyor.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index b11c7ed1..b9de99d2 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -4,8 +4,8 @@ platform: - x64 cache: - - node_modules - - app\node_modules + - node_modules -> package.json + - app\node_modules -> package.json - '%APPDATA%\npm-cache' - '%USERPROFILE%\.electron'