Skip to content

Commit

Permalink
Add support for pnpm to Node runtime support
Browse files Browse the repository at this point in the history
This adds support for pnpm as a package manager, but not as a runtime manager for Node (aka `pnpm env`)
  • Loading branch information
maxfierke committed Apr 28, 2024
1 parent 42fc1be commit e6f0f0e
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/mstrap/runtimes/node.cr
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,12 @@ module MStrap
# based on conventions.
class Node < Runtime
def bootstrap
if File.exists?("yarn.lock")
cmd "brew install yarn", quiet: true && skip_reshim { runtime_exec "yarn install" }
if File.exists?("pnpm-lock.yaml") || File.exists?("pnpm-workspace.yaml")
cmd("brew install pnpm", quiet: true) unless has_command?("pnpm")
skip_reshim { runtime_exec "pnpm install" }
elsif File.exists?("yarn.lock")
cmd("brew install yarn", quiet: true) unless has_command?("yarn")
skip_reshim { runtime_exec "yarn install" }
elsif File.exists?("package.json")
skip_reshim { runtime_exec "npm install" }
end
Expand All @@ -29,6 +33,7 @@ module MStrap
def matches? : Bool
[
"yarn.lock",
"pnpm-lock.yaml",
"package.json",
".node-version",
].any? do |file|
Expand Down

0 comments on commit e6f0f0e

Please sign in to comment.