Skip to content

Commit

Permalink
Add Node.js package (binary-only) (#15)
Browse files Browse the repository at this point in the history
* Add Node.js package

* Add `nodejs.npmInstall()` function
  • Loading branch information
kylewlacy authored May 31, 2024
1 parent 8adb0ed commit f70b7d3
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 0 deletions.
3 changes: 3 additions & 0 deletions projects/nodejs/brioche.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"dependencies": {}
}
39 changes: 39 additions & 0 deletions projects/nodejs/project.bri
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import * as std from "std";

export const project = {
name: "nodejs",
version: "20.14.0",
};

function nodejs(): std.Recipe<std.Directory> {
let node = std
.download({
url: "https://nodejs.org/dist/v20.14.0/node-v20.14.0-linux-x64.tar.xz",
hash: std.sha256Hash(
"fedf8fa73b6f51c4ffcc5da8f86cd1ed381bc9dceae0829832c7d683a78b8e36",
),
})
.unarchive("tar", "xz")
.peel()
.cast("directory");

node = std.autowrap(node, {
executables: ["bin/node"],
});

return std.withRunnableLink(node, "bin/node");
}
export default nodejs;

export function npmInstall(
pkg: std.AsyncRecipe<std.Directory>,
): std.Recipe<std.Directory> {
return std.runBash`
cd "$BRIOCHE_OUTPUT"
npm clean-install
`
.dependencies(nodejs())
.outputScaffold(pkg)
.unsafe({ networking: true })
.cast("directory");
}

0 comments on commit f70b7d3

Please sign in to comment.