Skip to content

Commit 36e2f91

Browse files
committed
setup(project) Starting to setup the project with base configuration
0 parents  commit 36e2f91

Some content is hidden

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

49 files changed

+13962
-0
lines changed

.gitignore

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
.idea
2+
.DS_Store
3+
.vscode
4+
5+
# Built #
6+
/__build__/
7+
/__server_build__/
8+
/node_modules/
9+
/typings/
10+
/tsd_typings/
11+
/dist/
12+
/dist-server/
13+
/compiled/
14+
15+
# Node #
16+
*.log
17+
/npm-debug.log.*
18+
19+
# Webpack #
20+
webpack.records.json
21+
22+
# Angular #
23+
*.ngfactory.ts
24+
*.css.shim.ts
25+
*.ngsummary.json
26+
*.metadata.json
27+
*.shim.ngstyle.ts

.prettierrc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"singleQuote": true,
3+
"trailingComma": "all"
4+
}

README.md

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
## Configuration
2+
3+
### Install postgres and create the database
4+
5+
```text
6+
$ brew install postgresql
7+
$ pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start
8+
```
9+
10+
*then create the first DB which will be the entry point for the following configuration*
11+
12+
```text
13+
$ createdb platform-prototype
14+
```
15+
16+
#### Create the databases (LOCAL and TEST)
17+
18+
```text
19+
$ psql -d platformprototype -c "DROP USER IF EXISTS platform-prototype-user;"
20+
$ psql -d platformprototype -c "CREATE USER platformprototypeuser WITH PASSWORD 'password';"
21+
$ psql -d platformprototype -c 'ALTER USER platformprototypeuser WITH SUPERUSER;'
22+
23+
$ psql -d platformprototype -c 'DROP DATABASE IF EXISTS platformprototype;'
24+
$ psql -d platformprototype -c 'CREATE DATABASE platformprototype;'
25+
$ psql -d platformprototype -c 'DROP DATABASE IF EXISTS platformprototypetest;'
26+
$ psql -d platformprototype -c 'CREATE DATABASE platformprototypetest;'
27+
```
28+
29+
### Run your server and work with it
30+
31+
#### Run client only
32+
33+
```typescript
34+
$ npm run start:client
35+
```
36+
37+
#### Run server only
38+
39+
```typescript
40+
$ npm run start:server
41+
````
42+
43+
#### Run SSR
44+
45+
```typescript
46+
$ npm run start:ssr
47+
```

angular.json

Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
{
2+
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
3+
"version": 1,
4+
"newProjectRoot": "projects",
5+
"projects": {
6+
"platform-prototype-universal": {
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/browser",
17+
"index": "src/index.html",
18+
"main": "src/main.ts",
19+
"polyfills": "src/polyfills.ts",
20+
"tsConfig": "tsconfig.client.json",
21+
"aot": false,
22+
"assets": ["src/favicon.ico", "src/assets"],
23+
"styles": ["src/styles.scss"],
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+
"extractCss": true,
38+
"namedChunks": false,
39+
"aot": true,
40+
"extractLicenses": true,
41+
"vendorChunk": false,
42+
"buildOptimizer": true,
43+
"budgets": [
44+
{
45+
"type": "initial",
46+
"maximumWarning": "2mb",
47+
"maximumError": "5mb"
48+
}
49+
]
50+
}
51+
}
52+
},
53+
"serve": {
54+
"builder": "@angular-devkit/build-angular:dev-server",
55+
"options": {
56+
"browserTarget": "platform-prototype-universal:build"
57+
},
58+
"configurations": {
59+
"production": {
60+
"browserTarget": "platform-prototype-universal:build:production"
61+
}
62+
}
63+
},
64+
"extract-i18n": {
65+
"builder": "@angular-devkit/build-angular:extract-i18n",
66+
"options": {
67+
"browserTarget": "platform-prototype-universal:build"
68+
}
69+
},
70+
"test": {
71+
"builder": "@angular-devkit/build-angular:karma",
72+
"options": {
73+
"main": "src/test.ts",
74+
"polyfills": "src/polyfills.ts",
75+
"tsConfig": "tsconfig.spec.client.json",
76+
"karmaConfig": "karma.conf.js",
77+
"assets": ["src/favicon.ico", "src/assets"],
78+
"styles": ["src/styles.scss"],
79+
"scripts": []
80+
}
81+
},
82+
"lint": {
83+
"builder": "@angular-devkit/build-angular:tslint",
84+
"options": {
85+
"tsConfig": [
86+
"tsconfig.client.json",
87+
"tsconfig.client.spec.json",
88+
"tsconfig.server.json"
89+
],
90+
"exclude": ["**/node_modules/**"]
91+
}
92+
},
93+
"e2e": {
94+
"builder": "@angular-devkit/build-angular:protractor",
95+
"options": {
96+
"protractorConfig": "e2e/protractor.conf.js",
97+
"devServerTarget": "platform-prototype-universal:serve"
98+
},
99+
"configurations": {
100+
"production": {
101+
"devServerTarget": "platform-prototype-universal:serve:production"
102+
}
103+
}
104+
},
105+
"server": {
106+
"builder": "@angular-devkit/build-angular:server",
107+
"options": {
108+
"outputPath": "dist/server",
109+
"main": "src/main.server.ts",
110+
"tsConfig": "tsconfig.server.json"
111+
},
112+
"configurations": {
113+
"production": {
114+
"fileReplacements": [
115+
{
116+
"replace": "src/environments/environment.ts",
117+
"with": "src/environments/environment.prod.ts"
118+
}
119+
]
120+
}
121+
}
122+
}
123+
}
124+
}
125+
},
126+
"defaultProject": "platform-prototype-universal"
127+
}

browserlist

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

e2e/protractor.conf.js

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+
};

e2e/src/app.e2e-spec.ts

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('Welcome to test!');
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+
});

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() {
5+
return browser.get(browser.baseUrl) as Promise<any>;
6+
}
7+
8+
getTitleText() {
9+
return element(by.css('app-root h1')).getText() as Promise<string>;
10+
}
11+
}

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+
}

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/test'),
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)