Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion website/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
"ts-node": "^10.9.2",
"typescript": "^5.9.3",
"typesense": "^1.8.2",
"typesense-sync": "https://s3.amazonaws.com/origin-static-assets/corp-node-packages/master/typesense-sync-v1.1.0.tgz"
"typesense-sync": "https://s3.amazonaws.com/origin-static-assets/corp-node-packages/master/typesense-sync-v2.0.0.tgz"
},
"browserslist": [
"since 2017-06"
Expand Down
32 changes: 15 additions & 17 deletions website/scripts/typesense-sync.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,17 @@
const { typesenseSync } = require('typesense-sync');
const { saveSettings } = require('typesense-sync/settings');
const tsConfig = require('../typesense.config.json');
import process from 'node:process';
import { typesenseSync } from 'typesense-sync';
const configFilePath = '../typesense.config.json';

const syncCollection = async () => {
const promises: Promise<any>[] = []
const config = {
configFilePath,
shouldSaveSettings: true,
};

for (const collection of tsConfig.collections) {
console.log(`Updating collection ${collection.name}`)
promises.push(typesenseSync(collection.name, collection.file_path))
}

return await Promise.all(promises)
}

saveSettings()
.then(() => syncCollection())
.then(() => console.log('Typesense sync completed'))
.catch(error => console.log('An error occurred', error))
typesenseSync(config)
.then(() => {
console.log('Typesense sync completed');
})
.catch((err) => {
console.error('An error occurred', err);
process.exit(1);
});
39 changes: 29 additions & 10 deletions website/typesense.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
"optional": true,
"sort": false,
"stem": false,
"type": "string"
"stem_dictionary": "",
"store": true
},
{
"facet": false,
Expand All @@ -26,7 +27,9 @@
"optional": true,
"sort": false,
"stem": false,
"type": "string"
"type": "string",
"stem_dictionary": "",
"store": true
},
{
"facet": false,
Expand All @@ -37,7 +40,9 @@
"optional": true,
"sort": true,
"stem": false,
"type": "int64"
"type": "int64",
"stem_dictionary": "",
"store": true
},
{
"facet": false,
Expand All @@ -48,7 +53,9 @@
"optional": true,
"sort": false,
"stem": false,
"type": "string"
"type": "string",
"stem_dictionary": "",
"store": true
},
{
"facet": false,
Expand All @@ -59,7 +66,9 @@
"optional": true,
"sort": false,
"stem": false,
"type": "string"
"type": "string",
"stem_dictionary": "",
"store": true
},
{
"facet": false,
Expand All @@ -70,7 +79,9 @@
"optional": true,
"sort": true,
"stem": false,
"type": "int64"
"type": "int64",
"stem_dictionary": "",
"store": true
},
{
"facet": false,
Expand All @@ -81,7 +92,9 @@
"optional": true,
"sort": false,
"stem": false,
"type": "string"
"type": "string",
"stem_dictionary": "",
"store": true
},
{
"facet": false,
Expand All @@ -92,7 +105,9 @@
"optional": true,
"sort": false,
"stem": false,
"type": "string[]"
"type": "string[]",
"stem_dictionary": "",
"store": true
},
{
"facet": false,
Expand All @@ -103,7 +118,9 @@
"optional": true,
"sort": false,
"stem": false,
"type": "string"
"type": "string",
"stem_dictionary": "",
"store": true
},
{
"facet": false,
Expand All @@ -114,7 +131,9 @@
"optional": true,
"sort": false,
"stem": false,
"type": "string[]"
"type": "string[]",
"stem_dictionary": "",
"store": true
}
]
},
Expand Down
19 changes: 9 additions & 10 deletions website/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3614,15 +3614,14 @@ typescript@^5.9.3:
resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.9.3.tgz#5b4f59e15310ab17a216f5d6cf53ee476ede670f"
integrity sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==

"typesense-sync@https://s3.amazonaws.com/origin-static-assets/corp-node-packages/master/typesense-sync-v1.1.0.tgz":
version "1.1.0"
resolved "https://s3.amazonaws.com/origin-static-assets/corp-node-packages/master/typesense-sync-v1.1.0.tgz"
integrity sha512-w1b1aWpiXHOF/VK9SpzsH1B4yVRcyn0EJGQDEoDL5a6R/iD3y+HvG93UGBKlwYCnjv3E5woxXOgYNIE0MqP2Kg==
"typesense-sync@https://s3.amazonaws.com/origin-static-assets/corp-node-packages/master/typesense-sync-v2.0.0.tgz":
version "2.0.0"
resolved "https://s3.amazonaws.com/origin-static-assets/corp-node-packages/master/typesense-sync-v2.0.0.tgz#eb267fc50527ed69ce272cef03ca61017bb20f9c"
dependencies:
"@babel/runtime" "^7.25.0"
crypto "^1.0.1"
dotenv "^16.4.5"
typesense "^2.0.3"
lodash "^4.17.21"
typesense "^3.0.1"
winston "^3.14.2"
yargs "^17.7.2"

Expand All @@ -3634,10 +3633,10 @@ typesense@^1.8.2:
axios "^1.6.0"
loglevel "^1.8.1"

typesense@^2.0.3:
version "2.1.0"
resolved "https://registry.npmjs.org/typesense/-/typesense-2.1.0.tgz"
integrity sha512-a/IRTL+dRXlpRDU4UodyGj8hl5xBz3nKihVRd/KfSFAfFPGcpdX6lxIgwdXy3O6VLNNiEsN8YwIsPHQPVT0vNw==
typesense@^3.0.1:
version "3.0.1"
resolved "https://registry.yarnpkg.com/typesense/-/typesense-3.0.1.tgz#fbbfef3383d983fb58e97b78a236047843cc69ca"
integrity sha512-aRzuDQlwR7s2sWw+JiR3CufrMWpzH5UAJ4XlybYczD02QPy5jCsEQiueqUu0Wiai4zW/RGYRruF3XrdEXPgPJA==
dependencies:
axios "^1.8.4"
loglevel "^1.8.1"
Expand Down
Loading