You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The nodejs.npmInstall() function takes a source option, which the documentation hints should contain your full NodeJS project contents including source code. The current example in the documentation looks like this:
import*asstdfrom"std";importnodejs,{npmInstall}from"nodejs";exportdefaultfunction(){// Get all the files for the NPM packageconstsource=Brioche.glob("src","package.lock","package.json");// Install the dependenciesconstnpmPackage=npmInstall({ source });// Run the build script and save the output from `dist/`returnstd.runBash` npm run build mv dist "$BRIOCHE_OUTPUT" `.workDir(npmPackage).dependencies(nodejs());};
Currently, the source project is passed in as-is to download dependencies using npm clean-install. This always works, but means that dependencies will be re-downloaded every time any source file changes in your project.
We should find a way to filter the source recipe to only use the files needed for fetching dependencies. In rust.cargoBuild() for instance, we use cargo chef as a "sanitizing step" before we fetch dependencies, leading to the same dependencies being re-used even if the source code changes.
A naive option would be to just use std.glob(source, ["package.json", "package-lock.json"]), which might work as a starting point but could cause issues if the project e.g. uses path dependencies. Ideally, we should find some holistic way to handle this: either by using a tool like cargo chef for NPM packages, or by analyzing the package.json file ourselves to determine what files we need to include.
The text was updated successfully, but these errors were encountered:
The
nodejs.npmInstall()
function takes asource
option, which the documentation hints should contain your full NodeJS project contents including source code. The current example in the documentation looks like this:Currently, the
source
project is passed in as-is to download dependencies usingnpm clean-install
. This always works, but means that dependencies will be re-downloaded every time any source file changes in your project.We should find a way to filter the
source
recipe to only use the files needed for fetching dependencies. Inrust.cargoBuild()
for instance, we usecargo chef
as a "sanitizing step" before we fetch dependencies, leading to the same dependencies being re-used even if the source code changes.A naive option would be to just use
std.glob(source, ["package.json", "package-lock.json"])
, which might work as a starting point but could cause issues if the project e.g. usespath
dependencies. Ideally, we should find some holistic way to handle this: either by using a tool likecargo chef
for NPM packages, or by analyzing thepackage.json
file ourselves to determine what files we need to include.The text was updated successfully, but these errors were encountered: