diff options
| author | Fuwn <[email protected]> | 2020-12-14 23:21:39 -0800 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2020-12-14 23:21:39 -0800 |
| commit | 823344c19094680e80e2b56449a243e183db8b06 (patch) | |
| tree | 92277700547ea671331828caa258ace7aaaa46d5 /apps | |
| parent | repo: angular (diff) | |
| download | me-823344c19094680e80e2b56449a243e183db8b06.tar.xz me-823344c19094680e80e2b56449a243e183db8b06.zip | |
:star:
Diffstat (limited to 'apps')
30 files changed, 473 insertions, 0 deletions
diff --git a/apps/me-e2e/protractor.conf.js b/apps/me-e2e/protractor.conf.js new file mode 100644 index 0000000..f238c0b --- /dev/null +++ b/apps/me-e2e/protractor.conf.js @@ -0,0 +1,36 @@ +// @ts-check +// Protractor configuration file, see link for more information +// https://github.com/angular/protractor/blob/master/lib/config.ts + +const { SpecReporter, StacktraceOption } = require('jasmine-spec-reporter'); + +/** + * @type { import("protractor").Config } + */ +exports.config = { + allScriptsTimeout: 11000, + specs: [ + './src/**/*.e2e-spec.ts' + ], + capabilities: { + browserName: 'chrome' + }, + directConnect: true, + baseUrl: 'http://localhost:4200/', + framework: 'jasmine', + jasmineNodeOpts: { + showColors: true, + defaultTimeoutInterval: 30000, + print: function() {} + }, + onPrepare() { + require('ts-node').register({ + project: require('path').join(__dirname, './tsconfig.json') + }); + jasmine.getEnv().addReporter(new SpecReporter({ + spec: { + displayStacktrace: StacktraceOption.PRETTY + } + })); + } +};
\ No newline at end of file diff --git a/apps/me-e2e/src/app.e2e-spec.ts b/apps/me-e2e/src/app.e2e-spec.ts new file mode 100644 index 0000000..838fd00 --- /dev/null +++ b/apps/me-e2e/src/app.e2e-spec.ts @@ -0,0 +1,23 @@ +import { AppPage } from './app.po'; +import { browser, logging } from 'protractor'; + +describe('workspace-project App', () => { + let page: AppPage; + + beforeEach(() => { + page = new AppPage(); + }); + + it('should display welcome message', () => { + page.navigateTo(); + expect(page.getTitleText()).toEqual('me app is running!'); + }); + + afterEach(async () => { + // Assert that there are no errors emitted from the browser + const logs = await browser.manage().logs().get(logging.Type.BROWSER); + expect(logs).not.toContain(jasmine.objectContaining({ + level: logging.Level.SEVERE, + } as logging.Entry)); + }); +}); diff --git a/apps/me-e2e/src/app.po.ts b/apps/me-e2e/src/app.po.ts new file mode 100644 index 0000000..b68475e --- /dev/null +++ b/apps/me-e2e/src/app.po.ts @@ -0,0 +1,11 @@ +import { browser, by, element } from 'protractor'; + +export class AppPage { + navigateTo(): Promise<unknown> { + return browser.get(browser.baseUrl) as Promise<unknown>; + } + + getTitleText(): Promise<string> { + return element(by.css('app-root .content span')).getText() as Promise<string>; + } +} diff --git a/apps/me-e2e/tsconfig.json b/apps/me-e2e/tsconfig.json new file mode 100644 index 0000000..7d1e139 --- /dev/null +++ b/apps/me-e2e/tsconfig.json @@ -0,0 +1,13 @@ +{ + "extends": "../../tsconfig.json", + "compilerOptions": { + "outDir": "../../dist/out-tsc", + "module": "commonjs", + "target": "es2018", + "types": [ + "jasmine", + "jasminewd2", + "node" + ] + } +} diff --git a/apps/me/karma.conf.js b/apps/me/karma.conf.js new file mode 100644 index 0000000..284d73b --- /dev/null +++ b/apps/me/karma.conf.js @@ -0,0 +1,32 @@ +// Karma configuration file, see link for more information +// https://karma-runner.github.io/1.0/config/configuration-file.html + +module.exports = function (config) { + config.set({ + basePath: '', + frameworks: ['jasmine', '@angular-devkit/build-angular'], + plugins: [ + require('karma-jasmine'), + require('karma-chrome-launcher'), + require('karma-jasmine-html-reporter'), + require('karma-coverage-istanbul-reporter'), + require('@angular-devkit/build-angular/plugins/karma') + ], + client: { + clearContext: false // leave Jasmine Spec Runner output visible in browser + }, + coverageIstanbulReporter: { + dir: require('path').join(__dirname, './coverage/me'), + reports: ['html', 'lcovonly', 'text-summary'], + fixWebpackSourcePaths: true + }, + reporters: ['progress', 'kjhtml'], + port: 9876, + colors: true, + logLevel: config.LOG_INFO, + autoWatch: true, + browsers: ['Chrome'], + singleRun: false, + restartOnFileChange: true + }); +}; diff --git a/apps/me/src/app/app-routing.module.ts b/apps/me/src/app/app-routing.module.ts new file mode 100644 index 0000000..d425c6f --- /dev/null +++ b/apps/me/src/app/app-routing.module.ts @@ -0,0 +1,10 @@ +import { NgModule } from '@angular/core'; +import { Routes, RouterModule } from '@angular/router'; + +const routes: Routes = []; + +@NgModule({ + imports: [RouterModule.forRoot(routes)], + exports: [RouterModule] +}) +export class AppRoutingModule { } diff --git a/apps/me/src/app/app.component.html b/apps/me/src/app/app.component.html new file mode 100644 index 0000000..ed457d6 --- /dev/null +++ b/apps/me/src/app/app.component.html @@ -0,0 +1,3 @@ +<app-navbar></app-navbar> + +<router-outlet></router-outlet>
\ No newline at end of file diff --git a/apps/me/src/app/app.component.scss b/apps/me/src/app/app.component.scss new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/apps/me/src/app/app.component.scss diff --git a/apps/me/src/app/app.component.spec.ts b/apps/me/src/app/app.component.spec.ts new file mode 100644 index 0000000..e299815 --- /dev/null +++ b/apps/me/src/app/app.component.spec.ts @@ -0,0 +1,35 @@ +import { TestBed } from '@angular/core/testing'; +import { RouterTestingModule } from '@angular/router/testing'; +import { AppComponent } from './app.component'; + +describe('AppComponent', () => { + beforeEach(async () => { + await TestBed.configureTestingModule({ + imports: [ + RouterTestingModule + ], + declarations: [ + AppComponent + ], + }).compileComponents(); + }); + + it('should create the app', () => { + const fixture = TestBed.createComponent(AppComponent); + const app = fixture.componentInstance; + expect(app).toBeTruthy(); + }); + + it(`should have as title 'me'`, () => { + const fixture = TestBed.createComponent(AppComponent); + const app = fixture.componentInstance; + expect(app.title).toEqual('me'); + }); + + it('should render title', () => { + const fixture = TestBed.createComponent(AppComponent); + fixture.detectChanges(); + const compiled = fixture.nativeElement; + expect(compiled.querySelector('.content span').textContent).toContain('me app is running!'); + }); +}); diff --git a/apps/me/src/app/app.component.ts b/apps/me/src/app/app.component.ts new file mode 100644 index 0000000..3a8dd4d --- /dev/null +++ b/apps/me/src/app/app.component.ts @@ -0,0 +1,10 @@ +import { Component } from '@angular/core'; + +@Component({ + selector: 'app-root', + templateUrl: './app.component.html', + styleUrls: ['./app.component.scss'] +}) +export class AppComponent { + title = 'me'; +} diff --git a/apps/me/src/app/app.module.ts b/apps/me/src/app/app.module.ts new file mode 100644 index 0000000..df8b354 --- /dev/null +++ b/apps/me/src/app/app.module.ts @@ -0,0 +1,33 @@ +import { BrowserModule } from '@angular/platform-browser'; +import { NgModule } from '@angular/core'; + +import { AngularFireModule } from 'angularfire2'; +import { AngularFirestoreModule } from 'angularfire2/firestore'; +import { AngularFireStorageModule } from 'angularfire2/storage'; +import { AngularFireAuthModule } from 'angularfire2/auth'; + +import { environment } from '../environments/environment'; + +import { AppRoutingModule } from './app-routing.module'; +import { AppComponent } from './app.component'; +import { CoreModule } from './core/core.module'; +import { SharedModule } from './shared/shared.module'; + +@NgModule({ + declarations: [ + AppComponent + ], + imports: [ + BrowserModule, + AppRoutingModule, + AngularFireModule.initializeApp(environment.firebase), + AngularFirestoreModule, + AngularFireAuthModule, + AngularFireStorageModule, + CoreModule, + SharedModule + ], + providers: [], + bootstrap: [AppComponent] +}) +export class AppModule { } diff --git a/apps/me/src/app/core/auth.service.spec.ts b/apps/me/src/app/core/auth.service.spec.ts new file mode 100644 index 0000000..f1251ca --- /dev/null +++ b/apps/me/src/app/core/auth.service.spec.ts @@ -0,0 +1,16 @@ +import { TestBed } from '@angular/core/testing'; + +import { AuthService } from './auth.service'; + +describe('AuthService', () => { + let service: AuthService; + + beforeEach(() => { + TestBed.configureTestingModule({}); + service = TestBed.inject(AuthService); + }); + + it('should be created', () => { + expect(service).toBeTruthy(); + }); +}); diff --git a/apps/me/src/app/core/auth.service.ts b/apps/me/src/app/core/auth.service.ts new file mode 100644 index 0000000..af27fde --- /dev/null +++ b/apps/me/src/app/core/auth.service.ts @@ -0,0 +1,9 @@ +import { Injectable } from '@angular/core'; + +@Injectable({ + providedIn: 'root' +}) +export class AuthService { + + constructor() { } +} diff --git a/apps/me/src/app/core/core.module.ts b/apps/me/src/app/core/core.module.ts new file mode 100644 index 0000000..9164577 --- /dev/null +++ b/apps/me/src/app/core/core.module.ts @@ -0,0 +1,12 @@ +import { NgModule } from '@angular/core'; +import { CommonModule } from '@angular/common'; +import { AuthService } from './auth.service'; + +@NgModule({ + declarations: [], + imports: [ + CommonModule + ], + providers: [AuthService] +}) +export class CoreModule { } diff --git a/apps/me/src/app/shared/navbar/navbar.component.html b/apps/me/src/app/shared/navbar/navbar.component.html new file mode 100644 index 0000000..6bbf8ee --- /dev/null +++ b/apps/me/src/app/shared/navbar/navbar.component.html @@ -0,0 +1 @@ +<p>navbar works!</p> diff --git a/apps/me/src/app/shared/navbar/navbar.component.scss b/apps/me/src/app/shared/navbar/navbar.component.scss new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/apps/me/src/app/shared/navbar/navbar.component.scss diff --git a/apps/me/src/app/shared/navbar/navbar.component.spec.ts b/apps/me/src/app/shared/navbar/navbar.component.spec.ts new file mode 100644 index 0000000..f8ccd6f --- /dev/null +++ b/apps/me/src/app/shared/navbar/navbar.component.spec.ts @@ -0,0 +1,25 @@ +import { ComponentFixture, TestBed } from '@angular/core/testing'; + +import { NavbarComponent } from './navbar.component'; + +describe('NavbarComponent', () => { + let component: NavbarComponent; + let fixture: ComponentFixture<NavbarComponent>; + + beforeEach(async () => { + await TestBed.configureTestingModule({ + declarations: [ NavbarComponent ] + }) + .compileComponents(); + }); + + beforeEach(() => { + fixture = TestBed.createComponent(NavbarComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/apps/me/src/app/shared/navbar/navbar.component.ts b/apps/me/src/app/shared/navbar/navbar.component.ts new file mode 100644 index 0000000..6a9bec8 --- /dev/null +++ b/apps/me/src/app/shared/navbar/navbar.component.ts @@ -0,0 +1,15 @@ +import { Component, OnInit } from '@angular/core'; + +@Component({ + selector: 'app-navbar', + templateUrl: './navbar.component.html', + styleUrls: ['./navbar.component.scss'] +}) +export class NavbarComponent implements OnInit { + + constructor() { } + + ngOnInit(): void { + } + +} diff --git a/apps/me/src/app/shared/shared.module.ts b/apps/me/src/app/shared/shared.module.ts new file mode 100644 index 0000000..7d373be --- /dev/null +++ b/apps/me/src/app/shared/shared.module.ts @@ -0,0 +1,16 @@ +import { NgModule } from '@angular/core'; +import { CommonModule } from '@angular/common'; +import { NavbarComponent } from './navbar/navbar.component'; + + + +@NgModule({ + declarations: [NavbarComponent], + imports: [ + CommonModule + ], + exports: [ + NavbarComponent + ] +}) +export class SharedModule { } diff --git a/apps/me/src/assets/.gitkeep b/apps/me/src/assets/.gitkeep new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/apps/me/src/assets/.gitkeep diff --git a/apps/me/src/environments/environment.prod.ts b/apps/me/src/environments/environment.prod.ts new file mode 100644 index 0000000..3612073 --- /dev/null +++ b/apps/me/src/environments/environment.prod.ts @@ -0,0 +1,3 @@ +export const environment = { + production: true +}; diff --git a/apps/me/src/environments/environment.ts b/apps/me/src/environments/environment.ts new file mode 100644 index 0000000..e76b904 --- /dev/null +++ b/apps/me/src/environments/environment.ts @@ -0,0 +1,25 @@ +// 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, + firebase: { + apiKey: "AIzaSyCyAYxbtHWO0nmsySFqk7CVGDnj8eKuxDc", + authDomain: "fuwn-id.firebaseapp.com", + projectId: "fuwn-id", + storageBucket: "fuwn-id.appspot.com", + messagingSenderId: "551534012953", + appId: "1:551534012953:web:8409011373abfb5b491888", + measurementId: "G-3PY1N2GLN9" + } +}; + +/* + * For easier debugging in development mode, you can import the following file + * to ignore zone related error stack frames such as `zone.run`, `zoneDelegate.invokeTask`. + * + * This import should be commented out in production mode because it will have a negative impact + * on performance if an error is thrown. + */ +// import 'zone.js/dist/zone-error'; // Included with Angular CLI. diff --git a/apps/me/src/favicon.ico b/apps/me/src/favicon.ico Binary files differnew file mode 100644 index 0000000..1cceb83 --- /dev/null +++ b/apps/me/src/favicon.ico diff --git a/apps/me/src/index.html b/apps/me/src/index.html new file mode 100644 index 0000000..b02582e --- /dev/null +++ b/apps/me/src/index.html @@ -0,0 +1,13 @@ +<!doctype html> +<html lang="en"> +<head> + <meta charset="utf-8"> + <title>Me</title> + <base href="/"> + <meta name="viewport" content="width=device-width, initial-scale=1"> + <link rel="icon" type="image/x-icon" href="favicon.ico"> +</head> +<body> + <app-root></app-root> +</body> +</html> diff --git a/apps/me/src/main.ts b/apps/me/src/main.ts new file mode 100644 index 0000000..c7b673c --- /dev/null +++ b/apps/me/src/main.ts @@ -0,0 +1,12 @@ +import { enableProdMode } from '@angular/core'; +import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; + +import { AppModule } from './app/app.module'; +import { environment } from './environments/environment'; + +if (environment.production) { + enableProdMode(); +} + +platformBrowserDynamic().bootstrapModule(AppModule) + .catch(err => console.error(err)); diff --git a/apps/me/src/polyfills.ts b/apps/me/src/polyfills.ts new file mode 100644 index 0000000..03711e5 --- /dev/null +++ b/apps/me/src/polyfills.ts @@ -0,0 +1,63 @@ +/** + * This file includes polyfills needed by Angular and is loaded before the app. + * You can add your own extra polyfills to this file. + * + * This file is divided into 2 sections: + * 1. Browser polyfills. These are applied before loading ZoneJS and are sorted by browsers. + * 2. Application imports. Files imported after ZoneJS that should be loaded before your main + * file. + * + * The current setup is for so-called "evergreen" browsers; the last versions of browsers that + * automatically update themselves. This includes Safari >= 10, Chrome >= 55 (including Opera), + * Edge >= 13 on the desktop, and iOS 10 and Chrome on mobile. + * + * Learn more in https://angular.io/guide/browser-support + */ + +/*************************************************************************************************** + * BROWSER POLYFILLS + */ + +/** IE10 and IE11 requires the following for NgClass support on SVG elements */ +// import 'classlist.js'; // Run `npm install --save classlist.js`. + +/** + * Web Animations `@angular/platform-browser/animations` + * Only required if AnimationBuilder is used within the application and using IE/Edge or Safari. + * Standard animation support in Angular DOES NOT require any polyfills (as of Angular 6.0). + */ +// import 'web-animations-js'; // Run `npm install --save 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 + * because those flags need to be set before `zone.js` being loaded, and webpack + * will put import in the top of bundle, so user need to create a separate file + * in this directory (for example: zone-flags.ts), and put the following flags + * into that file, and then add the following code before importing zone.js. + * import './zone-flags'; + * + * The flags allowed in zone-flags.ts are listed here. + * + * The following flags will work for all browsers. + * + * (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__UNPATCHED_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/apps/me/src/styles.scss b/apps/me/src/styles.scss new file mode 100644 index 0000000..90d4ee0 --- /dev/null +++ b/apps/me/src/styles.scss @@ -0,0 +1 @@ +/* You can add global styles to this file, and also import other style files */ diff --git a/apps/me/src/test.ts b/apps/me/src/test.ts new file mode 100644 index 0000000..50193eb --- /dev/null +++ b/apps/me/src/test.ts @@ -0,0 +1,25 @@ +// This file is required by karma.conf.js and loads recursively all the .spec and framework files + +import 'zone.js/dist/zone-testing'; +import { getTestBed } from '@angular/core/testing'; +import { + BrowserDynamicTestingModule, + platformBrowserDynamicTesting +} from '@angular/platform-browser-dynamic/testing'; + +declare const require: { + context(path: string, deep?: boolean, filter?: RegExp): { + keys(): string[]; + <T>(id: string): T; + }; +}; + +// First, initialize the Angular testing environment. +getTestBed().initTestEnvironment( + BrowserDynamicTestingModule, + platformBrowserDynamicTesting() +); +// Then we find all the tests. +const context = require.context('./', true, /\.spec\.ts$/); +// And load the modules. +context.keys().map(context); diff --git a/apps/me/tsconfig.app.json b/apps/me/tsconfig.app.json new file mode 100644 index 0000000..b625aa2 --- /dev/null +++ b/apps/me/tsconfig.app.json @@ -0,0 +1,14 @@ +{ + "extends": "../../tsconfig.json", + "compilerOptions": { + "outDir": "../../dist/out-tsc", + "types": [] + }, + "files": [ + "src/main.ts", + "src/polyfills.ts" + ], + "include": [ + "src/**/*.d.ts" + ] +} diff --git a/apps/me/tsconfig.spec.json b/apps/me/tsconfig.spec.json new file mode 100644 index 0000000..9611425 --- /dev/null +++ b/apps/me/tsconfig.spec.json @@ -0,0 +1,17 @@ +{ + "extends": "../../tsconfig.json", + "compilerOptions": { + "outDir": "../../dist/out-tsc", + "types": [ + "jasmine" + ] + }, + "files": [ + "src/test.ts", + "src/polyfills.ts" + ], + "include": [ + "src/**/*.spec.ts", + "src/**/*.d.ts" + ] +} |