Skip to content

Commit

Permalink
feat: add Angular Getting Started application
Browse files Browse the repository at this point in the history
  • Loading branch information
brandonroberts committed Jun 23, 2020
1 parent c2502f6 commit 331e825
Show file tree
Hide file tree
Showing 50 changed files with 1,110 additions and 4 deletions.
119 changes: 119 additions & 0 deletions angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,125 @@
}
},
"schematics": {}
},
"getting-started": {
"projectType": "application",
"schematics": {},
"root": "apps/getting-started",
"sourceRoot": "apps/getting-started/src",
"prefix": "reactiveangular",
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:browser",
"options": {
"outputPath": "dist/apps/getting-started",
"index": "apps/getting-started/src/index.html",
"main": "apps/getting-started/src/main.ts",
"polyfills": "apps/getting-started/src/polyfills.ts",
"tsConfig": "apps/getting-started/tsconfig.app.json",
"aot": true,
"assets": [
"apps/getting-started/src/favicon.ico",
"apps/getting-started/src/assets"
],
"styles": ["apps/getting-started/src/styles.css"],
"scripts": []
},
"configurations": {
"production": {
"fileReplacements": [
{
"replace": "apps/getting-started/src/environments/environment.ts",
"with": "apps/getting-started/src/environments/environment.prod.ts"
}
],
"optimization": true,
"outputHashing": "all",
"sourceMap": false,
"extractCss": true,
"namedChunks": false,
"extractLicenses": true,
"vendorChunk": false,
"buildOptimizer": true,
"budgets": [
{
"type": "initial",
"maximumWarning": "2mb",
"maximumError": "5mb"
},
{
"type": "anyComponentStyle",
"maximumWarning": "6kb",
"maximumError": "10kb"
}
]
}
}
},
"serve": {
"builder": "@angular-devkit/build-angular:dev-server",
"options": {
"browserTarget": "getting-started:build"
},
"configurations": {
"production": {
"browserTarget": "getting-started:build:production"
}
}
},
"extract-i18n": {
"builder": "@angular-devkit/build-angular:extract-i18n",
"options": {
"browserTarget": "getting-started:build"
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": [
"apps/getting-started/tsconfig.app.json",
"apps/getting-started/tsconfig.spec.json"
],
"exclude": ["**/node_modules/**", "!apps/getting-started/**/*"]
}
},
"test": {
"builder": "@nrwl/jest:jest",
"options": {
"jestConfig": "apps/getting-started/jest.config.js",
"tsConfig": "apps/getting-started/tsconfig.spec.json",
"passWithNoTests": true,
"setupFile": "apps/getting-started/src/test-setup.ts"
}
}
}
},
"getting-started-e2e": {
"root": "apps/getting-started-e2e",
"sourceRoot": "apps/getting-started-e2e/src",
"projectType": "application",
"architect": {
"e2e": {
"builder": "@nrwl/cypress:cypress",
"options": {
"cypressConfig": "apps/getting-started-e2e/cypress.json",
"tsConfig": "apps/getting-started-e2e/tsconfig.e2e.json",
"devServerTarget": "getting-started:serve"
},
"configurations": {
"production": {
"devServerTarget": "getting-started:serve:production"
}
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": ["apps/getting-started-e2e/tsconfig.e2e.json"],
"exclude": ["**/node_modules/**", "!apps/getting-started-e2e/**/*"]
}
}
}
}
},
"cli": {
Expand Down
12 changes: 12 additions & 0 deletions apps/getting-started-e2e/cypress.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"fileServerFolder": ".",
"fixturesFolder": "./src/fixtures",
"integrationFolder": "./src/integration",
"modifyObstructiveCode": false,
"pluginsFile": "./src/plugins/index",
"supportFile": "./src/support/index.ts",
"video": true,
"videosFolder": "../../dist/cypress/apps/getting-started-e2e/videos",
"screenshotsFolder": "../../dist/cypress/apps/getting-started-e2e/screenshots",
"chromeWebSecurity": false
}
4 changes: 4 additions & 0 deletions apps/getting-started-e2e/src/fixtures/example.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"name": "Using fixtures to represent data",
"email": "hello@cypress.io"
}
13 changes: 13 additions & 0 deletions apps/getting-started-e2e/src/integration/app.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { getGreeting } from '../support/app.po';

describe('getting-started', () => {
beforeEach(() => cy.visit('/'));

it('should display welcome message', () => {
// Custom command example, see `../support/commands.ts` file
cy.login('my-email@something.com', 'myPassword');

// Function helper example, see `../support/app.po.ts` file
getGreeting().contains('Welcome to getting-started!');
});
});
22 changes: 22 additions & 0 deletions apps/getting-started-e2e/src/plugins/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// ***********************************************************
// This example plugins/index.js can be used to load plugins
//
// You can change the location of this file or turn off loading
// the plugins file with the 'pluginsFile' configuration option.
//
// You can read more here:
// https://on.cypress.io/plugins-guide
// ***********************************************************

// This function is called when a project is opened or re-opened (e.g. due to
// the project's config changing)

const { preprocessTypescript } = require('@nrwl/cypress/plugins/preprocessor');

