refactor: upgrade to NodeJS 8, Angular 6, CLI 6, Electron 2.0, RxJS 6.1

This commit is contained in:
Heo Sangmin
2018-05-19 02:16:39 +09:00
parent a8c2b63e27
commit e37efdb9f3
12 changed files with 187 additions and 115 deletions

View File

@@ -1,63 +0,0 @@
{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"project": {
"name": "angularelectron"
},
"apps": [
{
"root": "src",
"outDir": "dist",
"assets": [
"assets",
"favicon.ico",
"favicon.png",
"favicon.icns",
"favicon.256x256.png"
],
"index": "index.html",
"main": "main.ts",
"polyfills": "polyfills.ts",
"test": "test.ts",
"tsconfig": "tsconfig.app.json",
"testTsconfig": "tsconfig.spec.json",
"prefix": "app",
"styles": [
"styles.scss"
],
"scripts": [],
"environmentSource": "environments/environment.ts",
"environments": {
"dev": "environments/environment.ts",
"prod": "environments/environment.prod.ts"
}
}
],
"e2e": {
"protractor": {
"config": "./protractor.conf.js"
}
},
"lint": [
{
"project": "src/tsconfig.app.json",
"exclude": "**/node_modules/**"
},
{
"project": "src/tsconfig.spec.json",
"exclude": "**/node_modules/**"
},
{
"project": "e2e/tsconfig.e2e.json",
"exclude": "**/node_modules/**"
}
],
"test": {
"karma": {
"config": "./karma.conf.js"
}
},
"defaults": {
"styleExt": "scss",
"component": {}
}
}

View File

@@ -1,7 +1,6 @@
language: node_js language: node_js
node_js: node_js:
- "7" - 8
- "6"
install: install:
- npm install - npm install
script: script:

View File

@@ -1,4 +1,4 @@
Copyright 2017 - Maxime GRIS Copyright 2018 - Maxime GRIS
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

View File

@@ -15,10 +15,10 @@ Bootstrap and package your project with Angular 5(+) and Electron (Typescript +
Currently runs with: Currently runs with:
- Angular v5.2.5 - Angular v6.0.2
- Angular-CLI v1.6.4 - Angular-CLI v6.0.3
- Electron v1.8.2 - Electron v2.0.1
- Electron Builder v20.0.4 - Electron Builder v20.13.4
With this sample, you can : With this sample, you can :

135
angular.json Normal file
View File

@@ -0,0 +1,135 @@
{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"version": 1,
"newProjectRoot": "projects",
"projects": {
"angular-electron": {
"root": "",
"sourceRoot": "src",
"projectType": "application",
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:browser",
"options": {
"outputPath": "dist",
"index": "src/index.html",
"main": "src/main.ts",
"tsConfig": "src/tsconfig.app.json",
"polyfills": "src/polyfills.ts",
"assets": [
"src/assets",
"src/favicon.ico",
"src/favicon.png",
"src/favicon.icns",
"src/favicon.256x256.png",
"src/favicon.512x512.png"
],
"styles": [
"src/styles.scss"
],
"scripts": []
},
"configurations": {
"production": {
"optimization": true,
"outputHashing": "all",
"sourceMap": false,
"extractCss": true,
"namedChunks": false,
"aot": true,
"extractLicenses": true,
"vendorChunk": false,
"buildOptimizer": true,
"fileReplacements": []
}
}
},
"serve": {
"builder": "@angular-devkit/build-angular:dev-server",
"options": {
"browserTarget": "angular-electron:build"
},
"configurations": {
"production": {
"browserTarget": "angular-electron:build:production"
}
}
},
"extract-i18n": {
"builder": "@angular-devkit/build-angular:extract-i18n",
"options": {
"browserTarget": "angular-electron:build"
}
},
"test": {
"builder": "@angular-devkit/build-angular:karma",
"options": {
"main": "src/test.ts",
"karmaConfig": "./karma.conf.js",
"polyfills": "src/polyfills.ts",
"tsConfig": "src/tsconfig.spec.json",
"scripts": [],
"styles": [
"src/styles.scss"
],
"assets": [
"src/assets",
"src/favicon.ico",
"src/favicon.png",
"src/favicon.icns",
"src/favicon.256x256.png",
"src/favicon.512x512.png"
]
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": [
"src/tsconfig.app.json",
"src/tsconfig.spec.json"
],
"exclude": [
"**/node_modules/**"
]
}
}
}
},
"angular-electron-e2e": {
"root": "",
"sourceRoot": "",
"projectType": "application",
"architect": {
"e2e": {
"builder": "@angular-devkit/build-angular:protractor",
"options": {
"protractorConfig": "./protractor.conf.js",
"devServerTarget": "angular-electron:serve"
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": [
"e2e/tsconfig.e2e.json"
],
"exclude": [
"**/node_modules/**"
]
}
}
}
}
},
"defaultProject": "angular-electron",
"schematics": {
"@schematics/angular:component": {
"prefix": "app",
"styleext": "scss"
},
"@schematics/angular:directive": {
"prefix": "app"
}
}
}

