瀏覽代碼

initial commit

Kroenen62 5 年之前
當前提交
6b6db06981

+ 13
- 0
.editorconfig 查看文件

@@ -0,0 +1,13 @@
1
+# Editor configuration, see https://editorconfig.org
2
+root = true
3
+
4
+[*]
5
+charset = utf-8
6
+indent_style = space
7
+indent_size = 2
8
+insert_final_newline = true
9
+trim_trailing_whitespace = true
10
+
11
+[*.md]
12
+max_line_length = off
13
+trim_trailing_whitespace = false

+ 46
- 0
.gitignore 查看文件

@@ -0,0 +1,46 @@
1
+# See http://help.github.com/ignore-files/ for more about ignoring files.
2
+
3
+# compiled output
4
+/dist
5
+/tmp
6
+/out-tsc
7
+# Only exists if Bazel was run
8
+/bazel-out
9
+
10
+# dependencies
11
+/node_modules
12
+
13
+# profiling files
14
+chrome-profiler-events.json
15
+speed-measure-plugin.json
16
+
17
+# IDEs and editors
18
+/.idea
19
+.project
20
+.classpath
21
+.c9/
22
+*.launch
23
+.settings/
24
+*.sublime-workspace
25
+
26
+# IDE - VSCode
27
+.vscode/*
28
+!.vscode/settings.json
29
+!.vscode/tasks.json
30
+!.vscode/launch.json
31
+!.vscode/extensions.json
32
+.history/*
33
+
34
+# misc
35
+/.sass-cache
36
+/connect.lock
37
+/coverage
38
+/libpeerconnection.log
39
+npm-debug.log
40
+yarn-error.log
41
+testem.log
42
+/typings
43
+
44
+# System Files
45
+.DS_Store
46
+Thumbs.db

+ 27
- 0
README.md 查看文件

@@ -0,0 +1,27 @@
1
+# AngularTooltipHtml
2
+
3
+This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 7.3.4.
4
+
5
+## Development server
6
+
7
+Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The app will automatically reload if you change any of the source files.
8
+
9
+## Code scaffolding
10
+
11
+Run `ng generate component component-name` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module`.
12
+
13
+## Build
14
+
15
+Run `ng build` to build the project. The build artifacts will be stored in the `dist/` directory. Use the `--prod` flag for a production build.
16
+
17
+## Running unit tests
18
+
19
+Run `ng test` to execute the unit tests via [Karma](https://karma-runner.github.io).
20
+
21
+## Running end-to-end tests
22
+
23
+Run `ng e2e` to execute the end-to-end tests via [Protractor](http://www.protractortest.org/).
24
+
25
+## Further help
26
+
27
+To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI README](https://github.com/angular/angular-cli/blob/master/README.md).

+ 140
- 0
angular.json 查看文件

@@ -0,0 +1,140 @@
1
+{
2
+  "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
3
+  "version": 1,
4
+  "newProjectRoot": "projects",
5
+  "projects": {
6
+    "angular-tooltip-html": {
7
+      "root": "",
8
+      "sourceRoot": "src",
9
+      "projectType": "application",
10
+      "prefix": "app",
11
+      "schematics": {
12
+        "@schematics/angular:component": {
13
+          "style": "sass"
14
+        }
15
+      },
16
+      "architect": {
17
+        "build": {
18
+          "builder": "@angular-devkit/build-angular:browser",
19
+          "options": {
20
+            "outputPath": "dist/angular-tooltip-html",
21
+            "index": "src/index.html",
22
+            "main": "src/main.ts",
23
+            "polyfills": "src/polyfills.ts",
24
+            "tsConfig": "src/tsconfig.app.json",
25
+            "assets": [
26
+              "src/favicon.ico",
27
+              "src/assets"
28
+            ],
29
+            "styles": [
30
+              "src/styles.scss"
31
+            ],
32
+            "scripts": [],
33
+            "es5BrowserSupport": true
34
+          },
35
+          "configurations": {
36
+            "production": {
37
+              "fileReplacements": [
38
+                {
39
+                  "replace": "src/environments/environment.ts",
40
+                  "with": "src/environments/environment.prod.ts"
41
+                }
42
+              ],
43
+              "optimization": true,
44
+              "outputHashing": "all",
45
+              "sourceMap": false,
46
+              "extractCss": true,
47
+              "namedChunks": false,
48
+              "aot": true,
49
+              "extractLicenses": true,
50
+              "vendorChunk": false,
51
+              "buildOptimizer": true,
52
+              "budgets": [
53
+                {
54
+                  "type": "initial",
55
+                  "maximumWarning": "2mb",
56
+                  "maximumError": "5mb"
57
+                }
58
+              ]
59
+            }
60
+          }
61
+        },
62
+        "serve": {
63
+          "builder": "@angular-devkit/build-angular:dev-server",
64
+          "options": {
65
+            "browserTarget": "angular-tooltip-html:build"
66
+          },
67
+          "configurations": {
68
+            "production": {
69
+              "browserTarget": "angular-tooltip-html:build:production"
70
+            }
71
+          }
72
+        },
73
+        "extract-i18n": {
74
+          "builder": "@angular-devkit/build-angular:extract-i18n",
75
+          "options": {
76
+            "browserTarget": "angular-tooltip-html:build"
77
+          }
78
+        },
79
+        "test": {
80
+          "builder": "@angular-devkit/build-angular:karma",
81
+          "options": {
82
+            "main": "src/test.ts",
83
+            "polyfills": "src/polyfills.ts",
84
+            "tsConfig": "src/tsconfig.spec.json",
85
+            "karmaConfig": "src/karma.conf.js",
86
+            "styles": [
87
+              "src/styles.scss"
88
+            ],
89
+            "scripts": [],
90
+            "assets": [
91
+              "src/favicon.ico",
92
+              "src/assets"
93
+            ]
94
+          }
95
+        },
96
+        "lint": {
97
+          "builder": "@angular-devkit/build-angular:tslint",
98
+          "options": {
99
+            "tsConfig": [
100
+              "src/tsconfig.app.json",
101
+              "src/tsconfig.spec.json"
102
+            ],
103
+            "exclude": [
104
+              "**/node_modules/**"
105
+            ]
106
+          }
107
+        }
108
+      }
109
+    },
110
+    "angular-tooltip-html-e2e": {
111
+      "root": "e2e/",
112
+      "projectType": "application",
113
+      "prefix": "",
114
+      "architect": {
115
+        "e2e": {
116
+          "builder": "@angular-devkit/build-angular:protractor",
117
+          "options": {
118
+            "protractorConfig": "e2e/protractor.conf.js",
119
+            "devServerTarget": "angular-tooltip-html:serve"
120
+          },
121
+          "configurations": {
122
+            "production": {
123
+              "devServerTarget": "angular-tooltip-html:serve:production"
124
+            }
125
+          }
126
+        },
127
+        "lint": {
128
+          "builder": "@angular-devkit/build-angular:tslint",
129
+          "options": {
130
+            "tsConfig": "e2e/tsconfig.e2e.json",
131
+            "exclude": [
132
+              "**/node_modules/**"
133
+            ]
134
+          }
135
+        }
136
+      }
137
+    }
138
+  },
139
+  "defaultProject": "angular-tooltip-html"
140
+}

+ 28
- 0
e2e/protractor.conf.js 查看文件

@@ -0,0 +1,28 @@
1
+// Protractor configuration file, see link for more information
2
+// https://github.com/angular/protractor/blob/master/lib/config.ts
3
+
4
+const { SpecReporter } = require('jasmine-spec-reporter');
5
+
6
+exports.config = {
7
+  allScriptsTimeout: 11000,
8
+  specs: [
9
+    './src/**/*.e2e-spec.ts'
10
+  ],
11
+  capabilities: {
12
+    'browserName': 'chrome'
13
+  },
14
+  directConnect: true,
15
+  baseUrl: 'http://localhost:4200/',
16
+  framework: 'jasmine',
17
+  jasmineNodeOpts: {
18
+    showColors: true,
19
+    defaultTimeoutInterval: 30000,
20
+    print: function() {}
21
+  },
22
+  onPrepare() {
23
+    require('ts-node').register({
24
+      project: require('path').join(__dirname, './tsconfig.e2e.json')
25
+    });
26
+    jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } }));
27
+  }
28
+};

