Skip to content

Commit 7ef455f

Browse files
committed
Fix everything except toppoki tests
1 parent 66bffd8 commit 7ef455f

25 files changed

+526
-353
lines changed

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
"name": "purescript-docs-search",
3+
"type": "module",
34
"version": "0.0.11",
45
"description": "Search frontend for the documentation generated by the PureScript compiler.",
56
"directories": {
@@ -19,7 +20,7 @@
1920
"bundle-app": "spago bundle-app --no-build --no-install -m Docs.Search.App --to dist/docs-search-app.js",
2021
"esbuild-app": "esbuild dist/docs-search-app.js --target=es2016 --bundle --minify --outfile=dist/docs-search-app.min.js && mv dist/docs-search-app.min.js dist/docs-search-app.js",
2122
"build-app": "npm run bundle-app && npm run esbuild-app",
22-
"bundle-main": "spago bundle-app --no-build --no-install -m Docs.Search.Main --to dist/main.js",
23+
"bundle-main": "spago bundle-app --no-build --no-install --platform node -m Docs.Search.Main --to dist/main.js",
2324
"esbuild-main": "esbuild dist/main.js --platform=node --bundle --minify --outfile=dist/main.min.js && mv dist/main.min.js dist/main.js",
2425
"add-shebang": "echo \"#!/usr/bin/env node\" > dist/purescript-docs-search && cat dist/main.js >> dist/purescript-docs-search",
2526
"chmod-main": "chmod +x dist/purescript-docs-search",

packages.dhall

Lines changed: 47 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
let mkPackage =
2-
https://raw.githubusercontent.com/purescript/package-sets/psc-0.13.2-20190725/src/mkPackage.dhall sha256:0b197efa1d397ace6eb46b243ff2d73a3da5638d8d0ac8473e8e4a8fc528cf57
2+
https://raw.githubusercontent.com/purescript/package-sets/psc-0.13.2-20190725/src/mkPackage.dhall
3+
sha256:0b197efa1d397ace6eb46b243ff2d73a3da5638d8d0ac8473e8e4a8fc528cf57
34

45
let upstream =
5-
https://github.com/purescript/package-sets/releases/download/psc-0.14.0-20210409/packages.dhall sha256:e81c2f2ce790c0e0d79869d22f7a37d16caeb5bd81cfda71d46c58f6199fd33f
6+
https://github.com/purescript/package-sets/releases/download/psc-0.15.0-20220506/packages.dhall
7+
sha256:f83b68ff07cf6557e82379e749118e6ff11eecc6be5754540aae855cd1e46917
68

79
let overrides = {=}
810

@@ -33,12 +35,7 @@ let additions =
3335
, "web-uievents"
3436
]
3537
"https://github.com/purescript-halogen/purescript-halogen.git"
36-
"v6.1.0"
37-
, halogen-css =
38-
mkPackage
39-
[ "halogen" ]
40-
"https://github.com/slamdata/purescript-halogen-css.git"
41-
"v8.0.0"
38+
"v7.0.0"
4239
, memoize =
4340
mkPackage
4441
[ "prelude"
@@ -67,8 +64,8 @@ let additions =
6764
, "free"
6865
, "memoize"
6966
]
70-
"https://github.com/srghma/purescript-optparse.git"
71-
"d49b03fcd35f5be167e9c5c44ab1c17ca0956fb1"
67+
"https://github.com/klntsky/purescript-optparse.git"
68+
"2fe4265b7c6b09744c11190a43ca06777c752473"
7269
, exitcodes =
7370
mkPackage
7471
[ "enums" ]
@@ -77,30 +74,42 @@ let additions =
7774
, markdown-it =
7875
mkPackage
7976
[ "prelude", "effect", "options" ]
80-
"https://github.com/nonbili/purescript-markdown-it.git"
81-
"v0.4.0"
77+
"https://github.com/klntsky/purescript-markdown-it.git"
78+
"f3b7654783a83a80d7c09b6caaa7cd40b93ddce1"
79+
, string-parsers =
80+
mkPackage
81+
[ "arrays"
82+
, "assert"
83+
, "bifunctors"
84+
, "console"
85+
, "control"
86+
, "effect"
87+
, "either"
88+
, "enums"
89+
, "foldable-traversable"
90+
, "lists"
91+
, "maybe"
92+
, "minibench"
93+
, "nonempty"
94+
, "partial"
95+
, "prelude"
96+
, "strings"
97+
, "tailrec"
98+
, "transformers"
99+
, "unfoldable"
100+
]
101+
"https://github.com/purescript-contrib/purescript-string-parsers.git"
102+
"v8.0.0"
82103
, html-parser-halogen =
83104
mkPackage
84105
[ "string-parsers", "halogen" ]
85-
"https://github.com/rnons/purescript-html-parser-halogen.git"
86-
"458e492e441fcf69a66911b7b64beea5849e0dad"
106+
"https://github.com/klntsky/purescript-html-parser-halogen.git"
107+
"5c31890d060d5abd0038fed6acd3f999a9362369"
87108
, markdown-it-halogen =
88109
mkPackage
89110
[ "markdown-it", "html-parser-halogen" ]
90111
"https://github.com/nonbili/purescript-markdown-it-halogen.git"
91112
"08c9625015bf04214be14e45230e8ce12f3fa2bf"
92-
, toppokki =
93-
mkPackage
94-
[ "prelude"
95-
, "record"
96-
, "functions"
97-
, "node-http"
98-
, "aff-promise"
99-
, "node-buffer"
100-
, "node-fs-aff"
101-
]
102-
"https://github.com/justinwoo/purescript-toppokki.git"
103-
"v2.4.0"
104113
, search-trie =
105114
mkPackage
106115
[ "prelude"
@@ -126,7 +135,18 @@ let additions =
126135
, "transformers"
127136
]
128137
"https://github.com/purescript-contrib/purescript-css.git"
129-
"5c1a44ee95c259352a2b4570b060de14130540bc"
138+
"710d6a742beb88299faf08aaeb997ee1e24483ab"
139+
, jest =
140+
mkPackage
141+
[ "aff"
142+
, "aff-promise"
143+
, "effect"
144+
, "prelude"
145+
, "psci-support"
146+
, "foldable-traversable"
147+
]
148+
"https://github.com/klntsky/purescript-jest.git"
149+
"7feaa5a880fc75002c4eca312993174e7220252b"
130150
}
131151

