generated from Adiltonzs/docs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
sync-search-indices.js
executable file
·35 lines (30 loc) · 1003 Bytes
/
sync-search-indices.js
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
#!/usr/bin/env node
// [start-readme]
//
// This script is run automatically via GitHub Actions on every push to `main` to generate searchable data.
// It can also be run manually. For more info see [contributing/search.md](contributing/search.md)
//
// [end-readme]
import searchSync from './search/sync.js'
import 'make-promises-safe'
main()
async function main() {
const sync = searchSync
// When called by the .github/workflows/sync-search-indices workflow
// the variable can be set to all or an empty string.
//
// The script/search/sync script expects the variables to be unset
// to select all languages or versions.
if (process.env.LANGUAGE === 'all' || process.env.LANGUAGE === '') {
delete process.env.LANGUAGE
}
if (process.env.VERSION === 'all' || process.env.VERSION === '') {
delete process.env.VERSION
}
const opts = {
dryRun: 'DRY_RUN' in process.env,
language: process.env.LANGUAGE,
version: process.env.VERSION,
}
await sync(opts)
}