Skip to content

Commit 19a3590

Browse files
committed
Shipped Brain Frontend
0 parents  commit 19a3590

File tree

370 files changed

+48937
-0
lines changed

Some content is hidden

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

370 files changed

+48937
-0
lines changed

README.md

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# Shipped Brain
2+
3+
This is the repository for Shipped Brain's frontend applicaition, currently using Angular 9.
4+
5+
## Install packages
6+
7+
```bash
8+
npm install
9+
```
10+
11+
## Format files with Prettier
12+
13+
```bash
14+
npm run prettier
15+
```
16+
17+
*If using Visual Studio Code, you can format files on save/paste by placing the following in your settings.json file:*
18+
19+
```json
20+
{
21+
"editor.formatOnSave": true,
22+
"editor.formatOnPaste": true,
23+
"editor.defaultFormatter": "esbenp.prettier-vscode"
24+
}
25+
```
26+
27+
## Lint project
28+
29+
```bash
30+
npm run lint
31+
```
32+
33+
## Run unit tests
34+
*(not yet implemented)*
35+
36+
```bash
37+
npm run test
38+
```
39+
40+
## Build application
41+
42+
```bash
43+
npm run build
44+
```

angular.json

+137
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,137 @@
1+
{
2+
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
3+
"version": 1,
4+
"newProjectRoot": "projects",
5+
"projects": {
6+
"shipped-brain": {
7+
"projectType": "application",
8+
"schematics": {
9+
"@schematics/angular:component": {
10+
"style": "scss"
11+
}
12+
},
13+
"root": "",
14+
"sourceRoot": "src",
15+
"prefix": "app",
16+
"architect": {
17+
"build": {
18+
"builder": "@angular-devkit/build-angular:browser",
19+
"options": {
20+
"outputPath": "dist/shipped-brain",
21+
"index": "src/index.html",
22+
"main": "src/main.ts",
23+
"polyfills": "src/polyfills.ts",
24+
"tsConfig": "tsconfig.app.json",
25+
"aot": true,
26+
"assets": ["src/favicon.ico", "src/assets"],
27+
"styles": [
28+
"src/styles.scss",
29+
"node_modules/font-awesome/css/font-awesome.css",
30+
"node_modules/ngx-toastr/toastr.css",
31+
"node_modules/prismjs/themes/prism-okaidia.css",
32+
"node_modules/prismjs/plugins/line-numbers/prism-line-numbers.css",
33+
"node_modules/prismjs/plugins/line-highlight/prism-line-highlight.css"
34+
],
35+
"scripts": [
36+
"node_modules/code-prettify/loader/run_prettify.js",
37+
"node_modules/marked/lib/marked.js",
38+
"node_modules/prismjs/prism.js",
39+
"node_modules/prismjs/components/prism-csharp.min.js",
40+
"node_modules/prismjs/components/prism-css.min.js",
41+
"node_modules/prismjs/plugins/line-numbers/prism-line-numbers.js",
42+
"node_modules/prismjs/plugins/line-highlight/prism-line-highlight.js"
43+
]
44+
},
45+
"configurations": {
46+
"production": {
47+
"fileReplacements": [
48+
{
49+
"replace": "src/environments/environment.ts",
50+
"with": "src/environments/environment.prod.ts"
51+
}
52+
],
53+
"optimization": true,
54+
"outputHashing": "all",
55+
"sourceMap": false,
56+
"extractCss": true,
57+
"namedChunks": false,
58+
"extractLicenses": true,
59+
"vendorChunk": false,
60+
"buildOptimizer": true,
61+
"budgets": [
62+
{
63+
"type": "initial",
64+
"maximumWarning": "2mb",
65+
"maximumError": "5mb"
66+
},
67+
{
68+
"type": "anyComponentStyle",
69+
"maximumWarning": "6kb",
70+
"maximumError": "10kb"
71+
}
72+
]
73+
}
74+
}
75+
},
76+
"serve": {
77+
"builder": "@angular-devkit/build-angular:dev-server",
78+
"options": {
79+
"browserTarget": "shipped-brain:build"
80+
},
81+
"configurations": {
82+
"production": {
83+
"browserTarget": "shipped-brain:build:production"
84+
}
85+
}
86+
},
87+
"extract-i18n": {
88+
"builder": "@angular-devkit/build-angular:extract-i18n",
89+
"options": {
90+
"browserTarget": "shipped-brain:build"
91+
}
92+
},
93+
"test": {
94+
"builder": "@angular-devkit/build-angular:karma",
95+
"options": {
96+
"main": "src/test.ts",
97+
"polyfills": "src/polyfills.ts",
98+
"tsConfig": "tsconfig.spec.json",
99+
"karmaConfig": "karma.conf.js",
100+
"assets": ["src/favicon.ico", "src/assets"],
101+
"styles": ["src/styles.scss"],
102+
"scripts": []
103+
}
104+
},
105+
"lint": {
106+
"builder": "@angular-devkit/build-angular:tslint",
107+
"options": {
108+
"tsConfig": [
109+
"tsconfig.app.json",
110+
"tsconfig.spec.json",
111+
"e2e/tsconfig.json"
112+
],
113+
"exclude": ["**/node_modules/**"]
114+
}
115+
},
116+
"e2e": {
117+
"builder": "@angular-devkit/build-angular:protractor",
118+
"options": {
119+
"protractorConfig": "e2e/protractor.conf.js",
120+
"devServerTarget": "shipped-brain:serve"
121+
},
122+
"configurations": {
123+
"production": {
124+
"devServerTarget": "shipped-brain:serve:production"
125+
}
126+
}
127+
}
128+
}
129+
}
130+
},
131+
"defaultProject": "shipped-brain",
132+
"cli": {
133+
"warnings": {
134+
"versionMismatch": false
135+
}
136+
}
137+
}

browserslist

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

build.sh

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ng build --prod --delete-output-path false

e2e/protractor.conf.js

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
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: ["./src/**/*.e2e-spec.ts"],
13+
capabilities: {
14+
browserName: "chrome",
15+
},
16+
directConnect: true,
17+
baseUrl: "http://localhost:4200/",
18+
framework: "jasmine",
19+
jasmineNodeOpts: {
20+
showColors: true,
21+
defaultTimeoutInterval: 30000,
22+
print: function () {},
23+
},
24+
onPrepare() {
25+
require("ts-node").register({
26+
project: require("path").join(__dirname, "./tsconfig.json"),
27+
});
28+
jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } }));
29+
},
30+
};

e2e/src/app.e2e-spec.ts

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import { browser, logging } from 'protractor';
2+
import { AppPage } from './app.po';
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('shipped-brain 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+
});

e2e/src/app.po.ts

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

e2e/tsconfig.json

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

karma.conf.js

+32
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/shipped-brain"),
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)