Skip to content

Commit 0287e4c

Browse files
committed
feat(web): init web app
1 parent 7dbdac0 commit 0287e4c

27 files changed

Lines changed: 447 additions & 32 deletions

angular.json

Lines changed: 124 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,7 @@
1616
"outputPath": "dist/apps/api",
1717
"main": "apps/api/src/main.ts",
1818
"tsConfig": "apps/api/tsconfig.app.json",
19-
"assets": [
20-
"apps/api/src/assets"
21-
]
19+
"assets": ["apps/api/src/assets"]
2220
},
2321
"configurations": {
2422
"production": {
@@ -46,9 +44,7 @@
4644
"apps/api/tsconfig.app.json",
4745
"apps/api/tsconfig.spec.json"
4846
],
49-
"exclude": [
50-
"**/node_modules/**"
51-
]
47+
"exclude": ["**/node_modules/**"]
5248
}
5349
},
5450
"test": {
@@ -73,9 +69,7 @@
7369
"libs/api/orient/tsconfig.lib.json",
7470
"libs/api/orient/tsconfig.spec.json"
7571
],
76-
"exclude": [
77-
"**/node_modules/**"
78-
]
72+
"exclude": ["**/node_modules/**"]
7973
}
8074
},
8175
"test": {
@@ -105,9 +99,7 @@
10599
"libs/core/tsconfig.lib.json",
106100
"libs/core/tsconfig.spec.json"
107101
],
108-
"exclude": [
109-
"**/node_modules/**"
110-
]
102+
"exclude": ["**/node_modules/**"]
111103
}
112104
},
113105
"test": {
@@ -134,9 +126,11 @@
134126
"build": {
135127
"builder": "@nrwl/builders:run-commands",
136128
"options": {
137-
"commands": [{
138-
"command": "npx tsc --project apps/cli/tsconfig.app.json"
139-
}]
129+
"commands": [
130+
{
131+
"command": "npx tsc --project apps/cli/tsconfig.app.json"
132+
}
133+
]
140134
},
141135
"configurations": {
142136
"production": {
@@ -161,9 +155,7 @@
161155
"apps/cli/tsconfig.app.json",
162156
"apps/cli/tsconfig.spec.json"
163157
],
164-
"exclude": [
165-
"**/node_modules/**"
166-
]
158+
"exclude": ["**/node_modules/**"]
167159
}
168160
},
169161
"test": {
@@ -174,6 +166,120 @@
174166
}
175167
}
176168
}
169+
},
170+
"web": {
171+
"root": "apps/web/",
172+
"sourceRoot": "apps/web/src",
173+
"projectType": "application",
174+
"prefix": "sm",
175+
"schematics": {
176+
"@nrwl/schematics:component": {
177+
"style": "scss"
178+
}
179+
},
180+
"architect": {
181+
"build": {
182+
"builder": "@angular-devkit/build-angular:browser",
183+
"options": {
184+
"outputPath": "dist/apps/web",
185+
"index": "apps/web/src/index.html",
186+
"main": "apps/web/src/main.ts",
187+
"polyfills": "apps/web/src/polyfills.ts",
188+
"tsConfig": "apps/web/tsconfig.app.json",
189+
"assets": ["apps/web/src/favicon.ico", "apps/web/src/assets"],
190+
"styles": ["apps/web/src/styles.scss"],
191+
"scripts": [],
192+
"es5BrowserSupport": true
193+
},
194+
"configurations": {
195+
"production": {
196+
"fileReplacements": [
197+
{
198+
"replace": "apps/web/src/environments/environment.ts",
199+
"with": "apps/web/src/environments/environment.prod.ts"
200+
}
201+
],
202+
"optimization": true,
203+
"outputHashing": "all",
204+
"sourceMap": false,
205+
"extractCss": true,
206+
"namedChunks": false,
207+
"aot": true,
208+
"extractLicenses": true,
209+
"vendorChunk": false,
210+
"buildOptimizer": true,
211+
"budgets": [
212+
{
213+
"type": "initial",
214+
"maximumWarning": "2mb",
215+
"maximumError": "5mb"
216+
}
217+
]
218+
}
219+
}
220+
},
221+
"serve": {
222+
"builder": "@angular-devkit/build-angular:dev-server",
223+
"options": {
224+
"browserTarget": "web:build"
225+
},
226+
"configurations": {
227+
"production": {
228+
"browserTarget": "web:build:production"
229+
}
230+
}
231+
},
232+
"extract-i18n": {
233+
"builder": "@angular-devkit/build-angular:extract-i18n",
234+
"options": {
235+
"browserTarget": "web:build"
236+
}
237+
},
238+
"lint": {
239+
"builder": "@angular-devkit/build-angular:tslint",
240+
"options": {
241+
"tsConfig": [
242+
"apps/web/tsconfig.app.json",
243+
"apps/web/tsconfig.spec.json"
244+
],
245+
"exclude": ["**/node_modules/**"]
246+
}
247+
},
248+
"test": {
249+
"builder": "@nrwl/builders:jest",
250+
"options": {
251+
"jestConfig": "apps/web/jest.config.js",
252+
"tsConfig": "apps/web/tsconfig.spec.json",
253+
"setupFile": "apps/web/src/test-setup.ts"
254+
}
255+
}
256+
}
257+
},
258+
"web-e2e": {
259+
"root": "apps/web-e2e",
260+
"projectType": "application",
261+
"prefix": "",
262+
"architect": {
263+
"e2e": {
264+
"builder": "@angular-devkit/build-angular:protractor",
265+
"options": {
266+
"protractorConfig": "apps/web-e2e/protractor.conf.js",
267+
"devServerTarget": "web:serve"
268+
},
269+
"configurations": {
270+
"production": {
271+
"devServerTarget": "web:serve:production"
272+
}
273+
}
274+
},
275+
"lint": {
276+
"builder": "@angular-devkit/build-angular:tslint",
277+
"options": {
278+
"tsConfig": "apps/web-e2e/tsconfig.e2e.json",
279+
"exclude": ["**/node_modules/**"]
280+
}
281+
}
282+
}
177283
}
178284
},
179285
"cli": {

apps/web-e2e/protractor.conf.js

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
// Protractor configuration file, see link for more information
2+
// https://github.com/angular/protractor/blob/master/lib/config.ts
3+
4+
const { SpecReporter } = require('jasmine-spec-reporter');
5+
6+
exports.config = {
7+
allScriptsTimeout: 11000,
8+
specs: ['./src/**/*.e2e-spec.ts'],
9+
capabilities: {
10+
browserName: 'chrome'
11+
},
12+
directConnect: true,
13+
baseUrl: 'http://localhost:4200/',
14+
framework: 'jasmine',
15+
jasmineNodeOpts: {
16+
showColors: true,
17+
defaultTimeoutInterval: 30000,
18+
print: function() {}
19+
},
20+
onPrepare() {
21+
require('ts-node').register({
22+
project: require('path').join(__dirname, './tsconfig.e2e.json')
23+
});
24+
jasmine
25+
.getEnv()
26+
.addReporter(new SpecReporter({ spec: { displayStacktrace: true } }));
27+
}
28+
};

apps/web-e2e/src/app.e2e-spec.ts

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
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 web!');
14+
});
15+
16+
afterEach(async () => {
17+
// Assert that there are no errors emitted from the browser
18+
const logs = await browser
19+
.manage()
20+
.logs()
21+
.get(logging.Type.BROWSER);
22+
expect(logs).not.toContain(
23+
jasmine.objectContaining({
24+
level: logging.Level.SEVERE
25+
} as logging.Entry)
26+
);
27+
});
28+
});

