git.iko.soy/rowtype-yoga/purescript-docs-search
on master help sign in
Add `--no-patch` flag to `build-index` command. (#22)

Add `--no-patch` flag to `build-index` command.

commit480f3bd917274172e5bb699e630de9ce33e1768f authorVladimir Kalnitsky <klntsky@gmail.com> dateSat 21 Sep 2019, 09:21 (7 years ago) parent363e001
3 files changed+18−7
CHANGELOG.md+1 src/Docs/Search/IndexBuilder.purs+9−5 src/Docs/Search/Main.purs+8−2
CHANGELOG.md+1
@@ -12,6 +12,7 @@ New features:
1212- Show help for each CLI command (#17)
1313- Add packages to the search index (#16)
1414- Sort search results by popularity (based on number of package reverse dependencies).
15+- Add `--no-patch` flag to `build-index` command.
1516
1617Bugfixes:
1718- Fix decoding of kind annotations in `forall`s (#17)
src/Docs/Search/IndexBuilder.purs+9−5
@@ -43,10 +43,12 @@ import Node.Process as Process
4343import Web.Bower.PackageMeta (PackageMeta(..))
4444
4545
46−type Config = { docsFiles :: Array String
47− , bowerFiles :: Array String
48− , generatedDocs :: String
49− }
46+type Config =
47+ { docsFiles :: Array String
48+ , bowerFiles :: Array String
49+ , generatedDocs :: String
50+ , noPatch :: Boolean
51+ }
5052
5153
5254run :: Config -> Effect Unit
@@ -83,7 +85,9 @@ run' cfg = do
8385 ignore <$> parallel (writeIndex cfg index)
8486 <*> parallel (writeTypeIndex cfg typeIndex)
8587 <*> parallel (writePackageInfo packageInfo)
86− <*> parallel (patchDocs cfg)
88+ <*> parallel (if cfg.noPatch
89+ then pure unit
90+ else patchDocs cfg)
8791 <*> parallel (copyAppFile cfg)
8892
8993 let countOfDefinitions = Trie.size $ unwrap index
src/Docs/Search/Main.purs+8−2
@@ -14,7 +14,7 @@ import Data.Maybe (Maybe, fromMaybe, optional)
1414import Data.Unfoldable (class Unfoldable)
1515import Effect (Effect)
1616import Effect.Console (log)
17−import Options.Applicative (Parser, command, execParser, fullDesc, helper, info, long, metavar, progDesc, strOption, subparser, value, (<**>))
17+import Options.Applicative (Parser, command, execParser, flag, fullDesc, help, helper, info, long, metavar, progDesc, strOption, subparser, value, (<**>))
1818import Options.Applicative as CA
1919
2020
@@ -45,6 +45,7 @@ data Commands
4545 { docsFiles :: Array String
4646 , bowerFiles :: Array String
4747 , generatedDocs :: String
48+ , noPatch :: Boolean
4849 }
4950 | Search
5051 { docsFiles :: Array String
@@ -92,7 +93,12 @@ buildIndex = ado
9293 <> value "./generated-docs/"
9394 )
9495
95− in BuildIndex { docsFiles, bowerFiles, generatedDocs }
96+ noPatch <- flag false true
97+ ( long "no-patch"
98+ <> help "Do not patch the HTML docs, only build indices"
99+ )
100+
101+ in BuildIndex { docsFiles, bowerFiles, generatedDocs, noPatch }
96102
97103
98104startInteractive :: Parser Commands