+ 23
- 0
e2e/src/app.e2e-spec.ts 查看文件

@@ -0,0 +1,23 @@
1
+import { AppPage } from './app.po';
2
+import { browser, logging } from 'protractor';
3
+
4
+describe('workspace-project App', () => {
5
+  let page: AppPage;
6
+
7
+  beforeEach(() => {
8
+    page = new AppPage();
9
+  });
10
+
11
+  it('should display welcome message', () => {
12
+    page.navigateTo();
13
+    expect(page.getTitleText()).toEqual('Welcome to angular-tooltip-html!');
14
+  });
15
+
16
+  afterEach(async () => {
17
+    // Assert that there are no errors emitted from the browser
18
+    const logs = await browser.manage().logs().get(logging.Type.BROWSER);
19
+    expect(logs).not.toContain(jasmine.objectContaining({
20
+      level: logging.Level.SEVERE,
21
+    } as logging.Entry));
22
+  });
23
+});

+ 11
- 0
e2e/src/app.po.ts 查看文件

@@ -0,0 +1,11 @@
1
+import { browser, by, element } from 'protractor';
2
+
3
+export class AppPage {
4
+  navigateTo() {
5
+    return browser.get(browser.baseUrl) as Promise<any>;
6
+  }
7
+
8
+  getTitleText() {
9
+    return element(by.css('app-root h1')).getText() as Promise<string>;
10
+  }
11
+}

