Skip to content

Commit

Permalink
Add example, put deno 2 behind a flag
Browse files Browse the repository at this point in the history
  • Loading branch information
aleksrutins committed Dec 17, 2024
1 parent 44d9c2c commit 1f941de
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
2 changes: 2 additions & 0 deletions examples/deno2/nixpacks.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[variables]
NIXPACKS_USE_DENO_2 = '1'
7 changes: 7 additions & 0 deletions examples/deno2/src/index.ts
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);
8 changes: 5 additions & 3 deletions src/providers/deno.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,13 @@ impl Provider for DenoProvider {
|| app.find_match(&re, "**/*.{ts,tsx,js,jsx}")?)
}

fn get_build_plan(&self, app: &App, _env: &Environment) -> Result<Option<BuildPlan>> {
fn get_build_plan(&self, app: &App, env: &Environment) -> Result<Option<BuildPlan>> {
let mut plan = BuildPlan::default();
plan.pin(false, Some(NIXPACKS_ARCHIVE_LATEST_DENO.to_string()));

let setup = Phase::setup(Some(vec![Pkg::new("deno")]));
let mut setup = Phase::setup(Some(vec![Pkg::new("deno")]));
if env.is_config_variable_truthy("USE_DENO_2") {
setup.pin(Some(NIXPACKS_ARCHIVE_LATEST_DENO.to_string()));
}
plan.add_phase(setup);

if let Some(build_cmd) = DenoProvider::get_build_cmd(app)? {
Expand Down

0 comments on commit 1f941de

Please sign in to comment.