Skip to content

Commit b0de598

Browse files
nipunn1313Convex, Inc.
authored and
Convex, Inc.
committed
Move node-executor reading of .nvmrc to compile time (#23908)
This allows us to precompile on one machine and run on another without a checkout. GitOrigin-RevId: 37a359a84c211a5c3f04d1f350bd7b24f34fdf99
1 parent acec008 commit b0de598

File tree

1 file changed

+6
-15
lines changed

1 file changed

+6
-15
lines changed

crates/node_executor/src/local.rs

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
use std::{
22
fs,
3-
path::{
4-
Path,
5-
PathBuf,
6-
},
3+
path::PathBuf,
74
time::Duration,
85
};
96

@@ -34,6 +31,10 @@ use crate::executor::{
3431
EXECUTE_TIMEOUT_RESPONSE_JSON,
3532
};
3633

34+
/// Always use node version specified in .nvmrc for lambda execution, even if
35+
/// we're using older version for CLI.
36+
const NODE_VERSION: &str = include_str!("../../../.nvmrc");
37+
3738
pub struct LocalNodeExecutor {
3839
_source_dir: TempDir,
3940
source_path: PathBuf,
@@ -57,17 +58,7 @@ impl LocalNodeExecutor {
5758
"Using local node executor. Source: {}",
5859
source_path.to_str().expect("Path is not UTF-8 string?"),
5960
);
60-
let repo_root = Path::new(env!("CARGO_MANIFEST_DIR"))
61-
.parent()
62-
.unwrap()
63-
.parent()
64-
.unwrap();
65-
66-
// Always use node version specified in .nvmrc for lambda execution, even if
67-
// we're using older version for CLI.
68-
let node_version = fs::read_to_string(repo_root.join(".nvmrc"))?
69-
.trim()
70-
.to_string();
61+
let node_version = NODE_VERSION.trim();
7162

7263
// Look for node16 in a few places. CI nvm installer uses `mynvm`
7364
let mut node_path = "node".to_string();

0 commit comments

Comments
 (0)