Skip to content

assets: add an error to ob run when file doesn't exist - #930

Merged
madeline-os merged 4 commits into
developfrom
aa/missing-file-warning
May 25, 2022
Merged

madeline-os merged 4 commits into
developfrom
aa/missing-file-warning

Conversation

@ali-abrar

@ali-abrar ali-abrar commented May 23, 2022

Copy link
Copy Markdown
Member

Before this PR, and since #831, calling static with a nonexistent file would not result in an error or a warning in ob run, but would fail at compile-time when using ob deploy or nix-build.

This PR adds errors like the following to static in ob run:

frontend/src/Frontend.hs:45:32-55: error:
    • Static file obeliskasdf.jpg was not found in static.out
    • In the untyped splice: $(static "obeliskasdf.jpg")
   |
45 |       elAttr "img" ("src" =: $(static "obeliskasdf.jpg"))
blank
   |                                ^^^^^^^^^^^^^^^^^^^^^^^^

Notes:

  • Since nix-derived assets are built asynchronously, this error might be reported because the nix-build of the static assets isn't ready yet. The user would have trigger a ghci reload (by saving a file) to get rid of the error.
  • The TH error will only be reported when the haskell code is being reloaded. Changing the files in static/ currently does not trigger a ghci reload and won't be noticed.
  • Related PR: Don't wait for nix show-derivation when deciding whether to provide UI feedback #835

I have:

  • Based work on latest develop branch
  • Followed the contribution guide
  • Looked for lint in my changes with hlint . (lint found code you did not write can be left alone)
  • Run the test suite: $(nix-build -A selftest --no-out-link)
  • Updated the changelog
  • (Optional) Run CI tests locally: nix-build release.nix -A build.x86_64-linux --no-out-link (or x86_64-darwin on macOS)

@ali-abrar
ali-abrar force-pushed the aa/missing-file-warning branch from 34d31ad to 3a33bda Compare May 24, 2022 14:26
@ali-abrar ali-abrar changed the title assets: add a warning to ob run when file doesn't exist assets: add an error to ob run when file doesn't exist May 24, 2022
@ali-abrar
ali-abrar requested review from cgibbard and madeline-os May 24, 2022 14:30
Comment thread ChangeLog.md Outdated
Comment thread lib/asset/manifest/src/Obelisk/Asset/TH.hs
@madeline-os
madeline-os merged commit bd76ace into develop May 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants