Module: Shakapacker
- Extended by:
- Shakapacker
- Included in:
- Shakapacker
- Defined in:
- lib/shakapacker.rb,
lib/shakapacker/doctor.rb,
lib/shakapacker/runner.rb,
lib/shakapacker/version.rb,
lib/shakapacker/utils/misc.rb,
lib/shakapacker/swc_migrator.rb,
lib/shakapacker/base_strategy.rb,
lib/shakapacker/rspack_runner.rb,
lib/shakapacker/utils/manager.rb,
lib/shakapacker/mtime_strategy.rb,
lib/shakapacker/webpack_runner.rb,
lib/shakapacker/digest_strategy.rb,
lib/shakapacker/version_checker.rb,
lib/shakapacker/bundler_switcher.rb,
lib/shakapacker/compiler_strategy.rb,
lib/shakapacker/dev_server_runner.rb,
lib/shakapacker/deprecation_helper.rb,
lib/shakapacker/utils/version_syntax_converter.rb
Defined Under Namespace
Modules: Helper, Utils Classes: BaseStrategy, BundlerSwitcher, Commands, Compiler, CompilerStrategy, Configuration, DevServer, DevServerProxy, DevServerRunner, DigestStrategy, Doctor, Engine, Env, Instance, Manifest, MtimeStrategy, RspackRunner, Runner, SwcMigrator, VersionChecker, WebpackRunner
Constant Summary collapse
- DEFAULT_ENV =
"development".freeze
- DEV_TEST_ENVS =
Environments that use their RAILS_ENV value for NODE_ENV All other environments (production, staging, etc.) use “production” for webpack optimizations
%w[development test].freeze
- VERSION =
Change the version in package.json too, please!
"9.2.0".freeze
- SHELL =
Thor::Shell::Color.new
Instance Method Summary collapse
- #ensure_log_goes_to_stdout ⇒ Object
-
#ensure_node_env! ⇒ Object
Set NODE_ENV based on RAILS_ENV if not already set - development/test environments use their RAILS_ENV value - all other environments (production, staging, etc.) use “production” for webpack optimizations.
- #instance ⇒ Object
- #instance=(instance) ⇒ Object
- #puts_deprecation_message(message) ⇒ Object
- #with_node_env(env) ⇒ Object
Instance Method Details
#ensure_log_goes_to_stdout ⇒ Object
37 38 39 40 41 42 43 |
# File 'lib/shakapacker.rb', line 37 def ensure_log_goes_to_stdout old_logger = Shakapacker.logger Shakapacker.logger = Logger.new(STDOUT) yield ensure Shakapacker.logger = old_logger end |
#ensure_node_env! ⇒ Object
Set NODE_ENV based on RAILS_ENV if not already set
-
development/test environments use their RAILS_ENV value
-
all other environments (production, staging, etc.) use “production” for webpack optimizations
33 34 35 |
# File 'lib/shakapacker.rb', line 33 def ensure_node_env! ENV["NODE_ENV"] ||= DEV_TEST_ENVS.include?(ENV["RAILS_ENV"]) ? ENV["RAILS_ENV"] : "production" end |
#instance ⇒ Object
18 19 20 |
# File 'lib/shakapacker.rb', line 18 def instance @instance ||= Shakapacker::Instance.new end |
#instance=(instance) ⇒ Object
14 15 16 |
# File 'lib/shakapacker.rb', line 14 def instance=(instance) @instance = instance end |
#puts_deprecation_message(message) ⇒ Object
6 7 8 |
# File 'lib/shakapacker/deprecation_helper.rb', line 6 def () SHELL.say "\n#{}\n", :yellow end |
#with_node_env(env) ⇒ Object
22 23 24 25 26 27 28 |
# File 'lib/shakapacker.rb', line 22 def with_node_env(env) original = ENV["NODE_ENV"] ENV["NODE_ENV"] = env yield ensure ENV["NODE_ENV"] = original end |