+ 13
- 0
e2e/tsconfig.e2e.json 查看文件

@@ -0,0 +1,13 @@
1
+{
2
+  "extends": "../tsconfig.json",
3
+  "compilerOptions": {
4
+    "outDir": "../out-tsc/app",
5
+    "module": "commonjs",
6
+    "target": "es5",
7
+    "types": [
8
+      "jasmine",
9
+      "jasminewd2",
10
+      "node"
11
+    ]
12
+  }
13
+}

+ 10576
- 0
package-lock.json
文件差異過大導致無法顯示
查看文件


+ 48
- 0
package.json 查看文件

@@ -0,0 +1,48 @@
1
+{
2
+  "name": "angular-tooltip-html",
3
+  "version": "0.0.0",
4
+  "scripts": {
5
+    "ng": "ng",
6
+    "start": "ng serve",
7
+    "build": "ng build",
8
+    "test": "ng test",
9
+    "lint": "ng lint",
10
+    "e2e": "ng e2e"
11
+  },
12
+  "private": true,
13
+  "dependencies": {
14
+    "@angular/animations": "~7.2.0",
15
+    "@angular/common": "~7.2.0",
16
+    "@angular/compiler": "~7.2.0",
17
+    "@angular/core": "~7.2.0",
18
+    "@angular/forms": "~7.2.0",
19
+    "@angular/platform-browser": "~7.2.0",
20
+    "@angular/platform-browser-dynamic": "~7.2.0",
21
+    "@angular/router": "~7.2.0",
22
+    "core-js": "^2.5.4",
23
+    "rxjs": "~6.3.3",
24
+    "tslib": "^1.9.0",
25
+    "zone.js": "~0.8.26"
26
+  },
27
+  "devDependencies": {
28
+    "@angular-devkit/build-angular": "~0.13.0",
29
+    "@angular/cli": "~7.3.4",
30
+    "@angular/compiler-cli": "~7.2.0",
31
+    "@angular/language-service": "~7.2.0",
32
+    "@types/node": "~8.9.4",
33
+    "@types/jasmine": "~2.8.8",
34
+    "@types/jasminewd2": "~2.0.3",
35
+    "codelyzer": "~4.5.0",
36
+    "jasmine-core": "~2.99.1",
37
+    "jasmine-spec-reporter": "~4.2.1",
38
+    "karma": "~4.0.0",
39
+    "karma-chrome-launcher": "~2.2.0",
40
+    "karma-coverage-istanbul-reporter": "~2.0.1",
41
+    "karma-jasmine": "~1.1.2",
42
+    "karma-jasmine-html-reporter": "^0.2.2",
43
+    "protractor": "~5.4.0",
44
+    "ts-node": "~7.0.0",
45
+    "tslint": "~5.11.0",
46
+    "typescript": "~3.2.2"
47
+  }
48
+}

+ 20
- 0
src/app/app.component.html 查看文件

