Skip to content

Commit 6a6fa81

Browse files
Merge pull request #10 from deepsourcelabs/demo-angular
Demo angular
2 parents 8207cc0 + 2678a7c commit 6a6fa81

Some content is hidden

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

52 files changed

+15596
-1
lines changed

.deepsource.toml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,11 @@ enabled = true
66

77
[analyzers.meta]
88
environment = ['nodejs']
9-
plugins = ['react']
9+
plugins = ['react', 'angular']
1010
dialect = 'flow'
11+
dependency_file_paths = [
12+
'packages/demo-angular/'
13+
]
1114

1215
[[transformers]]
1316
name = "prettier"

packages/demo-angular/.browserslistrc

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
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+
# For the full list of supported browsers by the Angular framework, please see:
6+
# https://angular.io/guide/browser-support
7+
8+
# You can see what browsers were selected by your queries by running:
9+
# npx browserslist
10+
11+
last 1 Chrome version
12+
last 1 Firefox version
13+
last 2 Edge major versions
14+
last 2 Safari major versions
15+
last 2 iOS major versions
16+
Firefox ESR
17+
not IE 11 # Angular supports IE 11 only as an opt-in. To opt-in, remove the 'not' prefix on this line.

packages/demo-angular/.editorconfig

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Editor configuration, see https://editorconfig.org
2+
root = true
3+
4+
[*]
5+
charset = utf-8
6+
indent_style = space
7+
indent_size = 2
8+
insert_final_newline = true
9+
trim_trailing_whitespace = true
10+
11+
[*.ts]
12+
quote_type = single
13+
14+
[*.md]
15+
max_line_length = off
16+
trim_trailing_whitespace = false

