Summary
A fresh nix develop -c ./scripts/build fails immediately with:
Building...
Compiling modules:
pslua: /.../purescript-lua-assert/dist/Test_Assert.lua: withFile: does not exist (No such file or directory)
The build cannot produce its output because the dist/ output directory does not exist on a clean checkout, and nothing in the build creates it before pslua tries to write into it.
Root cause
The pslua invocation for this package lives in the backend field of spago.dhall, which spago build runs after compiling CoreFn:
, backend =
''
pslua \
--foreign-path . \
--ps-output output \
--lua-output-file dist/Test_Assert.lua \
--entry Test.Assert
''
pslua opens the --lua-output-file target with withFile path WriteMode (see exe/Main.hs in Unisay/purescript-lua). WriteMode creates the file but not any missing parent directories. So writing dist/Test_Assert.lua requires dist/ to already exist.
On a clean checkout it does not:
- The repo's root
.gitignore contains /dist/, so the directory is never committed.
scripts/build only runs spago build and never creates dist/ first.
Result: withFile: does not exist.
Why it works in sibling forks but not here
The other Lua forks (e.g. purescript-lua-prelude, purescript-lua-strings, purescript-lua-arrays) avoid this in two ways:
- They drive
pslua directly from scripts/build rather than from the spago.dhall backend field.
- They commit a
dist/.gitignore (containing *.lua) and do not ignore /dist/ at the repo root, so dist/ exists on a fresh checkout while the generated .lua files stay untracked.
purescript-lua-assert does neither: its root .gitignore ignores all of /dist/, there is no committed dist/.gitignore, and the pslua call sits in spago.dhall. So nothing guarantees dist/ exists at build time.
Impact
./scripts/build is broken from a clean clone for everyone — CI and any new contributor. There is no workaround other than manually mkdir dist first. The package cannot be built by following its own build script.
How it was found
Running the documented build command on a freshly-reset checkout:
git checkout master && git clean -fdx # fresh state, no dist/
nix develop -c ./scripts/build
# -> pslua: .../dist/Test_Assert.lua: withFile: does not exist
echo $? # 1
Suggested fix
Minimal and self-contained: have scripts/build create the output directory before building, e.g. mkdir -p dist ahead of spago build. This matches the intent of the sibling forks (guarantee dist/ exists) without restructuring the build.
Note: pslua not creating the parent directory of --lua-output-file is a latent rough edge worth tracking separately upstream in Unisay/purescript-lua; this issue tracks the package-side fix.
Summary
A fresh
nix develop -c ./scripts/buildfails immediately with:The build cannot produce its output because the
dist/output directory does not exist on a clean checkout, and nothing in the build creates it beforepsluatries to write into it.Root cause
The
psluainvocation for this package lives in thebackendfield ofspago.dhall, whichspago buildruns after compiling CoreFn:psluaopens the--lua-output-filetarget withwithFile path WriteMode(seeexe/Main.hsinUnisay/purescript-lua).WriteModecreates the file but not any missing parent directories. So writingdist/Test_Assert.luarequiresdist/to already exist.On a clean checkout it does not:
.gitignorecontains/dist/, so the directory is never committed.scripts/buildonly runsspago buildand never createsdist/first.Result:
withFile: does not exist.Why it works in sibling forks but not here
The other Lua forks (e.g.
purescript-lua-prelude,purescript-lua-strings,purescript-lua-arrays) avoid this in two ways:psluadirectly fromscripts/buildrather than from thespago.dhallbackendfield.dist/.gitignore(containing*.lua) and do not ignore/dist/at the repo root, sodist/exists on a fresh checkout while the generated.luafiles stay untracked.purescript-lua-assertdoes neither: its root.gitignoreignores all of/dist/, there is no committeddist/.gitignore, and thepsluacall sits inspago.dhall. So nothing guaranteesdist/exists at build time.Impact
./scripts/buildis broken from a clean clone for everyone — CI and any new contributor. There is no workaround other than manuallymkdir distfirst. The package cannot be built by following its own build script.How it was found
Running the documented build command on a freshly-reset checkout:
Suggested fix
Minimal and self-contained: have
scripts/buildcreate the output directory before building, e.g.mkdir -p distahead ofspago build. This matches the intent of the sibling forks (guaranteedist/exists) without restructuring the build.Note:
psluanot creating the parent directory of--lua-output-fileis a latent rough edge worth tracking separately upstream inUnisay/purescript-lua; this issue tracks the package-side fix.