Title: scripts/build fails: dist/ output directory not created before pslua writes to it · Issue #1 · purescript-lua/purescript-lua-assert · GitHub
Open Graph Title: scripts/build fails: dist/ output directory not created before pslua writes to it · Issue #1 · purescript-lua/purescript-lua-assert
X Title: scripts/build fails: dist/ output directory not created before pslua writes to it · Issue #1 · purescript-lua/purescript-lua-assert
Description: 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 i...
Open Graph Description: 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 ...
X Description: 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 ...
Opengraph URL: https://github.com/purescript-lua/purescript-lua-assert/issues/1
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"scripts/build fails: dist/ output directory not created before pslua writes to it","articleBody":"## Summary\n\nA fresh `nix develop -c ./scripts/build` fails immediately with:\n\n```\nBuilding...\nCompiling modules:\npslua: /.../purescript-lua-assert/dist/Test_Assert.lua: withFile: does not exist (No such file or directory)\n```\n\nThe 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.\n\n## Root cause\n\nThe `pslua` invocation for this package lives in the `backend` field of `spago.dhall`, which `spago build` runs after compiling CoreFn:\n\n```dhall\n, backend =\n ''\n pslua \\\n --foreign-path . \\\n --ps-output output \\\n --lua-output-file dist/Test_Assert.lua \\\n --entry Test.Assert\n ''\n```\n\n`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.\n\nOn a clean checkout it does not:\n\n- The repo's root `.gitignore` contains `/dist/`, so the directory is never committed.\n- `scripts/build` only runs `spago build` and never creates `dist/` first.\n\nResult: `withFile: does not exist`.\n\n## Why it works in sibling forks but not here\n\nThe other Lua forks (e.g. `purescript-lua-prelude`, `purescript-lua-strings`, `purescript-lua-arrays`) avoid this in two ways:\n\n1. They drive `pslua` directly from `scripts/build` rather than from the `spago.dhall` `backend` field.\n2. 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.\n\n`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.\n\n## Impact\n\n`./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.\n\n## How it was found\n\nRunning the documented build command on a freshly-reset checkout:\n\n```bash\ngit checkout master && git clean -fdx # fresh state, no dist/\nnix develop -c ./scripts/build\n# -> pslua: .../dist/Test_Assert.lua: withFile: does not exist\necho $? # 1\n```\n\n## Suggested fix\n\nMinimal 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.\n\nNote: `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.\n","author":{"url":"https://github.com/Unisay","@type":"Person","name":"Unisay"},"datePublished":"2026-06-14T08:33:22Z","url":"https://github.com/purescript-lua/purescript-lua-assert/issues/1"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:0d79d2a6-4647-9596-52bb-a0ebba263457 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | DDDC:16EED3:3A83D5:4BF770:6B00D35F |
| html-safe-nonce | 4b4c4f0f701864a93563f6b64ab6832a422231fa0c925bf1ef1c1eb05f202a6a |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJERERDOjE2RUVEMzozQTgzRDU6NEJGNzcwOjZCMDBEMzVGIiwidmlzaXRvcl9pZCI6IjM5Njg3NjkwNzE0NDQ0NDgwOTUiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 6cdb5cd086fc594dadae26fce89293c9ee6206bda16d2ea5c4088ce8a344aa6c |
| hovercard-subject-tag | issue:4658453510 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/purescript-lua/purescript-lua-assert/1/issue_layout |
| twitter:image | https://opengraph.githubassets.com/cd6b5a2374c4bff7f8854fa497eafa09b858136962770bc14bcd3a41a3a820b4/purescript-lua/purescript-lua-assert/issues/1 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/cd6b5a2374c4bff7f8854fa497eafa09b858136962770bc14bcd3a41a3a820b4/purescript-lua/purescript-lua-assert/issues/1 |
| og:image:alt | 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 ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | Unisay |
| hostname | github.com |
| expected-hostname | github.com |
| None | 85bbdfe2b6ba16e234513bc6ceff5d848ef8449820c900692a2b4e67061931e5 |
| turbo-cache-control | no-preview |
| go-import | github.com/purescript-lua/purescript-lua-assert git https://github.com/purescript-lua/purescript-lua-assert.git |
| octolytics-dimension-user_id | 131581790 |
| octolytics-dimension-user_login | purescript-lua |
| octolytics-dimension-repository_id | 773124680 |
| octolytics-dimension-repository_nwo | purescript-lua/purescript-lua-assert |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | true |
| octolytics-dimension-repository_parent_id | 35369138 |
| octolytics-dimension-repository_parent_nwo | purescript/purescript-assert |
| octolytics-dimension-repository_network_root_id | 35369138 |
| octolytics-dimension-repository_network_root_nwo | purescript/purescript-assert |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 4943239a6d2c591325dad6e5c313e1cafda877f6 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width