Class: Lanes::Command::Webpack

Inherits:
Thor::Group
  • Object
show all
Includes:
Thor::Actions
Defined in:
lib/lanes/command/webpack.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#configObject

Returns the value of attribute config.



14
15
16
# File 'lib/lanes/command/webpack.rb', line 14

def config
  @config
end

#processObject (readonly)

Returns the value of attribute process.



12
13
14
# File 'lib/lanes/command/webpack.rb', line 12

def process
  @process
end

#wpd_configObject (readonly)

Returns the value of attribute wpd_config.



16
17
18
# File 'lib/lanes/command/webpack.rb', line 16

def wpd_config
  @wpd_config
end

Instance Method Details

#configureObject



27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/lanes/command/webpack.rb', line 27

def configure
    @wpd_config = WebpackDriver::Configuration.new(
        config.extension_path.join('config', 'webpack.config.js'),
        cmd_line_flags: ['--hot', '--inline'],
        logger: Lanes.logger,
        directory: config.controlling_extension.root_path
    )

    wpd_config.environment.merge!(
        EXTENSION_ID: config.controlling_extension.identifier,
        LANES_MODULES: config.module_paths.join(':'),
        ENTRY: 'show-maker/index.js',
        GENERATED_CONFIG_DIR: config.directory.to_s
    )

    self
end

#make_configObject



21
22
23
24
25
# File 'lib/lanes/command/webpack.rb', line 21

def make_config
    return if @config
    @config = ClientConfig.new
    config.invoke_all
end

#startupObject



45
46
47
48
49
# File 'lib/lanes/command/webpack.rb', line 45

def startup
    @process = ::WebpackDriver::DevServer.new(wpd_config)
    @process.start
    @process.wait if options[:wait]
end