Skip to content
This repository has been archived by the owner on Dec 23, 2023. It is now read-only.

Commit

Permalink
Update deps
Browse files Browse the repository at this point in the history
  • Loading branch information
bcomnes committed Oct 29, 2019
1 parent 7cb6373 commit 9c07870
Show file tree
Hide file tree
Showing 12 changed files with 104 additions and 103 deletions.
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const pump = require('pump')

function processFiles (config, logMap, dest, cb) {
const jobsStream = fromArray.obj(jobsCreator(logMap))
const parseStream = transform(10, {objectMode: true}, readParse)
const parseStream = transform(10, { objectMode: true }, readParse)
const generateFeedStream = transform(10, { objectMode: true }, feedFromJob(config))
const generateAtomStream = transform(10, { objectMode: true }, generateAtomFeed)
const writeFeeds = writer({ objectMode: true }, feedWriter(config, dest))
Expand Down
2 changes: 1 addition & 1 deletion lib/expand-author.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const gravatarUrl = require('gravatar-url')
function expandAuthor (authorValue) {
if (typeof authorValue === 'string') {
const author = parseAuthor(authorValue)
if (author.email) author.avatar = gravatarUrl(author.email, {size: 512})
if (author.email) author.avatar = gravatarUrl(author.email, { size: 512 })
return clean(author)
}
return clean(authorValue)
Expand Down
2 changes: 1 addition & 1 deletion lib/expand-icon.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ module.exports = function expandIcon (config, field, size) {

const author = typeof config.author === 'string' ? parseAuthor(config.author) : config.author
if (!author.email) return
return gravatarUrl(author.email, {size: size})
return gravatarUrl(author.email, { size: size })
}
7 changes: 4 additions & 3 deletions lib/expand-url.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
const nodeURL = require('url')

function expandURL (itemURL, baseURL) {
const itemURLObj = nodeURL.parse(itemURL)
const baseURLObj = nodeURL.parse(baseURL)
// TODO: Get rid of old UI behavior
const itemURLObj = nodeURL.parse(itemURL) /* eslint-disable-line node/no-deprecated-api */
const baseURLObj = nodeURL.parse(baseURL) /* eslint-disable-line node/no-deprecated-api */
if (itemURLObj.hostname) return itemURLObj.format()
if (baseURLObj.hostname) {
return nodeURL.resolve(baseURL, itemURL)
return nodeURL.resolve(baseURL, itemURL) /* eslint-disable-line node/no-deprecated-api */
}
return itemURLObj.format()
}
Expand Down
7 changes: 4 additions & 3 deletions lib/generate-feed.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,14 @@ module.exports = generateFeed

function expandFeedURL (name, config) {
if (config.feed_url) {
return nodeURL.resolve(config.feed_url, name + '.json')
// TODO: Get rid of old URL API
return nodeURL.resolve(config.feed_url, name + '.json') /* eslint-disable-line node/no-deprecated-api */
}
if (config.url) {
return nodeURL.resolve(config.url, name + '.json')
return nodeURL.resolve(config.url, name + '.json') /* eslint-disable-line node/no-deprecated-api */
}
// else
return nodeURL.resolve('/', name + '.json')
return nodeURL.resolve('/', name + '.json') /* eslint-disable-line node/no-deprecated-api */
}

/* jsonfeed reference
Expand Down
38 changes: 19 additions & 19 deletions lib/generate-feed.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,20 +66,20 @@ const items = [
test('generate-feed: no items', t => {
const jf = generateFeed('feed', config, [], '2017')
const expectedOutput = {
'version': 'https://jsonfeed.org/version/1',
'title': 'bret.io log',
'home_page_url': 'https://bret.io',
'feed_url': 'https://bret.io/feed.json',
'description': 'A running log of announcements, projects and accomplishments.',
'icon': 'https://bret.io/icon-512x512.png',
'favicon': 'https://bret.io/favicon-64x64.png',
'author': {
'name': 'Bret Comnes',
'url': 'https://bret.io',
'avatar': 'https://gravatar.com/avatar/8d8b82740cb7ca994449cccd1dfdef5f?size=512'
version: 'https://jsonfeed.org/version/1',
title: 'bret.io log',
home_page_url: 'https://bret.io',
feed_url: 'https://bret.io/feed.json',
description: 'A running log of announcements, projects and accomplishments.',
icon: 'https://bret.io/icon-512x512.png',
favicon: 'https://bret.io/favicon-64x64.png',
author: {
name: 'Bret Comnes',
url: 'https://bret.io',
avatar: 'https://gravatar.com/avatar/8d8b82740cb7ca994449cccd1dfdef5f?size=512'
},
'items': [],
'next_url': 'https://bret.io/2017.json'
items: [],
next_url: 'https://bret.io/2017.json'
}

t.deepEqual(jf, expectedOutput, 'generates a base json feed document correctly.')
Expand All @@ -92,20 +92,20 @@ test('generate-feed: missing arguments', t => {
t.throws(() => { generateFeed('foo', {}) }, /missing title in config/, 'throws when config is missing a title')
let jf
t.doesNotThrow(() => {
jf = generateFeed('foo', {title: 'foo bar'})
jf = generateFeed('foo', { title: 'foo bar' })
}, null, 'generate a minimal json feed with just a title config')
t.deepEqual(jf, {
'version': 'https://jsonfeed.org/version/1',
'title': 'foo bar',
'feed_url': '/foo.json',
'items': []
version: 'https://jsonfeed.org/version/1',
title: 'foo bar',
feed_url: '/foo.json',
items: []
}, 'minimal meets specification with relative URLs')
t.end()
})

test('generate-feed: with log items', t => {
const jf = generateFeed('feed', config, items, '2017')
const expected = {'version': 'https://jsonfeed.org/version/1', 'title': 'bret.io log', 'home_page_url': 'https://bret.io', 'feed_url': 'https://bret.io/feed.json', 'description': 'A running log of announcements, projects and accomplishments.', 'next_url': 'https://bret.io/2017.json', 'icon': 'https://bret.io/icon-512x512.png', 'favicon': 'https://bret.io/favicon-64x64.png', 'author': {'name': 'Bret Comnes', 'url': 'https://bret.io', 'avatar': 'https://gravatar.com/avatar/8d8b82740cb7ca994449cccd1dfdef5f?size=512'}, 'items': [{'date_published': '2018-04-07T22:06:43.000Z', 'content_text': 'No html, just some text', 'title': 'Ahh yes, a title', 'date_modified': '2018-04-08T17:31:18.000Z', 'url': 'https://bret.io/my-blog-post', 'external_url': 'https://bret.io/some-other-link', 'image': 'https://bret.io/some/image.png', 'banner_image': 'https://bret.io/some/banner_image.png', 'author': {'name': 'Some Guy', 'url': 'https://someguy.com', 'avatar': 'https://gravatar.com/avatar/251c028d36ce17f4cc44906df8162693?size=512'}, 'id': 'a-custom-id', 'summary': 'hey look a summary', 'tags': ['some', 'tags', 'as', 'well', 200], 'attachments': [{'url': 'https://bret.io/relative/attatchment.mp3', 'mime_type': 'audio/mpeg', 'title': 'relative', 'size_in_bytes': 500000, 'duration_in_seconds': 200}, {'url': 'https://example.com/external/attatchment.mp3', 'mime_type': 'audio/mpeg', 'title': 'external', 'size_in_bytes': 2000, 'duration_in_seconds': 200}]}, {'date_published': '2018-04-07T22:06:43.000Z', 'content_text': 'No html, just some text', 'title': 'No html, just some text', 'url': 'https://bret.io/my-blog-post', 'id': 'https://bret.io/my-blog-post-2018-04-07T22:06:43.000Z'}, {'date_published': '2018-04-07T22:06:43.000Z', 'content_text': 'No html, just some text', 'title': 'This is a blog title', 'url': 'https://bret.io/my-blog-post', 'id': 'https://bret.io/my-blog-post-2018-04-07T22:06:43.000Z'}, {'date_published': '2018-04-07T22:06:43.000Z', 'content_html': '<p>Hello, world!</p>', 'title': 'This is a blog title', 'url': 'https://bret.io/my-blog-post', 'external_url': 'https://example.com/some-external-link', 'id': 'https://bret.io/my-blog-post-2018-04-07T22:06:43.000Z'}]}
const expected = { version: 'https://jsonfeed.org/version/1', title: 'bret.io log', home_page_url: 'https://bret.io', feed_url: 'https://bret.io/feed.json', description: 'A running log of announcements, projects and accomplishments.', next_url: 'https://bret.io/2017.json', icon: 'https://bret.io/icon-512x512.png', favicon: 'https://bret.io/favicon-64x64.png', author: { name: 'Bret Comnes', url: 'https://bret.io', avatar: 'https://gravatar.com/avatar/8d8b82740cb7ca994449cccd1dfdef5f?size=512' }, items: [{ date_published: '2018-04-07T22:06:43.000Z', content_text: 'No html, just some text', title: 'Ahh yes, a title', date_modified: '2018-04-08T17:31:18.000Z', url: 'https://bret.io/my-blog-post', external_url: 'https://bret.io/some-other-link', image: 'https://bret.io/some/image.png', banner_image: 'https://bret.io/some/banner_image.png', author: { name: 'Some Guy', url: 'https://someguy.com', avatar: 'https://gravatar.com/avatar/251c028d36ce17f4cc44906df8162693?size=512' }, id: 'a-custom-id', summary: 'hey look a summary', tags: ['some', 'tags', 'as', 'well', 200], attachments: [{ url: 'https://bret.io/relative/attatchment.mp3', mime_type: 'audio/mpeg', title: 'relative', size_in_bytes: 500000, duration_in_seconds: 200 }, { url: 'https://example.com/external/attatchment.mp3', mime_type: 'audio/mpeg', title: 'external', size_in_bytes: 2000, duration_in_seconds: 200 }] }, { date_published: '2018-04-07T22:06:43.000Z', content_text: 'No html, just some text', title: 'No html, just some text', url: 'https://bret.io/my-blog-post', id: 'https://bret.io/my-blog-post-2018-04-07T22:06:43.000Z' }, { date_published: '2018-04-07T22:06:43.000Z', content_text: 'No html, just some text', title: 'This is a blog title', url: 'https://bret.io/my-blog-post', id: 'https://bret.io/my-blog-post-2018-04-07T22:06:43.000Z' }, { date_published: '2018-04-07T22:06:43.000Z', content_html: '<p>Hello, world!</p>', title: 'This is a blog title', url: 'https://bret.io/my-blog-post', external_url: 'https://example.com/some-external-link', id: 'https://bret.io/my-blog-post-2018-04-07T22:06:43.000Z' }] }
t.deepEqual(jf, expected, 'json feed generates as expected')
console.log(jf)
t.end()
Expand Down
2 changes: 1 addition & 1 deletion lib/jobs-creator.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ function jobsCreator (fileMap) {
function shape (e, i, entries) {
const name = i === entries.length - 1 ? 'feed' : e[0]
const prevFeed = entries[i - 1]
return {name, file: e[1], year: e[0], next: prevFeed && prevFeed[0]}
return { name, file: e[1], year: e[0], next: prevFeed && prevFeed[0] }
}

function ascending (eA, eB) {
Expand Down
2 changes: 1 addition & 1 deletion lib/read-parse.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ function readParse (job, done) {
} catch (e) {
return cb(e)
}
const jobWithItems = Object.assign(job, {items})
const jobWithItems = Object.assign(job, { items })
cb(null, jobWithItems)
}
], (err, jobWithItems) => {
Expand Down
14 changes: 7 additions & 7 deletions lib/type-dispatch.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ const test = require('tape')
const makeTypeDispatch = require('./type-dispatch')

const config = {
'title': 'bret.io log',
'url': 'https://bret.io',
'description': 'A running log of announcements, projects and accomplishments.',
'icon': '/icon-512x512.png',
'favicon': '/favicon-64x64.png',
'author': 'Bret Comnes <bcomnes@gmail.com> (https://bret.io)',
'avatar': '/avatar-512x512.png'
title: 'bret.io log',
url: 'https://bret.io',
description: 'A running log of announcements, projects and accomplishments.',
icon: '/icon-512x512.png',
favicon: '/favicon-64x64.png',
author: 'Bret Comnes <bcomnes@gmail.com> (https://bret.io)',
avatar: '/avatar-512x512.png'
}

const typeDispatch = makeTypeDispatch(config)
Expand Down
84 changes: 42 additions & 42 deletions lib/types/log/log.spec.js
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
const test = require('tape')
const makeLog = require('./index')
const config = {
'title': 'bret.io log',
'url': 'https://bret.io',
'description': 'A running log of announcements, projects and accomplishments.',
'icon': '/icon-512x512.png',
'favicon': '/favicon-64x64.png',
'author': 'Bret Comnes <bcomnes@gmail.com> (https://bret.io)',
'avatar': '/avatar-512x512.png'
title: 'bret.io log',
url: 'https://bret.io',
description: 'A running log of announcements, projects and accomplishments.',
icon: '/icon-512x512.png',
favicon: '/favicon-64x64.png',
author: 'Bret Comnes <bcomnes@gmail.com> (https://bret.io)',
avatar: '/avatar-512x512.png'
}
const log = makeLog(config)

test('log: with html', t => {
const item = {
'date': '2018-04-07T15:06:43-07:00',
'content': '<p>Hello, world!</p>',
'title': 'This is a blog title',
'url': '/my-blog-post',
'link': 'https://example.com/some-external-link'
date: '2018-04-07T15:06:43-07:00',
content: '<p>Hello, world!</p>',
title: 'This is a blog title',
url: '/my-blog-post',
link: 'https://example.com/some-external-link'
}

const jf = log(item, config)
Expand All @@ -34,10 +34,10 @@ test('log: with html', t => {

test('log: with text', t => {
const item = {
'date': '2018-04-07T15:06:43-07:00',
'content': 'No html, just some text',
'title': 'This is a blog title',
'url': '/my-blog-post'
date: '2018-04-07T15:06:43-07:00',
content: 'No html, just some text',
title: 'This is a blog title',
url: '/my-blog-post'
}

const jf = log(item, config)
Expand All @@ -54,9 +54,9 @@ test('log: with text', t => {

test('log: with no title', t => {
const item = {
'date': '2018-04-07T15:06:43-07:00',
'content': 'No html, just some text',
'url': '/my-blog-post'
date: '2018-04-07T15:06:43-07:00',
content: 'No html, just some text',
url: '/my-blog-post'
}

const jf = log(item, config)
Expand All @@ -72,32 +72,32 @@ test('log: with no title', t => {

test('log: all fields', t => {
const item = {
'date': '2018-04-07T15:06:43-07:00',
'title': 'Ahh yes, a title',
'modified': '2018-04-08T17:31:18Z',
'content': 'No html, just some text',
'url': '/my-blog-post',
'link': '/some-other-link',
'id': 'a-custom-id',
'summary': 'hey look a summary',
'image': '/some/image.png',
'banner_image': '/some/banner_image.png',
'author': 'Some Guy <someguy@gmail.com> (https://someguy.com)',
'tags': ['some', 'tags', 'as', 'well', 200],
'attachments': [
date: '2018-04-07T15:06:43-07:00',
title: 'Ahh yes, a title',
modified: '2018-04-08T17:31:18Z',
content: 'No html, just some text',
url: '/my-blog-post',
link: '/some-other-link',
id: 'a-custom-id',
summary: 'hey look a summary',
image: '/some/image.png',
banner_image: '/some/banner_image.png',
author: 'Some Guy <someguy@gmail.com> (https://someguy.com)',
tags: ['some', 'tags', 'as', 'well', 200],
attachments: [
{
'url': '/relative/attatchment.mp3',
'mime_type': 'audio/mpeg',
'title': 'relative',
'size_in_bytes': 500000,
'duration_in_seconds': 200
url: '/relative/attatchment.mp3',
mime_type: 'audio/mpeg',
title: 'relative',
size_in_bytes: 500000,
duration_in_seconds: 200
},
{
'url': 'https://example.com/external/attatchment.mp3',
'mime_type': 'audio/mpeg',
'title': 'external',
'size_in_bytes': 2000,
'duration_in_seconds': 200,
url: 'https://example.com/external/attatchment.mp3',
mime_type: 'audio/mpeg',
title: 'external',
size_in_bytes: 2000,
duration_in_seconds: 200,
an_extra_field: 'foo-bar'
}
]
Expand Down
12 changes: 6 additions & 6 deletions lib/types/raw.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@ const raw = require('./raw')

test('raw: filter out non-specified fields', t => {
const item = {
'id': '2',
'content_text': 'This is a second item.',
'url': 'https://example.org/second-item',
id: '2',
content_text: 'This is a second item.',
url: 'https://example.org/second-item',
someExtraField: 'foo'
}

const jf = raw(item)

t.deepEqual(jf, {
'id': '2',
'content_text': 'This is a second item.',
'url': 'https://example.org/second-item'
id: '2',
content_text: 'This is a second item.',
url: 'https://example.org/second-item'
}, 'filtered out extra fields')
console.log(jf)
t.end()
Expand Down
35 changes: 17 additions & 18 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,38 +8,37 @@
},
"dependencies": {
"cliclopts": "^1.1.1",
"flush-write-stream": "^1.0.3",
"flush-write-stream": "^2.0.0",
"from2-array": "0.0.4",
"from2-string": "^1.1.0",
"glob": "^7.1.2",
"gravatar-url": "^2.0.0",
"is-html": "^1.1.0",
"jsonfeed-to-atom": "^1.0.1",
"glob": "^7.1.5",
"gravatar-url": "^3.0.1",
"is-html": "^2.0.0",
"jsonfeed-to-atom": "^1.1.3",
"minimist": "^1.2.0",
"mkdirp": "^0.5.1",
"object-hash": "^1.3.0",
"parallel-transform": "^1.1.0",
"object-hash": "^2.0.0",
"parallel-transform": "^1.2.0",
"parse-author": "^2.0.0",
"pump": "^3.0.0",
"run-parallel": "^1.1.8",
"run-waterfall": "^1.1.4",
"run-parallel": "^1.1.9",
"run-waterfall": "^1.1.6",
"striptags": "^3.1.1",
"trim-left": "^1.0.1",
"trim-right": "^1.0.1"
},
"devDependencies": {
"@tap-format/spec": "^0.2.0",
"coveralls": "^3.0.0",
"coveralls": "^3.0.7",
"cpx2": "^2.0.0",
"dependency-check": "^3.1.0",
"dependency-cruiser": "^3.1.0",
"dependency-check": "^4.1.0",
"dependency-cruiser": "^5.2.2",
"existy": "^1.0.1",
"feed-validator": "^1.1.1",
"npm-run-all": "^4.0.2",
"nyc": "^11.6.0",
"standard": "^10.0.0",
"tape": "^4.7.0",
"tape-run": "^3.0.0",
"npm-run-all": "^4.1.5",
"nyc": "^14.1.1",
"standard": "^14.3.1",
"tape": "^4.11.0",
"tape-run": "^6.0.1",
"temporary-directory": "^1.0.2"
},
"homepage": "https://github.com/bcomnes/generate-feed#readme",
Expand Down

0 comments on commit 9c07870

Please sign in to comment.