View File

@@ -4,27 +4,28 @@
module.exports = function (config) { module.exports = function (config) {
config.set({ config.set({
basePath: '', basePath: '',
frameworks: ['jasmine', '@angular/cli'], frameworks: ['jasmine', '@angular-devkit/build-angular'],
plugins: [ plugins: [
require('karma-jasmine'), require('karma-jasmine'),
require('karma-chrome-launcher'), require('karma-chrome-launcher'),
require('karma-jasmine-html-reporter'), require('karma-jasmine-html-reporter'),
require('karma-coverage-istanbul-reporter'), require('karma-coverage-istanbul-reporter'),
require('@angular/cli/plugins/karma') require('@angular-devkit/build-angular/plugins/karma')
], ],
client:{ client:{
clearContext: false // leave Jasmine Spec Runner output visible in browser clearContext: false // leave Jasmine Spec Runner output visible in browser
}, },
files: [ files: [
{ pattern: './src/test.ts', watched: false }
], ],
preprocessors: { preprocessors: {
'./src/test.ts': ['@angular/cli']
}, },
mime: { mime: {
'text/x-typescript': ['ts','tsx'] 'text/x-typescript': ['ts','tsx']
}, },
coverageIstanbulReporter: { coverageIstanbulReporter: {
dir: require('path').join(__dirname, 'coverage'),
reports: [ 'html', 'lcovonly' ], reports: [ 'html', 'lcovonly' ],
fixWebpackSourcePaths: true fixWebpackSourcePaths: true
}, },
@@ -39,6 +40,6 @@ module.exports = function (config) {
logLevel: config.LOG_INFO, logLevel: config.LOG_INFO,
autoWatch: true, autoWatch: true,
browsers: ['Chrome'], browsers: ['Chrome'],
singleRun: false singleRun: true
}); });
}; };

View File

@@ -9,7 +9,7 @@
}, },
"keywords": [ "keywords": [
"angular", "angular",
"angular 5", "angular 6",
"electron", "electron",
"typescript", "typescript",
"sass" "sass"
@@ -21,7 +21,7 @@
"ng": "ng", "ng": "ng",
"start": "node hooks/environments/set_profile.js && npm-run-all -p ng:serve electron:serve", "start": "node hooks/environments/set_profile.js && npm-run-all -p ng:serve electron:serve",
"build": "node hooks/environments/set_profile.js && ng build && npm run electron:tsc", "build": "node hooks/environments/set_profile.js && ng build && npm run electron:tsc",
"build:prod": "node hooks/environments/set_profile.js && ng build --prod && npm run electron:tsc", "build:prod": "node hooks/environments/set_profile.js && ng build -c production && npm run electron:tsc",
"ng:serve": "ng serve -o", "ng:serve": "ng serve -o",
"electron:tsc": "tsc main.ts", "electron:tsc": "tsc main.ts",
"electron:serve": "wait-on http-get://localhost:4200/ && npm run electron:tsc && electron . --serve", "electron:serve": "wait-on http-get://localhost:4200/ && npm run electron:tsc && electron . --serve",
@@ -29,53 +29,53 @@
"electron:linux": "npm run build:prod && npx electron-builder build --linux", "electron:linux": "npm run build:prod && npx electron-builder build --linux",
"electron:windows": "npm run build:prod && npx electron-builder build --windows", "electron:windows": "npm run build:prod && npx electron-builder build --windows",
"electron:mac": "npm run build:prod && npx electron-builder build --mac", "electron:mac": "npm run build:prod && npx electron-builder build --mac",
"test": "karma start ./karma.conf.js", "test": "ng test",
"pree2e:build": "webdriver-manager update --gecko false && npm run ng serve", "pree2e:build": "webdriver-manager update --gecko false && npm run ng serve",
"pree2e:protractor": "wait-on http-get://localhost:4200/ && protractor ./protractor.conf.js", "pree2e:protractor": "wait-on http-get://localhost:4200/ && protractor ./protractor.conf.js",
"e2e": "npm-run-all -p -r pree2e:build pree2e:protractor" "e2e": "npm-run-all -p -r pree2e:build pree2e:protractor"
}, },
"dependencies": {}, "dependencies": {},
"devDependencies": { "devDependencies": {
"@angular/cli": "1.7.4", "@angular-devkit/build-angular": "0.6.3",
"@angular/common": "5.2.9", "@angular/cli": "6.0.3",
"@angular/compiler": "5.2.9", "@angular/common": "6.0.2",
"@angular/compiler-cli": "5.2.9", "@angular/compiler": "6.0.2",
"@angular/core": "5.2.9", "@angular/compiler-cli": "6.0.2",
"@angular/forms": "5.2.9", "@angular/core": "6.0.2",
"@angular/http": "5.2.9", "@angular/forms": "6.0.2",
"@angular/language-service": "5.2.9", "@angular/http": "6.0.2",
"@angular/platform-browser": "5.2.9", "@angular/language-service": "6.0.2",
"@angular/platform-browser-dynamic": "5.2.9", "@angular/platform-browser": "6.0.2",
"@angular/router": "5.2.9", "@angular/platform-browser-dynamic": "6.0.2",
"@ngx-translate/core": "9.1.1", "@angular/router": "6.0.2",
"@ngx-translate/http-loader": "2.0.1", "@ngx-translate/core": "10.0.1",
"@types/core-js": "0.9.36", "@ngx-translate/http-loader": "3.0.1",
"@types/jasmine": "2.8.6", "@types/jasmine": "2.8.7",
"@types/jasminewd2": "2.0.3", "@types/jasminewd2": "2.0.3",
"@types/node": "7.0.7", "@types/node": "8.0.58",
"codelyzer": "4.2.1", "codelyzer": "4.2.1",
"core-js": "2.5.5", "core-js": "2.5.6",
"cross-env": "5.1.4", "cross-env": "5.1.5",
"dotenv": "5.0.1", "dotenv": "5.0.1",
"electron": "1.8.4", "electron": "2.0.1",
"electron-builder": "20.8.1", "electron-builder": "20.13.4",
"electron-reload": "1.2.2", "electron-reload": "1.2.2",
"fs-extra": "5.0.0", "fs-extra": "6.0.1",
"jasmine-core": "2.99.1", "jasmine-core": "3.1.0",
"jasmine-spec-reporter": "4.2.1", "jasmine-spec-reporter": "4.2.1",
"karma": "2.0.0", "karma": "2.0.2",
"karma-chrome-launcher": "2.2.0", "karma-chrome-launcher": "2.2.0",
"karma-coverage-istanbul-reporter": "1.4.2", "karma-coverage-istanbul-reporter": "2.0.0",
"karma-jasmine": "1.1.1", "karma-jasmine": "1.1.2",
"karma-jasmine-html-reporter": "0.2.2", "karma-jasmine-html-reporter": "1.1.0",
"npm-run-all": "4.1.2", "npm-run-all": "4.1.3",
"npx": "10.0.1", "npx": "10.2.0",
"protractor": "5.3.1", "protractor": "5.3.2",
"replace": "0.3.0", "replace": "0.3.0",
"rxjs": "5.5.8", "rxjs": "6.1.0",
"ts-node": "4.1.0", "ts-node": "6.0.3",
"tslint": "5.9.1", "tslint": "5.10.0",
"typescript": "2.6.2", "typescript": "2.7.2",
"wait-on": "2.1.0", "wait-on": "2.1.0",
"webdriver-manager": "12.0.6", "webdriver-manager": "12.0.6",
"zone.js": "0.8.26" "zone.js": "0.8.26"

BIN
src/favicon.512x512.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

View File

@@ -6,8 +6,6 @@ import {
BrowserDynamicTestingModule, BrowserDynamicTestingModule,
platformBrowserDynamicTesting platformBrowserDynamicTesting
} from '@angular/platform-browser-dynamic/testing'; } from '@angular/platform-browser-dynamic/testing';
import { Observable } from 'rxjs/Observable';
import { TranslateLoader, TranslateService } from '@ngx-translate/core';
declare const require: any; declare const require: any;

View File

@@ -11,7 +11,8 @@
] ]
}, },
"files": [ "files": [
"test.ts" "test.ts",
"polyfills.ts"
], ],
"include": [ "include": [
"**/*.spec.ts", "**/*.spec.ts",

View File

@@ -13,6 +13,8 @@
], ],
"lib": [ "lib": [
"es2017", "es2017",
"es2016",
"es2015",
"dom" "dom"
] ]
} }

View File

@@ -18,7 +18,6 @@
"forin": true, "forin": true,
"import-blacklist": [ "import-blacklist": [
true, true,
"rxjs",
"rxjs/Rx" "rxjs/Rx"
], ],
"import-spacing": true, "import-spacing": true,