Skip to content
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

Merged
merged 80 commits into from
May 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
80 commits
Select commit Hold shift + click to select a range
534df0d
Vendor in psa & psa-utils
JordanMartinez Mar 30, 2023
64c9b45
Update imports to Spago-based ones
JordanMartinez Mar 30, 2023
63c6dd5
Derive instances
JordanMartinez Mar 30, 2023
a5e0166
Relocate encoder: PsaResult
JordanMartinez Mar 30, 2023
3905b17
Relocate encoder: PsaError
JordanMartinez Mar 30, 2023
2e656fd
Relocate encoder: Position
JordanMartinez Mar 30, 2023
e077c1b
Drop unneed FFI for version
JordanMartinez Mar 30, 2023
6456023
Convert class-based codecs to value-based ones
JordanMartinez Mar 30, 2023
77a9eec
Replace usage of iter_
JordanMartinez Mar 30, 2023
f64f630
Migrate printer to Dodo printer
JordanMartinez Mar 30, 2023
d974f42
Inline used renderers into Default; drop printer
JordanMartinez Mar 30, 2023
4e9aa09
Replace replicate with power
JordanMartinez Mar 30, 2023
cad4300
Inline only usage of padLeft; drop util
JordanMartinez Mar 30, 2023
c73e47d
Extract PSA's main's logic; convert to Aff
JordanMartinez Mar 30, 2023
2bdb7d3
Remove irrelevant args from ParseOptions
JordanMartinez Mar 30, 2023
809fb4e
Drop help arg
JordanMartinez Mar 30, 2023
56527b9
Psa - Cleanup imports
JordanMartinez Apr 1, 2023
26b7cf9
Psa - fix shadow named warning
JordanMartinez Apr 1, 2023
6580d48
Psa - drop unused unexported declarations
JordanMartinez Apr 1, 2023
fc57688
Psa - fix more compiler warnings
JordanMartinez Apr 1, 2023
d287298
Rename PsaOptions to PsaOutputOptions
JordanMartinez Apr 1, 2023
f15d574
Fix future shadowed name issue w/ Spago.Prelude
JordanMartinez Apr 1, 2023
4c4ab73
Use psaCompile as a wrapper of purs compile
JordanMartinez Apr 1, 2023
4eefe9d
Pass libDirs into psaCompile
JordanMartinez Apr 1, 2023
55e3d02
Refactor sourceGlob to include dir prefix
JordanMartinez Mar 31, 2023
727f410
Extract lib dirs out of source globs
JordanMartinez Mar 31, 2023
72e8416
Inline psa output cwd arg into sole usage
JordanMartinez Apr 1, 2023
e21613b
Use 1 arg for whether to stash & location
JordanMartinez Apr 1, 2023
7d281ed
Move StatVerbosity into core config
JordanMartinez Mar 31, 2023
f72b730
Add but don't yet use psa CLI flags
JordanMartinez Mar 31, 2023
68536c3
Refactor psaCompile options
JordanMartinez Apr 1, 2023
c5426ff
Add new flags to corresponding envs
JordanMartinez Apr 1, 2023
b9de0d5
99% there but compiler errors are incomprehensible
JordanMartinez Apr 1, 2023
2febe4d
Compile
f-f Apr 2, 2023
e2a02f7
Cleanup import warnings
JordanMartinez Apr 3, 2023
2de8552
Remove flag defaults
JordanMartinez Apr 3, 2023
32da4fc
Pass json errors through to build
JordanMartinez Apr 3, 2023
fce2abf
Update package set (get new node execa version)
JordanMartinez Apr 3, 2023
a49597b
Don't print json errors in terminal
JordanMartinez Apr 3, 2023
654bfdb
Drop redundant import
JordanMartinez Apr 3, 2023
d2ecdc5
Fix codecs: use nullable Maybe codec
JordanMartinez Apr 3, 2023
c832104
Add missing newline between error header & code
JordanMartinez Apr 3, 2023
a6622ef
Format imports
JordanMartinez Apr 3, 2023
e1345c3
Print json errors to stdout, not stderr
JordanMartinez Apr 3, 2023
b5102bc
Make file's dir before writing to file
JordanMartinez Apr 3, 2023
d43f8f4
Use different arg name for stash file
JordanMartinez Apr 3, 2023
43a7553
Update docs
JordanMartinez Apr 3, 2023
8706ede
End stash file names with '.stash'
JordanMartinez Apr 3, 2023
042608b
Make ansi colors bright
JordanMartinez Apr 3, 2023
7a6ea27
Separate default from custom stashes; security
JordanMartinez Apr 3, 2023
51f2d3b
Note which purs args are disallowed
JordanMartinez Apr 3, 2023
6ff0543
Simplfiy censor/filter code flags
JordanMartinez Apr 3, 2023
3d5066c
Correct flag doc
JordanMartinez Apr 3, 2023
1b09388
Update readme's config file docs
JordanMartinez Apr 3, 2023
e0d045e
Drop unneeded versions dep
JordanMartinez Apr 3, 2023
07531a9
Fix error message about json-errors config value
JordanMartinez Apr 3, 2023
bc6fcc5
Drop ".psa-stash" comment
JordanMartinez Apr 3, 2023
d2818f8
Fix formatting
JordanMartinez Apr 3, 2023
1dc2871
Merge branch 'master' into jam/integrate-psa
f-f Apr 6, 2023
9a9aa43
Rename CLI flags
JordanMartinez Apr 6, 2023
3a84645
From jsonErrors from Install/Run/Test/Bundle Args
JordanMartinez Apr 6, 2023
e4b8442
Merge 3 CLI args into 1
JordanMartinez Apr 6, 2023
a38eb01
Add missing value demoing custom stash file
JordanMartinez Apr 6, 2023
c4bcd5c
Update comment to refer to json errors, not output
JordanMartinez Apr 6, 2023
1d24ed4
Decoding psaaResult codec error should not fail build
JordanMartinez Apr 6, 2023
01664ce
Rename DefaultPrinter as just Printer
JordanMartinez Apr 6, 2023
f4f585a
Inline json printer into Printer
JordanMartinez Apr 6, 2023
3a4451f
Revert sourceGlob' change
JordanMartinez Apr 6, 2023
92dbed1
Remove custom stash file locations; rename to stash
JordanMartinez Apr 19, 2023
8315657
Update precedence: CLI > package > workspace > defaults
JordanMartinez Apr 19, 2023
52bda75
Add comment explaining why stdout is not piped
JordanMartinez Apr 19, 2023
136eb8a
Unnest PSA options under `psa` field
JordanMartinez Apr 19, 2023
0718725
Drop psa args from Install/Publish CLI flags
JordanMartinez Apr 19, 2023
443bb85
CLI flags: `---` -> `--`
JordanMartinez Apr 19, 2023
abcf5fd
Rename 'stash' to 'persist-warnings'
JordanMartinez Apr 19, 2023
1c4080a
Update censor build warnings options in readme
JordanMartinez Apr 19, 2023
bc6db40
Fix 'details' block
JordanMartinez Apr 19, 2023
d1a47fc
Fix typos
JordanMartinez Apr 19, 2023
1ace197
Rephrase persist warnings flag description
JordanMartinez Apr 19, 2023
44e9247
Merge branch 'master' into jam/integrate-psa
f-f May 3, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 46 additions & 2 deletions spaghetto/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,8 @@ When ran from the directory `foo`, Spago will search for a "workspace" config fi

