Skip to content

Commit

Permalink
Remove meta and map file
Browse files Browse the repository at this point in the history
  • Loading branch information
f-f committed Jan 20, 2025
1 parent 757a85e commit 98a29e0
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 64 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
/.spago
/bin/bundle.js
/bin/docs-search-app.js
/bin/docs-search-app.js.map
.direnv
.envrc
.spec-results
Expand Down
7 changes: 0 additions & 7 deletions bin/docs-search-app.js.map

This file was deleted.

24 changes: 10 additions & 14 deletions docs-search/client-halogen/src/Docs/Search/App.purs
Original file line number Diff line number Diff line change
@@ -1,23 +1,21 @@
-- | This is the main module of the client-side Halogen app.
module Docs.Search.App where

import Docs.Search.App.SearchField as SearchField
import Docs.Search.App.SearchResults as SearchResults
import Docs.Search.App.Sidebar as Sidebar
import Docs.Search.Config as Config
import Docs.Search.Extra (whenJust)
import Docs.Search.ModuleIndex as ModuleIndex
import Docs.Search.PackageIndex as PackageIndex
import Docs.Search.Meta as Meta

import Prelude

import Control.Alt (alt)
import Data.Map as Map
import Data.Maybe (Maybe(..))
import Data.Newtype (wrap)
import Data.Map as Map
import Data.Tuple (Tuple(..))
import Data.Tuple.Nested ((/\))
import Docs.Search.App.SearchField as SearchField
import Docs.Search.App.SearchResults as SearchResults
import Docs.Search.App.Sidebar as Sidebar
import Docs.Search.Config as Config
import Docs.Search.Extra (whenJust)
import Docs.Search.ModuleIndex as ModuleIndex
import Docs.Search.PackageIndex as PackageIndex
import Effect (Effect)
import Effect.Aff (launchAff_)
import Halogen as H
Expand All @@ -26,8 +24,8 @@ import Halogen.Subscription (subscribe)
import Halogen.VDom.Driver (runUI)
import MarkdownIt as MD
import Web.DOM.ChildNode as ChildNode
import Web.DOM.Document as Document
import Web.DOM.Document (Document)
import Web.DOM.Document as Document
import Web.DOM.Element as Element
import Web.DOM.Node as Node
import Web.DOM.ParentNode as ParentNode
Expand Down Expand Up @@ -66,7 +64,6 @@ main = do
HA.runHalogenAff do
packageIndex <- PackageIndex.loadPackageIndex
moduleIndex <- ModuleIndex.unpackModuleIndex <$> ModuleIndex.loadModuleIndex
meta <- Meta.load
let scores = PackageIndex.mkScoresFromPackageIndex packageIndex

let
Expand All @@ -82,7 +79,6 @@ main = do
initialSearchEngineState
pageContents
markdownIt
meta

sfio <- runUI SearchField.component unit searchField
srio <- runUI resultsComponent unit searchResults
Expand All @@ -106,7 +102,7 @@ main = do
addEventListener hashchange listener true (Window.toEventTarget window)

sbio <- do
component <- Sidebar.mkComponent moduleIndex isIndexHTML meta
component <- Sidebar.mkComponent moduleIndex isIndexHTML
runUI component unit sidebarContainer

-- Subscribe to window focus events
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import Docs.Search.DocTypes (DataDeclType(..))
import Docs.Search.Engine (Result(..), packageInfoToString)
import Docs.Search.Engine as Engine
import Docs.Search.Extra ((>#>))
import Docs.Search.Meta (Meta)
import Docs.Search.ModuleIndex (ModuleResult)
import Docs.Search.PackageIndex (PackageResult)
import Docs.Search.SearchResult (ResultInfo(..), SearchResult(..))
Expand Down Expand Up @@ -71,9 +70,8 @@ mkComponent
. EngineState
-> Element
-> MD.MarkdownIt
-> Meta
-> H.Component Query i o Aff
mkComponent initialEngineState contents markdownIt _ =
mkComponent initialEngineState contents markdownIt =
H.mkComponent
{ initialState: const
{ engineState: initialEngineState
Expand Down
4 changes: 1 addition & 3 deletions docs-search/client-halogen/src/Docs/Search/App/Sidebar.purs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import Data.Set as Set
import Data.Traversable (traverse)
import Data.Tuple.Nested (type (/\), (/\))
import Docs.Search.Config as Config
import Docs.Search.Meta (Meta)
import Docs.Search.ModuleIndex (ModuleIndex)
import Docs.Search.Types (ModuleName(..), PackageInfo(..))
import Effect (Effect)
Expand Down Expand Up @@ -61,9 +60,8 @@ mkComponent
:: forall i
. ModuleIndex
-> IsIndexHTML
-> Meta
-> Aff (H.Component Query i Action Aff)
mkComponent moduleIndex@{ packageModules } isIndexHTML _ = do
mkComponent moduleIndex@{ packageModules } isIndexHTML = do
groupingMode <- H.liftEffect loadGroupingModeFromLocalStorage
mbModuleName <- H.liftEffect getCurrentModuleName
let currentPackage = getCurrentPackage moduleIndex mbModuleName
Expand Down
26 changes: 0 additions & 26 deletions docs-search/common/src/Docs/Search/Meta.purs

This file was deleted.

11 changes: 0 additions & 11 deletions docs-search/index/src/Docs/Search/IndexBuilder.purs
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,6 @@ import Docs.Search.Declarations as Declarations
import Docs.Search.DocTypes (DocModule)
import Docs.Search.DocTypes as Docs
import Docs.Search.Extra ((>#>))
import Docs.Search.Meta (Meta)
import Docs.Search.Meta as Meta
import Docs.Search.ModuleIndex (PackedModuleIndex)
import Docs.Search.ModuleIndex as ModuleIndex
import Docs.Search.PackageIndex (PackageInfo)
Expand Down Expand Up @@ -107,7 +105,6 @@ run cfg = do
typeIndex = TypeIndex.mkTypeIndex cfg.moduleGraph cfg.workspacePackages scores docsJsons
packageInfo = PackageIndex.mkPackageInfo scores packageMetas
moduleIndex = ModuleIndex.mkPackedModuleIndex cfg.moduleGraph cfg.workspacePackages index
meta = {}

createDirectories cfg

Expand All @@ -116,7 +113,6 @@ run cfg = do
<*> parallel (writeTypeIndex typeIndex)
<*> parallel (writePackageInfo packageInfo)
<*> parallel (writeModuleIndex moduleIndex)
<*> parallel (writeMeta meta)
<*> parallel (patchDocs cfg)
<*> parallel (copyAppFile cfg)

Expand Down Expand Up @@ -266,13 +262,6 @@ writeModuleIndex moduleIndex = do
where
header = "window.DocsSearchModuleIndex = "

writeMeta :: Meta -> Aff Unit
writeMeta meta = do
writeTextFile UTF8 (unwrap Config.metaPath) $
header <> JSON.print (CJ.encode Meta.metaCodec meta)
where
header = "window." <> unwrap Config.metaItem <> " = "

-- | Get a mapping from index parts to index contents.
getIndex :: Declarations -> Map PartId (Array (Tuple String (Array SearchResult)))
getIndex (Declarations trie) =
Expand Down

0 comments on commit 98a29e0

Please sign in to comment.