Skip to content

Commit

Permalink
feat: star wars demo app
Browse files Browse the repository at this point in the history
  • Loading branch information
udayvunnam committed Jul 19, 2020
1 parent be01ebc commit 5bd26cb
Show file tree
Hide file tree
Showing 32 changed files with 738 additions and 2 deletions.
133 changes: 131 additions & 2 deletions angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,14 @@
"polyfills": "apps/breadcrumb-demo/src/polyfills.ts",
"tsConfig": "apps/breadcrumb-demo/tsconfig.app.json",
"aot": true,
"assets": ["apps/breadcrumb-demo/src/favicon.ico", "apps/breadcrumb-demo/src/assets"],
"styles": ["apps/breadcrumb-demo/src/assets/scss/xng-breadcrumb.scss", "apps/breadcrumb-demo/src/styles.scss"],
"assets": [
"apps/breadcrumb-demo/src/favicon.ico",
"apps/breadcrumb-demo/src/assets"
],
"styles": [
"apps/breadcrumb-demo/src/assets/scss/xng-breadcrumb.scss",
"apps/breadcrumb-demo/src/styles.scss"
],
"scripts": []
},
"configurations": {
Expand Down Expand Up @@ -160,6 +166,129 @@
}
},
"schematics": {}
},
"star-wars": {
"projectType": "application",
"schematics": {
"@nrwl/angular:component": {
"style": "scss"
}
},
"root": "apps/star-wars",
"sourceRoot": "apps/star-wars/src",
"prefix": "xng",
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:browser",
"options": {
"outputPath": "dist/apps/star-wars",
"index": "apps/star-wars/src/index.html",
"main": "apps/star-wars/src/main.ts",
"polyfills": "apps/star-wars/src/polyfills.ts",
"tsConfig": "apps/star-wars/tsconfig.app.json",
"aot": true,
"assets": [
"apps/star-wars/src/favicon.ico",
"apps/star-wars/src/assets"
],
"styles": ["apps/star-wars/src/styles.scss"],
"scripts": []
},
"configurations": {
"production": {
"fileReplacements": [
{
"replace": "apps/star-wars/src/environments/environment.ts",
"with": "apps/star-wars/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": "star-wars:build"
},
"configurations": {
"production": {
"browserTarget": "star-wars:build:production"
}
}
},
"extract-i18n": {
"builder": "@angular-devkit/build-angular:extract-i18n",
"options": {
"browserTarget": "star-wars:build"
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": [
"apps/star-wars/tsconfig.app.json",
"apps/star-wars/tsconfig.spec.json"
],
"exclude": ["**/node_modules/**", "!apps/star-wars/**/*"]
}
},
"test": {
"builder": "@nrwl/jest:jest",
"options": {
"jestConfig": "apps/star-wars/jest.config.js",
"tsConfig": "apps/star-wars/tsconfig.spec.json",
"passWithNoTests": true,
"setupFile": "apps/star-wars/src/test-setup.ts"
}
}
}
},
"star-wars-e2e": {
"root": "apps/star-wars-e2e",
"sourceRoot": "apps/star-wars-e2e/src",
"projectType": "application",
"architect": {
"e2e": {
"builder": "@nrwl/cypress:cypress",
"options": {
"cypressConfig": "apps/star-wars-e2e/cypress.json",
"tsConfig": "apps/star-wars-e2e/tsconfig.e2e.json",
"devServerTarget": "star-wars:serve"
},
"configurations": {
"production": {
"devServerTarget": "star-wars:serve:production"
}
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": ["apps/star-wars-e2e/tsconfig.e2e.json"],
"exclude": ["**/node_modules/**", "!apps/star-wars-e2e/**/*"]
}
}
}
}
},
"cli": {
Expand Down
12 changes: 12 additions & 0 deletions apps/star-wars-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/star-wars-e2e/videos",
"screenshotsFolder": "../../dist/cypress/apps/star-wars-e2e/screenshots",
"chromeWebSecurity": false
}
4 changes: 4 additions & 0 deletions apps/star-wars-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": "[email protected]"
}
13 changes: 13 additions & 0 deletions apps/star-wars-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('star-wars', () => {
beforeEach(() => cy.visit('/'));

it('should display welcome message', () => {
// Custom command example, see `../support/commands.ts` file
cy.login('[email protected]', 'myPassword');

// Function helper example, see `../support/app.po.ts` file
getGreeting().contains('Welcome to star-wars!');
});
});
22 changes: 22 additions & 0 deletions apps/star-wars-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/star-wars-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/star-wars-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/star-wars-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/star-wars-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/star-wars-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/star-wars-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/star-wars/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/star-wars/jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
module.exports = {
name: 'star-wars',
preset: '../../jest.config.js',
coverageDirectory: '../../coverage/apps/star-wars',
snapshotSerializers: [
'jest-preset-angular/build/AngularNoNgAttributesSnapshotSerializer.js',
'jest-preset-angular/build/AngularSnapshotSerializer.js',
'jest-preset-angular/build/HTMLCommentSerializer.js',
],
};
Loading

0 comments on commit 5bd26cb

Please sign in to comment.