packages/demo-angular/.gitignore

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# See http://help.github.com/ignore-files/ for more about ignoring files.
2+
3+
# compiled output
4+
/dist
5+
/tmp
6+
/out-tsc
7+
# Only exists if Bazel was run
8+
/bazel-out
9+
10+
# dependencies
11+
/node_modules
12+
13+
# profiling files
14+
chrome-profiler-events*.json
15+
speed-measure-plugin*.json
16+
17+
# IDEs and editors
18+
/.idea
19+
.project
20+
.classpath
21+
.c9/
22+
*.launch
23+
.settings/
24+
*.sublime-workspace
25+
26+
# IDE - VSCode
27+
.vscode/*
28+
!.vscode/settings.json
29+
!.vscode/tasks.json
30+
!.vscode/launch.json
31+
!.vscode/extensions.json
32+
.history/*
33+
34+
# misc
35+
/.sass-cache
36+
/connect.lock
37+
/coverage
38+
/libpeerconnection.log
39+
npm-debug.log
40+
yarn-error.log
41+
testem.log
42+
/typings
43+
44+
# System Files
45+
.DS_Store
46+
Thumbs.db

packages/demo-angular/README.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# DemoAngular
2+
3+
This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 11.0.5.
4+
5+
## Development server
6+
7+
Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The app will automatically reload if you change any of the source files.
8+
9+
## Code scaffolding
10+
11+
Run `ng generate component component-name` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module`.
12+
13+
## Build
14+
15+
Run `ng build` to build the project. The build artifacts will be stored in the `dist/` directory. Use the `--prod` flag for a production build.
16+
17+
## Running unit tests
18+
19+
Run `ng test` to execute the unit tests via [Karma](https://karma-runner.github.io).
20+
21+
## Running end-to-end tests
22+
23+
Run `ng e2e` to execute the end-to-end tests via [Protractor](http://www.protractortest.org/).
24+
25+
## Further help
26+
27+
To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI Overview and Command Reference](https://angular.io/cli) page.

packages/demo-angular/angular.json

Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
{
2+
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
3+
"version": 1,
4+
"newProjectRoot": "projects",
5+
"projects": {
6+
"demo-angular": {
7+
"projectType": "application",
8+
"schematics": {},
9+
"root": "",
10+
"sourceRoot": "src",
11+
"prefix": "app",
12+
"architect": {
13+
"build": {
14+
"builder": "@angular-devkit/build-angular:browser",
15+
"options": {
16+
"outputPath": "dist/demo-angular",
17+
"index": "src/index.html",
18+
"main": "src/main.ts",
19+
"polyfills": "src/polyfills.ts",
20+
"tsConfig": "tsconfig.app.json",
21+
"aot": true,
22+
"assets": ["src/favicon.ico", "src/assets"],
23+
"styles": ["src/styles.css"],
24+
"scripts": []
25+
},
26+
"configurations": {
27+
"production": {
28+
"fileReplacements": [
29+
{
30+
"replace": "src/environments/environment.ts",
31+
"with": "src/environments/environment.prod.ts"
32+
}
33+
],
34+
"optimization": true,
35+
"outputHashing": "all",
36+
"sourceMap": false,
37+
"namedChunks": false,
38+
"extractLicenses": true,
39+
"vendorChunk": false,
40+
"buildOptimizer": true,
41+
"budgets": [
42+
{
43+
"type": "initial",
44+
"maximumWarning": "2mb",
45+
"maximumError": "5mb"
46+
},
47+
{
48+
"type": "anyComponentStyle",
49+
"maximumWarning": "6kb",
50+
"maximumError": "10kb"
51+
}
52+
]
53+
}
54+
}
55+
},
56+
"serve": {
57+
"builder": "@angular-devkit/build-angular:dev-server",
58+
"options": {
59+
"browserTarget": "demo-angular:build"
60+
},
61+
"configurations": {
62+
"production": {
63+
"browserTarget": "demo-angular:build:production"
64+
}
65+
}
66+
},
67+
"extract-i18n": {
68+
"builder": "@angular-devkit/build-angular:extract-i18n",
69+
"options": {
70+
"browserTarget": "demo-angular:build"
71+
}
72+
},
73+
"test": {
74+
"builder": "@angular-devkit/build-angular:karma",
75+
"options": {
76+
"main": "src/test.ts",
77+
"polyfills": "src/polyfills.ts",
78+
"tsConfig": "tsconfig.spec.json",
79+
"karmaConfig": "karma.conf.js",
80+
"assets": ["src/favicon.ico", "src/assets"],
81+
"styles": ["src/styles.css"],
82+
"scripts": []
83+
}
84+
},
85+
"lint": {
86+
"builder": "@angular-devkit/build-angular:tslint",
87+
"options": {
88+
"tsConfig": [
89+
"tsconfig.app.json",
90+
"tsconfig.spec.json",
91+
"e2e/tsconfig.json"
92+
],
93+
"exclude": ["**/node_modules/**"]
94+
}
95+
},
96+
"e2e": {
97+
"builder": "@angular-devkit/build-angular:protractor",
98+
"options": {
99+
"protractorConfig": "e2e/protractor.conf.js",
100+
"devServerTarget": "demo-angular:serve"
101+
},
102+
"configurations": {
103+
"production": {
104+
"devServerTarget": "demo-angular:serve:production"
105+
}
106+
}
107+
}
108+
}
109+
}
110+
},
111+
"defaultProject": "demo-angular"
112+
}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
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, StacktraceOption } = require("jasmine-spec-reporter");
6+
7+
/**
8+
* @type { import("protractor").Config }
9+
*/
10+
exports.config = {
11+
allScriptsTimeout: 11000,
12+
specs: ["./src/**/*.e2e-spec.ts"],
13+
capabilities: {
14+
browserName: "chrome",
15+
},
16+
directConnect: true,
17+
SELENIUM_PROMISE_MANAGER: false,
18+
baseUrl: "http://localhost:4200/",
19+
framework: "jasmine",
20+
jasmineNodeOpts: {
21+
showColors: true,
22+
defaultTimeoutInterval: 30000,
23+
print: function () {},
24+
},
25+
onPrepare() {
26+
require("ts-node").register({
27+
project: require("path").join(__dirname, "./tsconfig.json"),
28+
});
29+
jasmine.getEnv().addReporter(
30+
new SpecReporter({
31+
spec: {
32+
displayStacktrace: StacktraceOption.PRETTY,
33+
},
34+
})
35+
);
36+
},
37+
};
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
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', async () => {
12+
await page.navigateTo();
13+
expect(await page.getTitleText()).toEqual('demo-angular 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(
20+
jasmine.objectContaining({
21+
level: logging.Level.SEVERE,
22+
} as logging.Entry)
23+
);
24+
});
25+
});
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+
async navigateTo(): Promise<unknown> {
5+
return browser.get(browser.baseUrl);
6+
}
7+
8+
async getTitleText(): Promise<string> {
9+
return element(by.css('app-root .content span')).getText();
10+
}
11+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
/* To learn more about this file see: https://angular.io/config/tsconfig. */
2+
{
3+
"extends": "../tsconfig.json",
4+
"compilerOptions": {
5+
"outDir": "../out-tsc/e2e",
6+
"module": "commonjs",
7+
"target": "es2018",
8+
"types": ["jasmine", "node"]
9+
}
10+
}

packages/demo-angular/karma.conf.js

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
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"),
13+
require("@angular-devkit/build-angular/plugins/karma"),
14+
],
15+
client: {
16+
jasmine: {
17+
// you can add configuration options for Jasmine here
18+
// the possible options are listed at https://jasmine.github.io/api/edge/Configuration.html
19+
// for example, you can disable the random execution with `random: false`
20+
// or set a specific seed with `seed: 4321`
21+
},
22+
clearContext: false, // leave Jasmine Spec Runner output visible in browser
23+
},
24+
jasmineHtmlReporter: {
25+
suppressAll: true, // removes the duplicated traces
26+
},
27+
coverageReporter: {
28+
dir: require("path").join(__dirname, "./coverage/demo-angular"),
29+
subdir: ".",
30+
reporters: [{ type: "html" }, { type: "text-summary" }],
31+
},
32+
reporters: ["progress", "kjhtml"],
33+
port: 9876,
34+
colors: true,
35+
logLevel: config.LOG_INFO,
36+
autoWatch: true,
37+
browsers: ["Chrome"],
38+
singleRun: false,
39+
restartOnFileChange: true,
40+
});
41+
};

0 commit comments

Comments
 (0)