From 1e1064de0b556e7ca7fcdb3a622dc18f027ed1c9 Mon Sep 17 00:00:00 2001 From: Mac Siri Date: Fri, 24 Mar 2023 12:48:59 -0400 Subject: [PATCH] Undo changes to Sprockets::UglifierWithSourceMapsCompressor (#19261) --- .github/workflows/ci-cd.yml | 13 +++---------- ...prockets_uglifier_with_source_maps_compressor.rb | 4 +++- 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/.github/workflows/ci-cd.yml b/.github/workflows/ci-cd.yml index a79c664f5..ef0d90de5 100644 --- a/.github/workflows/ci-cd.yml +++ b/.github/workflows/ci-cd.yml @@ -254,6 +254,8 @@ jobs: needs: [bundle_install, yarn_install, precompile_assets] timeout-minutes: 20 env: + RAILS_ENV: production + NODE_ENV: production DATABASE_URL: postgres://postgres:postgres@localhost:5432/Forem_prod_test DATABASE_NAME: Forem_prod_test APP_PROTOCOL: http:// @@ -277,15 +279,6 @@ jobs: steps: - uses: actions/checkout@v3 - - name: Cache compiled assets - uses: actions/cache/@v3 - with: - path: | - public/assets - public/packs-test - tmp/cache/webpacker - key: ${{ runner.os }}-precompiled-assets-${{ hashFiles('app/assets/**', 'app/javascript/**', 'config/webpack/**', 'config/webpacker.yml', '**/package.json', '**/yarn.lock') }} - restore-keys: ${{ runner.os }}-precompiled-assets- - name: Restore node_modules uses: actions/cache/restore@v3 with: @@ -301,7 +294,7 @@ jobs: with: bundler-cache: true - run: bundle exec rails assets:precompile - - run: bin/test-console-check + - run: RAILS_ENV=test bin/test-console-check cypress: runs-on: ubuntu-latest diff --git a/config/initializers/sprockets_uglifier_with_source_maps_compressor.rb b/config/initializers/sprockets_uglifier_with_source_maps_compressor.rb index f34e5cc60..c91f03545 100644 --- a/config/initializers/sprockets_uglifier_with_source_maps_compressor.rb +++ b/config/initializers/sprockets_uglifier_with_source_maps_compressor.rb @@ -21,7 +21,9 @@ module Sprockets ::Rails.application.config.assets.prefix, "#{name}-#{digest(sourcemap_json)}.js.map", ) - sourcemap_path = ::Rails.public_path.join(sourcemap_filename) + # rubocop:disable Rails/RootPathnameMethods + sourcemap_path = File.join(::Rails.public_path, sourcemap_filename) + # rubocop:enable Rails/RootPathnameMethods sourcemap_url = filename_to_url(sourcemap_filename) FileUtils.mkdir_p File.dirname(sourcemap_path)