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

Update Node and Bun versions #1011

Merged
merged 2 commits into from
Nov 17, 2023
Merged
Show file tree
Hide file tree
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
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
Loading