diff --git a/Gemfile b/Gemfile index 9e40b980..badaddf7 100644 --- a/Gemfile +++ b/Gemfile @@ -42,7 +42,7 @@ gem 'ransack' gem 'rubytree' gem 'rubyzip' gem 'sass-rails' -gem 'shakapacker', '6.6.0' +gem 'shakapacker', '7.0.0' gem 'slim-rails' gem 'sorcery' gem 'sprockets-rails' diff --git a/Gemfile.lock b/Gemfile.lock index 4ab5930e..e4770dbd 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -438,7 +438,7 @@ GEM sentry-ruby (5.9.0) concurrent-ruby (~> 1.0, >= 1.0.2) set (1.0.3) - shakapacker (6.6.0) + shakapacker (7.0.0) activesupport (>= 5.2) rack-proxy (>= 0.6.1) railties (>= 5.2) @@ -595,7 +595,7 @@ DEPENDENCIES selenium-webdriver sentry-rails sentry-ruby - shakapacker (= 6.6.0) + shakapacker (= 7.0.0) shoulda-matchers simplecov slim-rails diff --git a/bin/shakapacker b/bin/shakapacker new file mode 100755 index 00000000..13a008dc --- /dev/null +++ b/bin/shakapacker @@ -0,0 +1,13 @@ +#!/usr/bin/env ruby + +ENV["RAILS_ENV"] ||= "development" +ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", __FILE__) + +require "bundler/setup" +require "shakapacker" +require "shakapacker/webpack_runner" + +APP_ROOT = File.expand_path("..", __dir__) +Dir.chdir(APP_ROOT) do + Shakapacker::WebpackRunner.run(ARGV) +end diff --git a/bin/shakapacker-dev-server b/bin/shakapacker-dev-server new file mode 100755 index 00000000..5ae88979 --- /dev/null +++ b/bin/shakapacker-dev-server @@ -0,0 +1,13 @@ +#!/usr/bin/env ruby + +ENV["RAILS_ENV"] ||= "development" +ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", __FILE__) + +require "bundler/setup" +require "shakapacker" +require "shakapacker/dev_server_runner" + +APP_ROOT = File.expand_path("..", __dir__) +Dir.chdir(APP_ROOT) do + Shakapacker::DevServerRunner.run(ARGV) +end diff --git a/bin/webpacker b/bin/webpacker deleted file mode 100755 index 767da41d..00000000 --- a/bin/webpacker +++ /dev/null @@ -1,18 +0,0 @@ -#!/usr/bin/env ruby - -require "pathname" -require "bundler/setup" -require "webpacker" -require "webpacker/webpack_runner" - -ENV["RAILS_ENV"] ||= "development" -ENV["NODE_ENV"] ||= ENV["RAILS_ENV"] -ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", Pathname.new(__FILE__).realpath) -# We need to specify the path to the node_modules/.bin directory -# The automatic detection of the path doesn't work in all cases, as it could contain an escape sequence. -ENV["WEBPACKER_NODE_MODULES_BIN_PATH"] ||= File.expand_path("../../node_modules/.bin", Pathname.new(__FILE__).realpath) - -APP_ROOT = File.expand_path("..", __dir__) -Dir.chdir(APP_ROOT) do - Webpacker::WebpackRunner.run(ARGV) -end diff --git a/bin/webpacker-dev-server b/bin/webpacker-dev-server deleted file mode 100755 index bb735160..00000000 --- a/bin/webpacker-dev-server +++ /dev/null @@ -1,18 +0,0 @@ -#!/usr/bin/env ruby - -require "pathname" -require "bundler/setup" -require "webpacker" -require "webpacker/dev_server_runner" - -ENV["RAILS_ENV"] ||= "development" -ENV["NODE_ENV"] ||= ENV["RAILS_ENV"] -ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", Pathname.new(__FILE__).realpath) -# We need to specify the path to the node_modules/.bin directory -# The automatic detection of the path doesn't work in all cases, as it could contain an escape sequence. -ENV["WEBPACKER_NODE_MODULES_BIN_PATH"] ||= File.expand_path("../../node_modules/.bin", Pathname.new(__FILE__).realpath) - -APP_ROOT = File.expand_path("..", __dir__) -Dir.chdir(APP_ROOT) do - Webpacker::DevServerRunner.run(ARGV) -end diff --git a/config/webpacker.yml b/config/shakapacker.yml similarity index 99% rename from config/webpacker.yml rename to config/shakapacker.yml index e9427a05..688ce922 100644 --- a/config/webpacker.yml +++ b/config/shakapacker.yml @@ -22,7 +22,7 @@ default: &default cache_path: tmp/webpacker webpack_compile_output: true # See https://github.com/shakacode/shakapacker#deployment - webpacker_precompile: true + shakapacker_precompile: true # Location for manifest.json, defaults to {public_output_path}/manifest.json if unset # manifest_path: public/packs/manifest.json diff --git a/config/webpack/webpack.config.js b/config/webpack/webpack.config.js index 19c99518..0cf81859 100644 --- a/config/webpack/webpack.config.js +++ b/config/webpack/webpack.config.js @@ -1,6 +1,7 @@ // See the shakacode/shakapacker README and docs directory for advice on customizing your webpackConfig. -const { webpackConfig, config, merge } = require('shakapacker') +const { globalMutableWebpackConfig, generateWebpackConfig, config, merge } = require('shakapacker') +const webpackConfig = generateWebpackConfig() const webpack = require('webpack'); const CompressionPlugin = require("compression-webpack-plugin"); @@ -69,6 +70,6 @@ const envConfig = module.exports = { // Use the two lines below to remove the original WebpackAssetsManifest and replace it with our custom config. const filteredPlugins = webpackConfig.plugins.filter((plugin) => !(plugin instanceof WebpackAssetsManifest)) -webpackConfig.plugins = filteredPlugins; +globalMutableWebpackConfig.plugins = filteredPlugins; -module.exports = merge(webpackConfig, envConfig) +module.exports = merge(globalMutableWebpackConfig, envConfig) diff --git a/package.json b/package.json index 86cb104a..208876ac 100644 --- a/package.json +++ b/package.json @@ -39,7 +39,7 @@ "rails-erb-loader": "usabilityhub/rails-erb-loader#master", "sass": "^1.63.6", "sass-loader": "^13.3.1", - "shakapacker": "6.6.0", + "shakapacker": "7.0.0", "sortablejs": "^1.15.0", "sorttable": "^1.0.2", "style-loader": "^3.3.3", @@ -69,7 +69,7 @@ "defaults" ], "scripts": { - "webpack": "./bin/webpacker", - "webpack-dev-server": "./bin/webpacker-dev-server" + "webpack": "./bin/shakapacker", + "webpack-dev-server": "./bin/shakapacker-dev-server" } } diff --git a/yarn.lock b/yarn.lock index 2ba2d969..b238ad7f 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1724,9 +1724,9 @@ caniuse-api@^3.0.0: lodash.uniq "^4.5.0" caniuse-lite@^1.0.0, caniuse-lite@^1.0.30001503: - version "1.0.30001507" - resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001507.tgz#fae53f6286e7564783eadea9b447819410a59534" - integrity sha512-SFpUDoSLCaE5XYL2jfqe9ova/pbQHEmbheDf5r4diNwbAgR3qxM9NQtfsiSscjqoya5K7kFcHPUQ+VsUkIJR4A== + version "1.0.30001508" + resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001508.tgz#4461bbc895c692a96da399639cc1e146e7302a33" + integrity sha512-sdQZOJdmt3GJs1UMNpCCCyeuS2IEGLXnHyAo9yIO5JJDjbjoVRij4M1qep6P6gFpptD1PqIYgzM+gwJbOi92mw== chalk@^2.0.0: version "2.4.2" @@ -2770,9 +2770,9 @@ hpack.js@^2.1.6: wbuf "^1.1.0" html-entities@^2.3.2: - version "2.3.6" - resolved "https://registry.yarnpkg.com/html-entities/-/html-entities-2.3.6.tgz#966391d58e5737c77bca4025e31721b496ab7454" - integrity sha512-9o0+dcpIw2/HxkNuYKxSJUF/MMRZQECK4GnF+oQOmJ83yCVHTWgCH5aOXxK5bozNRmM8wtgryjHD3uloPBDEGw== + version "2.4.0" + resolved "https://registry.yarnpkg.com/html-entities/-/html-entities-2.4.0.tgz#edd0cee70402584c8c76cc2c0556db09d1f45061" + integrity sha512-igBTJcNNNhvZFRtm8uA6xMY6xYleeDwn3PeBCkDz7tHttv4F2hsDI2aPgNERWzvRcNYHNT3ymRaQzllmXj4YsQ== http-deceiver@^1.2.7: version "1.2.7" @@ -4076,10 +4076,10 @@ setprototypeof@1.2.0: resolved "https://registry.yarnpkg.com/setprototypeof/-/setprototypeof-1.2.0.tgz#66c9a24a73f9fc28cbe66b09fed3d33dcaf1b424" integrity sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw== -shakapacker@6.6.0: - version "6.6.0" - resolved "https://registry.yarnpkg.com/shakapacker/-/shakapacker-6.6.0.tgz#1e372a7ce6fa93f1a7bd1820737b8168679eb220" - integrity sha512-7sNnv8PXMlgm2Ob7vZOayLKu0+PPMN3q0HEyAlkFIJtHJt7wA3p1rObhlk0/OrNeBa4dio/9HiBUeEU7bZsHvw== +shakapacker@7.0.0: + version "7.0.0" + resolved "https://registry.yarnpkg.com/shakapacker/-/shakapacker-7.0.0.tgz#788c96e86eb78e44ee84c3cc03b7c091e4621fc3" + integrity sha512-yL5lbCdgtI8nUxZHarL7X5aB40r069wAunHwb59Hgw1gPg6/nMuYo7ofNTGXg11v1eunwAdjx8EfYnk4XwX27Q== dependencies: glob "^7.2.0" js-yaml "^4.1.0"