Skip to content

Commit b424fa7

Browse files
committed
build: Add logs to sync-algolia script
1 parent 01698de commit b424fa7

1 file changed

Lines changed: 14 additions & 14 deletions

File tree

bin/sync-algolia.js

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -18,32 +18,32 @@ function syncAlgolia() {
1818
// ALGOLIA_ADMIN_KEY must be added as an environment variable in Travis CI
1919
const client = algolia(ALGOLIA_APP_ID, process.env.ALGOLIA_ADMIN_KEY);
2020

21-
// Initialize the target and temporary indexes
21+
console.log('Initializing target and temporary indexes...');
2222
const index = client.initIndex('icons');
2323
const indexTmp = client.initIndex('icons_tmp');
2424

25-
// Copy the settings, synonyms and rules (but not the records)
26-
// of the target index into the temporary index
27-
client.copyIndex(index.indexName, indexTmp.indexName, [
28-
'settings',
29-
'synonyms',
30-
'rules',
31-
]);
25+
console.log('Copying target index into temporary index...');
26+
client.copyIndex(
27+
index.indexName,
28+
indexTmp.indexName,
29+
['settings', 'synonyms', 'rules'],
30+
err => {
31+
if (err) throw err;
32+
},
33+
);
3234

33-
// Push data to the temporary index
3435
const records = Object.keys(icons).map(name => ({
3536
name,
3637
tags: tags[name] || [],
3738
}));
3839

39-
indexTmp.addObjects(records, (err, content) => {
40+
console.log('Pushing data to the temporary index...');
41+
indexTmp.addObjects(records, err => {
4042
if (err) throw err;
41-
console.log(content);
4243
});
4344

44-
// Move the temporary index to the target index
45-
client.moveIndex(indexTmp.indexName, index.indexName, (err, content) => {
45+
console.log('Moving temporary index to target index...');
46+
client.moveIndex(indexTmp.indexName, index.indexName, err => {
4647
if (err) throw err;
47-
console.log(content);
4848
});
4949
}

0 commit comments

Comments
 (0)