Skip to content

Instantly share code, notes, and snippets.

@wolfadex
Forked from dillonkearns/Main.elm
Last active June 24, 2023 01:13
Show Gist options
  • Save wolfadex/1caccac7ce5f9c78661e7eb40ccdb3ac to your computer and use it in GitHub Desktop.
Save wolfadex/1caccac7ce5f9c78661e7eb40ccdb3ac to your computer and use it in GitHub Desktop.
{
"type": "application",
"source-directories": [
"."
],
"elm-version": "0.19.1",
"dependencies": {
"direct": {
"TSFoster/elm-uuid": "4.2.0",
"avh4/elm-color": "1.0.0",
"dillonkearns/elm-pages": "10.0.1",
"elm/browser": "1.0.2",
"elm/core": "1.0.5",
"elm/html": "1.0.0",
"elm/http": "2.0.0",
"elm/json": "1.1.3",
"elm/random": "1.0.0",
"elm/regex": "1.0.0",
"elm-community/list-extra": "8.7.0",
"elm-community/string-extra": "4.0.1",
"elm-explorations/linear-algebra": "1.0.3",
"elm-explorations/webgl": "1.1.3",
"fujiy/elm-json-convert": "1.0.0",
"ianmackenzie/elm-3d-camera": "3.1.0",
"ianmackenzie/elm-3d-scene": "1.0.1",
"ianmackenzie/elm-geometry": "3.9.1",
"ianmackenzie/elm-units": "2.9.0",
"justinmimbs/date": "4.0.1",
"mdgriffith/elm-codegen": "3.0.0",
"miniBill/elm-fast-dict": "1.1.0",
"pzp1997/assoc-list": "1.0.0",
"rtfeldman/elm-css": "18.0.0",
"wolfadex/elm-ecs": "2.0.0"
},
"indirect": {
"Chadtech/elm-bool-extra": "2.4.2",
"TSFoster/elm-bytes-extra": "1.3.0",
"TSFoster/elm-md5": "2.0.1",
"TSFoster/elm-sha1": "2.1.1",
"danfishgold/base64-bytes": "1.1.0",
"danyx23/elm-mimetype": "4.0.1",
"dillonkearns/elm-bcp47-language-tag": "1.0.1",
"dillonkearns/elm-cli-options-parser": "3.2.0",
"dillonkearns/elm-date-or-date-time": "2.0.0",
"dillonkearns/elm-form": "3.0.0",
"elm/bytes": "1.0.8",
"elm/file": "1.0.5",
"elm/parser": "1.1.0",
"elm/time": "1.0.0",
"elm/url": "1.0.0",
"elm/virtual-dom": "1.0.3",
"elm-community/basics-extra": "4.1.0",
"elm-community/maybe-extra": "5.3.0",
"fredcy/elm-parseint": "2.0.1",
"ianmackenzie/elm-1d-parameter": "1.0.1",
"ianmackenzie/elm-float-extra": "1.1.0",
"ianmackenzie/elm-geometry-linear-algebra-interop": "2.0.2",
"ianmackenzie/elm-interval": "2.0.0",
"ianmackenzie/elm-triangular-mesh": "1.1.0",
"ianmackenzie/elm-units-interval": "2.3.0",
"jluckyiv/elm-utc-date-strings": "1.0.0",
"miniBill/elm-codec": "2.0.0",
"miniBill/elm-unicode": "1.0.3",
"noahzgordon/elm-color-extra": "1.0.2",
"robinheghan/fnv1a": "1.0.0",
"robinheghan/murmur3": "1.0.0",
"rtfeldman/elm-hex": "1.0.0",
"rtfeldman/elm-iso8601-date-strings": "1.1.4",
"stil4m/elm-syntax": "7.2.9",
"stil4m/structured-writer": "1.0.3",
"the-sett/elm-pretty-printer": "3.0.0",
"the-sett/elm-syntax-dsl": "6.0.2",
"vito/elm-ansi": "10.0.1"
}
},
"test-dependencies": {
"direct": {},
"indirect": {}
}
}
module Main exposing (run)
import BackendTask
import BackendTask.File
import BackendTask.Glob
import Elm
import Elm.Annotation
import Pages.Script exposing (Script)
run : Script
run =
Pages.Script.withoutCliOptions
(BackendTask.Glob.succeed identity
|> BackendTask.Glob.match (BackendTask.Glob.literal "plugins/BonsaiPlugin/")
|> BackendTask.Glob.capture BackendTask.Glob.wildcard
|> BackendTask.Glob.match (BackendTask.Glob.literal ".elm")
|> BackendTask.Glob.toBackendTask
|> BackendTask.andThen
(\paths ->
Pages.Script.writeFile
{ path = "codegen/Plugins.elm"
, body =
Elm.file [ "Plugins" ]
[ Elm.declaration "components" <|
Elm.apply (Elm.val "List.foldl")
[ Elm.fn2
( "next", Nothing )
( "acc", Nothing )
(\next acc ->
Elm.apply
(Elm.value
{ importFrom = [ "Dict" ]
, name = "union"
, annotation = Nothing
}
)
[ acc, next ]
)
, Elm.value { importFrom = [ "Dict" ], name = "empty", annotation = Nothing }
, paths
|> List.map
(\path ->
Elm.value
{ importFrom = [ "BonsaiPlugin", path ]
, name = "components"
, annotation = Nothing
}
)
|> Elm.list
]
, Elm.declaration "systems" <|
Elm.apply (Elm.val "List.foldl")
[ Elm.fn2
( "next", Nothing )
( "acc", Nothing )
(\next acc ->
Elm.apply
(Elm.value
{ importFrom = [ "Dict" ]
, name = "union"
, annotation = Nothing
}
)
[ acc, next ]
)
, Elm.value { importFrom = [ "Dict" ], name = "empty", annotation = Nothing }
, paths
|> List.map
(\path ->
Elm.value
{ importFrom = [ "BonsaiPlugin", path ]
, name = "systems"
, annotation = Nothing
}
)
|> Elm.list
]
]
|> .contents
}
)
|> BackendTask.allowFatal
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment