forked from purescript/purescript
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBundle.hs
More file actions
47 lines (38 loc) · 1.29 KB
/
Bundle.hs
File metadata and controls
47 lines (38 loc) · 1.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
-- | Bundles compiled PureScript modules for the browser.
module Command.Bundle (command, initSqlite) where
import Prelude
import Language.PureScript.Make.IdeCache (sqliteInit)
import Options.Applicative qualified as Opts
import System.Exit (exitFailure)
import System.IO (stderr, hPutStrLn)
data PublishOptionsCLI = PublishOptionsCLI
{ cliCompileOutputDir :: FilePath
}
compileOutputDir :: Opts.Parser FilePath
compileOutputDir = Opts.option Opts.auto $
Opts.value "output"
<> Opts.showDefault
<> Opts.long "compile-output"
<> Opts.metavar "DIR"
<> Opts.help "Compiler output directory"
cliOptions :: Opts.Parser PublishOptionsCLI
cliOptions =
PublishOptionsCLI <$> compileOutputDir
app :: IO ()
app = do
hPutStrLn stderr $ unlines
[ "'purs bundle' was removed in the v0.15.0 release."
, "See https://github.com/purescript/documentation/blob/master/migration-guides/0.15-Migration-Guide.md"
, "for more information and bundler alternatives."
]
exitFailure
-- | Make it go.
command :: Opts.Parser (IO ())
command = run <$> (Opts.helper <*> pure ()) where
run :: () -> IO ()
run _ = app
initSqlite :: Opts.Parser (IO ())
initSqlite = run <$> (Opts.helper <*> cliOptions) where
run :: PublishOptionsCLI -> IO ()
run opts = do
sqliteInit opts.cliCompileOutputDir