apps/web-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('sm-root h1')).getText() as Promise<string>;
10+
}
11+
}

apps/web-e2e/tsconfig.e2e.json

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

apps/web-e2e/tsconfig.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"extends": "../../tsconfig.json",
3+
"compilerOptions": {
4+
"types": ["jasmine", "jasminewd2"]
5+
},
6+
"include": ["**/*.ts"]
7+
}

apps/web/browserslist

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# This file is currently used by autoprefixer to adjust CSS to support the below specified browsers
2+
# For additional information regarding the format and rule options, please see:
3+
# https://github.com/browserslist/browserslist#queries
4+
#
5+
# For IE 9-11 support, please remove 'not' from the last line of the file and adjust as needed
6+
7+
> 0.5%
8+
last 2 versions
9+
Firefox ESR
10+
not dead
11+
not IE 9-11

apps/web/jest.config.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
module.exports = {
2+
name: 'web',
3+
preset: '../../jest.config.js',
4+
coverageDirectory: '../../coverage/apps/web/',
5+
snapshotSerializers: [
6+
'jest-preset-angular/AngularSnapshotSerializer.js',
7+
'jest-preset-angular/HTMLCommentSerializer.js'
8+
]
9+
};
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<div style="text-align:center">
2+
<h1>Welcome to {{title}}!</h1>
3+
<img
4+
width="300"
5+
src="https://slackmap.com/assets/logo.svg"
6+
/>
7+
</div>
8+
<router-outlet></router-outlet>

apps/web/src/app/app.component.scss

Whitespace-only changes.

0 commit comments

Comments
 (0)