Skip to content

Commit

Permalink
fix: generator -> Error: Impossible: spawnSync child process neither …
Browse files Browse the repository at this point in the history
…exited nor was killed.
  • Loading branch information
srghma committed Oct 13, 2024
1 parent aabb5b3 commit caf8dcf
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,21 +44,25 @@ main = runAff_ (either throwException mempty) do

writeTextFile UTF8 (Path.concat [ tmpPath, "spago.yaml" ]) defaultSpagoYaml
writeTextFile UTF8 (Path.concat [ tmpPath, "package.json" ]) defaultPackageJson
liftEffect $ Console.log $ "running 'npm install'"
_ <- liftEffect $ ChildProcess.execSync' "npm install" (_ { cwd = Just tmpPath })

liftEffect $ Console.log $ "running 'spago ls packages --json'"
s <- liftEffect $ Buffer.toString UTF8 =<< Exec.execSync' "spago ls packages --json" (_ { cwd = Just tmpPath })

packages <- case Data.Argonaut.Decode.decodeJson =<< Data.Argonaut.Decode.parseJson s of
Left err -> throwError $ error $ Data.Argonaut.Decode.printJsonDecodeError err
Right (object :: Object Json) -> pure $ Foreign.Object.keys object

liftEffect $ Console.log $ "running 'spago install " <> Str.joinWith " " packages <> "'"
_ <- liftEffect $ Exec.execSync' ("spago install " <> Str.joinWith " " packages) (_ { cwd = Just tmpPath })
pursFiles <- getPursFiles 0 (tmpPath <> "/.spago")

let genCmdFile = Path.concat [ cwdPath, "bin", "index.js" ]
let genCmdFile = Path.concat [ cwdPath, "cli", "index.js" ]
let genCmdArgs = [ "generate-operators" ] <> pursFiles

-- liftEffect $ Console.log $ "Using command " <> Str.joinWith " " ([ genCmdFile ] <> genCmdArgs) <> "\n"
liftEffect $ Console.log $ "running " <> Str.joinWith " " ([ genCmdFile, "..."]) <> "\n"
-- liftEffect $ Console.log $ "running " <> Str.joinWith " " ([ genCmdFile ] <> genCmdArgs) <> "\n"

