socialnetworknews-web

A open-source Paper.li clone
git clone git://archive.git.mtrnord.blog/SocialNetworkNews/socialnetworknews-web.git
Log | Files | Refs | README | LICENSE

commit 61fcc95fe26b5a430c0cc9c123f1286d3a19120e
parent 2b30dfce67d3df294650f576659f573a27cce023
Author: MTRNord <mtrnord1@gmail.com>
Date:   Sat, 19 May 2018 18:04:27 +0200

Update some files

Diffstat:
Mpackage.json | 2+-
Msrc/environments/environment.ts | 17+++++++++++------
Msrc/main.ts | 7+------
Msrc/polyfills.ts | 25++++++++++++++++++++-----
Msrc/test.ts | 14+-------------
Msrc/tsconfig.app.json | 3++-
Mtsconfig.json | 7+++----
7 files changed, 39 insertions(+), 36 deletions(-)

diff --git a/package.json b/package.json @@ -8,7 +8,7 @@ "serve:ssr": "node dist/server.js", "build:client-and-server-bundles": "ng build --prod --source-map && ng run social-networks-news-web:server --source-map", "webpack:server": "webpack --config webpack.server.config.js --progress --colors", - "test": "ng test --browsers ChromeHeadless", + "test": "ng test --browsers ChromeHeadless --environment dev", "lint": "ng lint", "e2e": "ng e2e" }, diff --git a/src/environments/environment.ts b/src/environments/environment.ts @@ -1,10 +1,15 @@ -// The file contents for the current environment will overwrite these during build. -// The build system defaults to the dev environment which uses `environment.ts`, but if you do -// `ng build --env=prod` then `environment.prod.ts` will be used instead. -// The list of which env maps to which file can be found in `.angular-cli.json`. - -import 'zone.js/dist/zone-error'; +// This file can be replaced during build by using the `fileReplacements` array. +// `ng build ---prod` replaces `environment.ts` with `environment.prod.ts`. +// The list of file replacements can be found in `angular.json`. export const environment = { production: false }; + +/* + * In development mode, to ignore zone related error stack frames such as + * `zone.run`, `zoneDelegate.invokeTask` for easier debugging, you can + * import the following file, but please comment it out in production mode + * because it will have performance impact when throw error + */ +// import 'zone.js/dist/zone-error'; // Included with Angular CLI. diff --git a/src/main.ts b/src/main.ts @@ -4,13 +4,8 @@ import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; import { AppModule } from './app/app.module'; import { environment } from './environments/environment'; -import 'hammerjs'; - if (environment.production) { enableProdMode(); } -document.addEventListener('DOMContentLoaded', () => { - platformBrowserDynamic().bootstrapModule(AppModule) - .catch(err => console.log(err)); -}); +platformBrowserDynamic().bootstrapModule(AppModule); diff --git a/src/polyfills.ts b/src/polyfills.ts @@ -15,10 +15,6 @@ */ /*************************************************************************************************** - * APPLICATION IMPORTS - */ - -/*************************************************************************************************** * BROWSER POLYFILLS */ @@ -54,11 +50,30 @@ import 'core-js/es7/reflect'; * Required to support Web Animations `@angular/platform-browser/animations`. * Needed for: All but Chrome, Firefox and Opera. http://caniuse.com/#feat=web-animation **/ -import 'web-animations-js'; // Run `npm install --save web-animations-js`. +// import 'web-animations-js'; + +/** + * By default, zone.js will patch all possible macroTask and DomEvents + * user can disable parts of macroTask/DomEvents patch by setting following flags + */ +// (window as any).__Zone_disable_requestAnimationFrame = true; // disable patch requestAnimationFrame +// (window as any).__Zone_disable_on_property = true; // disable patch onProperty such as onclick +// (window as any).__zone_symbol__BLACK_LISTED_EVENTS = ['scroll', 'mousemove']; // disable patch specified eventNames +/* +* in IE/Edge developer tools, the addEventListener will also be wrapped by zone.js +* with the following flag, it will bypass `zone.js` patch for IE/Edge +*/ +// (window as any).__Zone_enable_cross_context_check = true; /*************************************************************************************************** * Zone JS is required by default for Angular itself. */ import 'zone.js/dist/zone'; // Included with Angular CLI. + + + +/*************************************************************************************************** + * APPLICATION IMPORTS + */ diff --git a/src/test.ts b/src/test.ts @@ -1,24 +1,14 @@ // This file is required by karma.conf.js and loads recursively all the .spec and framework files -import 'zone.js/dist/long-stack-trace-zone'; -import 'zone.js/dist/proxy.js'; -import 'zone.js/dist/sync-test'; -import 'zone.js/dist/jasmine-patch'; -import 'zone.js/dist/async-test'; -import 'zone.js/dist/fake-async-test'; +import 'zone.js/dist/zone-testing'; import { getTestBed } from '@angular/core/testing'; import { BrowserDynamicTestingModule, platformBrowserDynamicTesting } from '@angular/platform-browser-dynamic/testing'; -// Unfortunately there's no typing for the `__karma__` variable. Just declare it as any. -declare const __karma__: any; declare const require: any; -// Prevent Karma from running prematurely. -__karma__.loaded = function () {}; - // First, initialize the Angular testing environment. getTestBed().initTestEnvironment( BrowserDynamicTestingModule, @@ -28,5 +18,3 @@ getTestBed().initTestEnvironment( const context = require.context('./', true, /\.spec\.ts$/); // And load the modules. context.keys().map(context); -// Finally, start Karma to run the tests. -__karma__.start(); diff --git a/src/tsconfig.app.json b/src/tsconfig.app.json @@ -9,6 +9,7 @@ }, "exclude": [ "test.ts", - "**/*.spec.ts" + "**/*.spec.ts", + "**/testing/*" ] } diff --git a/tsconfig.json b/tsconfig.json @@ -8,14 +8,13 @@ "emitDecoratorMetadata": true, "experimentalDecorators": true, "target": "es5", + "skipLibCheck": true, "typeRoots": [ - "node_modules/@types", - "src/app/utils/types" + "node_modules/@types" ], "lib": [ "es2017", "dom" ] - }, - "include": ["src/**/*.ts"] + } }