Browse Source

nx g @nrwl/angular:app parent-form

tags/part_1
Kevin C. Coram 1 year ago
parent
commit
efc332b2b2
Signed by: kevin GPG Key ID: 0342351B3D61AD35
35 changed files with 6626 additions and 342 deletions
  1. +124
    -1
      angular.json
  2. +11
    -0
      apps/parent-form-e2e/cypress.json
  3. +4
    -0
      apps/parent-form-e2e/src/fixtures/example.json
  4. +9
    -0
      apps/parent-form-e2e/src/integration/app.spec.ts
  5. +22
    -0
      apps/parent-form-e2e/src/plugins/index.js
  6. +1
    -0
      apps/parent-form-e2e/src/support/app.po.ts
  7. +25
    -0
      apps/parent-form-e2e/src/support/commands.ts
  8. +17
    -0
      apps/parent-form-e2e/src/support/index.ts
  9. +8
    -0
      apps/parent-form-e2e/tsconfig.e2e.json
  10. +7
    -0
      apps/parent-form-e2e/tsconfig.json
  11. +1
    -0
      apps/parent-form-e2e/tslint.json
  12. +12
    -0
      apps/parent-form/browserslist
  13. +9
    -0
      apps/parent-form/jest.config.js
  14. +0
    -0
      apps/parent-form/src/app/app.component.css
  15. +29
    -0
      apps/parent-form/src/app/app.component.html
  16. +33
    -0
      apps/parent-form/src/app/app.component.spec.ts
  17. +10
    -0
      apps/parent-form/src/app/app.component.ts
  18. +16
    -0
      apps/parent-form/src/app/app.module.ts
  19. +0
    -0
      apps/parent-form/src/assets/.gitkeep
  20. +3
    -0
      apps/parent-form/src/environments/environment.prod.ts
  21. +16
    -0
      apps/parent-form/src/environments/environment.ts
  22. BIN
      apps/parent-form/src/favicon.ico
  23. +14
    -0
      apps/parent-form/src/index.html
  24. +13
    -0
      apps/parent-form/src/main.ts
  25. +62
    -0
      apps/parent-form/src/polyfills.ts
  26. +1
    -0
      apps/parent-form/src/styles.css
  27. +1
    -0
      apps/parent-form/src/test-setup.ts
  28. +9
    -0
      apps/parent-form/tsconfig.app.json
  29. +7
    -0
      apps/parent-form/tsconfig.json
  30. +10
    -0
      apps/parent-form/tsconfig.spec.json
  31. +7
    -0
      apps/parent-form/tslint.json
  32. +6
    -0
      nx.json
  33. +6095
    -335
      package-lock.json
  34. +21
    -2
      package.json
  35. +23
    -4
      tslint.json

+ 124
- 1
angular.json View File