@@ -0,0 +1,20 @@
1
+<!--The content below is only a placeholder and can be replaced.-->
2
+<div style="text-align:center">
3
+  <h1>
4
+    Welcome to {{ title }}!
5
+  </h1>
6
+  <img width="300" alt="Angular Logo" src="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNTAgMjUwIj4KICAgIDxwYXRoIGZpbGw9IiNERDAwMzEiIGQ9Ik0xMjUgMzBMMzEuOSA2My4ybDE0LjIgMTIzLjFMMTI1IDIzMGw3OC45LTQzLjcgMTQuMi0xMjMuMXoiIC8+CiAgICA8cGF0aCBmaWxsPSIjQzMwMDJGIiBkPSJNMTI1IDMwdjIyLjItLjFWMjMwbDc4LjktNDMuNyAxNC4yLTEyMy4xTDEyNSAzMHoiIC8+CiAgICA8cGF0aCAgZmlsbD0iI0ZGRkZGRiIgZD0iTTEyNSA1Mi4xTDY2LjggMTgyLjZoMjEuN2wxMS43LTI5LjJoNDkuNGwxMS43IDI5LjJIMTgzTDEyNSA1Mi4xem0xNyA4My4zaC0zNGwxNy00MC45IDE3IDQwLjl6IiAvPgogIDwvc3ZnPg==">
7
+</div>
8
+<h2>Here are some links to help you start: </h2>
9
+<ul>
10
+  <li>
11
+    <h2><a target="_blank" rel="noopener" href="https://angular.io/tutorial">Tour of Heroes</a></h2>
12
+  </li>
13
+  <li>
14
+    <h2><a target="_blank" rel="noopener" href="https://angular.io/cli">CLI Documentation</a></h2>
15
+  </li>
16
+  <li>
17
+    <h2><a target="_blank" rel="noopener" href="https://blog.angular.io/">Angular blog</a></h2>
18
+  </li>
19
+</ul>
20
+

+ 0
- 0
src/app/app.component.scss 查看文件


+ 31
- 0
src/app/app.component.spec.ts 查看文件

@@ -0,0 +1,31 @@
1
+import { TestBed, async } from '@angular/core/testing';
2
+import { AppComponent } from './app.component';
3
+
4
+describe('AppComponent', () => {
5
+  beforeEach(async(() => {
6
+    TestBed.configureTestingModule({
7
+      declarations: [
8
+        AppComponent
9
+      ],
10
+    }).compileComponents();
11
+  }));
12
+
13
+  it('should create the app', () => {
14
+    const fixture = TestBed.createComponent(AppComponent);
15
+    const app = fixture.debugElement.componentInstance;
16
+    expect(app).toBeTruthy();
17
+  });
18
+
19
+  it(`should have as title 'angular-tooltip-html'`, () => {
20
+    const fixture = TestBed.createComponent(AppComponent);
21
+    const app = fixture.debugElement.componentInstance;
22
+    expect(app.title).toEqual('angular-tooltip-html');
23
+  });
24
+
25
+  it('should render title in a h1 tag', () => {
26
+    const fixture = TestBed.createComponent(AppComponent);
27
+    fixture.detectChanges();
28
+    const compiled = fixture.debugElement.nativeElement;
29
+    expect(compiled.querySelector('h1').textContent).toContain('Welcome to angular-tooltip-html!');
30
+  });
31
+});

+ 10
- 0
src/app/app.component.ts 查看文件

@@ -0,0 +1,10 @@
1
+import { Component } from '@angular/core';
2
+
3
+@Component({
4
+  selector: 'app-root',
5
+  templateUrl: './app.component.html',
6
+  styleUrls: ['./app.component.scss']
7
+})
8
+export class AppComponent {
9
+  title = 'angular-tooltip-html';
10
+}

+ 16
- 0
src/app/app.module.ts 查看文件

@@ -0,0 +1,16 @@
1
+import { BrowserModule } from '@angular/platform-browser';
2
+import { NgModule } from '@angular/core';
3
+
4
+import { AppComponent } from './app.component';
5
+
6
+@NgModule({
7
+  declarations: [
8
+    AppComponent
9
+  ],
10
+  imports: [
11
+    BrowserModule
12
+  ],
13
+  providers: [],
14
+  bootstrap: [AppComponent]
15
+})
16
+export class AppModule { }

+ 0
- 0
src/assets/.gitkeep 查看文件


