From ff9bc620122d14964eb89d0171ebc645cbcad031 Mon Sep 17 00:00:00 2001 From: Kyle Lacy Date: Thu, 30 May 2024 02:26:42 -0700 Subject: [PATCH] Add `nodejs.npmInstall()` function --- projects/nodejs/project.bri | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/projects/nodejs/project.bri b/projects/nodejs/project.bri index c9a76af..ba27d3e 100644 --- a/projects/nodejs/project.bri +++ b/projects/nodejs/project.bri @@ -5,7 +5,7 @@ export const project = { version: "20.14.0", }; -export default (): std.Recipe => { +function nodejs(): std.Recipe { let node = std .download({ url: "https://nodejs.org/dist/v20.14.0/node-v20.14.0-linux-x64.tar.xz", @@ -22,4 +22,18 @@ export default (): std.Recipe => { }); return std.withRunnableLink(node, "bin/node"); -}; +} +export default nodejs; + +export function npmInstall( + pkg: std.AsyncRecipe, +): std.Recipe { + return std.runBash` + cd "$BRIOCHE_OUTPUT" + npm clean-install + ` + .dependencies(nodejs()) + .outputScaffold(pkg) + .unsafe({ networking: true }) + .cast("directory"); +}