Skip to content

Commit ef5f888

Browse files
author
Johannes Huster
committed
Added app with ng g application my-app
1 parent 9b4ae28 commit ef5f888

24 files changed

+1015
-0
lines changed

angular.json

Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,127 @@
163163
}
164164
}
165165
}
166+
},
167+
"my-app": {
168+
"projectType": "application",
169+
"schematics": {
170+
"@schematics/angular:component": {
171+
"style": "scss"
172+
}
173+
},
174+
"root": "projects/my-app",
175+
"sourceRoot": "projects/my-app/src",
176+
"prefix": "app",
177+
"architect": {
178+
"build": {
179+
"builder": "@angular-devkit/build-angular:browser",
180+
"options": {
181+
"outputPath": "dist/my-app",
182+
"index": "projects/my-app/src/index.html",
183+
"main": "projects/my-app/src/main.ts",
184+
"polyfills": "projects/my-app/src/polyfills.ts",
185+
"tsConfig": "projects/my-app/tsconfig.app.json",
186+
"aot": true,
187+
"assets": [
188+
"projects/my-app/src/favicon.ico",
189+
"projects/my-app/src/assets"
190+
],
191+
"styles": [
192+
"projects/my-app/src/styles.scss"
193+
],
194+
"scripts": []
195+
},
196+
"configurations": {
197+
"production": {
198+
"fileReplacements": [
199+
{
200+
"replace": "projects/my-app/src/environments/environment.ts",
201+
"with": "projects/my-app/src/environments/environment.prod.ts"
202+
}
203+
],
204+
"optimization": true,
205+
"outputHashing": "all",
206+
"sourceMap": false,
207+
"extractCss": true,
208+
"namedChunks": false,
209+
"extractLicenses": true,
210+
"vendorChunk": false,
211+
"buildOptimizer": true,
212+
"budgets": [
213+
{
214+
"type": "initial",
215+
"maximumWarning": "2mb",
216+
"maximumError": "5mb"
217+
},
218+
{
219+
"type": "anyComponentStyle",
220+
"maximumWarning": "6kb",
221+
"maximumError": "10kb"
222+
}
223+
]
224+
}
225+
}
226+
},
227+
"serve": {
228+
"builder": "@angular-devkit/build-angular:dev-server",
229+
"options": {
230+
"browserTarget": "my-app:build"
231+
},
232+
"configurations": {
233+
"production": {
234+
"browserTarget": "my-app:build:production"
235+
}
236+
}
237+
},
238+
"extract-i18n": {
239+
"builder": "@angular-devkit/build-angular:extract-i18n",
240+
"options": {
241+
"browserTarget": "my-app:build"
242+
}
243+
},
244+
"test": {
245+
"builder": "@angular-devkit/build-angular:karma",
246+
"options": {
247+
"main": "projects/my-app/src/test.ts",
248+
"polyfills": "projects/my-app/src/polyfills.ts",
249+
"tsConfig": "projects/my-app/tsconfig.spec.json",
250+
"karmaConfig": "projects/my-app/karma.conf.js",
251+
"assets": [
252+
"projects/my-app/src/favicon.ico",
253+
"projects/my-app/src/assets"
254+
],
255+
"styles": [
256+
"projects/my-app/src/styles.scss"
257+
],
258+
"scripts": []
259+
}
260+
},
261+
"lint": {
262+
"builder": "@angular-devkit/build-angular:tslint",
263+
"options": {
264+
"tsConfig": [
265+
"projects/my-app/tsconfig.app.json",
266+
"projects/my-app/tsconfig.spec.json",
267+
"projects/my-app/e2e/tsconfig.json"
268+
],
269+
"exclude": [
270+
"**/node_modules/**"
271+
]
272+
}
273+
},
274+
"e2e": {
275+
"builder": "@angular-devkit/build-angular:protractor",
276+
"options": {
277+
"protractorConfig": "projects/my-app/e2e/protractor.conf.js",
278+
"devServerTarget": "my-app:serve"
279+
},
280+
"configurations": {
281+
"production": {
282+
"devServerTarget": "my-app:serve:production"
283+
}
284+
}
285+
}
286+
}
166287
}},
167288
"defaultProject": "ref-err-reproduction"
168289
}

