svelte-algolia
Advanced tools
Comparing version 0.1.2 to 0.1.3
{ | ||
"name": "svelte-algolia", | ||
"version": "0.1.2", | ||
"version": "0.1.3", | ||
"description": "Algolia plugin for Svelte", | ||
@@ -14,8 +14,10 @@ "main": "src/index.js", | ||
"license": "MIT", | ||
"private": false, | ||
"dependencies": { | ||
"algoliasearch": "^4.5.1", | ||
"esm": "^3.2.25" | ||
}, | ||
"devDependencies": { | ||
"algoliasearch": "^4.5.1", | ||
"ava": "^3.13.0", | ||
"dotenv": "^8.2.0", | ||
"eslint": "^7.12.1", | ||
"esm": "^3.2.25", | ||
"prettier": "^2.1.2" | ||
@@ -25,6 +27,6 @@ }, | ||
"test": "ava", | ||
"prepublish": "ava" | ||
"prepublishOnly": "ava" | ||
}, | ||
"files": [ | ||
"src/**/*.js" | ||
"src" | ||
], | ||
@@ -39,2 +41,2 @@ "keywords": [ | ||
} | ||
} | ||
} |
@@ -7,2 +7,6 @@ <p align="center"> | ||
[![Test Status](https://github.com/janosh/svelte-algolia/workflows/ci/badge.svg)](https://github.com/janosh/svelte-algolia/actions) | ||
This package was inspired by the official [`gatsby-plugin-algolia`](https://github.com/algolia/gatsby-plugin-algolia). | ||
## Usage | ||
@@ -26,3 +30,2 @@ | ||
apiKey: secrets.algoliaAdminKey, | ||
partialUpdates: true, | ||
indices: [ | ||
@@ -43,4 +46,48 @@ { name: `pokedex`, getData: pokemonDataLoader }, | ||
## Config Options | ||
```js | ||
const defaultConfig = { | ||
verbosity: 1, // 0, 1 or 2 for no/some/lots of logging | ||
partialUpdates: false, // if true, figures out diffs between existing | ||
// items and new ones and only uploads, otherwise, completely overrides | ||
// each index on every call to indexAlgolia() | ||
matchFields: [], // (only used when partialUpdates is true) keys of fields to | ||
// check for whether an item has changed; could e.g. be a timestamp, hash or | ||
// an ID that's updated every time the item has changed | ||
} | ||
``` | ||
## As a `rollup` plugin | ||
To use this package as part of a `rollup` build (e.g. in a Svelte or Sapper app), simply include it in your `plugins` array: | ||
```js | ||
// rollup.config.js | ||
import { indexAlgolia } from 'svelte-algolia' | ||
const algoliaConfig = { | ||
// see config options above | ||
} | ||
// check if running in build or development mode | ||
const dev = process.env.NODE_ENV === `development` | ||
export default { | ||
input: './src/index.js', | ||
output: { | ||
file: './build/bundle.js', | ||
format: 'iife', | ||
name: 'bundle' | ||
plugins: [ | ||
// to save Algolia indexing operations, you may want to only | ||
// update your indices when building your app for production | ||
!dev && indexAlgolia(algoliaConfig), | ||
] | ||
} | ||
} | ||
``` | ||
## Contribute | ||
PRs are welcome but best open an issue first to discuss any changes. |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
10119
4
91
0
2
+ Addedalgoliasearch@^4.5.1
+ Addedesm@^3.2.25
+ Added@algolia/cache-browser-local-storage@4.24.0(transitive)
+ Added@algolia/cache-common@4.24.0(transitive)
+ Added@algolia/cache-in-memory@4.24.0(transitive)
+ Added@algolia/client-account@4.24.0(transitive)
+ Added@algolia/client-analytics@4.24.0(transitive)
+ Added@algolia/client-common@4.24.0(transitive)
+ Added@algolia/client-personalization@4.24.0(transitive)
+ Added@algolia/client-search@4.24.0(transitive)
+ Added@algolia/logger-common@4.24.0(transitive)
+ Added@algolia/logger-console@4.24.0(transitive)
+ Added@algolia/recommend@4.24.0(transitive)
+ Added@algolia/requester-browser-xhr@4.24.0(transitive)
+ Added@algolia/requester-common@4.24.0(transitive)
+ Added@algolia/requester-node-http@4.24.0(transitive)
+ Added@algolia/transporter@4.24.0(transitive)
+ Addedalgoliasearch@4.24.0(transitive)
+ Addedesm@3.2.25(transitive)