mvw-search-index 2.2.9 → 2.2.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +18 -11
- package/package-lock.json +1016 -1338
- package/package.json +10 -10
package/README.md
CHANGED
|
@@ -11,7 +11,7 @@ Can e.g. be used to generate a search index for a static website, generated with
|
|
|
11
11
|
|
|
12
12
|
## Usage
|
|
13
13
|
|
|
14
|
-
First you have to install this package,
|
|
14
|
+
First you have to install this package, then create the index that you use on e.g. a search page. Find samples for
|
|
15
15
|
everything in the following chapters.
|
|
16
16
|
|
|
17
17
|
### Installation
|
|
@@ -28,10 +28,14 @@ There are multiple possibilities to generate the script. Some are demonstrated i
|
|
|
28
28
|
|
|
29
29
|
#### From CLI
|
|
30
30
|
|
|
31
|
-
|
|
31
|
+
```bash
|
|
32
|
+
mvw-search-index <glob> <destination> [css-selector]
|
|
33
|
+
```
|
|
32
34
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
+
For example:
|
|
36
|
+
```bash
|
|
37
|
+
mvw-search-index ./build/**/*.html ./build/index.json
|
|
38
|
+
```
|
|
35
39
|
|
|
36
40
|
Or from an npm script e.g. for a hugo page (has to be executed after page creation, obviously):
|
|
37
41
|
|
|
@@ -43,18 +47,19 @@ Or from an npm script e.g. for a hugo page (has to be executed after page creati
|
|
|
43
47
|
}
|
|
44
48
|
```
|
|
45
49
|
|
|
46
|
-
#### From
|
|
50
|
+
#### From TypeScript
|
|
47
51
|
|
|
48
|
-
```
|
|
52
|
+
```ts
|
|
49
53
|
import { SearchIndex } from "mvw-search-index";
|
|
50
|
-
|
|
54
|
+
|
|
51
55
|
let index = SearchIndex.createFromHtml(files, bodySelector);
|
|
52
56
|
// or: let index = SearchIndex.createFromInfo(info);
|
|
53
57
|
// or: let index = SearchIndex.createFromGlob(glob, bodySelector, cb);
|
|
58
|
+
|
|
54
59
|
fs.writeFileSync("index.json", JSON.stringify(index));
|
|
55
60
|
```
|
|
56
61
|
|
|
57
|
-
### From
|
|
62
|
+
### From node.js
|
|
58
63
|
|
|
59
64
|
```js
|
|
60
65
|
"use strict";
|
|
@@ -63,11 +68,12 @@ const index = require("mvw-search-index");
|
|
|
63
68
|
const fs = require("fs")
|
|
64
69
|
|
|
65
70
|
index.SearchIndex.createFromGlob("./build/**/*.html",
|
|
66
|
-
|
|
67
|
-
|
|
71
|
+
"main",
|
|
72
|
+
(index) => fs.writeFileSync("./static/suche/index.json",
|
|
73
|
+
JSON.stringify(index)));
|
|
68
74
|
```
|
|
69
75
|
|
|
70
|
-
### Sample usage of the created
|
|
76
|
+
### Sample usage of the created index
|
|
71
77
|
|
|
72
78
|
You can run `npm run serve` from this repository to run the sample site contained in [./demo](./demo).
|
|
73
79
|
|
|
@@ -75,6 +81,7 @@ This contains a very basic static website with a search form on the landing page
|
|
|
75
81
|
|
|
76
82
|
## Releases
|
|
77
83
|
|
|
84
|
+
- 2.2.10 updates dependencies
|
|
78
85
|
- 2.2.9 gets rid of vinyl and provides a demo application
|
|
79
86
|
- 2.1.4 - 2.1.12: dependency update
|
|
80
87
|
- 2.1.3: added support of glob on API
|