Nix build helpers for Deno projects that manage dependencies with pnpm and run on dodo.
buildDenoPackage: installsnode_modulesfrompnpm-lock.yamlvia importPnpmLock (no dependency hash), then runsdeno taskordeno compiledeno,denort: dodo packagespnpm: nixpkgspnpm_12wasmbuildHook: seedswasm-optfor@deno/wasmbuildraphus: the@deltarocks/raphusCLI
deno.lock dependencies are not supported.
@deltarocks/raphus transpiles a package written for Deno to JS + .d.ts in
dist/ before pnpm publish:
{
"scripts": {
"prepack": "raphus"
},
"publishConfig": {
"directory": "dist",
"linkDirectory": false
},
"devDependencies": {
"@deltarocks/raphus": "^0.1.0"
}
}Files reachable from exports, bin and files are copied or transpiled;
catalog: and workspace: dependency specs are resolved. It needs deno on
PATH. Its @std/* dependencies come from JSR as npm:@jsr/* aliases: pnpm
resolves them out of the box, other clients need
@jsr:registry=https://npm.jsr.io/ in .npmrc.
{
inputs.raphus = {
url = "git+file:///home/lach/Projects/contrib/raphus";
inputs.nixpkgs.follows = "nixpkgs";
};
}inputs'.raphus.legacyPackages.buildDenoPackage (finalAttrs: {
pname = "my-package";
version = "0.1.0";
src = ./.;
binaryEntrypointPath = "main.ts";
})Without binaryEntrypointPath, deno task build runs and installPhase has to
copy artifacts to $out:
inputs'.raphus.legacyPackages.buildDenoPackage {
pname = "my-site";
version = "0.1.0";
src = ./.;
installPhase = ''
cp -r dist $out
'';
}NODE_ENV defaults to production for the build and is embedded into compiled
binaries as a default (NODE_ENV = null disables it). DENORT_BIN points at
denort (denortPackage = null drops it), so custom buildPhases can run
deno compile directly. The lock file defaults to src + "/pnpm-lock.yaml";
set pnpmLockFile when src is a derivation or the lock lives elsewhere.
Everything in this repository shares one version, sealed with bureaucrate in global mode.