+ 11
- 0
src/browserslist 查看文件

@@ -0,0 +1,11 @@
1
+# This file is currently used by autoprefixer to adjust CSS to support the below specified browsers
2
+# For additional information regarding the format and rule options, please see:
3
+# https://github.com/browserslist/browserslist#queries
4
+#
5
+# For IE 9-11 support, please remove 'not' from the last line of the file and adjust as needed
6
+
7
+> 0.5%
8
+last 2 versions
9
+Firefox ESR
10
+not dead
11
+not IE 9-11

+ 3
- 0
src/environments/environment.prod.ts 查看文件

@@ -0,0 +1,3 @@
1
+export const environment = {
2
+  production: true
3
+};

+ 16
- 0
src/environments/environment.ts 查看文件

@@ -0,0 +1,16 @@
1
+// This file can be replaced during build by using the `fileReplacements` array.
2
+// `ng build --prod` replaces `environment.ts` with `environment.prod.ts`.
3
+// The list of file replacements can be found in `angular.json`.
4
+
5
+export const environment = {
6
+  production: false
7
+};
8
+
9
+/*
10
+ * For easier debugging in development mode, you can import the following file
11
+ * to ignore zone related error stack frames such as `zone.run`, `zoneDelegate.invokeTask`.
12
+ *
13
+ * This import should be commented out in production mode because it will have a negative impact
14
+ * on performance if an error is thrown.
15
+ */
16
+// import 'zone.js/dist/zone-error';  // Included with Angular CLI.

二進制
src/favicon.ico 查看文件


+ 14
- 0
src/index.html 查看文件

@@ -0,0 +1,14 @@
1
+<!doctype html>
2
+<html lang="en">
3
+<head>
4
+  <meta charset="utf-8">
5
+  <title>AngularTooltipHtml</title>
6
+  <base href="/">
7
+
8
+  <meta name="viewport" content="width=device-width, initial-scale=1">
9
+  <link rel="icon" type="image/x-icon" href="favicon.ico">
10
+</head>
11
+<body>
12
+  <app-root></app-root>
13
+</body>
14
+</html>

+ 32
- 0
src/karma.conf.js 查看文件

@@ -0,0 +1,32 @@
1
+// Karma configuration file, see link for more information
2
+// https://karma-runner.github.io/1.0/config/configuration-file.html
3
+
4
+module.exports = function (config) {
5
+  config.set({
6
+    basePath: '',
7
+    frameworks: ['jasmine', '@angular-devkit/build-angular'],
8
+    plugins: [
9
+      require('karma-jasmine'),
10
+      require('karma-chrome-launcher'),
11
+      require('karma-jasmine-html-reporter'),
12
+      require('karma-coverage-istanbul-reporter'),
13
+      require('@angular-devkit/build-angular/plugins/karma')
14
+    ],
15
+    client: {
16
+      clearContext: false // leave Jasmine Spec Runner output visible in browser
17
+    },
18
+    coverageIstanbulReporter: {
19
+      dir: require('path').join(__dirname, '../coverage/angular-tooltip-html'),
20
+      reports: ['html', 'lcovonly', 'text-summary'],
21
+      fixWebpackSourcePaths: true
22
+    },
23
+    reporters: ['progress', 'kjhtml'],
24
+    port: 9876,
25
+    colors: true,
26
+    logLevel: config.LOG_INFO,
27
+    autoWatch: true,
28
+    browsers: ['Chrome'],
29
+    singleRun: false,
30
+    restartOnFileChange: true
31
+  });
32
+};

+ 12
- 0
src/main.ts 查看文件

@@ -0,0 +1,12 @@
1
+import { enableProdMode } from '@angular/core';
2
+import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
3
+
4
+import { AppModule } from './app/app.module';
5
+import { environment } from './environments/environment';
6
+
7
+if (environment.production) {
8
+  enableProdMode();
9
+}
10
+
11
+platformBrowserDynamic().bootstrapModule(AppModule)
12
+  .catch(err => console.error(err));

+ 63
- 0
src/polyfills.ts 查看文件

