diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 8a89b85..52a891b 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -4,6 +4,10 @@ before_script: - yarn cache: + key: + files: + - package.json + - yarn.lock paths: - node_modules @@ -28,7 +32,7 @@ pages: - cp public/index.html public/404.html artifacts: paths: - - dist/public + - public only: - master - pages diff --git a/angular.json b/angular.json index 4247459..b535add 100644 --- a/angular.json +++ b/angular.json @@ -47,12 +47,70 @@ ], "optimization": true, "outputHashing": "all", - "sourceMap": false, + "sourceMap": true, "extractCss": true, - "namedChunks": false, + "namedChunks": true, "aot": true, "extractLicenses": true, - "vendorChunk": false, + "vendorChunk": true, + "buildOptimizer": true, + "budgets": [ + { + "type": "initial", + "maximumWarning": "2mb", + "maximumError": "5mb" + }, + { + "type": "anyComponentStyle", + "maximumWarning": "6kb", + "maximumError": "10kb" + } + ] + }, + "gitlab": { + "fileReplacements": [ + { + "replace": "src/environments/environment.ts", + "with": "src/environments/environment.gitlab.ts" + } + ], + "optimization": true, + "outputHashing": "all", + "sourceMap": true, + "extractCss": true, + "namedChunks": true, + "aot": true, + "extractLicenses": true, + "vendorChunk": true, + "buildOptimizer": true, + "budgets": [ + { + "type": "initial", + "maximumWarning": "2mb", + "maximumError": "5mb" + }, + { + "type": "anyComponentStyle", + "maximumWarning": "6kb", + "maximumError": "10kb" + } + ] + }, + "ipfs": { + "fileReplacements": [ + { + "replace": "src/environments/environment.ts", + "with": "src/environments/environment.ipfs.ts" + } + ], + "optimization": true, + "outputHashing": "all", + "sourceMap": true, + "extractCss": true, + "namedChunks": true, + "aot": true, + "extractLicenses": true, + "vendorChunk": true, "buildOptimizer": true, "budgets": [ { diff --git a/package.json b/package.json index 5b17ee3..2feea65 100644 --- a/package.json +++ b/package.json @@ -4,9 +4,10 @@ "scripts": { "ng": "ng", "start": "ng serve --ssl", - "build": "ng build", - "build:prod": "ng build --prod", - "build:gitlab": "ng build --prod --base-href /public-gateway-cacher/", + "build": "ng build --base-href /", + "build:prod": "ng build --configuration=production --base-href /", + "build:gitlab": "ng build --configuration=gitlab --base-href /public-gateway-cacher/", + "build:ipfs": "ng build --configuration=ipfs", "test": "ng test", "lint": "ng lint", "e2e": "ng e2e", diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts index 33ec000..aaf3979 100644 --- a/src/app/app-routing.module.ts +++ b/src/app/app-routing.module.ts @@ -1,5 +1,6 @@ import { NgModule } from '@angular/core'; import { RouterModule, Routes } from '@angular/router'; +import { environment } from '../environments/environment'; const routes: Routes = [{ path: '', @@ -7,7 +8,7 @@ const routes: Routes = [{ }]; @NgModule({ - imports: [RouterModule.forRoot(routes, { useHash: true })], + imports: [RouterModule.forRoot(routes, { useHash: environment.useHash })], exports: [RouterModule] }) export class AppRoutingModule { } diff --git a/src/app/interfaces/environment.ts b/src/app/interfaces/environment.ts new file mode 100644 index 0000000..f5b42a2 --- /dev/null +++ b/src/app/interfaces/environment.ts @@ -0,0 +1,5 @@ +export interface Environment { + production: boolean; + base_href?: string; + useHash: boolean; +} diff --git a/src/app/pages/pages.component.html b/src/app/pages/pages.component.html index 7057c1a..4e7fb63 100644 --- a/src/app/pages/pages.component.html +++ b/src/app/pages/pages.component.html @@ -3,7 +3,7 @@