projects/my-app/browserslist

Lines changed: 12 additions & 0 deletions
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'.
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
// @ts-check
2+
// Protractor configuration file, see link for more information
3+
// https://github.com/angular/protractor/blob/master/lib/config.ts
4+
5+
const { SpecReporter } = require('jasmine-spec-reporter');
6+
7+
/**
8+
* @type { import("protractor").Config }
9+
*/
10+
exports.config = {
11+
allScriptsTimeout: 11000,
12+
specs: [
13+
'./src/**/*.e2e-spec.ts'
14+
],
15+
capabilities: {
16+
browserName: 'chrome'
17+
},
18+
directConnect: true,
19+
baseUrl: 'http://localhost:4200/',
20+
framework: 'jasmine',
21+
jasmineNodeOpts: {
22+
showColors: true,
23+
defaultTimeoutInterval: 30000,
24+
print: function() {}
25+
},
26+
onPrepare() {
27+
require('ts-node').register({
28+
project: require('path').join(__dirname, './tsconfig.json')
29+
});
30+
jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } }));
31+
}
32+
};
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import { AppPage } from './app.po';
2+
import { browser, logging } from 'protractor';
3+
4+
describe('workspace-project App', () => {
5+
let page: AppPage;
6+
7+
beforeEach(() => {
8+
page = new AppPage();
9+
});
10+
11+
it('should display welcome message', () => {
12+
page.navigateTo();
13+
expect(page.getTitleText()).toEqual('my-app app is running!');
14+
});
15+
16+
afterEach(async () => {
17+
// Assert that there are no errors emitted from the browser
18+
const logs = await browser.manage().logs().get(logging.Type.BROWSER);
19+
expect(logs).not.toContain(jasmine.objectContaining({
20+
level: logging.Level.SEVERE,
21+
} as logging.Entry));
22+
});
23+
});

projects/my-app/e2e/src/app.po.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import { browser, by, element } from 'protractor';
2+
3+
export class AppPage {
4+
navigateTo(): Promise<unknown> {
5+
return browser.get(browser.baseUrl) as Promise<unknown>;
6+
}
7+
8+
getTitleText(): Promise<string> {
9+
return element(by.css('app-root .content span')).getText() as Promise<string>;
10+
}
11+
}

projects/my-app/e2e/tsconfig.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"extends": "../../../tsconfig.json",
3+
"compilerOptions": {
4+
"outDir": "../../../out-tsc/e2e",
5+
"module": "commonjs",
6+
"target": "es5",
7+
"types": [
8+
"jasmine",
9+
"jasminewd2",
10+
"node"
11+
]
12+
}
13+
}

projects/my-app/karma.conf.js

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
// Karma configuration file, see link for more information
2+
// https://karma-runner.github.io/1.0/config/configuration-file.html
3+
4+
module.exports = function (config) {
5+
config.set({
6+
basePath: '',
7+
frameworks: ['jasmine', '@angular-devkit/build-angular'],
8+
plugins: [
9+
require('karma-jasmine'),
10+
require('karma-chrome-launcher'),
11+
require('karma-jasmine-html-reporter'),
12+
require('karma-coverage-istanbul-reporter'),
13+
require('@angular-devkit/build-angular/plugins/karma')
14+
],
15+
client: {
16+
clearContext: false // leave Jasmine Spec Runner output visible in browser
17+
},
18+
coverageIstanbulReporter: {
19+
dir: require('path').join(__dirname, '../../coverage/my-app'),
20+
reports: ['html', 'lcovonly', 'text-summary'],
21+
fixWebpackSourcePaths: true
22+
},
23+
reporters: ['progress', 'kjhtml'],
24+
port: 9876,
25+
colors: true,
26+
logLevel: config.LOG_INFO,
27+
autoWatch: true,
28+
browsers: ['Chrome'],
29+
singleRun: false,
30+
restartOnFileChange: true
31+
});
32+
};

0 commit comments

Comments
 (0)