Skip to content

Commit cea3a70

Browse files
committed
Prettify and use different environments
1 parent 70573da commit cea3a70

39 files changed

+1523
-650
lines changed

README.md

Lines changed: 57 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,58 @@
1-
# node-browser
1+
# kwg-node-browser
2+
23
Web service for viewing data about nodes
4+
5+
## Background
6+
7+
KnowWhereGraph has billions of data nodes, each with an attached HTTP URI. This web application provides an interface for viewing information attached to a particular node.
8+
9+
## Running
10+
11+
The node explorer can be run under several environments, which are defined as Angular environments under `src/app/environments`.
12+
13+
### Local Environment
14+
15+
The local environment assumes that the KnowWhereGraph stack is running locally, which includes an endpoint at `https://localhost/sparql`. It also redirects all web links to localhost.
16+
```
17+
ng serve --configuration=local
18+
```
19+
20+
### Stage Environment
21+
22+
The stage environment uses the staging deployments SPARQL endpoint. It also redirects links to the staging server.
23+
24+
### Production Environment
25+
26+
The prod environment uses the production SPARQL endpoint and redirects to the production server.
27+
28+
### Custom
29+
30+
Changes can be made to any of these environments to mix and match behavior.
31+
32+
## Building & Deploying
33+
34+
When using the node explorer in a production environment, the source should be built and then served with a server like NGINX or Apache.
35+
36+
### Production
37+
38+
Production deployments should deploy the application by building and serving the distribution with a reverse proxy such as nginx or apache.
39+
40+
To build the node explorer,
41+
42+
```
43+
ng build --configuration=prod
44+
```
45+
46+
### Staging
47+
48+
Staging builds are done similarly to production with
49+
50+
```
51+
ng build --configuration=stage
52+
```
53+
54+
## Developing
55+
56+
The standard Git Flow: create a feature branch off of the `develop` branch and make pull requests into it. For full releases, merge from the `develop` branch into `main`.
57+
58+
Before requesting a review, format the code with prettier: `npx prettier . --write`

node-browser/.prettierrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{}

node-browser/angular.json

Lines changed: 42 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,11 @@
2626
"polyfills": "src/polyfills.ts",
2727
"tsConfig": "tsconfig.app.json",
2828
"inlineStyleLanguage": "scss",
29-
"assets": [
30-
"src/favicon.ico",
31-
"src/assets"
32-
],
29+
"assets": ["src/favicon.ico", "src/assets"],
3330
"styles": [
3431
"src/styles.scss",
3532
"./node_modules/leaflet/dist/leaflet.css",
36-
"./node_modules/@geoman-io/leaflet-geoman-free/dist/leaflet-geoman.css",
33+
"./node_modules/material-icons/iconfont/material-icons.css",
3734
"./node_modules/leaflet.markercluster/dist/MarkerCluster.Default.css"
3835
],
3936
"scripts": [
@@ -44,42 +41,71 @@
4441
},
4542
"configurations": {
4643
"production": {
44+
"fileReplacements": [
45+
{
46+
"replace": "src/environments/environment.ts",
47+
"with": "src/environments/environment.prod.ts"
48+
}
49+
],
4750
"budgets": [
4851
{
4952
"type": "initial",
5053
"maximumWarning": "500kb",
51-
"maximumError": "1mb"
54+
"maximumError": "2mb"
5255
},
5356
{
5457
"type": "anyComponentStyle",
5558
"maximumWarning": "2kb",
56-
"maximumError": "4kb"
59+
"maximumError": "2mb"
5760
}
5861
],
5962
"outputHashing": "all"
6063
},
61-
"development": {
64+
"stage": {
6265
"buildOptimizer": false,
6366
"optimization": false,
6467
"vendorChunk": true,
6568
"extractLicenses": false,
6669
"sourceMap": true,
67-
"namedChunks": true
70+
"namedChunks": true,
71+
"fileReplacements": [
72+
{
73+
"replace": "src/environments/environment.ts",
74+
"with": "src/environments/environment.stage.ts"
75+
}
76+
]
77+
},
78+
"local": {
79+
"buildOptimizer": false,
80+
"optimization": false,
81+
"vendorChunk": true,
82+
"extractLicenses": false,
83+
"sourceMap": true,
84+
"namedChunks": true,
85+
"fileReplacements": [
86+
{
87+
"replace": "src/environments/environment.ts",
88+
"with": "src/environments/environment.local.ts"
89+
}
90+
]
6891
}
6992
},
7093
"defaultConfiguration": "production"
7194
},
7295
"serve": {
7396
"builder": "@angular-devkit/build-angular:dev-server",
7497
"configurations": {
75-
"production": {
98+
"prod": {
7699
"browserTarget": "node-browser:build:production"
77100
},
78-
"development": {
79-
"browserTarget": "node-browser:build:development"
101+
"local": {
102+
"browserTarget": "node-browser:build:local"
103+
},
104+
"stage": {
105+
"browserTarget": "node-browser:build:stage"
80106
}
81107
},
82-
"defaultConfiguration": "development"
108+
"defaultConfiguration": "prod"
83109
},
84110
"extract-i18n": {
85111
"builder": "@angular-devkit/build-angular:extract-i18n",
@@ -90,19 +116,11 @@
90116
"test": {
91117
"builder": "@angular-devkit/build-angular:karma",
92118
"options": {
93-
"polyfills": [
94-
"zone.js",
95-
"zone.js/testing"
96-
],
119+
"polyfills": "src/polyfills.ts",
97120
"tsConfig": "tsconfig.spec.json",
98121
"inlineStyleLanguage": "scss",
99-
"assets": [
100-
"src/favicon.ico",
101-
"src/assets"
102-
],
103-
"styles": [
104-
"src/styles.scss"
105-
],
122+
"assets": ["src/favicon.ico", "src/assets"],
123+
"styles": ["src/styles.scss"],
106124
"scripts": []
107125
}
108126
}

0 commit comments

Comments
 (0)