Skip to content

Commit f2fc155

Browse files
committed
Fix bin/webpack when ui-classic not bundled
When building rpms, we do not run bundle update in ui-classic (we only run in core) To build the ui assets, we use `rake update:ui` which calls `./bin/webpack`. The webpack command needs to know the i18n gem, and asks bundler for that path. Since bundler has not been installed, this command fails. The solution is to populate the i18n path in our paths.json file. Since this path was known when we created paths.json, this is easier to do. Before ====== So when running bin/webpack, we get an error when running `bundle info`: ``` ./bin/webpack Ruby versions >= 3.2.0 are untested! The git source https://github.com/ManageIQ/amazon_ssa_support.git is not yet checked out. Please run `bundle install` before trying to start your application manageiq-ui-classic/node_modules/webpack-cli/bin/cli.js:93 throw err; ``` After ===== ``` ./bin/webpack [success] ```
1 parent d12d720 commit f2fc155

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

config/webpack/configuration.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ const { readFileSync } = require('fs');
88
const configPath = resolve('config', 'webpacker.yml');
99
const settings = safeLoad(readFileSync(configPath), 'utf8')[env.NODE_ENV];
1010

11-
const { output: outputRoot, engines } = require('./paths.json');
11+
const { output: outputRoot, i18n, engines } = require('./paths.json');
1212

1313
function removeOuterSlashes(string) {
1414
return string.replace(/^\/*/, '').replace(/\/*$/, '');
@@ -32,5 +32,6 @@ module.exports = {
3232
settings,
3333
env,
3434
output,
35+
i18n,
3536
engines,
3637
};

config/webpack/shared.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,15 @@ const DuplicatePackageCheckerPlugin = require('duplicate-package-checker-webpack
1212
const { SplitChunksPlugin } = require('webpack').optimize;
1313
const { execSync } = require('child_process');
1414

15-
const { env, settings, output, engines } = require('./configuration.js');
15+
const { env, settings, i18n, output, engines } = require('./configuration.js');
1616
const loaders = require('./loaders.js');
1717
const RailsEnginesPlugin = require('./RailsEnginesPlugin');
1818

1919
const extensionGlob = `**/*{${settings.extensions.join(',')}}*`; // */
2020
const entryPath = join(settings.source_path, settings.source_entry_path);
2121
const moduleDir = engines['manageiq-ui-classic'].node_modules;
2222

23-
const gettextDir = execSync('bundle info --path gettext_i18n_rails_js', { encoding: 'utf-8' }).trim();
23+
const gettextDir = i18n;
2424

2525
const sharedPackages = [
2626
'@carbon/icons-react',

lib/tasks/manageiq/ui_tasks.rake

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,12 @@ namespace :webpack do
6666
end
6767

6868
task :paths do
69+
i18n_path = Bundler::CLI::Common.select_spec("gettext_i18n_rails_js").full_gem_path
70+
6971
json = JSON.pretty_generate(
7072
:info => "This file is autogenerated by rake webpack:paths, do not edit",
7173
:output => Rails.root.to_s,
74+
:i18n => i18n_path,
7275
:engines => asset_engines.map { |p|
7376
key = p.namespace
7477
value = {:root => p.path,

0 commit comments

Comments
 (0)