module.exports = (on, config) => {
// `on` is used to hook into various events Cypress emits
// `config` is the resolved Cypress config

// Preprocess Typescript file using Nx helper
on('file:preprocessor', preprocessTypescript(config));
};
1 change: 1 addition & 0 deletions apps/getting-started-e2e/src/support/app.po.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const getGreeting = () => cy.get('h1');
31 changes: 31 additions & 0 deletions apps/getting-started-e2e/src/support/commands.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
// ***********************************************
// This example commands.js shows you how to
// create various custom commands and overwrite
// existing commands.
//
// For more comprehensive examples of custom
// commands please read more here:
// https://on.cypress.io/custom-commands
// ***********************************************
// eslint-disable-next-line @typescript-eslint/no-namespace
declare namespace Cypress {
interface Chainable<Subject> {
login(email: string, password: string): void;
}
}
//
// -- This is a parent command --
Cypress.Commands.add('login', (email, password) => {
console.log('Custom command example: Login', email, password);
});
//
// -- This is a child command --
// Cypress.Commands.add("drag", { prevSubject: 'element'}, (subject, options) => { ... })
//
//
// -- This is a dual command --
// Cypress.Commands.add("dismiss", { prevSubject: 'optional'}, (subject, options) => { ... })
//
//
// -- This will overwrite an existing command --
// Cypress.Commands.overwrite("visit", (originalFn, url, options) => { ... })
17 changes: 17 additions & 0 deletions apps/getting-started-e2e/src/support/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// ***********************************************************
// This example support/index.js is processed and
// loaded automatically before your test files.
//
// This is a great place to put global configuration and
// behavior that modifies Cypress.
//
// You can change the location of this file or turn off
// automatically serving support files with the
// 'supportFile' configuration option.
//
// You can read more here:
// https://on.cypress.io/configuration
// ***********************************************************

// Import commands.js using ES2015 syntax:
import './commands';
9 changes: 9 additions & 0 deletions apps/getting-started-e2e/tsconfig.e2e.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"sourceMap": false,
"outDir": "../../dist/out-tsc",
"allowJs": true
},
"include": ["src/**/*.ts", "src/**/*.js"]
}
7 changes: 7 additions & 0 deletions apps/getting-started-e2e/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"types": ["cypress", "node"]
},
"include": ["**/*.ts", "**/*.js"]
}
5 changes: 5 additions & 0 deletions apps/getting-started-e2e/tslint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"extends": "../../tslint.json",
"linterOptions": { "exclude": ["!**/*"] },
"rules": {}
}
12 changes: 12 additions & 0 deletions apps/getting-started/browserslist
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# This file is used by the build system to adjust CSS and JS output to support the specified browsers below.
# For additional information regarding the format and rule options, please see:
# https://github.com/browserslist/browserslist#queries

# You can see what browsers were selected by your queries by running:
# npx browserslist

> 0.5%
last 2 versions
Firefox ESR
not dead
not IE 9-11 # For IE 9-11 support, remove 'not'.
10 changes: 10 additions & 0 deletions apps/getting-started/jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
module.exports = {
name: 'getting-started',
preset: '../../jest.config.js',
coverageDirectory: '../../coverage/apps/getting-started',
snapshotSerializers: [
'jest-preset-angular/build/AngularNoNgAttributesSnapshotSerializer.js',
'jest-preset-angular/build/AngularSnapshotSerializer.js',
'jest-preset-angular/build/HTMLCommentSerializer.js',
],
};
7 changes: 7 additions & 0 deletions apps/getting-started/src/app/app.component.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@


/*
Copyright Google LLC. All Rights Reserved.
Use of this source code is governed by an MIT-style license that
can be found in the LICENSE file at http://angular.io/license
*/
11 changes: 11 additions & 0 deletions apps/getting-started/src/app/app.component.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<app-top-bar></app-top-bar>

<div class="container">
<router-outlet></router-outlet>
</div>

<!--
Copyright Google LLC. All Rights Reserved.
Use of this source code is governed by an MIT-style license that
can be found in the LICENSE file at http://angular.io/license
-->
16 changes: 16 additions & 0 deletions apps/getting-started/src/app/app.component.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { Component } from '@angular/core';

@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent {
}


/*
Copyright Google LLC. All Rights Reserved.
Use of this source code is governed by an MIT-style license that
can be found in the LICENSE file at http://angular.io/license
*/
48 changes: 48 additions & 0 deletions apps/getting-started/src/app/app.module.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { RouterModule } from '@angular/router';
import { HttpClientModule } from '@angular/common/http';
import { ReactiveFormsModule } from '@angular/forms';

import { AppComponent } from './app.component';
import { TopBarComponent } from './top-bar/top-bar.component';
import { ProductListComponent } from './product-list/product-list.component';
import { ProductAlertsComponent } from './product-alerts/product-alerts.component';
import { ProductDetailsComponent } from './product-details/product-details.component';
import { CartComponent } from './cart/cart.component';
import { ShippingComponent } from './shipping/shipping.component';


@NgModule({
imports: [
BrowserModule,
HttpClientModule,
ReactiveFormsModule,
RouterModule.forRoot([
{ path: '', component: ProductListComponent },
{ path: 'products/:productId', component: ProductDetailsComponent },
{ path: 'cart', component: CartComponent },
{ path: 'shipping', component: ShippingComponent },
])
],
declarations: [
AppComponent,
TopBarComponent,
ProductListComponent,
ProductAlertsComponent,
ProductDetailsComponent,
CartComponent,
ShippingComponent
],
bootstrap: [
AppComponent
]
})
export class AppModule { }


/*
Copyright Google LLC. All Rights Reserved.
Use of this source code is governed by an MIT-style license that
can be found in the LICENSE file at http://angular.io/license
*/

0 comments on commit 331e825

Please sign in to comment.