Skip to content

Commit

Permalink
Add command to remove an NPM package
Browse files Browse the repository at this point in the history
  • Loading branch information
ayushn21 committed Oct 17, 2024
1 parent 5cf2fd3 commit 09d2be7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,10 @@ def add_npm_package(package_details)
run "#{Bridgetown::PluginManager.package_manager} #{Bridgetown::PluginManager.package_manager_install_command} #{package_details}" # rubocop:disable Layout
end

def remove_npm_package(package_details)
run "#{Bridgetown::PluginManager.package_manager} #{Bridgetown::PluginManager.package_manager_uninstall_command} #{package_details}" # rubocop:disable Layout
end

def apply_from_url(url)
apply transform_automation_url(url.dup)
end
Expand Down
4 changes: 4 additions & 0 deletions bridgetown-core/lib/bridgetown-core/plugin_manager.rb
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,10 @@ def self.package_manager_install_command
package_manager == "npm" ? "install" : "add"
end

def self.package_manager_uninstall_command
package_manager == "npm" ? "uninstall" : "remove"
end

# rubocop:disable Metrics/PerceivedComplexity, Metrics/CyclomaticComplexity

# Iterates through loaded gems and finds npm-add gemspec metadata.
Expand Down

0 comments on commit 09d2be7

Please sign in to comment.