diff --git a/.gitignore b/.gitignore index 91729af70e5426f434dcbe580f655a5083507a82..375fa44b18a143e3a046b528f05c9caab31cf090 100644 --- a/.gitignore +++ b/.gitignore @@ -18,3 +18,5 @@ webpack.records.json /npm-debug.log.* morgan.log + +*.css diff --git a/README.md b/README.md index 50352981abab0c843f1294f9ca5a92df34edb517..0052719a67329e56b7e27ba87a06ad08900f0867 100644 --- a/README.md +++ b/README.md @@ -27,7 +27,3 @@ Currently this contains the [Angular 2 Universal Starter](https://github.com/ang ## AoT and Prod - `npm run build:prod:ngc` to compile the ngfactory files and build prod - - - - diff --git a/nodemon.json b/nodemon.json index 97a836fbb5cd63051b2297aa3f79fb5505a59ed0..7c50f347613b62c97448e7b8af1fea27e8b09fd4 100644 --- a/nodemon.json +++ b/nodemon.json @@ -3,5 +3,5 @@ "dist", "src/index.html" ], - "ext" : "js ts json html" + "ext": "js ts json html" } diff --git a/package.json b/package.json index 1ceea4fcbd7ffc092e87819ea71e1f5e605b9512..01e736ecb5d74c3257943912bd72abc157ee24ef 100644 --- a/package.json +++ b/package.json @@ -32,17 +32,17 @@ "lint": "tslint \"src/**/*.ts\" || true" }, "dependencies": { - "@angular/common": "~2.1.2", - "@angular/compiler": "~2.1.2", - "@angular/compiler-cli": "~2.1.2", - "@angular/core": "~2.1.2", - "@angular/forms": "~2.1.2", - "@angular/http": "~2.1.2", - "@angular/platform-browser": "~2.1.2", - "@angular/platform-browser-dynamic": "~2.1.2", - "@angular/platform-server": "~2.1.2", - "@angular/router": "~3.1.2", - "@angular/upgrade": "~2.1.2", + "@angular/common": "~2.2.4", + "@angular/compiler": "~2.2.4", + "@angular/compiler-cli": "~2.2.4", + "@angular/core": "~2.2.4", + "@angular/forms": "~2.2.4", + "@angular/http": "~2.2.4", + "@angular/platform-browser": "~2.2.4", + "@angular/platform-browser-dynamic": "~2.2.4", + "@angular/platform-server": "~2.2.4", + "@angular/router": "~3.2.4", + "@angular/upgrade": "~2.2.4", "@angularclass/bootloader": "~1.0.1", "@angularclass/idle-preload": "~1.0.4", "@ng-bootstrap/ng-bootstrap": "1.0.0-alpha.14", @@ -61,27 +61,27 @@ "ng2-translate": "~4.0.1", "preboot": "~4.5.2", "rxjs": "5.0.0-beta.12", - "webfontloader": "^1.6.26", + "webfontloader": "^1.6.27", "zone.js": "~0.6.26" }, "devDependencies": { - "@ngtools/webpack": "~1.1.7", - "@types/body-parser": "0.0.29", - "@types/compression": "0.0.29", - "@types/cookie-parser": "^1.3.29", - "@types/express": "^4.0.32", - "@types/express-serve-static-core": "^4.0.33", - "@types/hammerjs": "^2.0.32", + "@ngtools/webpack": "1.1.7", + "@types/body-parser": "0.0.33", + "@types/compression": "0.0.33", + "@types/cookie-parser": "^1.3.30", + "@types/express": "^4.0.34", + "@types/express-serve-static-core": "^4.0.39", + "@types/hammerjs": "^2.0.33", "@types/memory-cache": "0.0.29", - "@types/mime": "0.0.28", + "@types/mime": "0.0.29", "@types/morgan": "^1.7.32", - "@types/node": "^6.0.38", - "@types/serve-static": "^1.7.27", + "@types/node": "^6.0.51", + "@types/serve-static": "^1.7.31", "@types/webfontloader": "^1.6.27", "accepts": "^1.3.3", - "angular2-template-loader": "^0.4.0", + "angular2-template-loader": "^0.6.0", "awesome-typescript-loader": "^2.2.4", - "codelyzer": "1.0.0-beta.3", + "codelyzer": "2.0.0-beta.1", "cookie-parser": "^1.4.3", "copy-webpack-plugin": "~4.0.1", "express-interceptor": "^1.2.0", @@ -90,21 +90,21 @@ "json-loader": "^0.5.4", "memory-cache": "^0.1.6", "node-sass": "^3.13.0", - "nodemon": "^1.10.0", + "nodemon": "^1.11.0", "raw-loader": "^0.5.1", "reflect-metadata": "0.1.8", "rimraf": "^2.5.4", - "sass-loader": "^4.0.2", "string-replace-loader": "^1.0.5", "ts-helpers": "^1.1.2", - "ts-node": "^1.3.0", - "tslint": "3.13.0", - "typescript": "2.0.2", + "ts-node": "^1.7.0", + "tslint": "4.0.2", + "tslint-loader": "3.2.1", + "typescript": "2.0.10", "v8-lazy-parse-webpack-plugin": "^0.3.0", "webpack": "2.1.0-beta.27", "webpack-bundle-analyzer": "1.4.1", "webpack-dev-middleware": "^1.8.4", "webpack-dev-server": "2.1.0-beta.11", - "webpack-merge": "~0.16.0" + "webpack-merge": "~1.0.2" } } diff --git a/src/__workaround.browser.ts b/src/__workaround.browser.ts index 026f505fa3781cfbc29141cbc12805703a2953b7..939d7a5883448fbe2e78495ebdcd67db6d43c609 100644 --- a/src/__workaround.browser.ts +++ b/src/__workaround.browser.ts @@ -8,14 +8,14 @@ let __compiler__ = require('@angular/compiler'); import { __platform_browser_private__ } from '@angular/platform-browser'; import { __core_private__ } from '@angular/core'; if (!__core_private__['ViewUtils']) { - __core_private__['ViewUtils'] = __core_private__['view_utils']; + __core_private__['ViewUtils'] = __core_private__['view_utils']; } if (__compiler__ && __compiler__.SelectorMatcher && __compiler__.CssSelector) { - (__compiler__).__compiler_private__ = { - SelectorMatcher: __compiler__.SelectorMatcher, - CssSelector: __compiler__.CssSelector - } + (__compiler__).__compiler_private__ = { + SelectorMatcher: __compiler__.SelectorMatcher, + CssSelector: __compiler__.CssSelector + } } diff --git a/src/__workaround.node.ts b/src/__workaround.node.ts index ed39c8d31954ee09700c943a3c87ec52a0b20ea9..61e1f665de524ef35d21157636c9b57b59a6a158 100644 --- a/src/__workaround.node.ts +++ b/src/__workaround.node.ts @@ -9,25 +9,25 @@ import { __platform_browser_private__ } from '@angular/platform-browser'; import { __core_private__ } from '@angular/core'; let patch = false; if (!__core_private__['ViewUtils']) { - patch = true; - __core_private__['ViewUtils'] = __core_private__['view_utils']; + patch = true; + __core_private__['ViewUtils'] = __core_private__['view_utils']; } if (__compiler__ && __compiler__.SelectorMatcher && __compiler__.CssSelector) { - patch = true; - (__compiler__).__compiler_private__ = { - SelectorMatcher: __compiler__.SelectorMatcher, - CssSelector: __compiler__.CssSelector - } + patch = true; + (__compiler__).__compiler_private__ = { + SelectorMatcher: __compiler__.SelectorMatcher, + CssSelector: __compiler__.CssSelector + } } if (patch) { - var __universal__ = require('angular2-platform-node/__private_imports__'); - __universal__.ViewUtils = __core_private__['view_utils']; - __universal__.CssSelector = __universal__.CssSelector || __compiler__.CssSelector; - __universal__.SelectorMatcher = __universal__.SelectorMatcher || __compiler__.SelectorMatcher; + var __universal__ = require('angular2-platform-node/__private_imports__'); + __universal__.ViewUtils = __core_private__['view_utils']; + __universal__.CssSelector = __universal__.CssSelector || __compiler__.CssSelector; + __universal__.SelectorMatcher = __universal__.SelectorMatcher || __compiler__.SelectorMatcher; } // Fix Material Support diff --git a/src/angular2-meta.ts b/src/angular2-meta.ts index f961d9e4fec3e29ddcddbbf26d55669e1e4e5f4a..dcce3c2cb510cc710c263a1abcecef5d213c23fc 100644 --- a/src/angular2-meta.ts +++ b/src/angular2-meta.ts @@ -6,9 +6,9 @@ * found in the LICENSE file at https://angular.io/license */ -import {Injectable} from '@angular/core'; +import { Injectable } from '@angular/core'; // es6-modules are used here -import {DomAdapter, getDOM} from '@angular/platform-browser/src/dom/dom_adapter'; +import { DomAdapter, getDOM } from '@angular/platform-browser/src/dom/dom_adapter'; /** * Represent meta element. @@ -69,7 +69,7 @@ export class Meta { * @param tags * @returns {HTMLMetaElement[]} */ - addTags(...tags: Array<MetaDefinition|MetaDefinition[]>): HTMLMetaElement[] { + addTags(...tags: Array<MetaDefinition | MetaDefinition[]>): HTMLMetaElement[] { const presentTags = this._flattenArray(tags); if (presentTags.length === 0) return []; return presentTags.map((tag: MetaDefinition) => this._addInternal(tag)); diff --git a/src/app/home/home.component.ts b/src/app/home/home.component.ts index 7fa49d852ca62fe774fac32ff356d8f1f88d0956..9cb0704a0a4c9c13b7803e20c46fa61d46f72e28 100644 --- a/src/app/home/home.component.ts +++ b/src/app/home/home.component.ts @@ -4,16 +4,19 @@ import { Component, ChangeDetectionStrategy, ViewEncapsulation } from '@angular/ changeDetection: ChangeDetectionStrategy.Default, encapsulation: ViewEncapsulation.Emulated, selector: 'ds-home', - styleUrls: ['./home.component.scss'], + styleUrls: ['./home.component.css'], templateUrl: './home.component.html' }) export class HomeComponent { + data: any = {}; + constructor() { this.universalInit(); } universalInit() { + } } diff --git a/src/app/shared/api.service.ts b/src/app/shared/api.service.ts index b2228729b7b4d014d6c6bb35777c79dec1f56587..5487bd5a363f04755f764e35e42df28d5f0d4f14 100644 --- a/src/app/shared/api.service.ts +++ b/src/app/shared/api.service.ts @@ -11,9 +11,9 @@ export class ApiService { } - /** - * whatever domain/feature method name - */ + /** + * whatever domain/feature method name + */ get(url: string, options?: any) { return this._http.get(url, options) .map(res => res.json()) diff --git a/src/app/shared/cache.service.ts b/src/app/shared/cache.service.ts index 87780632e505d24b08ed4a505c6fcc7e12661d7d..1268c90410c06bbb30c0b362ab6309dc8b87d9a5 100644 --- a/src/app/shared/cache.service.ts +++ b/src/app/shared/cache.service.ts @@ -4,7 +4,7 @@ import { Inject, Injectable, isDevMode } from '@angular/core'; export class CacheService { static KEY = 'CacheService'; - constructor(@Inject('LRU') public _cache: Map<string, any>) { + constructor( @Inject('LRU') public _cache: Map<string, any>) { } diff --git a/src/app/shared/model/model.service.ts b/src/app/shared/model/model.service.ts index 7d44a2b223ad5877058afb7b1f31a4c7a8f21ed2..251a31542fa89cc50a36344cf34ed904af1774a9 100644 --- a/src/app/shared/model/model.service.ts +++ b/src/app/shared/model/model.service.ts @@ -23,14 +23,14 @@ export function hashCodeString(str: string): string { // domain/feature service @Injectable() export class ModelService { - // This is only one example of one Model depending on your domain + // This is only one example of one Model depending on your domain constructor(public _api: ApiService, public _cache: CacheService) { } - /** - * whatever domain/feature method name - */ + /** + * whatever domain/feature method name + */ get(url) { // you want to return the cache if there is a response in it. // This would cache the first response so if your API isn't idempotent diff --git a/src/assets/logo.png b/src/assets/logo.png deleted file mode 100644 index afea237f93a9c9370901fe74e1ef5e1368381a48..0000000000000000000000000000000000000000 Binary files a/src/assets/logo.png and /dev/null differ diff --git a/src/backend/api.ts b/src/backend/api.ts index 3acf45b619a536a240ebaac1d3cce2f06465c013..51dfc177c341dc28ef311c3e4245db1ba22996bb 100644 --- a/src/backend/api.ts +++ b/src/backend/api.ts @@ -1,9 +1,9 @@ var util = require('util'); -var {Router} = require('express'); +var { Router } = require('express'); // Our API for demos only -import {fakeDataBase} from './db'; -import {fakeDemoRedisCache} from './cache'; +import { fakeDataBase } from './db'; +import { fakeDemoRedisCache } from './cache'; // you would use cookies/token etc var USER_ID = 'f9d98cf1-1b96-464e-8755-bcc2a5c09077'; // hardcoded as an example @@ -32,9 +32,9 @@ export function serverApi(req, res) { var COUNT = 4; var TODOS = [ { id: 0, value: 'finish example', created_at: new Date(), completed: false }, - { id: 1, value: 'add tests', created_at: new Date(), completed: false }, + { id: 1, value: 'add tests', created_at: new Date(), completed: false }, { id: 2, value: 'include development environment', created_at: new Date(), completed: false }, - { id: 3, value: 'include production environment', created_at: new Date(), completed: false } + { id: 3, value: 'include production environment', created_at: new Date(), completed: false } ]; export function createTodoApi() { @@ -51,7 +51,7 @@ export function createTodoApi() { }) .post(function(req, res) { - console.log('POST', util.inspect(req.body, {colors: true})); + console.log('POST', util.inspect(req.body, { colors: true })); var todo = req.body; if (todo) { TODOS.push({ @@ -81,12 +81,12 @@ export function createTodoApi() { router.route('/todos/:todo_id') .get(function(req, res) { - console.log('GET', util.inspect(req.todo, {colors: true})); + console.log('GET', util.inspect(req.todo, { colors: true })); res.json(req.todo); }) .put(function(req, res) { - console.log('PUT', util.inspect(req.body, {colors: true})); + console.log('PUT', util.inspect(req.body, { colors: true })); var index = TODOS.indexOf(req.todo); var todo = TODOS[index] = req.body; diff --git a/src/typings.d.ts b/src/typings.d.ts index dd39e59907fe86cdc116df1c080d4ff2f89c0d95..e3ce18864e3eb2729e06254c6a7c52d144bb011f 100644 --- a/src/typings.d.ts +++ b/src/typings.d.ts @@ -39,7 +39,7 @@ interface SystemJS { // Extra variables that live on Global that will be replaced by webpack DefinePlugin declare var ENV: string; declare var HMR: boolean; -declare var Zone: {current: any}; +declare var Zone: { current: any }; interface GlobalEnvironment { ENV; HMR; @@ -68,6 +68,6 @@ interface WebpackRequire { } // Extend typings -interface NodeRequire extends WebpackRequire {} -interface NodeModule extends WebpackModule {} -interface Global extends GlobalEnvironment {} +interface NodeRequire extends WebpackRequire { } +interface NodeModule extends WebpackModule { } +interface Global extends GlobalEnvironment { } diff --git a/tsconfig.aot.json b/tsconfig.aot.json index 99eb05bc493b5453df1a0d73a09be7ba0c0b29d7..468a6d392d3b5d1cdf0112c52153582b7da28dde 100644 --- a/tsconfig.aot.json +++ b/tsconfig.aot.json @@ -24,5 +24,7 @@ }, "compileOnSave": false, "buildOnSave": false, - "atom": { "rewriteTsconfig": false } + "atom": { + "rewriteTsconfig": false + } } diff --git a/tsconfig.json b/tsconfig.json index 38cb58017bcee0e2b774e0381d12afff95a0b70d..c10735a758220456526502a266215ded6a8ecb5f 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -23,5 +23,7 @@ }, "compileOnSave": false, "buildOnSave": false, - "atom": { "rewriteTsconfig": false } + "atom": { + "rewriteTsconfig": false + } } diff --git a/tslint.json b/tslint.json index 0ca77a12c61e66a10ddb76a73680c92f10299ce3..6b00e6bcf5c933076753211fced06a6aa4456537 100644 --- a/tslint.json +++ b/tslint.json @@ -2,102 +2,19 @@ "rulesDirectory": [ "node_modules/codelyzer" ], - "rules":{ - "class-name": true, - "comment-format": [ + "rules": { + "directive-selector": [ true, - "check-space" + "attribute", + "ds", + "camelCase" ], - "curly": true, - "eofline": true, - "forin": true, - "indent": [ + "component-selector": [ true, - "spaces" + "element", + "ds", + "kebab-case" ], - "label-position": true, - "label-undefined": true, - "max-line-length": [ - true, - 140 - ], - "member-access": false, - "member-ordering": [ - true, - "static-before-instance", - "variables-before-functions" - ], - "no-arg": true, - "no-bitwise": true, - "no-console": [ - true, - "debug", - "info", - "time", - "timeEnd", - "trace" - ], - "no-construct": true, - "no-debugger": true, - "no-duplicate-key": true, - "no-duplicate-variable": true, - "no-empty": false, - "no-eval": true, - "no-inferrable-types": true, - "no-shadowed-variable": true, - "no-string-literal": false, - "no-switch-case-fall-through": true, - "no-trailing-whitespace": true, - "no-unused-expression": true, - "no-unused-variable": true, - "no-unreachable": true, - "no-use-before-declare": true, - "no-var-keyword": true, - "object-literal-sort-keys": false, - "one-line": [ - true, - "check-open-brace", - "check-catch", - "check-else", - "check-whitespace" - ], - "quotemark": [ - true, - "single" - ], - "radix": true, - "semicolon": [ - "always" - ], - "triple-equals": [ - true, - "allow-null-check" - ], - "typedef-whitespace": [ - true, - { - "call-signature": "nospace", - "index-signature": "nospace", - "parameter": "nospace", - "property-declaration": "nospace", - "variable-declaration": "nospace" - } - ], - "variable-name": false, - "whitespace": [ - true, - "check-branch", - "check-decl", - "check-operator", - "check-separator", - "check-type" - ], - "directive-selector-prefix": [true, "ds"], - "component-selector-prefix": [true, "ds"], - "directive-selector-name": [true, "camelCase"], - "component-selector-name": [true, "kebab-case"], - "directive-selector-type": [true, "attribute"], - "component-selector-type": [true, "element"], "use-input-property-decorator": true, "use-output-property-decorator": true, "use-host-property-decorator": true, @@ -107,7 +24,11 @@ "no-forward-ref": true, "use-life-cycle-interface": true, "use-pipe-transform-interface": true, - "pipe-naming": [true, "camelCase", "ds"], + "pipe-naming": [ + true, + "camelCase", + "ds" + ], "component-class-suffix": true, "directive-class-suffix": true, "import-destructuring-spacing": true, diff --git a/webpack.config.ts b/webpack.config.ts index 9077b7371d61d5045280feefec5031752b350aaa..960b90d27edc96317a7b484e08e4157704f8f1ee 100644 --- a/webpack.config.ts +++ b/webpack.config.ts @@ -27,7 +27,12 @@ export var commonPlugins = [ // Loader options new webpack.LoaderOptionsPlugin({ - + options: { + tslint: { + emitErrors: false, + failOnHint: false + }, + } }), ]; @@ -49,8 +54,13 @@ export var commonConfig = { { test: /\.ts$/, use: ['awesome-typescript-loader', 'angular2-template-loader'] }, { test: /\.html$/, use: 'raw-loader' }, { test: /\.css$/, use: 'raw-loader' }, - { test: /\.scss$/, use: ['raw-loader', 'sass-loader'] }, - { test: /\.json$/, use: 'json-loader' } + { test: /\.json$/, use: 'json-loader' }, + { + enforce: 'pre', + test: /\.ts?$/, + use: 'tslint-loader', + exclude: /(node_modules)/, + } ], }, plugins: [ diff --git a/webpack.prod.config.ts b/webpack.prod.config.ts index a0f1b66304711113dbd38990251b2c1b4de121dd..7516b4da3967d891db05ddf263eaaf253534d72b 100644 --- a/webpack.prod.config.ts +++ b/webpack.prod.config.ts @@ -4,7 +4,7 @@ const clone = require('js.clone'); const webpackMerge = require('webpack-merge'); const V8LazyParseWebpackPlugin = require('v8-lazy-parse-webpack-plugin'); const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin; -import webpackConfig, { root, includeClientPackages } from './webpack.config'; +import webpackConfig, { root, includeClientPackages } from './webpack.config'; // const CompressionPlugin = require('compression-webpack-plugin'); @@ -171,8 +171,8 @@ export const serverConfig = { export default [ // Client - webpackMerge(webpackConfig[0], clone(commonConfig), clientConfig, {plugins: webpackConfig[0].plugins.concat(commonPlugins, clientPlugins) }), + webpackMerge(webpackConfig[0], clone(commonConfig), clientConfig, { plugins: webpackConfig[0].plugins.concat(commonPlugins, clientPlugins) }), // Server - webpackMerge(webpackConfig[1], clone(commonConfig), serverConfig, {plugins: webpackConfig[1].plugins.concat(commonPlugins, serverPlugins) }) + webpackMerge(webpackConfig[1], clone(commonConfig), serverConfig, { plugins: webpackConfig[1].plugins.concat(commonPlugins, serverPlugins) }) ];