Skip to content

Commit 331e825

Browse files
feat: add Angular Getting Started application
1 parent c2502f6 commit 331e825

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+1110
-4
lines changed

angular.json

+119
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,125 @@
2828
}
2929
},
3030
"schematics": {}
31+
},
32+
"getting-started": {
33+
"projectType": "application",
34+
"schematics": {},
35+
"root": "apps/getting-started",
36+
"sourceRoot": "apps/getting-started/src",
37+
"prefix": "reactiveangular",
38+
"architect": {
39+
"build": {
40+
"builder": "@angular-devkit/build-angular:browser",
41+
"options": {
42+
"outputPath": "dist/apps/getting-started",
43+
"index": "apps/getting-started/src/index.html",
44+
"main": "apps/getting-started/src/main.ts",
45+
"polyfills": "apps/getting-started/src/polyfills.ts",
46+
"tsConfig": "apps/getting-started/tsconfig.app.json",
47+
"aot": true,
48+
"assets": [
49+
"apps/getting-started/src/favicon.ico",
50+
"apps/getting-started/src/assets"
51+
],
52+
"styles": ["apps/getting-started/src/styles.css"],
53+
"scripts": []
54+
},
55+
"configurations": {
56+
"production": {
57+
"fileReplacements": [
58+
{
59+
"replace": "apps/getting-started/src/environments/environment.ts",
60+
"with": "apps/getting-started/src/environments/environment.prod.ts"
61+
}
62+
],
63+
"optimization": true,
64+
"outputHashing": "all",
65+
"sourceMap": false,
66+
"extractCss": true,
67+
"namedChunks": false,
68+
"extractLicenses": true,
69+
"vendorChunk": false,
70+
"buildOptimizer": true,
71+
"budgets": [
72+
{
73+
"type": "initial",
74+
"maximumWarning": "2mb",
75+
"maximumError": "5mb"
76+
},
77+
{
78+
"type": "anyComponentStyle",
79+
"maximumWarning": "6kb",
80+
"maximumError": "10kb"
81+
}
82+
]
83+
}
84+
}
85+
},
86+
"serve": {
87+
"builder": "@angular-devkit/build-angular:dev-server",
88+
"options": {
89+
"browserTarget": "getting-started:build"
90+
},
91+
"configurations": {
92+
"production": {
93+
"browserTarget": "getting-started:build:production"
94+
}
95+
}
96+
},
97+
"extract-i18n": {
98+
"builder": "@angular-devkit/build-angular:extract-i18n",
99+
"options": {
100+
"browserTarget": "getting-started:build"
101+
}
102+
},
103+
"lint": {
104+
"builder": "@angular-devkit/build-angular:tslint",
105+
"options": {
106+
"tsConfig": [
107+
"apps/getting-started/tsconfig.app.json",
108+
"apps/getting-started/tsconfig.spec.json"
109+
],
110+
"exclude": ["**/node_modules/**", "!apps/getting-started/**/*"]
111+
}
112+
},
113+
"test": {
114+
"builder": "@nrwl/jest:jest",
115+
"options": {
116+
"jestConfig": "apps/getting-started/jest.config.js",
117+
"tsConfig": "apps/getting-started/tsconfig.spec.json",
118+
"passWithNoTests": true,
119+
"setupFile": "apps/getting-started/src/test-setup.ts"
120+
}
121+
}
122+
}
123+
},
124+
"getting-started-e2e": {
125+
"root": "apps/getting-started-e2e",
126+
"sourceRoot": "apps/getting-started-e2e/src",
127+
"projectType": "application",
128+
"architect": {
129+
"e2e": {
130+
"builder": "@nrwl/cypress:cypress",
131+
"options": {
132+
"cypressConfig": "apps/getting-started-e2e/cypress.json",
133+
"tsConfig": "apps/getting-started-e2e/tsconfig.e2e.json",
134+
"devServerTarget": "getting-started:serve"
135+
},
136+
"configurations": {
137+
"production": {
138+
"devServerTarget": "getting-started:serve:production"
139+
}
140+
}
141+
},
142+
"lint": {
143+
"builder": "@angular-devkit/build-angular:tslint",
144+
"options": {
145+
"tsConfig": ["apps/getting-started-e2e/tsconfig.e2e.json"],
146+
"exclude": ["**/node_modules/**", "!apps/getting-started-e2e/**/*"]
147+
}
148+
}
149+
}
31150
}
32151
},
33152
"cli": {

apps/getting-started-e2e/cypress.json

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"fileServerFolder": ".",
3+
"fixturesFolder": "./src/fixtures",
4+
"integrationFolder": "./src/integration",
5+
"modifyObstructiveCode": false,
6+
"pluginsFile": "./src/plugins/index",
7+
"supportFile": "./src/support/index.ts",
8+
"video": true,
9+
"videosFolder": "../../dist/cypress/apps/getting-started-e2e/videos",
10+
"screenshotsFolder": "../../dist/cypress/apps/getting-started-e2e/screenshots",
11+
"chromeWebSecurity": false
12+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"name": "Using fixtures to represent data",
3+
"email": "[email protected]"
4+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import { getGreeting } from '../support/app.po';
2+
3+
describe('getting-started', () => {
4+
beforeEach(() => cy.visit('/'));
5+
6+
it('should display welcome message', () => {
7+
// Custom command example, see `../support/commands.ts` file
8+
cy.login('[email protected]', 'myPassword');
9+
10+
// Function helper example, see `../support/app.po.ts` file
11+
getGreeting().contains('Welcome to getting-started!');
12+
});
13+
});
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// ***********************************************************
2+
// This example plugins/index.js can be used to load plugins
3+
//
4+
// You can change the location of this file or turn off loading
5+
// the plugins file with the 'pluginsFile' configuration option.
6+
//
7+
// You can read more here:
8+
// https://on.cypress.io/plugins-guide
9+
// ***********************************************************
10+
11+
// This function is called when a project is opened or re-opened (e.g. due to
12+
// the project's config changing)
13+
14+
const { preprocessTypescript } = require('@nrwl/cypress/plugins/preprocessor');
15+
16+
module.exports = (on, config) => {
17+
// `on` is used to hook into various events Cypress emits
18+
// `config` is the resolved Cypress config
19+
20+
// Preprocess Typescript file using Nx helper
21+
on('file:preprocessor', preprocessTypescript(config));
22+
};
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export const getGreeting = () => cy.get('h1');
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
// ***********************************************
2+
// This example commands.js shows you how to
3+
// create various custom commands and overwrite
4+
// existing commands.
5+
//
6+
// For more comprehensive examples of custom
7+
// commands please read more here:
8+
// https://on.cypress.io/custom-commands
9+
// ***********************************************
10+
// eslint-disable-next-line @typescript-eslint/no-namespace
11+
declare namespace Cypress {
12+
interface Chainable<Subject> {
13+
login(email: string, password: string): void;
14+
}
15+
}
16+
//
17+
// -- This is a parent command --
18+
Cypress.Commands.add('login', (email, password) => {
19+
console.log('Custom command example: Login', email, password);
20+
});
21+
//
22+
// -- This is a child command --
23+
// Cypress.Commands.add("drag", { prevSubject: 'element'}, (subject, options) => { ... })
24+
//
25+
//
26+
// -- This is a dual command --
27+
// Cypress.Commands.add("dismiss", { prevSubject: 'optional'}, (subject, options) => { ... })
28+
//
29+
//
30+
// -- This will overwrite an existing command --
31+
// Cypress.Commands.overwrite("visit", (originalFn, url, options) => { ... })
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// ***********************************************************
2+
// This example support/index.js is processed and
3+
// loaded automatically before your test files.
4+
//
5+
// This is a great place to put global configuration and
6+
// behavior that modifies Cypress.
7+
//
8+
// You can change the location of this file or turn off
9+
// automatically serving support files with the
10+
// 'supportFile' configuration option.
11+
//
12+
// You can read more here:
13+
// https://on.cypress.io/configuration
14+
// ***********************************************************
15+
16+
// Import commands.js using ES2015 syntax:
17+
import './commands';
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"extends": "./tsconfig.json",
3+
"compilerOptions": {
4+
"sourceMap": false,
5+
"outDir": "../../dist/out-tsc",
6+
"allowJs": true
7+
},
8+
"include": ["src/**/*.ts", "src/**/*.js"]
9+
}
+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"extends": "../../tsconfig.json",
3+
"compilerOptions": {
4+
"types": ["cypress", "node"]
5+
},
6+
"include": ["**/*.ts", "**/*.js"]
7+
}

