Unverified Commit a41d68db authored by Pieterjan Vanhoof's avatar Pieterjan Vanhoof Committed by GitHub

Merge pull request #366 from stratisproject/ui

Update to Angular 5, prepare for electron-builder
parents ccafe8c3 5deb9d0f
{
"appId": "com.stratisplatform.breeze",
"productName": "Breeze Wallet",
"mac": {
"category": "com.stratisplatform.breeze"
},
"directories": {
"app": "dist",
"output": "app-builds"
},
"win": {
"icon": "dist/assets/images/breeze-logo",
"target": ["nsis"],
"asarUnpack": "assets/daemon/*"
},
"nsis": {
"oneClick": false
},
"msi": {
"warningsAsErrors": false
}
}
......@@ -157,7 +157,8 @@ function startBitcoinApi() {
//Start Breeze Bitcoin Daemon
let apiPath = path.resolve(__dirname, 'assets//daemon//Stratis.BreezeD');
if (os.platform() === 'win32') {
apiPath = path.resolve(__dirname, 'assets\\daemon\\Stratis.BreezeD.exe');
apiPath = path.resolve(__dirname, 'assets\\daemon\\Stratis.BreezeD.exe');
//apiPath = path.resolve(__dirname, '..\\app.asar.unpacked\\assets\\daemon\\Stratis.BreezeD.exe');
}
if(!testnet) {
......@@ -183,7 +184,8 @@ function startStratisApi() {
//Start Breeze Stratis Daemon
let apiPath = path.resolve(__dirname, 'assets//daemon//Stratis.BreezeD');
if (os.platform() === 'win32') {
apiPath = path.resolve(__dirname, 'assets\\daemon\\Stratis.BreezeD.exe');
apiPath = path.resolve(__dirname, 'assets\\daemon\\Stratis.BreezeD.exe');
//apiPath = path.resolve(__dirname, '..\\app.asar.unpacked\\assets\\daemon\\Stratis.BreezeD.exe');
}
if (!testnet) {
......
......@@ -34,6 +34,7 @@
"electron:prod": "npm run build:prod && electron ./dist",
"package:linux": "npm run build:prod && node package.js --platform=linux --arch=x64",
"package:windows": "npm run build:prod && node package.js --platform=win32 --arch=ia32",
"package:winsetup": "npm run build:prod && npx electron-builder build --windows",
"package:mac": "npm run build:prod && node package.js --platform=darwin --arch=x64",
"test": "karma start ./karma.conf.js",
"pree2e": "webdriver-manager update --standalone false --gecko false --quiet && npm run build",
......@@ -41,44 +42,49 @@
},
"private": true,
"dependencies": {
"@angular/animations": "4.4.5",
"@angular/common": "4.4.5",
"@angular/compiler": "4.4.5",
"@angular/core": "4.4.5",
"@angular/forms": "4.4.5",
"@angular/http": "4.4.5",
"@angular/platform-browser": "4.4.5",
"@angular/platform-browser-dynamic": "4.4.5",
"@angular/platform-server": "4.4.5",
"@angular/router": "4.4.5",
"@angular/animations": "5.0.2",
"@angular/common": "5.0.2",
"@angular/compiler": "5.0.2",
"@angular/core": "5.0.2",
"@angular/forms": "5.0.2",
"@angular/http": "5.0.2",
"@angular/platform-browser": "5.0.2",
"@angular/platform-browser-dynamic": "5.0.2",
"@angular/platform-server": "5.0.2",
"@angular/router": "5.0.2",
"@ng-bootstrap/ng-bootstrap": "1.0.0-beta.5",
"bootstrap": "4.0.0-beta",
"core-js": "2.5.1",
"electron-context-menu": "0.9.1",
"enhanced-resolve": "3.4.1",
"ngx-clipboard": "8.1.1",
"ngx-bootstrap": "1.9.3",
"rxjs": "5.4.3",
"ngx-bootstrap": "2.0.0-beta.8",
"rxjs": "5.5.2",
"zone.js": "0.8.18"
},
"devDependencies": {
"@angular/cli": "1.4.7",
"@angular/compiler-cli": "4.4.5",
"@angular/cli": "1.5.3",
"@angular/compiler-cli": "5.0.2",
"@angular/language-service": "5.0.2",
"@types/core-js": "0.9.36",
"@types/jasmine": "2.6.0",
"@types/node": "7.0.7",
"autoprefixer": "7.1.5",
"codelyzer": "3.2.1",
"autoprefixer": "7.1.6",
"circular-dependency-plugin": "4.2.1",
"codelyzer": "4.0.1",
"copyfiles": "1.2.0",
"cross-env": "5.1.0",
"copy-webpack-plugin": "4.2.1",
"cross-env": "5.1.1",
"css-loader": "0.28.7",
"cssnano": "3.10.0",
"electron": "1.7.9",
"electron-packager": "9.1.0",
"electron-builder": "19.45.5",
"electron-packager": "10.1.0",
"electron-reload": "1.2.2",
"exports-loader": "0.6.4",
"file-loader": "1.1.5",
"html-loader": "0.5.1",
"html-webpack-plugin": "2.30.1",
"istanbul-instrumenter-loader": "3.0.0",
"jasmine-core": "2.8.0",
"jasmine-spec-reporter": "4.2.1",
......@@ -94,23 +100,26 @@
"less-loader": "4.0.5",
"minimist": "1.2.0",
"mkdirp": "0.5.1",
"npm-run-all": "4.1.1",
"node-sass": "4.5.3",
"npm-run-all": "4.1.2",
"npx": "9.7.1",
"node-sass": "4.7.2",
"postcss-loader": "2.0.8",
"postcss-url": "7.1.2",
"postcss-url": "7.2.1",
"protractor": "5.2.0",
"raw-loader": "0.5.1",
"sass-loader": "6.0.6",
"script-loader": "0.7.2",
"source-map-loader": "0.2.2",
"source-map-loader": "0.2.3",
"style-loader": "0.19.0",
"stylus-loader": "3.0.1",
"ts-node": "3.3.0",
"tslint": "5.7.0",
"typescript": "2.5.3",
"tslint": "5.8.0",
"typescript": "2.6.1",
"uglifyjs-webpack-plugin": "1.1.0",
"url-loader": "0.6.2",
"webdriver-manager": "12.0.6",
"webpack": "3.8.1",
"webpack-dev-server": "2.9.2"
"webpack-concat-plugin": "1.4.2",
"webpack-dev-server": "2.9.4"
}
}
export const environment = {
production: true
production: true,
silent: false
};
......@@ -4,5 +4,6 @@
// The list of which env maps to which file can be found in `angular-cli.json`.
export const environment = {
production: false
production: false,
silent: false
};
......@@ -26,8 +26,7 @@
"es2016",
"dom"
]
}
,
},
"exclude": [
"node_modules"
]
......
const fs = require('fs');
const path = require('path');
const webpack = require('webpack');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const ProgressPlugin = require('webpack/lib/ProgressPlugin');
const CircularDependencyPlugin = require('circular-dependency-plugin');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const UglifyJsPlugin = require('uglifyjs-webpack-plugin');
const autoprefixer = require('autoprefixer');
const postcssUrl = require('postcss-url');
const ConcatPlugin = require('webpack-concat-plugin');
const customProperties = require('postcss-custom-properties');
const { NoEmitOnErrorsPlugin, LoaderOptionsPlugin, DefinePlugin, HashedModuleIdsPlugin } = require('webpack');
const { GlobCopyWebpackPlugin, BaseHrefWebpackPlugin, InsertConcatAssetsWebpackPlugin } = require('@angular/cli/plugins/webpack');
const { CommonsChunkPlugin, UglifyJsPlugin } = require('webpack').optimize;
const { AotPlugin } = require('@ngtools/webpack');
const { NoEmitOnErrorsPlugin, SourceMapDevToolPlugin, DefinePlugin, NamedModulesPlugin } = require('webpack');
const { BaseHrefWebpackPlugin, NamedLazyChunksWebpackPlugin, InsertConcatAssetsWebpackPlugin } = require('@angular/cli/plugins/webpack');
const { CommonsChunkPlugin } = require('webpack').optimize;
const { AngularCompilerPlugin } = require('@ngtools/webpack');
const ConcatPlugin = require('webpack-concat-plugin');
const nodeModules = path.join(process.cwd(), 'node_modules');
const realNodeModules = fs.realpathSync(nodeModules);
const genDirNodeModules = path.join(process.cwd(), 'src', '$$_gendir', 'node_modules');
const entryPoints = ["inline", "polyfills", "sw-register", "styles", "vendor", "main"];
const minimizeCss = false;
const baseHref = "";
const deployUrl = "";
const postcssPlugins = function () {
const importantCommentRe = /@preserve|@license|[@#]\s*source(?:Mapping)?URL|^!/i;
const minimizeOptions = {
autoprefixer: false,
safe: true,
mergeLonghand: false,
discardComments: { remove: (comment) => !importantCommentRe.test(comment) }
};
return [
postcssUrl({
url: (obj) => {
if (!obj.url.startsWith('/') || obj.url.startsWith('//')) {
return obj.url;
}
if (deployUrl.match(/:\/\//)) {
// If deployUrl contains a scheme, ignore baseHref use deployUrl as is.
return `${deployUrl.replace(/\/$/, '')}${obj.url}`;
}
else if (baseHref.match(/:\/\//)) {
// If baseHref contains a scheme, include it as is.
return baseHref.replace(/\/$/, '') +
`/${deployUrl}/${obj.url}`.replace(/\/\/+/g, '/');
}
else {
// Join together base-href, deploy-url and the original URL.
// Also dedupe multiple slashes into single ones.
return `/${baseHref}/${deployUrl}/${obj.url}`.replace(/\/\/+/g, '/');
}
}
}),
autoprefixer(),
customProperties({ preserve: true })
].concat(minimizeCss ? [cssnano(minimizeOptions)] : []);
};
const isProd = (process.env.NODE_ENV === 'production');
//add all external css to be added in our index.html--> like as if it's .angular-cli.json
......@@ -44,7 +85,7 @@ function getPlugins() {
plugins.push(new NoEmitOnErrorsPlugin());
if(scripts.length > 0){
if (scripts.length > 0) {
plugins.push(new ConcatPlugin({
"uglify": false,
"sourceMap": true,
......@@ -57,20 +98,39 @@ function getPlugins() {
]));
}
plugins.push(new GlobCopyWebpackPlugin({
"patterns": [
"assets",
"favicon.ico"
],
"globOptions": {
"cwd": process.cwd() + "/src",
"dot": true,
"ignore": "**/.gitkeep"
plugins.push(new CopyWebpackPlugin([
{
"context": "src",
"to": "",
"from": {
"glob": "assets/**/*",
"dot": true
}
},
{
"context": "src",
"to": "",
"from": {
"glob": "favicon.ico",
"dot": true
}
}
], {
"ignore": [
".gitkeep"
],
"debug": "warning"
}));
plugins.push(new ProgressPlugin());
plugins.push(new CircularDependencyPlugin({
"exclude": /(\\|\/)node_modules(\\|\/)/,
"failOnError": false
}));
plugins.push(new NamedLazyChunksWebpackPlugin());
plugins.push(new HtmlWebpackPlugin({
"template": "./src/index.html",
"filename": "./index.html",
......@@ -103,98 +163,74 @@ function getPlugins() {
plugins.push(new BaseHrefWebpackPlugin({}));
plugins.push(new CommonsChunkPlugin({
"name": "inline",
"name": [
"inline"
],
"minChunks": null
}));
plugins.push(new CommonsChunkPlugin({
"name": "vendor",
"minChunks": (module) => module.resource && module.resource.startsWith(nodeModules),
"name": [
"vendor"
],
"minChunks": (module) => {
return module.resource
&& (module.resource.startsWith(nodeModules)
|| module.resource.startsWith(genDirNodeModules)
|| module.resource.startsWith(realNodeModules));
},
"chunks": [
"main"
]
}));
plugins.push(new ExtractTextPlugin({
"filename": "[name].bundle.css",
"disable": true
plugins.push(new SourceMapDevToolPlugin({
"filename": "[file].map[query]",
"moduleFilenameTemplate": "[resource-path]",
"fallbackModuleFilenameTemplate": "[resource-path]?[hash]",
"sourceRoot": "webpack:///"
}));
plugins.push(new LoaderOptionsPlugin({
"sourceMap": false,
"options": {
"postcss": [
autoprefixer(),
postcssUrl({
"url": (obj) => {
// Only convert root relative URLs, which CSS-Loader won't process into require().
if (!obj.url.startsWith('/') || obj.url.startsWith('//')) {
return obj.url;
}
if (deployUrl.match(/:\/\//)) {
// If deployUrl contains a scheme, ignore baseHref use deployUrl as is.
return `${deployUrl.replace(/\/$/, '')}${obj.url}`;
}
else if (baseHref.match(/:\/\//)) {
// If baseHref contains a scheme, include it as is.
return baseHref.replace(/\/$/, '') +
`/${deployUrl}/${obj.url}`.replace(/\/\/+/g, '/');
}
else {
// Join together base-href, deploy-url and the original URL.
// Also dedupe multiple slashes into single ones.
return `/${baseHref}/${deployUrl}/${obj.url}`.replace(/\/\/+/g, '/');
}
}
})
],
"sassLoader": {
"sourceMap": false,
"includePaths": []
},
"lessLoader": {
"sourceMap": false
},
"context": ""
}
plugins.push(new CommonsChunkPlugin({
"name": [
"main"
],
"minChunks": 2,
"async": "common"
}));
if (isProd) {
plugins.push(new HashedModuleIdsPlugin({
"hashFunction": "md5",
"hashDigest": "base64",
"hashDigestLength": 4
}));
plugins.push(new NamedModulesPlugin({}));
plugins.push(new AotPlugin({
if (isProd) {
plugins.push(new AngularCompilerPlugin({
"mainPath": "main.ts",
"platform": 0,
"sourceMap": true,
"tsConfigPath": "src/tsconfig.app.json",
"skipCodeGeneration": true,
"compilerOptions": {},
"hostReplacementPaths": {
"environments/index.ts": "environments/environment.prod.ts"
"environments/index.ts": "environments/index.prod.ts"
},
"exclude": [],
"tsConfigPath": "src/tsconfig.app.json"
"exclude": []
}));
plugins.push(new UglifyJsPlugin({
"mangle": {
"screw_ie8": true
},
"compress": {
"screw_ie8": true,
"warnings": false
},
"sourceMap": false
}));
} else {
plugins.push(new AotPlugin({
plugins.push(new AngularCompilerPlugin({
"mainPath": "main.ts",
"platform": 0,
"sourceMap": true,
"tsConfigPath": "src/tsconfig.app.json",
"skipCodeGeneration": true,
"compilerOptions": {},
"hostReplacementPaths": {
"environments/index.ts": "environments/environment.ts"
"environments/index.ts": "environments/index.ts"
},
"exclude": [],
"tsConfigPath": "src/tsconfig.app.json",
"skipCodeGeneration": true
"exclude": []
}));
}
......@@ -205,6 +241,7 @@ module.exports = {
"devtool": "source-map",
"externals": {
"electron": "require('electron')",
"buffer": "require('buffer')",
"child_process": "require('child_process')",
"crypto": "require('crypto')",
"events": "require('events')",
......@@ -230,14 +267,20 @@ module.exports = {
".ts",
".js",
".scss",
".css",
".json"
],
"aliasFields": [],
"alias": { // WORKAROUND See. angular-cli/issues/5433
"environments": isProd ? path.resolve(__dirname, 'src/environments/environment.prod.ts') : path.resolve(__dirname, 'src/environments/environment.ts')
"environments": isProd ? path.resolve(__dirname, 'src/environments/index.prod.ts') : path.resolve(__dirname, 'src/environments/index.ts')
},
"modules": [
"./node_modules"
],
"mainFields": [
"browser",
"module",
"main"
]
},
"resolveLoader": {
......@@ -257,124 +300,232 @@ module.exports = {
"output": {
"path": path.join(process.cwd(), "dist"),
"filename": "[name].bundle.js",
"chunkFilename": "[id].chunk.js"
"chunkFilename": "[id].chunk.js",
"crossOriginLoading": false
},
"module": {
"rules": [
{
"enforce": "pre",
"test": /\.(js|ts)$/,
"loader": "source-map-loader",
"exclude": [
/\/node_modules\//,
path.join(__dirname, 'node_modules', '@angular/compiler')
]
},
{
"test": /\.html$/,
"loader": "html-loader"
},
{
"test": /\.(eot|svg)$/,
"loader": "file-loader?name=[name].[hash:20].[ext]"
"use": ["html-loader"]
},
{
"test": /\.(jpg|png|gif|otf|ttf|woff|woff2|cur|ani)$/,
"loader": "url-loader?name=[name].[hash:20].[ext]&limit=10000"
test: /\.(png|jpg|gif|svg|eot|ttf|woff|woff2|json|xml|ico|cur|ani)$/,
"use": ["file-loader?name=[path][name].[ext]"]
},
{
"exclude": style_paths,
"test": /\.css$/,
"loaders": [
"use": [
"exports-loader?module.exports.toString()",
"css-loader?{\"sourceMap\":false,\"importLoaders\":1}",
"postcss-loader"
{
"loader": "css-loader",
"options": {
"sourceMap": false,
"importLoaders": 1
}
},
{
"loader": "postcss-loader",
"options": {
"ident": "postcss",
"plugins": postcssPlugins
}
}
]
},
{
"exclude": style_paths,
"test": /\.scss$|\.sass$/,
"loaders": [
"use": [
"exports-loader?module.exports.toString()",
"css-loader?{\"sourceMap\":false,\"importLoaders\":1}",
"postcss-loader",
"sass-loader"
{
"loader": "css-loader",
"options": {
"sourceMap": false,
"importLoaders": 1
}
},
{
"loader": "postcss-loader",
"options": {
"ident": "postcss",
"plugins": postcssPlugins
}
},
{
"loader": "sass-loader",
"options": {
"sourceMap": false,
"precision": 8,
"includePaths": []
}
}
]
},
{
"exclude": style_paths,
"test": /\.less$/,
"loaders": [
"use": [
"exports-loader?module.exports.toString()",
"css-loader?{\"sourceMap\":false,\"importLoaders\":1}",
"postcss-loader",
"less-loader"
{
"loader": "css-loader",
"options": {
"sourceMap": false,
"importLoaders": 1
}
},
{
"loader": "postcss-loader",
"options": {
"ident": "postcss",
"plugins": postcssPlugins
}
},
{
"loader": "less-loader",
"options": {
"sourceMap": false
}
}
]
},
{
"exclude": style_paths,
"test": /\.styl$/,
"loaders": [
"use": [
"exports-loader?module.exports.toString()",
"css-loader?{\"sourceMap\":false,\"importLoaders\":1}",
"postcss-loader",
"stylus-loader?{\"sourceMap\":false,\"paths\":[]}"
{
"loader": "css-loader",
"options": {
"sourceMap": false,
"importLoaders": 1
}
},
{
"loader": "postcss-loader",
"options": {
"ident": "postcss",
"plugins": postcssPlugins
}
},
{
"loader": "stylus-loader",
"options": {
"sourceMap": false,
"paths": []
}
}
]
},
{
"include": style_paths,
"test": /\.css$/,
"loaders": ExtractTextPlugin.extract({
"use": [
"css-loader?{\"sourceMap\":false,\"importLoaders\":1}",
"postcss-loader"
],
"fallback": "style-loader",
"publicPath": ""
})
"use": [
"style-loader",
{
"loader": "css-loader",
"options": {
"sourceMap": false,
"importLoaders": 1
}
},
{
"loader": "postcss-loader",
"options": {
"ident": "postcss",
"plugins": postcssPlugins
}
}
]
},
{
"include": style_paths,
"test": /\.scss$|\.sass$/,
"loaders": ExtractTextPlugin.extract({
"use": [
"css-loader?{\"sourceMap\":false,\"importLoaders\":1}",
"postcss-loader",
"sass-loader"
],
"fallback": "style-loader",
"publicPath": ""
})
"use": [
"style-loader",
{
"loader": "css-loader",
"options": {
"sourceMap": false,
"importLoaders": 1
}
},
{
"loader": "postcss-loader",
"options": {
"ident": "postcss",
"plugins": postcssPlugins
}
},
{
"loader": "sass-loader",
"options": {
"sourceMap": false,
"precision": 8,
"includePaths": []
}
}
]
},
{
"include": style_paths,
"include":style_paths,
"test": /\.less$/,
"loaders": ExtractTextPlugin.extract({
"use": [
"css-loader?{\"sourceMap\":false,\"importLoaders\":1}",
"postcss-loader",
"less-loader"
],
"fallback": "style-loader",
"publicPath": ""
})
"use": [
"style-loader",
{
"loader": "css-loader",
"options": {
"sourceMap": false,
"importLoaders": 1
}
},
{
"loader": "postcss-loader",
"options": {
"ident": "postcss",
"plugins": postcssPlugins
}
},
{
"loader": "less-loader",
"options": {
"sourceMap": false
}
}
]
},
{
"include": style_paths,
"test": /\.styl$/,
"loaders": ExtractTextPlugin.extract({
"use": [
"css-loader?{\"sourceMap\":false,\"importLoaders\":1}",
"postcss-loader",
"stylus-loader?{\"sourceMap\":false,\"paths\":[]}"
],
"fallback": "style-loader",
"publicPath": ""
})
"use": [
"style-loader",
{
"loader": "css-loader",
"options": {
"sourceMap": false,
"importLoaders": 1
}
},
{
"loader": "postcss-loader",
"options": {
"ident": "postcss",
"plugins": postcssPlugins
}
},
{
"loader": "stylus-loader",
"options": {
"sourceMap": false,
"paths": []
}
}
]
},
{
"test": /\.ts$/,
"loader": "@ngtools/webpack"
"use": "@ngtools/webpack"
}
]
},
......@@ -391,5 +542,8 @@ module.exports = {
setImmediate: false,
__dirname: false,
__filename: false
},
"devServer": {
"historyApiFallback": true
}
};
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment