Skip to content

Commit

Permalink
Update Node and Bun versions (#1011)
Browse files Browse the repository at this point in the history
* update node and bun versions

* fix node custom version test
  • Loading branch information
coffee-cup authored Nov 17, 2023
1 parent 58c8a81 commit c679aac
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 6 deletions.
2 changes: 1 addition & 1 deletion examples/node-custom-version/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
"start": "./start.sh"
},
"engines": {
"node": "20.x"
"node": "21.x"
}
}
5 changes: 4 additions & 1 deletion src/providers/node/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -110,6 +112,7 @@ impl Provider for NodeProvider {
fn get_build_plan(&self, app: &App, env: &Environment) -> Result<Option<BuildPlan>> {
// 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")]);
Expand Down
2 changes: 1 addition & 1 deletion tests/docker_run_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ expression: plan
"setup": {
"name": "setup",
"nixPkgs": [
"nodejs_20",
"nodejs_21",
"npm-8_x"
],
"nixOverlays": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ expression: plan
"setup": {
"name": "setup",
"nixPkgs": [
"nodejs_20",
"nodejs_21",
"pnpm-8_x"
],
"nixOverlays": [
Expand Down
2 changes: 1 addition & 1 deletion tests/snapshots/generate_plan_tests__node_turborepo.snap
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ expression: plan
"setup": {
"name": "setup",
"nixPkgs": [
"nodejs_20",
"nodejs_21",
"npm-8_x"
],
"nixOverlays": [
Expand Down

0 comments on commit c679aac

Please sign in to comment.