apps/getting-started-e2e/tslint.json

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"extends": "../../tslint.json",
3+
"linterOptions": { "exclude": ["!**/*"] },
4+
"rules": {}
5+
}

apps/getting-started/browserslist

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# This file is used by the build system to adjust CSS and JS output to support the specified browsers below.
2+
# For additional information regarding the format and rule options, please see:
3+
# https://github.com/browserslist/browserslist#queries
4+
5+
# You can see what browsers were selected by your queries by running:
6+
# npx browserslist
7+
8+
> 0.5%
9+
last 2 versions
10+
Firefox ESR
11+
not dead
12+
not IE 9-11 # For IE 9-11 support, remove 'not'.

apps/getting-started/jest.config.js

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
module.exports = {
2+
name: 'getting-started',
3+
preset: '../../jest.config.js',
4+
coverageDirectory: '../../coverage/apps/getting-started',
5+
snapshotSerializers: [
6+
'jest-preset-angular/build/AngularNoNgAttributesSnapshotSerializer.js',
7+
'jest-preset-angular/build/AngularSnapshotSerializer.js',
8+
'jest-preset-angular/build/HTMLCommentSerializer.js',
9+
],
10+
};
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
2+
3+
/*
4+
Copyright Google LLC. All Rights Reserved.
5+
Use of this source code is governed by an MIT-style license that
6+
can be found in the LICENSE file at http://angular.io/license
7+
*/
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<app-top-bar></app-top-bar>
2+
3+
<div class="container">
4+
<router-outlet></router-outlet>
5+
</div>
6+
7+
<!--
8+
Copyright Google LLC. All Rights Reserved.
9+
Use of this source code is governed by an MIT-style license that
10+
can be found in the LICENSE file at http://angular.io/license
11+
-->
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import { Component } from '@angular/core';
2+
3+
@Component({
4+
selector: 'app-root',
5+
templateUrl: './app.component.html',
6+
styleUrls: ['./app.component.css']
7+
})
8+
export class AppComponent {
9+
}
10+
11+
12+
/*
13+
Copyright Google LLC. All Rights Reserved.
14+
Use of this source code is governed by an MIT-style license that
15+
can be found in the LICENSE file at http://angular.io/license
16+
*/
+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
import { NgModule } from '@angular/core';
2+
import { BrowserModule } from '@angular/platform-browser';
3+
import { RouterModule } from '@angular/router';
4+
import { HttpClientModule } from '@angular/common/http';
5+
import { ReactiveFormsModule } from '@angular/forms';
6+
7+
import { AppComponent } from './app.component';
8+
import { TopBarComponent } from './top-bar/top-bar.component';
9+
import { ProductListComponent } from './product-list/product-list.component';
10+
import { ProductAlertsComponent } from './product-alerts/product-alerts.component';
11+
import { ProductDetailsComponent } from './product-details/product-details.component';
12+
import { CartComponent } from './cart/cart.component';
13+
import { ShippingComponent } from './shipping/shipping.component';
14+
15+
16+
@NgModule({
17+
imports: [
18+
BrowserModule,
19+
HttpClientModule,
20+
ReactiveFormsModule,
21+
RouterModule.forRoot([
22+
{ path: '', component: ProductListComponent },
23+
{ path: 'products/:productId', component: ProductDetailsComponent },
24+
{ path: 'cart', component: CartComponent },
25+
{ path: 'shipping', component: ShippingComponent },
26+
])
27+
],
28+
declarations: [
29+
AppComponent,
30+
TopBarComponent,
31+
ProductListComponent,
32+
ProductAlertsComponent,
33+
ProductDetailsComponent,
34+
CartComponent,
35+
ShippingComponent
36+
],
37+
bootstrap: [
38+
AppComponent
39+
]
40+
})
41+
export class AppModule { }
42+
43+
44+
/*
45+
Copyright Google LLC. All Rights Reserved.
46+
Use of this source code is governed by an MIT-style license that
47+
can be found in the LICENSE file at http://angular.io/license
48+
*/

0 commit comments

Comments
 (0)