@@ -25,9 +25,132 @@
}
}
}
},
"parent-form": {
"projectType": "application",
"schematics": {},
"root": "apps/parent-form",
"sourceRoot": "apps/parent-form/src",
"prefix": "nested-forms",
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:browser",
"options": {
"outputPath": "dist/apps/parent-form",
"index": "apps/parent-form/src/index.html",
"main": "apps/parent-form/src/main.ts",
"polyfills": "apps/parent-form/src/polyfills.ts",
"tsConfig": "apps/parent-form/tsconfig.app.json",
"aot": false,
"assets": [
"apps/parent-form/src/favicon.ico",
"apps/parent-form/src/assets"
],
"styles": ["apps/parent-form/src/styles.css"],
"scripts": []
},
"configurations": {
"production": {
"fileReplacements": [
{
"replace": "apps/parent-form/src/environments/environment.ts",
"with": "apps/parent-form/src/environments/environment.prod.ts"
}
],
"optimization": true,
"outputHashing": "all",
"sourceMap": false,
"extractCss": true,
"namedChunks": false,
"aot": true,
"extractLicenses": true,
"vendorChunk": false,
"buildOptimizer": true,
"budgets": [
{
"type": "initial",
"maximumWarning": "2mb",
"maximumError": "5mb"
}
]
}
}
},
"serve": {
"builder": "@angular-devkit/build-angular:dev-server",
"options": {
"browserTarget": "parent-form:build"
},
"configurations": {
"production": {
"browserTarget": "parent-form:build:production"
}
}
},
"extract-i18n": {
"builder": "@angular-devkit/build-angular:extract-i18n",
"options": {
"browserTarget": "parent-form:build"
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": [
"apps/parent-form/tsconfig.app.json",
"apps/parent-form/tsconfig.spec.json"
],
"exclude": ["**/node_modules/**", "!apps/parent-form/**"]
}
},
"test": {
"builder": "@nrwl/jest:jest",
"options": {
"jestConfig": "apps/parent-form/jest.config.js",
"tsConfig": "apps/parent-form/tsconfig.spec.json",
"setupFile": "apps/parent-form/src/test-setup.ts"
}
}
}
},
"parent-form-e2e": {
"root": "apps/parent-form-e2e",
"sourceRoot": "apps/parent-form-e2e/src",
"projectType": "application",
"architect": {
"e2e": {
"builder": "@nrwl/cypress:cypress",
"options": {
"cypressConfig": "apps/parent-form-e2e/cypress.json",
"tsConfig": "apps/parent-form-e2e/tsconfig.e2e.json",
"devServerTarget": "parent-form:serve"
},
"configurations": {
"production": {
"devServerTarget": "parent-form:serve:production"
}
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": ["apps/parent-form-e2e/tsconfig.e2e.json"],
"exclude": ["**/node_modules/**", "!apps/parent-form-e2e/**"]
}
}
}
}
},
"cli": {
"defaultCollection": "@nrwl/workspace"
"defaultCollection": "@nrwl/angular"
},
"schematics": {
"@nrwl/angular:application": {
"unitTestRunner": "jest",
"e2eTestRunner": "cypress"
},
"@nrwl/angular:library": {
"unitTestRunner": "jest"
}
}
}

+ 11
- 0
apps/parent-form-e2e/cypress.json View File

@@ -0,0 +1,11 @@
{
"fileServerFolder": ".",
"fixturesFolder": "./src/fixtures",
"integrationFolder": "./src/integration",
"pluginsFile": "./src/plugins/index",
"supportFile": false,
"video": true,
"videosFolder": "../../dist/cypress/apps/parent-form-e2e/videos",
"screenshotsFolder": "../../dist/cypress/apps/parent-form-e2e/screenshots",
"chromeWebSecurity": false
}

+ 4
- 0
apps/parent-form-e2e/src/fixtures/example.json View File

@@ -0,0 +1,4 @@
{
"name": "Using fixtures to represent data",
"email": "hello@cypress.io"
}

+ 9
- 0
apps/parent-form-e2e/src/integration/app.spec.ts View File

@@ -0,0 +1,9 @@
import { getGreeting } from '../support/app.po';

describe('parent-form', () => {
beforeEach(() => cy.visit('/'));

it('should display welcome message', () => {
getGreeting().contains('Welcome to parent-form!');
});
});

+ 22
- 0
apps/parent-form-e2e/src/plugins/index.js View File

@@ -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
on('file:preprocessor', preprocessTypescript(config));
};

+ 1
- 0
apps/parent-form-e2e/src/support/app.po.ts View File

@@ -0,0 +1 @@
export const getGreeting = () => cy.get('h1');

+ 25
- 0
apps/parent-form-e2e/src/support/commands.ts View File

@@ -0,0 +1,25 @@
// ***********************************************
// 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
// ***********************************************
//
//
// -- This is a parent command --
// Cypress.Commands.add("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
- 0
apps/parent-form-e2e/src/support/index.ts View File

@@ -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';

+ 8
- 0
apps/parent-form-e2e/tsconfig.e2e.json View File

@@ -0,0 +1,8 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"sourceMap": false,
"outDir": "../../dist/out-tsc"
},
"include": ["src/**/*.ts"]
}

+ 7
- 0
apps/parent-form-e2e/tsconfig.json View File

@@ -0,0 +1,7 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"types": ["cypress", "node"]
},
"include": ["**/*.ts"]
}

+ 1
- 0
apps/parent-form-e2e/tslint.json View File

@@ -0,0 +1 @@
{ "extends": "../../tslint.json", "rules": [] }

