hexo-algolia
Advanced tools
Comparing version 1.2.2 to 1.2.3
# hexo-algolia changelog | ||
## v1.2.3, 2017-08-31 | ||
- remove lodash from dependencies ([#25](https://github.com/oncletom/hexo-algolia/pull/25)) | ||
## v1.2.2, 2017-08-31 | ||
- Do not index `page.content` as it causes the indexing to fail if it is bigger than 10kB ([#24](https://github.com/oncletom/hexo-algolia/pull/24), [#15](https://github.com/oncletom/hexo-algolia/issues/15)) | ||
- Index `page.updated` (and its `page.updated_as_int` counterpart) [#24](https://github.com/oncletom/hexo-algolia/pull/24) | ||
- do not index `page.content` as it causes the indexing to fail if it is bigger than 10kB ([#24](https://github.com/oncletom/hexo-algolia/pull/24), [#15](https://github.com/oncletom/hexo-algolia/issues/15)) | ||
- index `page.updated` (and its `page.updated_as_int` counterpart) [#24](https://github.com/oncletom/hexo-algolia/pull/24) | ||
@@ -8,0 +12,0 @@ ## v1.2.1, 2017-08-25 |
'use strict'; | ||
var _ = require('lodash'); | ||
var each = require('p-each-series'); | ||
@@ -14,2 +13,12 @@ var algoliasearch = require('algoliasearch'); | ||
var INDEXED_PROPERTIES = [ | ||
'title', | ||
'date', | ||
'updated', | ||
'slug', | ||
'excerpt', | ||
'permalink', | ||
'layout' | ||
]; | ||
function computeSha1(text) { | ||
@@ -19,2 +28,19 @@ return crypto.createHash('sha1').update(text, 'utf8').digest('hex'); | ||
function pick(object, properties) { | ||
return properties.reduce(function(filteredObj, prop) { | ||
filteredObj[prop] = object[prop]; | ||
return filteredObj; | ||
}, {}); | ||
} | ||
function chunk(array, chunkSize) { | ||
var batches = []; | ||
while (array.length > 0) { | ||
batches.push(array.splice(0, chunkSize)); | ||
} | ||
return batches; | ||
} | ||
module.exports = function(args, callback) { | ||
@@ -76,11 +102,3 @@ var hexo = this; | ||
return publishedPagesAndPosts.map(function(data) { | ||
var storedPost = _.pick(data, [ | ||
'title', | ||
'date', | ||
'updated', | ||
'slug', | ||
'excerpt', | ||
'permalink', | ||
'layout' | ||
]); | ||
var storedPost = pick(data, INDEXED_PROPERTIES); | ||
@@ -93,3 +111,3 @@ storedPost.objectID = computeSha1(data.path); | ||
storedPost.categories = data.categories.map(function(item) { | ||
return _.pick(item, ['name', 'path']); | ||
return pick(item, ['name', 'path']); | ||
}); | ||
@@ -100,3 +118,3 @@ } | ||
storedPost.tags = data.tags.map(function(item) { | ||
return _.pick(item, ['name', 'path']); | ||
return pick(item, ['name', 'path']); | ||
}); | ||
@@ -125,3 +143,3 @@ } | ||
.then(function(actions) { | ||
var options = _.assign({}, CONSOLE_DEFAULTS, args || {}); | ||
var options = Object.assign({}, CONSOLE_DEFAULTS, args || {}); | ||
@@ -141,3 +159,3 @@ if (options.dryRun) { | ||
.then(function() { | ||
var chunks = _.chunk(actions, options.chunkSize); | ||
var chunks = chunk(actions, options.chunkSize); | ||
@@ -144,0 +162,0 @@ return each(chunks, function(chunk, i) { |
'use strict'; | ||
var _ = require('lodash'); | ||
var BASE_URLS = { | ||
@@ -16,3 +14,3 @@ CDN: 'https://cdn.jsdelivr.net/algoliasearch/3/', | ||
function generateScriptTags (hexo, baseUrl, options) { | ||
var opts = _.assign({}, DEFAULT_OPTIONS, options); | ||
var opts = Object.assign({}, DEFAULT_OPTIONS, options); | ||
var filename = | ||
@@ -19,0 +17,0 @@ 'algoliasearch' + |
{ | ||
"name": "hexo-algolia", | ||
"version": "1.2.2", | ||
"version": "1.2.3", | ||
"lockfileVersion": 1, | ||
@@ -781,3 +781,4 @@ "requires": true, | ||
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.4.tgz", | ||
"integrity": "sha1-eCA6TRwyiuHYbcpkYONptX9AVa4=" | ||
"integrity": "sha1-eCA6TRwyiuHYbcpkYONptX9AVa4=", | ||
"dev": true | ||
}, | ||
@@ -784,0 +785,0 @@ "lru-cache": { |
{ | ||
"name": "hexo-algolia", | ||
"version": "1.2.2", | ||
"version": "1.2.3", | ||
"description": "Index your content in Algolia Search API", | ||
@@ -37,3 +37,2 @@ "main": "index", | ||
"algoliasearch": "^3.24.3", | ||
"lodash": "^4.17.4", | ||
"p-each-series": "^1.0.0" | ||
@@ -40,0 +39,0 @@ }, |
123388
2
1546
- Removedlodash@^4.17.4
- Removedlodash@4.17.21(transitive)