Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: add angular file replacements for NG_CONFIGURATION #1547

Merged
merged 1 commit into from
Aug 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
75 changes: 38 additions & 37 deletions interfaces/IBF-dashboard/.gitignore
Original file line number Diff line number Diff line change
@@ -1,38 +1,39 @@
/.angular/cache
# IDE / Editors
.vscode
.idea
*.sublime-project
*.sublime-workspace


# Configuration, secrets, etc:
.env
environment.prod.ts


# Assets ONLY included during build
src/assets/leaflet


# Generated files
dist
coverage
platforms
plugins
www


# External code
node_modules


# Logs / Cache / temporary files
logs
*.log
npm-debug.log*
.npm
.ionic
.sass-cache
.sourcemaps
.versions
# IDE / Editors
.vscode
.idea
*.sublime-project
*.sublime-workspace


# Configuration, secrets, etc:
.env
environment.*
!environment.template.ts


# Assets ONLY included during build
src/assets/leaflet


# Generated files
dist
coverage
platforms
plugins
www


# External code
node_modules


# Logs / Cache / temporary files
logs
*.log
npm-debug.log*
.npm
.ionic
.sass-cache
.sourcemaps
.versions
4 changes: 2 additions & 2 deletions interfaces/IBF-dashboard/_set-env-variabes.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ const dotenv = require('dotenv');
// Load environment-variables from .env file (if available)
dotenv.config();

const configFileTemplate = require('./src/environments/environment.prod.ts.template.js');
const targetPath = './src/environments/environment.prod.ts';
const configFileTemplate = require('./src/environments/environment.template.ts');
const targetPath = `./src/environments/environment.${process.env.NG_CONFIGURATION}.ts`;

fs.writeFile(targetPath, configFileTemplate, (err) => {
if (err) {
Expand Down
29 changes: 26 additions & 3 deletions interfaces/IBF-dashboard/angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.prod.ts"
"with": "src/environments/environment.production.ts"
}
],
"optimization": true,
Expand All @@ -86,6 +86,12 @@
"serviceWorker": "ngsw-config.json"
},
"stage": {
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.stage.ts"
}
],
"assets": [
{
"glob": "**/*",
Expand Down Expand Up @@ -135,13 +141,30 @@
"input": "src/assets/icons/test",
"output": "assets/icons"
}
],
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.test.ts"
}
]
},
"development": {
"fileReplacements": []
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.development.ts"
}
]
},
"ci": {
"progress": false
"progress": false,
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.ci.ts"
}
]
}
},
"defaultConfiguration": ""
Expand Down
4 changes: 2 additions & 2 deletions interfaces/IBF-dashboard/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"scripts": {
"build": "ng build",
"build:prod": "npm run build -- --configuration production",
"compress": "gzipper compress --skip-compressed --remove-larger --gzip --gzip-level 9 ./www/",
"compress": "gzipper compress --skip-compressed --remove-larger --gzip --gzip-level 9 ./www/browser/",
"e2e": "ng e2e",
"format:fix": "npm run format:check -- --write",
"format:check": "prettier --check \"**/*.{md,js,ts,scss,html}\" ",
Expand All @@ -16,7 +16,7 @@
"postbuild:prod": "npm run compress",
"prebuild": "npm run set-env-variables",
"prestart": "npm install --no-audit --no-fund",
"serve:static": "cp www/index.html www/404.html && npx http-server www/ -c-1 --gzip",
"serve:static": "cp www/browser/index.html www/browser/404.html && npx http-server www/browser/ -c-1 --gzip",
"set-env-variables": "node ./_set-env-variabes.js",
"start": "ng serve",
"start:no-install": "ng serve",
Expand Down