At the end of this process, `foo` and `baz` are the only packages considered.

</details>

### `spago.yml` fields and their meaning

```yml
Expand All @@ -238,11 +240,49 @@ package:
# One of three options
# 1. just the package
- packageName
# 2. the package, using the widest possible vesrion range
# 2. the package, using the widest possible version range
- packageName: "*"
# 2. the package, using a specified vesrion range
# 2. the package, using a specified version range
- packageName: ">=1.1.1 <2.0.0"

# optional
build:
# optional, whether to censor warnings from dependency sources,
# project sources, both, or none
censorBuildWarnings:
# one of 4 values:
# 1. Both
"all"
# 2. dependency only
"dependency"
# 3. project only
"project"
# 4. do not censor warnings
"none"
# optional, NonEmptyArray, censor specific codes
censorCodes:
- ShadowedName
# optional, NonEmptyArray, only show specific codes
filterCodes:
- ShadowedName
# optional, whether to show statistics at the end
# of warning/error output and how much informaiton
statVerbosity:
# One of 3 values
# 1. Don't show it
"no-stats"
# 2. Show it and only sum the total warnings/errors
"compact-stats"
# 3. Show it and show total warnings/errors by code
"verbose-stats"
# optional, boolean, whether to show the source code
# corresponding to the error's location
showSource: true
# optional, boolean, counts compiler warnings as compiler errors
strict: false
# optional, Boolean String, persist compiler warnings
stash: true

# optional
bundle:
# optional, Boolean, whether to minify
Expand Down Expand Up @@ -345,6 +385,10 @@ workspace:
output: "output"
# optional, Boolean, fail the build if `spago.yml` has redundant/missing packages
pedantic_packages: false
# All of the Package's `buildOptions` fields (e.g. `strict` as shown below)
# can also go here. Any specified here will be used
# if the selected package doesn't specify that option in its configuration
strict: false
```

