Skip to content

Commit

Permalink
Use explicit fast build without source maps and minify for testing an…
Browse files Browse the repository at this point in the history
…d PullPreview (opf#16563)

Use explicit fast build without source maps and minify for testing and PP
  • Loading branch information
oliverguenther authored Aug 30, 2024
1 parent 4ed7ef1 commit b151e80
Show file tree
Hide file tree
Showing 6 changed files with 5 additions and 40 deletions.
2 changes: 1 addition & 1 deletion docker/ci/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ backend_stuff() {
}

frontend_stuff() {
execute_quiet "DATABASE_URL=nulldb://db time bin/rails openproject:plugins:register_frontend assets:precompile"
execute_quiet "OPENPROJECT_ANGULAR_BUILD=fast DATABASE_URL=nulldb://db time bin/rails openproject:plugins:register_frontend assets:precompile"
execute_quiet "cp -rp config/frontend_assets.manifest.json public/assets/frontend_assets.manifest.json"
}

Expand Down
2 changes: 1 addition & 1 deletion docker/pullpreview/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ x-defaults: &defaults
build:
context: .
args:
OPENPROJECT_ANGULAR_UGLIFY: "false"
OPENPROJECT_ANGULAR_BUILD: "fast"
restart: unless-stopped
env_file:
- .env.pullpreview
Expand Down
32 changes: 0 additions & 32 deletions frontend/angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -102,38 +102,6 @@
}
]
},
"fastprod": {
"index": "",
"preserveSymlinks": true,
"optimization": false,
"outputHashing": "all",
"sourceMap": false,
"namedChunks": false,
"extractLicenses": false,
"buildOptimizer" : false,
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.prod.ts"
}
]
},
"ci": {
"index": "",
"preserveSymlinks": true,
"optimization": false,
"outputHashing": "all",
"sourceMap": false,
"namedChunks": false,
"extractLicenses": false,
"buildOptimizer" : false,
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.prod.ts"
}
]
}
}
},
"serve": {
Expand Down
2 changes: 1 addition & 1 deletion frontend/extra-webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ module.exports = {
minimizer: [
new TerserPlugin({
terserOptions: {
mangle: process.env.OPENPROJECT_ANGULAR_UGLIFY !== 'false',
mangle: process.env.OPENPROJECT_ANGULAR_BUILD !== 'fast',
keep_classnames: true,
keep_fnames: true,
}
Expand Down
3 changes: 1 addition & 2 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,7 @@
},
"scripts": {
"analyze": "ng build --configuration production --stats-json && webpack-bundle-analyzer -h 0.0.0.0 -p 9999 ../public/assets/frontend/stats.json",
"build:ci": "node --max_old_space_size=8192 ./node_modules/@angular/cli/bin/ng build --configuration ci",
"build:fast": "OPENPROJECT_ANGULAR_UGLIFY=false node --max_old_space_size=8192 ./node_modules/@angular/cli/bin/ng build --configuration fastprod",
"build:fast": "OPENPROJECT_ANGULAR_BUILD=fast node --max_old_space_size=8192 ./node_modules/@angular/cli/bin/ng build --configuration production",
"build": "node --max_old_space_size=4096 ./node_modules/@angular/cli/bin/ng build --configuration production --named-chunks --source-map",
"build:watch": "node --max_old_space_size=4096 ./node_modules/@angular/cli/bin/ng build --watch --named-chunks",
"tokens:generate": "theo src/app/spot/styles/tokens/tokens.yml --transform web --format sass,json --dest src/app/spot/styles/tokens/dist",
Expand Down
4 changes: 1 addition & 3 deletions lib/tasks/assets.rake
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,7 @@ namespace :assets do
puts "Building angular frontend"
Dir.chdir Rails.root.join("frontend") do
cmd =
if ENV["CI"]
"npm run build:ci"
elsif ENV["OPENPROJECT_ANGULAR_UGLIFY"] == "false"
if ENV["OPENPROJECT_ANGULAR_BUILD"] == "fast"
"npm run build:fast"
else
"npm run build"
Expand Down

0 comments on commit b151e80

Please sign in to comment.