-
Notifications
You must be signed in to change notification settings - Fork 256
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
Use latest Deno 2 version #1243
Open
aleksrutins
wants to merge
8
commits into
railwayapp:main
Choose a base branch
from
aleksrutins:aleks/deno-2
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
bbaa0e4
Use latest Deno 2 version
aleksrutins 44d9c2c
clippy + fmt
aleksrutins 1f941de
Add example, put deno 2 behind a flag
aleksrutins 5245be8
Proper tests
aleksrutins 0a7e484
Update docs for deno 2
aleksrutins bfef7f4
fmt + clippy
aleksrutins fee967a
Fully support Deno 2 by default, support `engines.deno`
aleksrutins b4c5b4a
Merge branch 'main' into aleks/deno-2
coffee-cup File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"engines": { | ||
"deno": "1" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import * as o from "https://deno.land/x/cowsay/mod.ts"; | ||
|
||
let m = o.say({ | ||
text: "Hello from Deno", | ||
}); | ||
|
||
console.log(m); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,10 @@ use self::{ | |
phase::{Phase, Phases, StartPhase}, | ||
topological_sort::topological_sort, | ||
}; | ||
use super::images::{DEBIAN_BASE_IMAGE, UBUNTU_BASE_IMAGE}; | ||
use super::{ | ||
images::{DEBIAN_BASE_IMAGE, UBUNTU_BASE_IMAGE}, | ||
nix::NIXPACKS_ARCHIVE_LEGACY_OPENSSL, | ||
}; | ||
use crate::nixpacks::{ | ||
app::{App, StaticAssets}, | ||
environment::{Environment, EnvironmentVariables}, | ||
|
@@ -46,6 +49,8 @@ pub struct BuildPlan { | |
|
||
pub phases: Option<Phases>, | ||
|
||
pub pinned_archive: Option<String>, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is not necessary as phases already support setting the Nix archive to a specific version, https://github.com/railwayapp/nixpacks/blob/7653b2f1a8b7c4532adb51d1c8f7f20cbd26386c/src/nixpacks/plan/phase.rs/#L207. See this as an example |
||
|
||
#[serde(rename = "start")] | ||
pub start_phase: Option<StartPhase>, | ||
} | ||
|
@@ -292,7 +297,7 @@ impl BuildPlan { | |
} | ||
|
||
/// Store the base image and phase dependencies in this BuildPlan, for later reproducibility. | ||
pub fn pin(&mut self, use_debian: bool) { | ||
pub fn pin(&mut self, use_debian: bool, archive: Option<String>) { | ||
self.providers = Some(Vec::new()); | ||
if self.build_image.is_none() { | ||
let base_image = if use_debian { | ||
|
@@ -306,12 +311,20 @@ impl BuildPlan { | |
self.resolve_phase_names(); | ||
let phases = self.phases.get_or_insert(Phases::default()); | ||
for phase in (*phases).values_mut() { | ||
phase.pin(use_debian); | ||
phase.pin(if archive.is_some() { | ||
archive.clone() | ||
} else if use_debian { | ||
Some(NIXPACKS_ARCHIVE_LEGACY_OPENSSL.to_string()) | ||
} else { | ||
None | ||
}); | ||
} | ||
|
||
if let Some(start) = &mut self.start_phase { | ||
start.pin(); | ||
} | ||
|
||
self.pinned_archive = archive; | ||
} | ||
|
||
/// Prefix each phase name with the name of the provider that generated the phase, in the case of multiple providers. | ||
|
@@ -485,7 +498,7 @@ mod test { | |
) | ||
.unwrap(); | ||
|
||
plan.pin(false); | ||
plan.pin(false, None); | ||
assert_eq!( | ||
plan.get_phase("setup").unwrap().nix_pkgs, | ||
Some(vec!["nodejs".to_string(), "yarn".to_string()]) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
--- | ||
source: tests/generate_plan_tests.rs | ||
expression: plan | ||
snapshot_kind: text | ||
--- | ||
{ | ||
"providers": [], | ||
"buildImage": "[build_image]", | ||
"variables": { | ||
"NIXPACKS_METADATA": "deno" | ||
}, | ||
"phases": { | ||
"build": { | ||
"name": "build", | ||
"dependsOn": [ | ||
"install", | ||
"setup" | ||
], | ||
"cmds": [ | ||
"deno cache src/index.ts" | ||
] | ||
}, | ||
"setup": { | ||
"name": "setup", | ||
"nixPkgs": [ | ||
"deno" | ||
], | ||
"nixOverlays": [], | ||
"nixpkgsArchive": "[archive]" | ||
} | ||
}, | ||
"start": { | ||
"cmd": "deno run --allow-all src/index.ts" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
--- | ||
source: tests/generate_plan_tests.rs | ||
expression: plan | ||
snapshot_kind: text | ||
--- | ||
{ | ||
"providers": [], | ||
"buildImage": "[build_image]", | ||
"variables": { | ||
"NIXPACKS_METADATA": "deno", | ||
"NIXPACKS_USE_DENO_2": "1" | ||
}, | ||
"phases": { | ||
"build": { | ||
"name": "build", | ||
"dependsOn": [ | ||
"install", | ||
"setup" | ||
], | ||
"cmds": [ | ||
"deno cache src/index.ts" | ||
] | ||
}, | ||
"setup": { | ||
"name": "setup", | ||
"nixPkgs": [ | ||
"deno" | ||
], | ||
"nixOverlays": [], | ||
"nixpkgsArchive": "[archive]" | ||
} | ||
}, | ||
"start": { | ||
"cmd": "deno run --allow-all src/index.ts" | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be moved to the deno provider file