Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix excessive reshimming during batch npm/yarn installs #27

Merged
merged 1 commit into from
Jan 18, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions src/mstrap/runtimes/node.cr
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ module MStrap
def bootstrap
if File.exists?("yarn.lock")
cmd "brew install yarn", quiet: true
cmd "yarn install", quiet: true
skip_reshim { cmd "yarn install", quiet: true }
elsif File.exists?("package.json")
cmd "npm install", quiet: true
skip_reshim { cmd "npm install", quiet: true }
end
end

Expand All @@ -39,7 +39,7 @@ module MStrap
end
end

asdf_exec "npm", cmd_args, runtime_version: runtime_version
skip_reshim { asdf_exec "npm", cmd_args, runtime_version: runtime_version }
end

def matches? : Bool
Expand All @@ -51,6 +51,16 @@ module MStrap
File.exists?(file)
end
end

private def skip_reshim
begin
ENV["ASDF_SKIP_RESHIM"] = "1"
yield
ensure
ENV.delete("ASDF_SKIP_RESHIM")
asdf_exec "asdf", ["reshim", "nodejs"]
end
end
end
end
end