genCmdResult <- liftEffect $ Node.Library.Execa.execaSync genCmdFile genCmdArgs
( _
Expand Down Expand Up @@ -140,6 +144,6 @@ defaultSpagoYaml = Array.intercalate "\n"
, " dependencies: []"
, "workspace:"
, " package_set:"
, " registry: 50.4.0"
, " registry: 60.5.1"
, " extra_packages: {}"
]
35 changes: 32 additions & 3 deletions lib/src/Tidy/Operators/Defaults.purs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ module Tidy.Operators.Defaults where
defaultOperators :: Array String
defaultOperators =
[ """ApplicativePhases.(:) 6"""
, """Beta.DOM.(++) 0"""
, """Beta.DOM.Internal.(++) 0"""
, """Bookhound.ParserCombinators.(->>-) 6"""
, """Bookhound.ParserCombinators.(<#>) 6"""
, """Bookhound.ParserCombinators.(<&>) 6"""
Expand Down Expand Up @@ -339,7 +341,8 @@ defaultOperators =
, """Data.Functor.Pairing.(⋈) type 4"""
, """Data.Functor.Product.Nested.(</\>) type 6"""
, """Data.Functor.Product.Nested.(</\>) 6"""
, """Data.Geometry.Plane.(<+|) 6"""
, """Data.Geometria.(<+|) 6"""
, """Data.Geometria.Types.(<+|) 6"""
, """Data.Group.Action.(+>) 6"""
, """Data.Group.Action.(<+) 6"""
, """Data.HeytingAlgebra.(&&) 3"""
Expand Down Expand Up @@ -474,13 +477,13 @@ defaultOperators =
, """Data.Set.Ordered.(..) 8"""
, """Data.Set.Ordered.(:) 6"""
, """Data.Set.Ordered.(\\) 5"""
, """Data.Sparse.Matrix.(??) 8"""
, """Data.Sparse.Matrix.(!!) 8"""
, """Data.Sparse.Matrix.(~) 7"""
, """Data.Sparse.Matrix.(~*) 7"""
, """Data.Sparse.Matrix.(~+) 7"""
, """Data.Sparse.Polynomial.(!) 8"""
, """Data.Sparse.Polynomial.(.-) 5"""
, """Data.Sparse.Polynomial.(:.) 5"""
, """Data.Sparse.Polynomial.(?) 8"""
, """Data.Sparse.Polynomial.(^) 8"""
, """Data.Tuple.Nested.(/\) type 6"""
, """Data.Tuple.Nested.(/\) 6"""
Expand Down Expand Up @@ -509,6 +512,10 @@ defaultOperators =
, """Data.UInt64.(.&.) 10"""
, """Data.UInt64.(.^.) 10"""
, """Data.UInt64.(.|.) 10"""
, """Data.URL.(#) 3"""
, """Data.URL.(&) 3"""
, """Data.URL.(/) 3"""
, """Data.URL.(?) 3"""
, """Data.Undefined.NoProblem.(:::) type 6"""
, """Data.Undefined.NoProblem.(<>) type 2"""
, """Data.Undefined.NoProblem.(|>) type 1"""
Expand Down Expand Up @@ -572,6 +579,18 @@ defaultOperators =
, """Elmish.Test.Combinators.(>>) 8"""
, """ExpectInferred.(+) type 2"""
, """ExpectInferred.(^) type 1"""
, """FFI.Simple.(!-) 9"""
, """FFI.Simple.(!=) 9"""
, """FFI.Simple.(..) 9"""
, """FFI.Simple.(...) 4"""
, """FFI.Simple.(.=) 9"""
, """FFI.Simple.(.?) 9"""
, """FFI.Simple.Functions.(...) 4"""
, """FFI.Simple.Objects.(!-) 9"""
, """FFI.Simple.Objects.(!=) 9"""
, """FFI.Simple.Objects.(..) 9"""
, """FFI.Simple.Objects.(.=) 9"""
, """FFI.Simple.Objects.(.?) 9"""
, """FRP.Event.Class.(*|>) 4"""
, """FRP.Event.Class.(<**>) 4"""
, """FRP.Event.Class.(<**|>) 4"""
Expand Down Expand Up @@ -667,6 +686,7 @@ defaultOperators =
, """Pipes.(>~) 5"""
, """Pipes.(~<) 5"""
, """Pipes.(~>) 4"""
, """Pipes.Async.(>-/->) 7"""
, """Pipes.Core.(+>>) 6"""
, """Pipes.Core.(//<) 4"""
, """Pipes.Core.(//>) 4"""
Expand Down Expand Up @@ -806,6 +826,12 @@ defaultOperators =
, """Signal.(~>) 4"""
, """StringParser.(<?>) 4"""
, """StringParser.Combinators.(<?>) 4"""
, """TLDR.Combinators.($>) type 4"""
, """TLDR.Combinators.(<$) type 4"""
, """TLDR.Combinators.(||) type 2"""
, """TLDR.List.(:) type 6"""
, """TLDR.Matchers.(&&&) type 2"""
, """TLDR.Matchers.(|||) type 2"""
, """Tecton.(#+) 9"""
, """Tecton.(#-) 9"""
, """Tecton.($=) 8"""
Expand Down Expand Up @@ -882,6 +908,9 @@ defaultOperators =
, """Text.PrettyPrint.Leijen.(<+>) 6"""
, """Text.PrettyPrint.Leijen.(<//>) 5"""
, """Text.PrettyPrint.Leijen.(</>) 5"""
, """Text.Smolder.Markup.(!) 4"""
, """Text.Smolder.Markup.(!?) 4"""
, """Text.Smolder.Markup.(#!) 4"""
, """TsBridge.(|&|) type 7"""
, """TsBridge.(~) type 9"""
, """TsBridge.Types.Intersection.(|&|) type 7"""
Expand Down
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@
"bundle:cli:worker": "purs-backend-es bundle-app --platform node --to \"./bundle/Cli.Worker/index.js\" --main Cli.Worker --no-build",
"test": "npm run test:lib",
"test:lib": "spago test --package tidy --censor-stats --strict --pedantic-packages",
"run:generate-default-operators": "spago run --package tidy-generate-default-operators --main GenerateDefaultOperatorsModule",
"generate-default-operators:update_registry": "registry_value=$(awk '/registry:/ {print $2}' spago.yaml) && echo \"registry_value=\" $registry_value && sed -i \"s/registry:.*/registry: $registry_value\\\"/\" generate-default-operators/src/GenerateDefaultOperatorsModule.purs",
"generate-default-operators:run": "spago run --package tidy-generate-default-operators --main GenerateDefaultOperatorsModule",
"generate-default-operators": "npm run generate-default-operators:update_registry && npm run generate-default-operators:run",
"format-self": "npm run build && node ./cli/index.js format-in-place lib bin generate-default-operators",
"check-self": "node ./cli/index.js check lib bin generate-default-operators",
"prepublishOnly": "rm -rf output bundle && npm run bundle:cli"
Expand Down

0 comments on commit caf8dcf

Please sign in to comment.