132152
in upstream // overrides // additions

spago.dhall

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,9 @@
3939
, "profunctor"
4040
, "profunctor-lenses"
4141
, "search-trie"
42+
, "spec"
4243
, "string-parsers"
4344
, "strings"
44-
, "test-unit"
45-
, "toppokki"
4645
, "transformers"
4746
, "tuples"
4847
, "unfoldable"

src/Docs/Search/App.purs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ main = do
8686
srio <- runUI resultsComponent unit searchResults
8787

8888
void $ H.liftEffect $ subscribe sfio.messages $ \sfm -> do
89-
launchAff_ do
89+
launchAff_ $ void do
9090
srio.query (SearchResults.MessageFromSearchField sfm unit)
9191

9292
-- We need to read the URI hash only when both components are initialized and
@@ -97,8 +97,8 @@ main = do
9797
H.liftEffect do
9898

9999
listener <-
100-
eventListener \event ->
101-
launchAff_ do
100+
eventListener \_event ->
101+
launchAff_ $ void do
102102
sfio.query $ SearchField.ReadURIHash unit
103103

104104
addEventListener hashchange listener true (Window.toEventTarget window)
@@ -111,8 +111,8 @@ main = do
111111
H.liftEffect do
112112

113113
listener <-
114-
eventListener \event ->
115-
launchAff_ do
114+
eventListener \_event ->
115+
launchAff_ $ void do
116116
sbio.query $ Sidebar.UpdateModuleGrouping unit
117117

118118
addEventListener focus listener true (Window.toEventTarget window)

