Skip to content
This repository was archived by the owner on Apr 18, 2025. It is now read-only.

Commit 277d520

Browse files
author
Nir Galon
authored
Update project (#98)
* Update client to angular v8 * Fix server database connection * Fix client errors * Add requirements file from pipfile * Fix travis file * Fix travis * Fix server errors * Fix travis errors * Fix travis * Fix travis * Fix travis * Fix travis * Fix angular lint errors * Fix travis * Add chrome to travis * Fix travis * Fix travis * Fix travis * Fix travis last take? * Fix travis * Fix server errors * Add pwa * Cleanup
1 parent e38fae1 commit 277d520

File tree

82 files changed

+9828
-7049
lines changed

Some content is hidden

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

82 files changed

+9828
-7049
lines changed

.travis.yml

Lines changed: 41 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,41 @@
1-
sudo: required
2-
dist: trusty
3-
4-
addons:
5-
apt:
6-
sources:
7-
- google-chrome
8-
packages:
9-
- google-chrome-stable
10-
11-
language: python
12-
python:
13-
- 3.6
14-
15-
services:
16-
- postgresql
17-
18-
cache:
19-
npm: true
20-
directories:
21-
- client/node_modules
22-
23-
before_install:
24-
- npm install -g npm@latest local-web-server codecov
25-
- export CHROME_BIN=chromium-browser
26-
- export DISPLAY=:99.0
27-
- sh -e /etc/init.d/xvfb start
28-
29-
install:
30-
# Client
31-
- cd client && npm install
32-
33-
# Server
34-
- cd ../server && pip install coverage pycodestyle
35-
- pip install -r requirements.txt
36-
- psql -c 'create database server;' -U postgres
37-
38-
script:
39-
# Client
40-
- cd ../client && npm run lint
41-
- npm run test
42-
- npm run build
43-
- cd dist && ws --port 4200&
44-
- npm run e2e
45-
46-
# Server
47-
- cd ../server && coverage run --source='.' manage.py test
48-
- coverage xml
49-
- pycodestyle --show-source --max-line-length=120 --show-pep8 .
50-
51-
after_script:
52-
- cd .. && codecov
1+
matrix:
2+
include:
3+
- language: python
4+
python: 3.7
5+
env:
6+
- DB_URI="postgres://postgres:@localhost:5432/assp"
7+
- DB_NAME="assp"
8+
- DB_USER="postgres"
9+
- DB_PASSWORD=""
10+
- DB_PORT="5432"
11+
- HOST="0.0.0.0"
12+
- PORT="8000"
13+
- LOG_LEVEL="info"
14+
- ENV="development"
15+
services:
16+
- postgresql
17+
before_script:
18+
- cd server && pip install coverage pycodestyle python-dotenv
19+
- pip install -r requirements.txt
20+
- psql -c 'create database assp;' -U postgres
21+
script:
22+
- python -m unittest
23+
- pycodestyle --show-source --max-line-length=120 --show-pep8 .
24+
25+
- language: node_js
26+
node_js:
27+
- v12
28+
services:
29+
- xvfb
30+
addons:
31+
chrome: stable
32+
before_install:
33+
- npm install -g npm@latest codecov
34+
- export DISPLAY=:99.0
35+
install:
36+
- cd client && npm install
37+
script:
38+
- npm run lint
39+
- npm run test
40+
- npm run build
41+
- npm run e2e

client/.editorconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Editor configuration, see http://editorconfig.org
1+
# Editor configuration, see https://editorconfig.org
22
root = true
33

44
[*]

client/.gitignore

Lines changed: 0 additions & 39 deletions
This file was deleted.

client/README.md

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,27 @@
11
# Client
22

3-
The front end (client) side of the project written in Angular, with Angular-CLI, ngrx, and Material.
3+
This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 8.3.7.
44

5-
## Prerequisites
5+
## Development server
66

7-
* Install [Angular-cli](https://github.com/angular/angular-cli).
8-
* Install [npm](https://nodejs.org/en/).
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.
98

10-
## Installation
9+
## Code scaffolding
1110

12-
1. Run `npm install` to install dependencies.
13-
2. Run `npm start` to fire up the dev server.
14-
3. Open browser to [http://localhost:4200](http://localhost:4200).
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`.
1512

16-
## Tests
13+
## Build
1714

18-
* Run `npm run lint` to check for TSLint mistakes.
19-
* Run `npm run test` to execute the unit tests via Karma.
20-
* Run `npm run e2e` to execute the end-to-end tests via Protractor.
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.
2116

22-
## Deploy
17+
## Running unit tests
2318

24-
1. Run `ng build --prod` to build the project.
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 README](https://github.com/angular/angular-cli/blob/master/README.md).

client/angular.json

Lines changed: 38 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@
44
"newProjectRoot": "projects",
55
"projects": {
66
"client": {
7-
"root": "",
8-
"sourceRoot": "src",
97
"projectType": "application",
10-
"prefix": "client",
118
"schematics": {
129
"@schematics/angular:component": {
13-
"styleext": "scss"
10+
"style": "scss"
1411
}
1512
},
13+
"root": "",
14+
"sourceRoot": "src",
15+
"prefix": "assp",
1616
"architect": {
1717
"build": {
1818
"builder": "@angular-devkit/build-angular:browser",
@@ -21,14 +21,15 @@
2121
"index": "src/index.html",
2222
"main": "src/main.ts",
2323
"polyfills": "src/polyfills.ts",
24-
"tsConfig": "src/tsconfig.app.json",
24+
"tsConfig": "tsconfig.app.json",
25+
"aot": false,
2526
"assets": [
2627
"src/favicon.ico",
27-
"src/assets"
28+
"src/assets",
29+
"src/manifest.webmanifest"
2830
],
2931
"styles": [
30-
"src/styles.scss",
31-
"src/app-theme.scss"
32+
"src/styles.scss"
3233
],
3334
"scripts": []
3435
},
@@ -48,7 +49,21 @@
4849
"aot": true,
4950
"extractLicenses": true,
5051
"vendorChunk": false,
51-
"buildOptimizer": true
52+
"buildOptimizer": true,
53+
"budgets": [
54+
{
55+
"type": "initial",
56+
"maximumWarning": "2mb",
57+
"maximumError": "5mb"
58+
},
59+
{
60+
"type": "anyComponentStyle",
61+
"maximumWarning": "6kb",
62+
"maximumError": "10kb"
63+
}
64+
],
65+
"serviceWorker": true,
66+
"ngswConfigPath": "ngsw-config.json"
5267
}
5368
}
5469
},
@@ -74,36 +89,32 @@
7489
"options": {
7590
"main": "src/test.ts",
7691
"polyfills": "src/polyfills.ts",
77-
"tsConfig": "src/tsconfig.spec.json",
78-
"karmaConfig": "src/karma.conf.js",
92+
"tsConfig": "tsconfig.spec.json",
93+
"karmaConfig": "karma.conf.js",
94+
"assets": [
95+
"src/favicon.ico",
96+
"src/assets",
97+
"src/manifest.webmanifest"
98+
],
7999
"styles": [
80100
"src/styles.scss"
81101
],
82-
"scripts": [],
83-
"assets": [
84-
"src/favicon.ico",
85-
"src/assets"
86-
]
102+
"scripts": []
87103
}
88104
},
89105
"lint": {
90106
"builder": "@angular-devkit/build-angular:tslint",
91107
"options": {
92108
"tsConfig": [
93-
"src/tsconfig.app.json",
94-
"src/tsconfig.spec.json"
109+
"tsconfig.app.json",
110+
"tsconfig.spec.json",
111+
"e2e/tsconfig.json"
95112
],
96113
"exclude": [
97114
"**/node_modules/**"
98115
]
99116
}
100-
}
101-
}
102-
},
103-
"client-e2e": {
104-
"root": "e2e/",
105-
"projectType": "application",
106-
"architect": {
117+
},
107118
"e2e": {
108119
"builder": "@angular-devkit/build-angular:protractor",
109120
"options": {
@@ -115,21 +126,8 @@
115126
"devServerTarget": "client:serve:production"
116127
}
117128
}
118-
},
119-
"lint": {
120-
"builder": "@angular-devkit/build-angular:tslint",
121-
"options": {
122-
"tsConfig": "e2e/tsconfig.e2e.json",
123-
"exclude": [
124-
"**/node_modules/**"
125-
]
126-
}
127129
}
128130
}
129-
}
130-
},
131-
"defaultProject": "client",
132-
"cli": {
133-
"defaultCollection": "@ngrx/schematics"
134-
}
131+
}},
132+
"defaultProject": "client"
135133
}

client/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'.

client/e2e/protractor.conf.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
1+
// @ts-check
12
// Protractor configuration file, see link for more information
23
// https://github.com/angular/protractor/blob/master/lib/config.ts
34

45
const { SpecReporter } = require('jasmine-spec-reporter');
56

7+
/**
8+
* @type { import("protractor").Config }
9+
*/
610
exports.config = {
711
allScriptsTimeout: 11000,
812
specs: [
@@ -21,7 +25,7 @@ exports.config = {
2125
},
2226
onPrepare() {
2327
require('ts-node').register({
24-
project: require('path').join(__dirname, './tsconfig.e2e.json')
28+
project: require('path').join(__dirname, './tsconfig.json')
2529
});
2630
jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } }));
2731
}

client/e2e/src/app.e2e-spec.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { AppPage } from './app.po';
2+
import { browser, logging } from 'protractor';
23

34
describe('workspace-project App', () => {
45
let page: AppPage;
@@ -7,8 +8,11 @@ describe('workspace-project App', () => {
78
page = new AppPage();
89
});
910

10-
it('should display welcome message', () => {
11-
page.navigateTo();
12-
expect(page.getParagraphText()).toEqual('Welcome to client!');
11+
afterEach(async () => {
12+
// Assert that there are no errors emitted from the browser
13+
const logs = await browser.manage().logs().get(logging.Type.BROWSER);
14+
expect(logs).not.toContain(jasmine.objectContaining({
15+
level: logging.Level.SEVERE,
16+
} as logging.Entry));
1317
});
1418
});

client/e2e/src/app.po.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ import { browser, by, element } from 'protractor';
22

33
export class AppPage {
44
navigateTo() {
5-
return browser.get('/');
5+
return browser.get(browser.baseUrl) as Promise<any>;
66
}
77

8-
getParagraphText() {
9-
return element(by.css('client-root h1')).getText();
8+
getTitleText() {
9+
return element(by.css('asp-root .content span')).getText() as Promise<string>;
1010
}
1111
}

0 commit comments

Comments
 (0)