Class: Inertia::Generators::JSPackageManager
- Inherits:
-
Object
- Object
- Inertia::Generators::JSPackageManager
- Defined in:
- lib/generators/inertia/install/js_package_manager.rb
Class Method Summary collapse
Instance Method Summary collapse
- #add_dependencies(*dependencies) ⇒ Object
-
#initialize(generator) ⇒ JSPackageManager
constructor
A new instance of JSPackageManager.
- #present? ⇒ Boolean
Constructor Details
#initialize(generator) ⇒ JSPackageManager
Returns a new instance of JSPackageManager.
10 11 12 |
# File 'lib/generators/inertia/install/js_package_manager.rb', line 10 def initialize(generator) @generator = generator end |
Class Method Details
.package_managers ⇒ Object
6 7 8 |
# File 'lib/generators/inertia/install/js_package_manager.rb', line 6 def self.package_managers %w[npm yarn bun pnpm] end |
Instance Method Details
#add_dependencies(*dependencies) ⇒ Object
18 19 20 21 22 23 |
# File 'lib/generators/inertia/install/js_package_manager.rb', line 18 def add_dependencies(*dependencies) = @generator.[:verbose] ? '' : ' --silent' @generator.in_root do @generator.run "#{package_manager} add #{dependencies.join(' ')}#{}" end end |
#present? ⇒ Boolean
14 15 16 |
# File 'lib/generators/inertia/install/js_package_manager.rb', line 14 def present? package_manager.present? end |