@@ -0,0 +1,63 @@
1
+/**
2
+ * This file includes polyfills needed by Angular and is loaded before the app.
3
+ * You can add your own extra polyfills to this file.
4
+ *
5
+ * This file is divided into 2 sections:
6
+ *   1. Browser polyfills. These are applied before loading ZoneJS and are sorted by browsers.
7
+ *   2. Application imports. Files imported after ZoneJS that should be loaded before your main
8
+ *      file.
9
+ *
10
+ * The current setup is for so-called "evergreen" browsers; the last versions of browsers that
11
+ * automatically update themselves. This includes Safari >= 10, Chrome >= 55 (including Opera),
12
+ * Edge >= 13 on the desktop, and iOS 10 and Chrome on mobile.
13
+ *
14
+ * Learn more in https://angular.io/guide/browser-support
15
+ */
16
+
17
+/***************************************************************************************************
18
+ * BROWSER POLYFILLS
19
+ */
20
+
21
+/** IE10 and IE11 requires the following for NgClass support on SVG elements */
22
+// import 'classlist.js';  // Run `npm install --save classlist.js`.
23
+
24
+/**
25
+ * Web Animations `@angular/platform-browser/animations`
26
+ * Only required if AnimationBuilder is used within the application and using IE/Edge or Safari.
27
+ * Standard animation support in Angular DOES NOT require any polyfills (as of Angular 6.0).
28
+ */
29
+// import 'web-animations-js';  // Run `npm install --save web-animations-js`.
30
+
31
+/**
32
+ * By default, zone.js will patch all possible macroTask and DomEvents
33
+ * user can disable parts of macroTask/DomEvents patch by setting following flags
34
+ * because those flags need to be set before `zone.js` being loaded, and webpack
35
+ * will put import in the top of bundle, so user need to create a separate file
36
+ * in this directory (for example: zone-flags.ts), and put the following flags
37
+ * into that file, and then add the following code before importing zone.js.
38
+ * import './zone-flags.ts';
39
+ *
40
+ * The flags allowed in zone-flags.ts are listed here.
41
+ *
42
+ * The following flags will work for all browsers.
43
+ *
44
+ * (window as any).__Zone_disable_requestAnimationFrame = true; // disable patch requestAnimationFrame
45
+ * (window as any).__Zone_disable_on_property = true; // disable patch onProperty such as onclick
46
+ * (window as any).__zone_symbol__BLACK_LISTED_EVENTS = ['scroll', 'mousemove']; // disable patch specified eventNames
47
+ *
48
+ *  in IE/Edge developer tools, the addEventListener will also be wrapped by zone.js
49
+ *  with the following flag, it will bypass `zone.js` patch for IE/Edge
50
+ *
51
+ *  (window as any).__Zone_enable_cross_context_check = true;
52
+ *
53
+ */
54
+
55
+/***************************************************************************************************
56
+ * Zone JS is required by default for Angular itself.
57
+ */
58
+import 'zone.js/dist/zone';  // Included with Angular CLI.
59
+
60
+
61
+/***************************************************************************************************
62
+ * APPLICATION IMPORTS
63
+ */

+ 1
- 0
src/styles.scss 查看文件

@@ -0,0 +1 @@
1
+/* You can add global styles to this file, and also import other style files */

+ 20
- 0
src/test.ts 查看文件

@@ -0,0 +1,20 @@
1
+// This file is required by karma.conf.js and loads recursively all the .spec and framework files
2
+
3
+import 'zone.js/dist/zone-testing';
4
+import { getTestBed } from '@angular/core/testing';
5
+import {
6
+  BrowserDynamicTestingModule,
7
+  platformBrowserDynamicTesting
8
+} from '@angular/platform-browser-dynamic/testing';
9
+
10
+declare const require: any;
11
+
12
+// First, initialize the Angular testing environment.
13
+getTestBed().initTestEnvironment(
14
+  BrowserDynamicTestingModule,
15
+  platformBrowserDynamicTesting()
16
+);
17
+// Then we find all the tests.
18
+const context = require.context('./', true, /\.spec\.ts$/);
19
+// And load the modules.
20
+context.keys().map(context);

+ 11
- 0
src/tsconfig.app.json 查看文件

@@ -0,0 +1,11 @@
1
+{
2
+  "extends": "../tsconfig.json",
3
+  "compilerOptions": {
4
+    "outDir": "../out-tsc/app",
5
+    "types": []
6
+  },
7
+  "exclude": [
8
+    "test.ts",
9
+    "**/*.spec.ts"
10
+  ]
11
+}

