-
Notifications
You must be signed in to change notification settings - Fork 131
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Integrate PSA into spago #955
Conversation
Thanks Nate! If you have no preference on this then my personal preference is that we stick to this fork here so we can iterate quickly on the new Spago. Once things get more stable we can think about upstreaming improvements to your repo. |
It doesn't make sense to use both `--censor-warnings` and `--censor-src`.
Long names are used here to prevent a clash with Spago.Prelude's `printJson`.
As I've spent time on this, I'm actually wondering why this work isn't being done in the compiler itself as that would remove the underlying reason for why |
@JordanMartinez indeed it would be nice if the compiler did all of this and |
spaghetto/README.md
Outdated
@@ -148,4 +190,9 @@ workspace: | |||
output: "output" | |||
# optional, Boolean, fail the build if `spago.yml` has redundant/missing packages | |||
pedantic_packages: false | |||
# optional, PsaOptions | |||
# These options only take affect when | |||
# a package is not selected (e.g. `spago build` vs `spago build -p pkgName`) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see - these are fair points and they all makes sense but I'm still concerned about having the "build options" all scattered around the different config files.
I think the clarity of having only a single set of things to configure is a bigger advantage over being able to issue small tweaks to the different packages in the build.
It sounds like we can cover most of these concerns by having some more configuration flags for test code, and compiling that separately with different settings if these are specified.
The only thing that we'd not cover would be the "test code as package code" scenario of halogen-hooks, but I'd say it's acceptable, since it's a very niche use-case. If it becomes more common, then we can consider a way to support it.
spaghetto/bin/src/Flags.purs
Outdated
|
||
censorBuildWarnings ∷ ArgParser (Maybe Core.CensorBuildWarnings) | ||
censorBuildWarnings = | ||
ArgParser.argument [ "---censor-build-warnings" ] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ArgParser.argument [ "---censor-build-warnings" ] | |
ArgParser.argument [ "--censor-build-warnings" ] |
These flags now all have three hyphens
spaghetto/bin/src/Main.purs
Outdated
} | ||
|
||
type PublishArgs = | ||
{ selectedPackage :: Maybe String | ||
, psaArgs :: PsaArgs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is about the user being able to configure the build via flags. I don't think calling spago publish --strict
makes much sense, but of course we can pick up the strict flag from the config file if specified.
spaghetto/bin/src/Flags.purs
Outdated
stashFile ∷ ArgParser (Maybe (Either Boolean String)) | ||
stashFile = ArgParser.optional $ ArgParser.choose "stash" | ||
[ ArgParser.argument [ "---stash-file" ] "Enable persistent warnings using a specific stash file" | ||
# ArgParser.unformat "FILE" (Right <<< Right <<< Paths.mkLocalCachesCustomStashFile <<< Path.basename) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I left a comment in the previous review and I can't find it - I don't see the benefit of allowing custom stash files, since we already differentiate the stash locations per package in the build, so this just adds more complexity for no clear upside
spaghetto/README.md
Outdated
@@ -148,4 +190,9 @@ workspace: | |||
output: "output" | |||
# optional, Boolean, fail the build if `spago.yml` has redundant/missing packages | |||
pedantic_packages: false | |||
# optional, PsaOptions | |||
# These options only take affect when | |||
# a package is not selected (e.g. `spago build` vs `spago build -p pkgName`) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd add that this is a fairly weak opinion because we don't have any real-world usage of this whole monorepo setup yet.
We can probably just ship the "workspace-only" version and then tweak later once folks need things.
I'd likely prefer the "workspace settings are the default ones, and package specific ones override" implementation, so we'd have to rework this anyways.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll merge this now - thanks Jordan!
Description of the change
Fixes #904.
spago.yml
support (see https://github.com/natefaubion/purescript-psa-utils/pulls and https://github.com/natefaubion/purescript-psa/issues)Summary of PR:
psa
andpsa-utils
were vendored into this codebase and modified/updated in the following ways:Dodo
as its printer rather than its custom code. Moreover, a brighter red and yellow are used for warnings and errors than what was used previously.codec-argonaut
as its Json encoder/decoderreplicate
withpower
PsaOptions
toPsaOutputOptions
because*Options
in this codebase typically refers to values used in misc commands.output
tobuildOutput
becauseoutput
is already exported fromSpago.Prelude
stash
andstashFile
into one argumentansi
arg tocolor
(since Spago already has a similarly-named flag)isLib
arg as libraries can be determined via Spagostdout
rather thanstderr
. (I'm not sure if this is correct to do, but I'll clarify why in the PR via a code comment).psa
was integrated into Spago in the following way:psa
'smain
function was extracted out intoPsa.psaCompile
, which wrapsPurs.compile
logDebug
statements were added to make it easier to see where problems arise (if any) in the futurepsa
takes, I decided to keep all of them configurable viaspago.yml
except for:json-errors
: I assume this is only useful if being called by an IDE or if someone wants to run their own custom printeransi
: this doesn't seem like something one should configure viaspago.yml
, only via CLIlibraryDirs
: with Spago in control, we know what the library directories are.spago build -b pkgName
is used:.spago/stashes/defaults/pkgName.stash
spago build
is used:.spago/stashes/defaults/entire-workspace.stash
spago build --psa-stash-file "foo"
is used:.spago/stashes/custom/foo.stash
spago build --psa-stash-file "../foo"
is used:.spago/stashes/custom/foo.stash
Checklist:
README
P.S.: the above checks are not compulsory to get a change merged, so you may skip them. However, taking care of them will result in less work for the maintainers and will be much appreciated 😊