mirror of
https://github.com/oven-sh/bun
synced 2026-02-16 22:01:47 +00:00
fix(install) make sure node-gyp is available during lifecycle scripts (#7622)
* bunx node-gyp * add test * create temp node-gyp when used in script * windows reminder * closer? * Update bunx_command.zig * append fake node to end of path * Update install.zig * correct temp node-gyp dir, always append parent `node_modules/.bin` dir * make sure temp node-gyp doesnt run itself --------- Co-authored-by: Jarred Sumner <jarred@jarredsumner.com> Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
This commit is contained in:
@@ -459,20 +459,20 @@ pub const RunCommand = struct {
|
||||
this_bundler.configureLinker();
|
||||
}
|
||||
|
||||
const bun_node_dir = switch (@import("builtin").target.os.tag) {
|
||||
pub const bun_node_dir = switch (@import("builtin").target.os.tag) {
|
||||
// TODO:
|
||||
.windows => "TMPDIR",
|
||||
|
||||
.macos => "/private/tmp",
|
||||
else => "/tmp",
|
||||
} ++ if (!Environment.isDebug)
|
||||
"/bun-node-" ++ Environment.git_sha_short
|
||||
"/bun-node" ++ if (Environment.git_sha_short.len > 0) "-" ++ Environment.git_sha_short else ""
|
||||
else
|
||||
"/bun-debug-node";
|
||||
"/bun-debug-node" ++ (if (Environment.git_sha_short.len > 0) "-" ++ Environment.git_sha_short else "");
|
||||
|
||||
var self_exe_bin_path_buf: [bun.MAX_PATH_BYTES + 1]u8 = undefined;
|
||||
|
||||
fn createFakeTemporaryNodeExecutable(PATH: *std.ArrayList(u8), optional_bun_path: *string) !void {
|
||||
pub fn createFakeTemporaryNodeExecutable(PATH: *std.ArrayList(u8), optional_bun_path: *string) !void {
|
||||
// If we are already running as "node", the path should exist
|
||||
if (CLI.pretend_to_be_node) return;
|
||||
|
||||
@@ -514,7 +514,7 @@ pub const RunCommand = struct {
|
||||
break;
|
||||
}
|
||||
|
||||
if (PATH.items.len > 0) {
|
||||
if (PATH.items.len > 0 and PATH.items[PATH.items.len - 1] != std.fs.path.delimiter) {
|
||||
try PATH.append(std.fs.path.delimiter);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user