class Lanes::Command::ClientConfig

Constants

ROOT

Attributes

controlling_extension[R]
directory[R]
extension_path[R]
lanes_root_path[R]
module_paths[R]

Public Class Methods

source_root() click to toggle source
# File lib/lanes/command/client_config.rb, line 16
def self.source_root
    ROOT.join("templates", "js")
end

Public Instance Methods

apply_lanes_config() click to toggle source
# File lib/lanes/command/client_config.rb, line 20
def apply_lanes_config
    Lanes::Configuration.apply
    Lanes::Extensions.load_controlling_config
end
make_temp_dir() click to toggle source
# File lib/lanes/command/client_config.rb, line 31
def make_temp_dir
    @directory = Pathname.new(Dir.mktmpdir)
end
set_module_paths() click to toggle source
# File lib/lanes/command/client_config.rb, line 35
def set_module_paths
    @module_paths = Extensions.map { |e| e.root_path.join('client').to_s }.reverse + [
        controlling_extension.root_path.join('node_modules').to_s,
        directory.to_s
    ]
end
set_vars() click to toggle source
# File lib/lanes/command/client_config.rb, line 25
def set_vars
    @lanes_root_path = ROOT
    @controlling_extension = Command.load_current_extension(raise_on_fail: true)
    @extension_path = controlling_extension.root_path
end
write_asset_files() click to toggle source
# File lib/lanes/command/client_config.rb, line 42
def write_asset_files
    say "Generating config in #{directory}", :green

    template('jest.config.json',
             directory.join('jest.config.json'), verbose: false)

    template('root-view.html',
             directory.join('root-view.tmpl.html'), verbose: false)

    template('screens.js',
             directory.join('lanes/screen-definitions.js'), verbose: false)

    # set the mtime to the past, otherwise Webpack will build repeatedly for a second
    FileUtils.touch directory.join('index.html').to_s, mtime: Time.now - 1.minute
end