src/Docs/Search/App/SearchField.purs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ render state =
156156
[ HH.input
157157
[ HP.value state.input
158158
, HP.placeholder "Search for definitions... (S to focus)"
159-
, HP.id_ "docs-search-query-field"
159+
, HP.id "docs-search-query-field"
160160
, HP.type_ HP.InputText
161161
, HE.onKeyUp (\event ->
162162
case KeyboardEvent.code event of

src/Docs/Search/App/SearchResults.purs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -202,9 +202,9 @@ render state@{ mode: Active } =
202202
, HH.div_ $
203203
Array.concat $ shownResults <#> renderResult state
204204

205-
, HH.div [ HP.class_ (wrap "load_more"), HP.id_ "load-more" ]
205+
, HH.div [ HP.class_ (wrap "load_more"), HP.id "load-more" ]
206206
[ if Array.length shownResults < Array.length state.results
207-
then HH.a [ HP.id_ "load-more-link"
207+
then HH.a [ HP.id "load-more-link"
208208
, HE.onClick $ const MoreResultsRequested ]
209209
[ HH.text "Show more results" ]
210210
else HH.p_

src/Docs/Search/App/Sidebar.purs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,14 @@ import Data.Maybe (Maybe(..), isJust, fromMaybe)
1717
import Data.Newtype (wrap, unwrap)
1818
import Data.Set (Set)
1919
import Data.Set as Set
20-
import Data.Symbol (SProxy(..))
2120
import Data.Tuple.Nested (type (/\), (/\))
2221
import Effect (Effect)
2322
import Effect.Aff (Aff)
2423
import Halogen as H
2524
import Halogen.HTML as HH
2625
import Halogen.HTML.Events as HE
2726
import Halogen.HTML.Properties as HP
27+
import Type.Proxy (Proxy(..))
2828
import Web.HTML as HTML
2929
import Web.HTML.Window as Window
3030
import Web.Storage.Storage as Storage
@@ -131,15 +131,15 @@ render state@{ groupingMode, moduleNames, localPackageName } =
131131
]
132132

133133
[ HH.h3_ [ HH.text $ if groupingMode == DontGroup then "Modules" else "Packages" ]
134-
, HH.input [ HP.id_ "group-modules__input"
134+
, HH.input [ HP.id "group-modules__input"
135135
, HP.type_ HP.InputCheckbox
136136
, HP.checked (groupingMode == GroupByPackage)
137137
, HE.onChecked $ ToggleGrouping <<< isCheckedToGroupingMode
138138
]
139139

140140
, HH.text " "
141141
, HH.label [ HP.for "group-modules__input"
142-
, HP.id_ "group-modules__label"
142+
, HP.id "group-modules__label"
143143
]
144144
[ HH.text " GROUP BY PACKAGE" ]
145145

@@ -215,4 +215,4 @@ isCheckedToGroupingMode = if _ then GroupByPackage else DontGroup
215215
-- Some optics:
216216

217217
_groupingMode :: forall a b rest. (a -> b) -> { groupingMode :: a | rest } -> { groupingMode :: b | rest }
218-
_groupingMode = prop (SProxy :: SProxy "groupingMode")
218+
_groupingMode = prop (Proxy :: Proxy "groupingMode")

src/Docs/Search/BrowserEngine.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/* global exports */
22

3-
exports.loadIndex_ = function (partId) {
3+
export function loadIndex_ (partId) {
44
return function (url) {
55
return function () {
66
return new Promise(function(resolve, reject) {

src/Docs/Search/IndexBuilder.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
/* global __dirname require exports */
22

3-
var path = require('path');
4-
var glob = require('glob');
3+
import globMain from "glob";
54

6-
exports.getDirname = function () {
5+
export function getDirname () {
76
return __dirname;
87
};
98

10-
exports.glob = function (pattern) {
9+
export function glob (pattern) {
1110
return function () {
12-
return glob.sync(pattern);
11+
return globMain.sync(pattern);
1312
};
1413
};

src/Docs/Search/IndexBuilder.purs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@ import Effect.Aff (Aff, launchAff_, parallel, sequential)
4343
import Effect.Class (liftEffect)
4444
import Effect.Console (log)
4545
import Node.Encoding (Encoding(UTF8))
46-
import Node.FS.Aff (exists, mkdir, readFile, readTextFile, readdir, stat, writeFile, writeTextFile)
46+
import Node.FS.Aff (mkdir, readFile, readTextFile, readdir, stat, writeFile, writeTextFile)
47+
import Node.FS.Sync (exists)
4748
import Node.FS.Stats (isDirectory, isFile)
4849
import Node.Process as Process
4950
import Web.Bower.PackageMeta (PackageMeta(..))
@@ -369,15 +370,15 @@ copyAppFile { generatedDocs } = do
369370

370371
directoryExists :: String -> Aff Boolean
371372
directoryExists path = do
372-
doesExist <- exists path
373+
doesExist <- liftEffect $ exists path
373374
case doesExist of
374375
false -> pure false
375376
true -> isDirectory <$> stat path
376377

377378

378379
fileExists :: String -> Aff Boolean
379380
fileExists path = do
380-
doesExist <- exists path
381+
doesExist <- liftEffect $ exists path
381382
case doesExist of
382383
false -> pure false
383384
true -> isFile <$> stat path

0 commit comments

Comments
 (0)