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

Update Node deps to breaking changes #671

Merged
merged 13 commits into from
Nov 30, 2023
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/node_modules
/output
/scratch
/.vscode

result

Expand Down
2 changes: 1 addition & 1 deletion app/spago.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@ package:
- exists
- filterable
- fetch
- fetch-core
- foldable-traversable
- foreign-object
- formatters
- http-methods
- httpurple
- identity
- integers
- js-fetch
- js-date
- js-uri
- js-promise-aff
Expand Down
13 changes: 7 additions & 6 deletions app/src/App/API.purs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import Data.String.NonEmpty as NonEmptyString
import Data.String.Regex as Regex
import Effect.Aff as Aff
import Effect.Ref as Ref
import Node.ChildProcess.Types (Exit(..))
import Node.FS.Aff as FS.Aff
import Node.FS.Stats as FS.Stats
import Node.FS.Sync as FS.Sync
Expand Down Expand Up @@ -722,7 +723,7 @@ publishRegistry { source, payload, metadata: Metadata metadata, manifest: Manife
Tar.create { cwd: tmp, folderName: newDir }

Log.info "Tarball created. Verifying its size..."
FS.Stats.Stats { size: bytes } <- Run.liftAff $ FS.Aff.stat tarballPath
bytes <- Run.liftAff $ map FS.Stats.size $ FS.Aff.stat tarballPath
for_ (Operation.Validation.validateTarballSize bytes) case _ of
Operation.Validation.ExceedsMaximum maxPackageBytes ->
Except.throw $ "Package tarball is " <> show bytes <> " bytes, which exceeds the maximum size of " <> show maxPackageBytes <> " bytes."
Expand Down Expand Up @@ -1144,11 +1145,11 @@ jsonToDhallManifest dhallTypes jsonStr = do
-- will remove the './' prefix. We need to manually append this to the relative path.
let args = [ "--records-loose", "--unions-strict", Path.concat [ dhallTypes, "v1", "Manifest.dhall" ] ]
process <- Execa.execa cmd args identity
process.stdin.writeUtf8End jsonStr
result <- process.result
pure case result of
Right _ -> Right jsonStr
Left { stderr } -> Left stderr
for_ process.stdin \{ writeUtf8End } -> writeUtf8End jsonStr
result <- process.getResult
pure case result.exit of
Normally 0 -> Right jsonStr
_ -> Left result.stderr

getPacchettiBotti :: forall r. Run (PACCHETTIBOTTI_ENV + r) Owner
getPacchettiBotti = do
Expand Down
2 changes: 1 addition & 1 deletion app/src/App/GitHubIssue.purs
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ main = launchAff_ $ do

liftEffect (Ref.read thrownRef) >>= case _ of
true ->
liftEffect $ Process.exit 1
liftEffect $ Process.exit' 1
_ -> do
-- After the run, close the issue. If an exception was thrown then the issue will remain open.
_ <- Octokit.request env.octokit (Octokit.closeIssueRequest { address: Constants.registry, issue: env.issue })
Expand Down
2 changes: 1 addition & 1 deletion app/src/App/Server.purs
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ main = do
createServerEnv # Aff.runAff_ case _ of
Left error -> do
Console.log $ "Failed to start server: " <> Aff.message error
Process.exit 1
Process.exit' 1
Right env -> do
_healthcheck <- Aff.launchAff do
let
Expand Down
4 changes: 2 additions & 2 deletions app/src/Fetch/Retry.purs
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ import Effect.Aff (Error)
import Effect.Aff as Aff
import Fetch (class ToCoreRequestOptions, HighlevelRequestOptions, Response, new)
import Fetch (Response) as ReExport
import Fetch.Core as Core
import Fetch.Core.Request as CoreRequest
import Fetch.Internal.Request as Request
import Fetch.Internal.Response as Response
import JS.Fetch as Core
import JS.Fetch.Request as CoreRequest
import Prim.Row (class Union)
import Promise.Aff as Promise.Aff

Expand Down
2 changes: 1 addition & 1 deletion foreign/src/Foreign/Gzip.purs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import Effect.Aff.Class (class MonadAff, liftAff)
import Effect.Exception (Error)
import Effect.Uncurried (EffectFn1, EffectFn3, mkEffectFn1, runEffectFn3)
import Fetch (class ToRequestBody)
import Fetch.Core.RequestBody (RequestBody)
import JS.Fetch.RequestBody (RequestBody)
import Node.Buffer (Buffer)
import Unsafe.Coerce (unsafeCoerce)

Expand Down
5 changes: 3 additions & 2 deletions foreign/test/Foreign/Gzip.purs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ module Test.Registry.Foreign.Gzip (spec) where

import Prelude

import Data.Either (Either(..))
import Data.Maybe (fromMaybe)
import Node.ChildProcess.Types (Exit(..))
import Node.FS.Aff as FS.Aff
import Node.Library.Execa as Execa
import Node.Path as Path
Expand All @@ -25,4 +26,4 @@ spec = do
result <- _.getResult =<< Execa.execa "zcat" [ file ] identity
case result.exit of
Normally 0 -> result.stdout `Assert.shouldEqual` contents
_ -> Assert.fail $ result.originalMessage
_ -> Assert.fail $ fromMaybe result.message result.originalMessage
6 changes: 3 additions & 3 deletions scripts/src/CompilerVersions.purs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ main = launchAff_ do
args <- Array.drop 2 <$> liftEffect Process.argv
let description = "A script for determining the supported compiler versions for packages."
arguments <- case Arg.parseArgs "compiler-versions" description parser args of
Left err -> Console.log (Arg.printArgError err) *> liftEffect (Process.exit 1)
Left err -> Console.log (Arg.printArgError err) *> liftEffect (Process.exit' 1)
Right command -> pure command

-- Environment
Expand Down Expand Up @@ -141,7 +141,7 @@ main = launchAff_ do
let
interpret :: Run _ ~> Aff
interpret =
Except.catch (\error -> Run.liftEffect (Console.log error *> Process.exit 1))
Except.catch (\error -> Run.liftEffect (Console.log error *> Process.exit' 1))
>>> Registry.interpret (Registry.handle registryEnv)
>>> Storage.interpret (Storage.handleReadOnly cache)
>>> GitHub.interpret (GitHub.handle { octokit, cache, ref: githubCacheRef })
Expand Down Expand Up @@ -229,7 +229,7 @@ compilersForPackageVersion package version target = do

if Array.null supported then do
Log.error $ "Could not find supported compiler versions for " <> formatPackageVersion package version
Run.liftEffect $ Process.exit 1
Run.liftEffect $ Process.exit' 1
else
Log.info $ "Found supported compiler versions for " <> formatPackageVersion package version <> ": " <> Array.intercalate ", " (map Version.print supported)

Expand Down
4 changes: 2 additions & 2 deletions scripts/src/LegacyImporter.purs
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ main = launchAff_ do

let description = "A script for uploading legacy registry packages."
mode <- case Arg.parseArgs "legacy-importer" description parser args of
Left err -> Console.log (Arg.printArgError err) *> liftEffect (Process.exit 1)
Left err -> Console.log (Arg.printArgError err) *> liftEffect (Process.exit' 1)
Right command -> pure command

Env.loadEnvFile ".env"
Expand Down Expand Up @@ -166,7 +166,7 @@ main = launchAff_ do
# runAppEffects
# Cache.interpret Legacy.Manifest._legacyCache (Cache.handleMemoryFs { cache, ref: legacyCacheRef })
# Cache.interpret _importCache (Cache.handleMemoryFs { cache, ref: importCacheRef })
# Except.catch (\msg -> Log.error msg *> Run.liftEffect (Process.exit 1))
# Except.catch (\msg -> Log.error msg *> Run.liftEffect (Process.exit' 1))
# Comment.interpret Comment.handleLog
# Log.interpret (\log -> Log.handleTerminal Normal log *> Log.handleFs Verbose logPath log)
# Env.runResourceEnv resourceEnv
Expand Down
4 changes: 2 additions & 2 deletions scripts/src/PackageDeleter.purs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ main = launchAff_ do
args <- Array.drop 2 <$> liftEffect Process.argv
let description = "A script for deleting registry packages."
arguments <- case Arg.parseArgs "package-deleter" description parser args of
Left err -> Console.log (Arg.printArgError err) *> liftEffect (Process.exit 1)
Left err -> Console.log (Arg.printArgError err) *> liftEffect (Process.exit' 1)
Right command -> pure command

-- Environment
Expand Down Expand Up @@ -145,7 +145,7 @@ main = launchAff_ do
Package name version -> pure $ Map.singleton name [ version ]
-- --file packagesversions.json
File path -> liftAff (readJsonFile deletePackagesCodec path) >>= case _ of
Left err -> Console.log err *> liftEffect (Process.exit 1)
Left err -> Console.log err *> liftEffect (Process.exit' 1)
Right values -> pure values

let
Expand Down
4 changes: 2 additions & 2 deletions scripts/src/PackageSetUpdater.purs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ main = Aff.launchAff_ do
args <- Array.drop 2 <$> liftEffect Process.argv
let description = "A script for updating the package sets."
mode <- case Arg.parseArgs "package-set-updater" description parser args of
Left err -> Console.log (Arg.printArgError err) *> liftEffect (Process.exit 1)
Left err -> Console.log (Arg.printArgError err) *> liftEffect (Process.exit' 1)
Right command -> pure command

-- Environment
Expand Down Expand Up @@ -113,7 +113,7 @@ main = Aff.launchAff_ do
# Registry.interpret (Registry.handle registryEnv)
# Storage.interpret (Storage.handleReadOnly cache)
# GitHub.interpret (GitHub.handle { octokit, cache, ref: githubCacheRef })
# Except.catch (\msg -> Log.error msg *> Run.liftEffect (Process.exit 1))
# Except.catch (\msg -> Log.error msg *> Run.liftEffect (Process.exit' 1))
# Comment.interpret Comment.handleLog
# Log.interpret (\log -> Log.handleTerminal Normal log *> Log.handleFs Verbose logPath log)
# Env.runResourceEnv resourceEnv
Expand Down
2 changes: 1 addition & 1 deletion scripts/src/PackageTransferrer.purs
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ main = launchAff_ do
# Registry.interpret (Registry.handle registryEnv)
# Storage.interpret (Storage.handleReadOnly cache)
# GitHub.interpret (GitHub.handle { octokit, cache, ref: githubCacheRef })
# Except.catch (\msg -> Log.error msg *> Run.liftEffect (Process.exit 1))
# Except.catch (\msg -> Log.error msg *> Run.liftEffect (Process.exit' 1))
# Comment.interpret Comment.handleLog
# Log.interpret (\log -> Log.handleTerminal Normal log *> Log.handleFs Verbose logPath log)
# Env.runPacchettiBottiEnv { privateKey, publicKey }
Expand Down
6 changes: 3 additions & 3 deletions scripts/src/Solver.purs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ main = launchAff_ do
getAction = case args of
[ "--file", path ] -> do
packageversions <- liftAff (readJsonFile deletePackagesCodec path) >>= case _ of
Left err -> Aff.log err *> liftEffect (Process.exit 1)
Left err -> Aff.log err *> liftEffect (Process.exit' 1)
Right values -> pure values
pure \registry -> do
forWithIndex_ packageversions \package versionsofpackage -> do
Expand All @@ -85,7 +85,7 @@ main = launchAff_ do
package = unsafeFromRight $ PackageName.parse "manifest"
version = unsafeFromRight $ Version.parse "0.0.0"
deps <- liftAff (readJsonFile codec path) >>= case _ of
Left err -> Aff.log err *> liftEffect (Process.exit 1)
Left err -> Aff.log err *> liftEffect (Process.exit' 1)
Right values -> pure values
pure \registry -> test registry package version deps
[ "--all" ] -> pure \registry -> do
Expand Down Expand Up @@ -148,7 +148,7 @@ main = launchAff_ do
# runAppEffects
# Cache.interpret Legacy.Manifest._legacyCache (Cache.handleMemoryFs { cache, ref: legacyCacheRef })
# Cache.interpret _importCache (Cache.handleMemoryFs { cache, ref: importCacheRef })
# Except.catch (\msg -> Log.error msg *> Run.liftEffect (Process.exit 1))
# Except.catch (\msg -> Log.error msg *> Run.liftEffect (Process.exit' 1))
# Comment.interpret Comment.handleLog
# Env.runResourceEnv resourceEnv
# Log.interpret (\log -> Log.handleTerminal Normal log *> Log.handleFs Verbose logPath log)
Expand Down
8 changes: 4 additions & 4 deletions scripts/src/VerifyIntegrity.purs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ main = launchAff_ do
args <- Array.drop 2 <$> liftEffect Process.argv
let description = "A script for verifying that the registry and registry-index repos match each other and S3."
arguments <- case Arg.parseArgs "package-verify" description parser args of
Left err -> Console.log (Arg.printArgError err) *> liftEffect (Process.exit 1)
Left err -> Console.log (Arg.printArgError err) *> liftEffect (Process.exit' 1)
Right command -> pure command

-- Environment
Expand Down Expand Up @@ -103,13 +103,13 @@ main = launchAff_ do
Package name -> pure (Just [ name ])
-- --file packagesversions.json
File path -> liftAff (readJsonFile (CA.array PackageName.codec) path) >>= case _ of
Left err -> Console.log err *> liftEffect (Process.exit 1)
Left err -> Console.log err *> liftEffect (Process.exit' 1)
Right values -> pure (Just values)
All -> pure Nothing

let
interpret =
Except.catch (\error -> Run.liftEffect (Console.log error *> Process.exit 1))
Except.catch (\error -> Run.liftEffect (Console.log error *> Process.exit' 1))
>>> Registry.interpret (Registry.handle registryEnv)
>>> Storage.interpret (Storage.handleS3 { s3, cache })
>>> GitHub.interpret (GitHub.handle { octokit, cache, ref: githubCacheRef })
Expand Down Expand Up @@ -146,7 +146,7 @@ main = launchAff_ do

Log.info "Finished."
when (any isLeft results) do
liftEffect $ Process.exit 1
liftEffect $ Process.exit' 1

intercalateMap :: forall f a d. Monoid d => Foldable f => d -> (a -> d) -> f a -> d
intercalateMap s f = intercalate s <<< map f <<< Array.fromFoldable
Expand Down
Loading
Loading