Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

Fix load paths for production

Oliver Günther7f3a30f32497
diff --git a/config/application.rb b/config/application.rb
index 9f797f18280..7c2cf27f145 100644
--- a/config/application.rb
+++ b/config/application.rb
@@ -120,6 +120,13 @@ module OpenProject
config.paths.add Rails.root.join('lib').to_s, eager_load: true
config.paths.add Rails.root.join('lib/constraints').to_s, eager_load: true
+ # Add lookbook preview paths when enabled
+ if OpenProject::Configuration.lookbook_enabled?
+ config.paths.add Primer::ViewComponents::Engine.root.join('app/components').to_s, eager_load: true
+ config.paths.add Rails.root.join("spec/components/previews").to_s, eager_load: true
+ config.paths.add Primer::ViewComponents::Engine.root.join('previews').to_s, eager_load: true
+ end
+
# Constants in lib_static should only be loaded once and never be unloaded.
# That directory contains configurations and patches to rails core functionality.
config.autoload_once_paths << Rails.root.join('lib_static').to_s
diff --git a/config/initializers/lookbook.rb b/config/initializers/lookbook.rb
index 4fd71c55862..851e9e827aa 100644
--- a/config/initializers/lookbook.rb
+++ b/config/initializers/lookbook.rb
@@ -7,9 +7,14 @@ OpenProject::Application.configure do
config.lookbook.project_logo = Rails.root.join('app/assets/images/icon_logo_white.svg').read
config.lookbook.ui_favicon = Rails.root.join('app/assets/images/icon_logo.svg').read
config.lookbook.page_paths = [Rails.root.join("spec/components/docs/").to_s]
+
+ config.lookbook.component_paths << Primer::ViewComponents::Engine.root.join('app/components').to_s
+ config.view_component.preview_paths += [
+ Rails.root.join("spec/components/previews").to_s,
+ Primer::ViewComponents::Engine.root.join('previews').to_s
+ ]
+
# Show notes first, all other panels next
- config.lookbook.component_paths << Primer::ViewComponents::Engine.root.join("app", "components").to_s
- config.view_component.preview_paths << Primer::ViewComponents::Engine.root.join("previews").to_s
config.lookbook.preview_inspector.drawer_panels = [:notes, "*"]
config.lookbook.ui_theme = "blue"
diff --git a/frontend/extra-webpack.config.js b/frontend/extra-webpack.config.js
index 0744375e538..2eef5b817f1 100644
--- a/frontend/extra-webpack.config.js
+++ b/frontend/extra-webpack.config.js
@@ -5,7 +5,7 @@ module.exports = {
minimizer: [
new TerserPlugin({
terserOptions: {
- mangle: process.env.OPENPROJECT_ANGULAR_OPTIMIZATION !== 'false',
+ mangle: process.env.OPENPROJECT_ANGULAR_UGLIFY !== 'false',
keep_classnames: true,
keep_fnames: true,
}
diff --git a/frontend/package.json b/frontend/package.json
index aed1c4d56f2..8150c0e1409 100644
--- a/frontend/package.json
+++ b/frontend/package.json
@@ -181,7 +181,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 ./node_modules/@angular/cli/bin/ng build --configuration production --named-chunks --source-map=false",
- "build:fast": "node ./node_modules/@angular/cli/bin/ng build --configuration production --named-chunks --source-map=false --optimization=false",
+ "build:fast": "OPENPROJECT_ANGULAR_UGLIFY=false node ./node_modules/@angular/cli/bin/ng build --configuration production --named-chunks --source-map=false --optimization=false",
"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",
diff --git a/lib/tasks/assets.rake b/lib/tasks/assets.rake
index a261d24c7e2..01347df43e2 100644
--- a/lib/tasks/assets.rake
+++ b/lib/tasks/assets.rake
@@ -65,7 +65,7 @@ namespace :assets do
cmd =
if ENV['CI']
'npm run build:ci'
- elsif ENV['OPENPROJECT_ANGULAR_OPTIMIZATION'] == 'false'
+ elsif ENV['OPENPROJECT_ANGULAR_UGLIFY'] == 'false'
'npm run build:fast'
else
'npm run build'
diff --git a/spec/components/previews/danger_zone_preview.rb b/spec/components/previews/danger_zone_preview.rb
index 945cdb481e2..1e78e0c3b35 100644
--- a/spec/components/previews/danger_zone_preview.rb
+++ b/spec/components/previews/danger_zone_preview.rb
@@ -1,8 +1,4 @@
# @logical_path OpenProject
-class FormsPreview < Lookbook::Preview
+class DangerZonePreview < Lookbook::Preview
def default; end
-
- def bordered; end
-
- def compressed; end
end