From c679aac321c28fff846617d44ef99d13cb8ede4d Mon Sep 17 00:00:00 2001 From: Jake Runzer Date: Fri, 17 Nov 2023 15:34:11 -0500 Subject: [PATCH] Update Node and Bun versions (#1011) * update node and bun versions * fix node custom version test --- examples/node-custom-version/package.json | 2 +- src/providers/node/mod.rs | 5 ++++- tests/docker_run_tests.rs | 2 +- .../snapshots/generate_plan_tests__node_custom_version.snap | 2 +- .../generate_plan_tests__node_pnpm_custom_node_version.snap | 2 +- tests/snapshots/generate_plan_tests__node_turborepo.snap | 2 +- 6 files changed, 9 insertions(+), 6 deletions(-) diff --git a/examples/node-custom-version/package.json b/examples/node-custom-version/package.json index 8f3f8a832..8d027ec35 100644 --- a/examples/node-custom-version/package.json +++ b/examples/node-custom-version/package.json @@ -6,6 +6,6 @@ "start": "./start.sh" }, "engines": { - "node": "20.x" + "node": "21.x" } } diff --git a/src/providers/node/mod.rs b/src/providers/node/mod.rs index 8c82e4dbe..ac2faa28a 100644 --- a/src/providers/node/mod.rs +++ b/src/providers/node/mod.rs @@ -23,8 +23,10 @@ mod turborepo; pub const NODE_OVERLAY: &str = "https://github.com/railwayapp/nix-npm-overlay/archive/main.tar.gz"; +const NODE_NIXPKGS_ARCHIVE: &str = "bf744fe90419885eefced41b3e5ae442d732712d"; + const DEFAULT_NODE_VERSION: u32 = 18; -const AVAILABLE_NODE_VERSIONS: &[u32] = &[14, 16, 18, 20]; +const AVAILABLE_NODE_VERSIONS: &[u32] = &[14, 16, 18, 20, 21]; const YARN_CACHE_DIR: &str = "/usr/local/share/.cache/yarn/v6"; const PNPM_CACHE_DIR: &str = "/root/.local/share/pnpm/store/v3"; @@ -110,6 +112,7 @@ impl Provider for NodeProvider { fn get_build_plan(&self, app: &App, env: &Environment) -> Result> { // Setup let mut setup = Phase::setup(Some(NodeProvider::get_nix_packages(app, env)?)); + setup.set_nix_archive(NODE_NIXPKGS_ARCHIVE.into()); if NodeProvider::uses_node_dependency(app, "prisma") { setup.add_nix_pkgs(&[Pkg::new("openssl")]); diff --git a/tests/docker_run_tests.rs b/tests/docker_run_tests.rs index a3b43c184..e7dc4a301 100644 --- a/tests/docker_run_tests.rs +++ b/tests/docker_run_tests.rs @@ -437,7 +437,7 @@ async fn test_node_nx_express() { async fn test_node_custom_version() { let name = simple_build("./examples/node-custom-version").await; let output = run_image(&name, None).await; - assert!(output.contains("Node version: v20")); + assert!(output.contains("Node version: v21")); } #[tokio::test] diff --git a/tests/snapshots/generate_plan_tests__node_custom_version.snap b/tests/snapshots/generate_plan_tests__node_custom_version.snap index da280c251..fbdd80e9d 100644 --- a/tests/snapshots/generate_plan_tests__node_custom_version.snap +++ b/tests/snapshots/generate_plan_tests__node_custom_version.snap @@ -39,7 +39,7 @@ expression: plan "setup": { "name": "setup", "nixPkgs": [ - "nodejs_20", + "nodejs_21", "npm-8_x" ], "nixOverlays": [ diff --git a/tests/snapshots/generate_plan_tests__node_pnpm_custom_node_version.snap b/tests/snapshots/generate_plan_tests__node_pnpm_custom_node_version.snap index 10b219a0b..3309781ea 100644 --- a/tests/snapshots/generate_plan_tests__node_pnpm_custom_node_version.snap +++ b/tests/snapshots/generate_plan_tests__node_pnpm_custom_node_version.snap @@ -42,7 +42,7 @@ expression: plan "setup": { "name": "setup", "nixPkgs": [ - "nodejs_20", + "nodejs_21", "pnpm-8_x" ], "nixOverlays": [ diff --git a/tests/snapshots/generate_plan_tests__node_turborepo.snap b/tests/snapshots/generate_plan_tests__node_turborepo.snap index 91f653955..ef91238ab 100644 --- a/tests/snapshots/generate_plan_tests__node_turborepo.snap +++ b/tests/snapshots/generate_plan_tests__node_turborepo.snap @@ -44,7 +44,7 @@ expression: plan "setup": { "name": "setup", "nixPkgs": [ - "nodejs_20", + "nodejs_21", "npm-8_x" ], "nixOverlays": [