gitbook-plugin-rss
Advanced tools
Comparing version 2.1.5 to 3.0.0
32
index.js
@@ -1,7 +0,7 @@ | ||
import title from 'get-md-title'; | ||
import desc from 'get-md-desc'; | ||
import RSS from 'rss'; | ||
import { writeFileSync as write } from 'fs'; | ||
import { resolve, basename } from 'path'; | ||
import { parse } from 'url'; | ||
const title = require('get-md-title'); | ||
const desc = require('get-md-desc'); | ||
const RSS = require('rss'); | ||
const { writeFileSync: write } = require('fs'); | ||
const { resolve, basename } = require('path'); | ||
const { parse } = require('url'); | ||
@@ -11,6 +11,6 @@ // Define variables | ||
export default { | ||
module.exports = { | ||
website: { | ||
assets: './assets', | ||
js: [ 'plugin.js' ] | ||
js: [ 'plugin.js' ], | ||
}, | ||
@@ -20,3 +20,3 @@ | ||
// Get and init RSS configuration | ||
'init': function () { | ||
init() { | ||
site = this.config.get('pluginsConfig.rss'); | ||
@@ -27,3 +27,3 @@ feed = new RSS(site); | ||
// Collect all pages | ||
'page:before': function (page) { | ||
['page:before'](page) { | ||
// If README.md, then change it to root | ||
@@ -33,3 +33,3 @@ const url = site.site_url + | ||
? '' | ||
: page.path.replace(/.md$/,'.html')); | ||
: page.path.replace(/.md$/, '.html')); | ||
@@ -40,6 +40,6 @@ const pageTitle = title(page.content); | ||
feed.item({ | ||
title: pageTitle? pageTitle.text : '', | ||
description: pageDescription? pageDescription.text : '', | ||
title: pageTitle ? pageTitle.text : '', | ||
description: pageDescription ? pageDescription.text : '', | ||
url: url, | ||
author: site.author | ||
author: site.author, | ||
}); | ||
@@ -51,8 +51,8 @@ | ||
// Generate XML and write to file | ||
'finish': function () { | ||
finish() { | ||
const xml = feed.xml({ indent: true }); | ||
const feedpath = basename(parse(site.feed_url).pathname); | ||
return write(resolve(this.options.output, feedpath), xml, 'utf-8'); | ||
} | ||
}, | ||
} | ||
}; |
{ | ||
"name": "gitbook-plugin-rss", | ||
"version": "2.1.5", | ||
"version": "3.0.0", | ||
"description": "RSS for your gitbook", | ||
"main": "index.es5.js", | ||
"main": "index.js", | ||
"engines": { | ||
"gitbook": ">=2.5.0" | ||
"node": ">=4", | ||
"gitbook": ">=3.2.0" | ||
}, | ||
@@ -61,8 +62,3 @@ "gitbook": { | ||
"scripts": { | ||
"watch": "npm run transpile -- --watch", | ||
"transpile": "babel index.js --out-file index.es5.js", | ||
"prepublish": "npm run transpile", | ||
"clean": "rimraf index.es5.js", | ||
"push": "git push --follow-tags", | ||
"postpublish": "npm-run-all clean push" | ||
"postpublish": "git push --follow-tags" | ||
}, | ||
@@ -84,16 +80,7 @@ "repository": { | ||
"homepage": "https://github.com/denysdovhan/gitbook-plugin-rss#readme", | ||
"devDependencies": { | ||
"babel-cli": "^6.16.0", | ||
"babel-core": "^6.14.0", | ||
"babel-eslint": "^7.0.0", | ||
"babel-plugin-add-module-exports": "^0.2.1", | ||
"babel-preset-es2015": "^6.16.0", | ||
"npm-run-all": "3.1.0", | ||
"rimraf": "*" | ||
}, | ||
"dependencies": { | ||
"get-md-desc": "^1.0.2", | ||
"get-md-title": "^1.0.4", | ||
"rss": "^1.2.1" | ||
"rss": "^1.2.2" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
9257
0
2
9
56
Updatedrss@^1.2.2