+ 12
- 0
apps/parent-form/browserslist View File

@@ -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'.

+ 9
- 0
apps/parent-form/jest.config.js View File

@@ -0,0 +1,9 @@
module.exports = {
name: 'parent-form',
preset: '../../jest.config.js',
coverageDirectory: '../../coverage/apps/parent-form',
snapshotSerializers: [
'jest-preset-angular/AngularSnapshotSerializer.js',
'jest-preset-angular/HTMLCommentSerializer.js'
]
};

+ 0
- 0
apps/parent-form/src/app/app.component.css View File


+ 29
- 0
apps/parent-form/src/app/app.component.html View File

@@ -0,0 +1,29 @@
<div style="text-align:center">
<h1>Welcome to {{ title }}!</h1>
<img
width="450"
src="https://raw.githubusercontent.com/nrwl/nx/master/nx-logo.png"
/>
</div>

<p>
This is an Angular app built with <a href="https://nx.dev/angular">Nx</a>.
</p>
<p>🔎 **Nx is a set of Extensible Dev Tools for Monorepos.**</p>

<h2>Quick Start & Documentation</h2>

<ul>
<li>
<a href="https://nx.dev/angular/getting-started/what-is-nx"
>10-minute video showing all Nx features</a
>
</li>
<li>
<a href="https://nx.dev/angular/tutorial/01-create-application"
>Interactive tutorial</a
>
</li>
</ul>

<router-outlet></router-outlet>

+ 33
- 0
apps/parent-form/src/app/app.component.spec.ts View File

@@ -0,0 +1,33 @@
import { TestBed, async } from '@angular/core/testing';
import { AppComponent } from './app.component';
import { RouterTestingModule } from '@angular/router/testing';

describe('AppComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
imports: [RouterTestingModule],
declarations: [AppComponent]
}).compileComponents();
}));

it('should create the app', () => {
const fixture = TestBed.createComponent(AppComponent);
const app = fixture.debugElement.componentInstance;
expect(app).toBeTruthy();
});

it(`should have as title 'parent-form'`, () => {
const fixture = TestBed.createComponent(AppComponent);
const app = fixture.debugElement.componentInstance;
expect(app.title).toEqual('parent-form');
});

it('should render title in a h1 tag', () => {
const fixture = TestBed.createComponent(AppComponent);
fixture.detectChanges();
const compiled = fixture.debugElement.nativeElement;
expect(compiled.querySelector('h1').textContent).toContain(
'Welcome to parent-form!'
);
});
});

+ 10
- 0
apps/parent-form/src/app/app.component.ts View File

@@ -0,0 +1,10 @@
import { Component } from '@angular/core';

@Component({
selector: 'nested-forms-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent {
title = 'parent-form';
}

+ 16
- 0
apps/parent-form/src/app/app.module.ts View File

@@ -0,0 +1,16 @@
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';

import { AppComponent } from './app.component';
import { RouterModule } from '@angular/router';

@NgModule({
declarations: [AppComponent],
imports: [
BrowserModule,
RouterModule.forRoot([], { initialNavigation: 'enabled' })
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule {}

+ 0
- 0
apps/parent-form/src/assets/.gitkeep View File


+ 3
- 0
apps/parent-form/src/environments/environment.prod.ts View File

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

+ 16
- 0
apps/parent-form/src/environments/environment.ts View File

@@ -0,0 +1,16 @@
// 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
};

/*
* 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.

BIN
apps/parent-form/src/favicon.ico View File

Before After

+ 14
- 0
apps/parent-form/src/index.html View File

@@ -0,0 +1,14 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>ParentForm</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>
<nested-forms-root></nested-forms-root>
</body>
</html>

+ 13
- 0
apps/parent-form/src/main.ts View File

@@ -0,0 +1,13 @@
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));

+ 62
- 0
apps/parent-form/src/polyfills.ts View File

@@ -0,0 +1,62 @@
/**
* 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.ts';
*
* 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
*/

+ 1
- 0
apps/parent-form/src/styles.css View File

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

+ 1
- 0
apps/parent-form/src/test-setup.ts View File

@@ -0,0 +1 @@
import 'jest-preset-angular';

+ 9
- 0
apps/parent-form/tsconfig.app.json View File

@@ -0,0 +1,9 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "../../dist/out-tsc",
"types": []
},
"include": ["**/*.ts"],
"exclude": ["src/test-setup.ts", "**/*.spec.ts"]
}

+ 7
- 0
apps/parent-form/tsconfig.json View File

@@ -0,0 +1,7 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"types": ["node", "jest"]
},
"include": ["**/*.ts"]
}