### FAQs
Expand Down
67 changes: 65 additions & 2 deletions spaghetto/bin/src/Flags.purs
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,76 @@ import Spago.Prelude

import ArgParse.Basic (ArgParser)
import ArgParse.Basic as ArgParser
import Data.Set.NonEmpty (NonEmptySet)
import Data.Set.NonEmpty as NonEmptySet
import Spago.Core.Config (ShowSourceCode(..))
import Spago.Core.Config as Core

selectedPackage ∷ ArgParser (Maybe String)
selectedPackage =
ArgParser.argument [ "--package", "-p" ]
"Select the local project to build"
# ArgParser.optional

strict ∷ ArgParser (Maybe Boolean)
strict =
ArgParser.flag [ "--strict" ]
"Promotes project sources' warnings to errors"
# ArgParser.boolean
# ArgParser.optional

censorBuildWarnings ∷ ArgParser (Maybe Core.CensorBuildWarnings)
censorBuildWarnings =
ArgParser.argument [ "--censor-build-warnings" ]
"Censor compiler warnings based on file's location: 'dependency', 'project', or 'all'"
# ArgParser.unformat "ARG"
( case _ of
"all" -> Right Core.CensorAllWarnings
"project" -> Right Core.CensorProjectWarnings
"dependency" -> Right Core.CensorDependencyWarnings
_ -> Left $ "Expected 'all', 'project', or 'dependency'"
)
# ArgParser.optional

showSource ∷ ArgParser (Maybe ShowSourceCode)
showSource =
NoSourceCode
<$ ArgParser.flag [ "--no-source" ]
"Disable original source code printing"
# ArgParser.optional

censorCodes :: ArgParser (Maybe (NonEmptySet String))
censorCodes =
ArgParser.argument [ "--censor-code" ]
"Censor a specific error code (e.g. `ShadowedName`)"
# ArgParser.many
<#> NonEmptySet.fromFoldable

filterCodes :: ArgParser (Maybe (NonEmptySet String))
filterCodes =
ArgParser.argument [ "--filter-code" ]
"Only show a specific error code (e.g. `TypesDoNotUnify`)"
# ArgParser.many
<#> NonEmptySet.fromFoldable

statVerbosity :: ArgParser (Maybe Core.StatVerbosity)
statVerbosity = ArgParser.optional $ ArgParser.choose "StatVerbosity"
[ Core.VerboseStats <$ ArgParser.flag [ "--verbose-stats" ] "Show counts for each warning type"
, Core.NoStats <$ ArgParser.flag [ "--censor-stats" ] "Censor warning/error summary"
]

persistWarnings ∷ ArgParser (Maybe Boolean)
persistWarnings =
ArgParser.flag [ "--persist-warnings" ] "Persist the compiler warnings between multiple underlying `purs compile` calls"
# ArgParser.boolean
# ArgParser.optional

jsonErrors ∷ ArgParser Boolean
jsonErrors =
ArgParser.flag [ "--json-errors" ]
"Output compiler warnings/errors as JSON"
# ArgParser.boolean

minify ∷ ArgParser Boolean
minify =
ArgParser.flag [ "--minify" ]
Expand Down Expand Up @@ -63,7 +126,7 @@ verbose =

noColor ∷ ArgParser Boolean
noColor =
ArgParser.flag [ "--no-color" ]
ArgParser.flag [ "--no-color", "--monochrome" ]
"Force logging without ANSI color escape sequences"
# ArgParser.boolean
# ArgParser.default false
Expand Down Expand Up @@ -92,7 +155,7 @@ pedanticPackages =
pursArgs ∷ ArgParser (List String)
pursArgs =
ArgParser.argument [ "--purs-args" ]
"Arguments to pass to purs compile. Wrap in quotes."
"Arguments to pass to purs compile. Wrap in quotes. `--output` and `--json-errors` must be passed to Spago directly."
# ArgParser.many

execArgs :: ArgParser (Maybe (Array String))
Expand Down
Loading