@nuxtjs/feed
Advanced tools
Comparing version 0.2.0 to 1.0.0
@@ -5,2 +5,18 @@ # Change Log | ||
<a name="1.0.0"></a> | ||
# [1.0.0](https://github.com/nuxt-community/feed-module/compare/v0.2.0...v1.0.0) (2019-01-12) | ||
### Bug Fixes | ||
* log error before fatal ([#26](https://github.com/nuxt-community/feed-module/issues/26)) ([2a120a5](https://github.com/nuxt-community/feed-module/commit/2a120a5)) | ||
* send utf-8 charset as header ([#18](https://github.com/nuxt-community/feed-module/issues/18)) ([a412ee4](https://github.com/nuxt-community/feed-module/commit/a412ee4)) | ||
### Features | ||
* introduce data property ([23e819e](https://github.com/nuxt-community/feed-module/commit/23e819e)) | ||
<a name="0.2.0"></a> | ||
@@ -7,0 +23,0 @@ # [0.2.0](https://github.com/nuxt-community/feed-module/compare/v0.1.1...v0.2.0) (2018-10-05) |
import path from 'path' | ||
import fs from 'fs-extra' | ||
import AsyncCache from 'async-cache' | ||
import pify from 'pify' | ||
import { promisify } from 'util' | ||
import { Feed } from 'feed' | ||
@@ -33,3 +33,3 @@ import consola from 'consola' | ||
feedCache.get = pify(feedCache.get) | ||
feedCache.get = promisify(feedCache.get) | ||
@@ -64,3 +64,3 @@ options.forEach((feedOptions, index) => { | ||
} | ||
return lookup.hasOwnProperty(type) ? lookup[type] : 'application/xml' | ||
return (lookup.hasOwnProperty(type) ? lookup[type] : 'application/xml') + '; charset=UTF-8' | ||
} | ||
@@ -76,7 +76,7 @@ | ||
try { | ||
await feedOptions.create.call(this, feed) | ||
await feedOptions.create.call(this, feed, feedOptions.data) | ||
feed.options = Object.assign({ generator: 'https://github.com/nuxt-community/feed-module' }, feed.options) | ||
} catch (err) /* istanbul ignore next */ { | ||
logger.error(err) | ||
logger.fatal('Error while executing feed creation function') | ||
logger.error(err) | ||
} | ||
@@ -83,0 +83,0 @@ return callback(null, feed[feedOptions.type](), feedOptions.cacheTime) |
{ | ||
"name": "@nuxtjs/feed", | ||
"version": "0.2.0", | ||
"version": "1.0.0", | ||
"description": "", | ||
@@ -25,3 +25,3 @@ "license": "MIT", | ||
"lint": "eslint lib test", | ||
"test": "npm run lint && jest", | ||
"test": "yarn lint && yarn jest", | ||
"release": "standard-version && git push --follow-tags && npm publish", | ||
@@ -60,23 +60,22 @@ "commitlint": "commitlint -e $GIT_PARAMS", | ||
"async-cache": "^1.1.0", | ||
"consola": "^1.4.3", | ||
"feed": "^2.0.1", | ||
"fs-extra": "^7.0.0", | ||
"pify": "^3.0.0" | ||
"consola": "^2.3.2", | ||
"feed": "^2.0.2", | ||
"fs-extra": "^7.0.1" | ||
}, | ||
"devDependencies": { | ||
"@commitlint/cli": "^7.1.2", | ||
"@commitlint/config-conventional": "^7.1.2", | ||
"@commitlint/cli": "^7.3.1", | ||
"@commitlint/config-conventional": "^7.3.1", | ||
"codecov": "^3.1.0", | ||
"eslint": "^5.6.1", | ||
"eslint": "^5.12.0", | ||
"eslint-config-standard": "^12.0.0", | ||
"eslint-plugin-import": "^2.14.0", | ||
"eslint-plugin-jest": "^21.24.1", | ||
"eslint-plugin-node": "^7.0.1", | ||
"eslint-plugin-jest": "^22.1.3", | ||
"eslint-plugin-node": "^8.0.1", | ||
"eslint-plugin-promise": "^4.0.1", | ||
"eslint-plugin-standard": "^4.0.0", | ||
"eslint-plugin-vue": "^4.7.1", | ||
"husky": "^1.1.0", | ||
"eslint-plugin-vue": "^5.1.0", | ||
"husky": "^1.3.1", | ||
"jest": "^23.6.0", | ||
"jsdom": "^12.1.0", | ||
"nuxt": "^2.1.0", | ||
"jsdom": "^13.1.0", | ||
"nuxt": "^2.3.4", | ||
"request-promise-native": "^1.0.5", | ||
@@ -83,0 +82,0 @@ "standard-version": "^4.4.0" |
@@ -19,2 +19,3 @@ # Feed module - Everyone deserves RSS, Atom and Json | ||
* Works with **all modes** (yes, even generate!) | ||
* For Nuxt 2.x and higher | ||
@@ -27,3 +28,3 @@ ## Setup | ||
```js | ||
{ | ||
export default { | ||
modules: [ | ||
@@ -48,3 +49,3 @@ // Simple usage | ||
```js | ||
{ | ||
export default { | ||
//... | ||
@@ -57,5 +58,6 @@ feed: [ | ||
cacheTime: 1000 * 60 * 15, // How long should the feed be cached | ||
type: 'rss2' // Can be: rss2, atom1, json1 | ||
type: 'rss2', // Can be: rss2, atom1, json1 | ||
data: ['Some additional data'] //will be passed as 2nd argument to `create` function | ||
} | ||
], | ||
] | ||
//... | ||
@@ -74,13 +76,13 @@ } | ||
//Import axios into your nuxt.config.js | ||
const axios = require('axios') | ||
import axios from 'axios' | ||
// In your `feed` array: | ||
async create (feed) { | ||
async create (feed){ | ||
feed.options = { | ||
title: 'My blog', | ||
link: 'https://my-url.com/feed.xml', | ||
link: 'https://lichter.io/feed.xml', | ||
description: 'This is my personal feed!', | ||
} | ||
const posts = await (axios.get('https://api.blog.lichter.io/posts')).data | ||
const posts = await (axios.get('https://blog-api.lichter.io/posts')).data | ||
posts.forEach(post => { | ||
@@ -124,4 +126,4 @@ feed.addItem({ | ||
feed: async () => { | ||
const posts = (await axios.get('https://api.blog.lichter.io/posts')).data | ||
const tags = (await axios.get('https://api.blog.lichter.io/tags')).data | ||
const posts = (await axios.get('https://blog-api.lichter.io/posts')).data | ||
const tags = (await axios.get('https://blog-api.lichter.io/tags')).data | ||
@@ -136,3 +138,3 @@ return tags.map(t => { | ||
title: `${t.name} - My blog`, | ||
link: `https://my-url.com/${t.slug}.xml`, | ||
link: `https://blog.lichter.io/${t.slug}.xml`, | ||
description: `All posts related to ${t.name} of my blog`, | ||
@@ -155,3 +157,3 @@ } | ||
}) | ||
}, | ||
} | ||
} | ||
@@ -158,0 +160,0 @@ ``` |
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
12059
4
1
166
+ Addedconsola@2.15.3(transitive)
- Removedpify@^3.0.0
- Removedansi-styles@3.2.1(transitive)
- Removedchalk@2.4.2(transitive)
- Removedci-info@1.6.0(transitive)
- Removedcolor-convert@1.9.3(transitive)
- Removedcolor-name@1.1.3(transitive)
- Removedconsola@1.4.5(transitive)
- Removedescape-string-regexp@1.0.5(transitive)
- Removedfigures@2.0.0(transitive)
- Removedhas-flag@3.0.0(transitive)
- Removedis-ci@1.2.1(transitive)
- Removedlodash@4.17.21(transitive)
- Removedpify@3.0.0(transitive)
- Removedstd-env@1.3.1(transitive)
- Removedsupports-color@5.5.0(transitive)
Updatedconsola@^2.3.2
Updatedfeed@^2.0.2
Updatedfs-extra@^7.0.1