+ 10
- 0
apps/parent-form/tsconfig.spec.json View File

@@ -0,0 +1,10 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "../../dist/out-tsc",
"module": "commonjs",
"types": ["jest", "node"]
},
"files": ["src/test-setup.ts"],
"include": ["**/*.spec.ts", "**/*.d.ts"]
}

+ 7
- 0
apps/parent-form/tslint.json View File

@@ -0,0 +1,7 @@
{
"extends": "../../tslint.json",
"rules": {
"directive-selector": [true, "attribute", "nestedForms", "camelCase"],
"component-selector": [true, "element", "nested-forms", "kebab-case"]
}
}

+ 6
- 0
nx.json View File

@@ -10,6 +10,12 @@
"projects": {
"contact-model": {
"tags": []
},
"parent-form-e2e": {
"tags": []
},
"parent-form": {
"tags": []
}
}
}

+ 6095
- 335
package-lock.json
File diff suppressed because it is too large
View File


+ 21
- 2
package.json View File

@@ -28,7 +28,19 @@
"help": "nx help"
},
"private": true,
"dependencies": {},
"dependencies": {
"@angular/animations": "^8.0.0",
"@angular/common": "^8.0.0",
"@angular/compiler": "^8.0.0",
"@angular/core": "^8.0.0",
"@angular/forms": "^8.0.0",
"@angular/platform-browser": "^8.0.0",
"@angular/platform-browser-dynamic": "^8.0.0",
"@angular/router": "^8.0.0",
"core-js": "^2.5.4",
"rxjs": "~6.4.0",
"zone.js": "^0.9.1"
},
"devDependencies": {
"@angular/cli": "8.1.1",
"@nrwl/angular": "^8.4.12",
@@ -42,6 +54,13 @@
"ts-jest": "^24.0.2",
"ts-node": "~7.0.0",
"tslint": "~5.11.0",
"typescript": "~3.4.5"
"typescript": "~3.4.5",
"@angular/compiler-cli": "^8.0.0",
"@angular/language-service": "^8.0.0",
"@angular-devkit/build-angular": "^0.800.1",
"codelyzer": "~5.0.1",
"jest-preset-angular": "7.0.0",
"cypress": "3.4.1",
"@nrwl/cypress": "8.4.12"
}
}

+ 23
- 4
tslint.json View File

@@ -1,5 +1,8 @@
{
"rulesDirectory": ["node_modules/@nrwl/workspace/src/tslint"],
"rulesDirectory": [
"node_modules/@nrwl/workspace/src/tslint",
"node_modules/codelyzer"
],
"rules": {
"arrow-return-shorthand": true,
"callable-types": true,
@@ -47,15 +50,31 @@
"triple-equals": [true, "allow-null-check"],
"unified-signatures": true,
"variable-name": false,

"nx-enforce-module-boundaries": [
true,
{
"allow": [],
"depConstraints": [
{ "sourceTag": "*", "onlyDependOnLibsWithTags": ["*"] }
{
"sourceTag": "*",
"onlyDependOnLibsWithTags": ["*"]
}
]
}
]
],
"directive-selector": [true, "attribute", "app", "camelCase"],
"component-selector": [true, "element", "app", "kebab-case"],
"no-conflicting-lifecycle": true,
"no-host-metadata-property": true,
"no-input-rename": true,
"no-inputs-metadata-property": true,
"no-output-native": true,
"no-output-on-prefix": true,
"no-output-rename": true,
"no-outputs-metadata-property": true,
"template-banana-in-box": true,
"template-no-negated-async": true,
"use-lifecycle-interface": true,
"use-pipe-transform-interface": true
}
}

Loading…
Cancel
Save