Class: Mxrb::Compiler::WebBundleBuilder

Inherits:
Object
  • Object
show all
Includes:
ModelValues
Defined in:
lib/mxrb/compiler/web_bundle_builder.rb

Overview

Generates the web-client entrypoint and runs the version-owned Rspack toolchain directly. rubocop:disable Metrics

Instance Method Summary collapse

Constructor Details

#initialize(mpr_path, deployment:, mendix_home:) ⇒ WebBundleBuilder

Returns a new instance of WebBundleBuilder.



15
16
17
18
19
20
# File 'lib/mxrb/compiler/web_bundle_builder.rb', line 15

def initialize(mpr_path, deployment:, mendix_home:)
  @mpr_path = File.expand_path(mpr_path)
  @deployment = File.expand_path(deployment)
  @source = SourceModel.read(@mpr_path)
  @version_root = version_root(mendix_home)
end

Instance Method Details

#buildObject



22
23
24
25
26
27
28
29
30
31
# File 'lib/mxrb/compiler/web_bundle_builder.rb', line 22

def build
  web = File.join(@deployment, 'web')
  profiles = Adapter.for(@source.version, source: @source).web_profiles
  return LegacyPageBuilder.new(@source, web, profiles:).build unless profiles.include?(:react)

  prepare(web)
  run_bundler(web)
  WebShellMaterializer.new(web, version: @source.version).materialize
  result(web)
end