+ 18
- 0
src/tsconfig.spec.json 查看文件

@@ -0,0 +1,18 @@
1
+{
2
+  "extends": "../tsconfig.json",
3
+  "compilerOptions": {
4
+    "outDir": "../out-tsc/spec",
5
+    "types": [
6
+      "jasmine",
7
+      "node"
8
+    ]
9
+  },
10
+  "files": [
11
+    "test.ts",
12
+    "polyfills.ts"
13
+  ],
14
+  "include": [
15
+    "**/*.spec.ts",
16
+    "**/*.d.ts"
17
+  ]
18
+}

+ 17
- 0
src/tslint.json 查看文件

@@ -0,0 +1,17 @@
1
+{
2
+    "extends": "../tslint.json",
3
+    "rules": {
4
+        "directive-selector": [
5
+            true,
6
+            "attribute",
7
+            "app",
8
+            "camelCase"
9
+        ],
10
+        "component-selector": [
11
+            true,
12
+            "element",
13
+            "app",
14
+            "kebab-case"
15
+        ]
16
+    }
17
+}

+ 22
- 0
tsconfig.json 查看文件

@@ -0,0 +1,22 @@
1
+{
2
+  "compileOnSave": false,
3
+  "compilerOptions": {
4
+    "baseUrl": "./",
5
+    "outDir": "./dist/out-tsc",
6
+    "sourceMap": true,
7
+    "declaration": false,
8
+    "module": "es2015",
9
+    "moduleResolution": "node",
10
+    "emitDecoratorMetadata": true,
11
+    "experimentalDecorators": true,
12
+    "importHelpers": true,
13
+    "target": "es5",
14
+    "typeRoots": [
15
+      "node_modules/@types"
16
+    ],
17
+    "lib": [
18
+      "es2018",
19
+      "dom"
20
+    ]
21
+  }
22
+}

+ 75
- 0
tslint.json 查看文件

@@ -0,0 +1,75 @@
1
+{
2
+  "extends": "tslint:recommended",
3
+  "rulesDirectory": [
4
+    "codelyzer"
5
+  ],
6
+  "rules": {
7
+    "array-type": false,
8
+    "arrow-parens": false,
9
+    "deprecation": {
10
+      "severity": "warn"
11
+    },
12
+    "import-blacklist": [
13
+      true,
14
+      "rxjs/Rx"
15
+    ],
16
+    "interface-name": false,
17
+    "max-classes-per-file": false,
18
+    "max-line-length": [
19
+      true,
20
+      140
21
+    ],
22
+    "member-access": false,
23
+    "member-ordering": [
24
+      true,
25
+      {
26
+        "order": [
27
+          "static-field",
28
+          "instance-field",
29
+          "static-method",
30
+          "instance-method"
31
+        ]
32
+      }
33
+    ],
34
+    "no-consecutive-blank-lines": false,
35
+    "no-console": [
36
+      true,
37
+      "debug",
38
+      "info",
39
+      "time",
40
+      "timeEnd",
41
+      "trace"
42
+    ],
43
+    "no-empty": false,
44
+    "no-inferrable-types": [
45
+      true,
46
+      "ignore-params"
47
+    ],
48
+    "no-non-null-assertion": true,
49
+    "no-redundant-jsdoc": true,
50
+    "no-switch-case-fall-through": true,
51
+    "no-use-before-declare": true,
52
+    "no-var-requires": false,
53
+    "object-literal-key-quotes": [
54
+      true,
55
+      "as-needed"
56
+    ],
57
+    "object-literal-sort-keys": false,
58
+    "ordered-imports": false,
59
+    "quotemark": [
60
+      true,
61
+      "single"
62
+    ],
63
+    "trailing-comma": false,
64
+    "no-output-on-prefix": true,
65
+    "use-input-property-decorator": true,
66
+    "use-output-property-decorator": true,
67
+    "use-host-property-decorator": true,
68
+    "no-input-rename": true,
69
+    "no-output-rename": true,
70
+    "use-life-cycle-interface": true,
71
+    "use-pipe-transform-interface": true,
72
+    "component-class-suffix": true,
73
+    "directive-class-suffix": true
74
+  }
75
+}