mirror of
https://github.com/feathericons/feather.git
synced 2023-08-10 21:13:24 +03:00
build: Add sync-algolia script
This commit is contained in:
parent
894dcfd6a6
commit
1d3283d81d
@ -9,6 +9,8 @@ before_script:
|
|||||||
- npm prune
|
- npm prune
|
||||||
script:
|
script:
|
||||||
- npm start
|
- npm start
|
||||||
|
after_success:
|
||||||
|
- npx babel-node ./bin/sync-algolia.js
|
||||||
deploy:
|
deploy:
|
||||||
provider: script
|
provider: script
|
||||||
skip_cleanup: true
|
skip_cleanup: true
|
||||||
|
34
bin/sync-algolia.js
Normal file
34
bin/sync-algolia.js
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
/* eslint-disable import/no-extraneous-dependencies */
|
||||||
|
import algolia from 'algoliasearch';
|
||||||
|
import icons from '../dist/icons.json';
|
||||||
|
import tags from '../src/tags.json';
|
||||||
|
|
||||||
|
const ALGOLIA_APP_ID = '5EEOG744D0';
|
||||||
|
|
||||||
|
if (
|
||||||
|
process.env.TRAVIS_PULL_REQUEST === 'false' &&
|
||||||
|
process.env.TRAVIS_BRANCH === 'master'
|
||||||
|
) {
|
||||||
|
syncAlgolia();
|
||||||
|
}
|
||||||
|
|
||||||
|
function syncAlgolia() {
|
||||||
|
const client = algolia(ALGOLIA_APP_ID, process.env.ALGOLIA_ADMIN_KEY);
|
||||||
|
|
||||||
|
const index = client.initIndex('icons');
|
||||||
|
|
||||||
|
const records = Object.keys(icons).map(name => ({
|
||||||
|
name,
|
||||||
|
tags: tags[name] || [],
|
||||||
|
}));
|
||||||
|
|
||||||
|
index.clearIndex((err, content) => {
|
||||||
|
if (err) throw err;
|
||||||
|
console.log(content); // eslint-disable-line no-console
|
||||||
|
});
|
||||||
|
|
||||||
|
index.addObjects(records, (err, content) => {
|
||||||
|
if (err) throw err;
|
||||||
|
console.log(content); // eslint-disable-line no-console
|
||||||
|
});
|
||||||
|
}
|
3868
package-lock.json
generated
3868
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -26,6 +26,7 @@
|
|||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@commitlint/cli": "^5.2.5",
|
"@commitlint/cli": "^5.2.5",
|
||||||
"@commitlint/config-angular": "^5.1.1",
|
"@commitlint/config-angular": "^5.1.1",
|
||||||
|
"algoliasearch": "^3.27.1",
|
||||||
"babel-cli": "^6.24.1",
|
"babel-cli": "^6.24.1",
|
||||||
"babel-loader": "^7.1.1",
|
"babel-loader": "^7.1.1",
|
||||||
"babel-plugin-transform-object-rest-spread": "^6.26.0",
|
"babel-plugin-transform-object-rest-spread": "^6.26.0",
|
||||||
|
Loading…
Reference in New Issue
Block a user