Skip to content

Commit

Permalink
Merge pull request #258 from WPMedia/AIO-322
Browse files Browse the repository at this point in the history
AJC updates  AIO-322
  • Loading branch information
HardipAtWpost committed Nov 16, 2020
2 parents 1c31501 + 5e5ee40 commit 9358763
Show file tree
Hide file tree
Showing 44 changed files with 1,831 additions and 1,208 deletions.
16 changes: 16 additions & 0 deletions .changeset/seven-horses-trade.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
'@wpmedia/feeds-source-collections-block': minor
'@wpmedia/feeds-source-content-api-block': minor
'@wpmedia/mrss-feature-block': minor
'@wpmedia/rss-fbia-feature-block': minor
'@wpmedia/rss-feature-block': minor
'@wpmedia/rss-flipboard-feature-block': minor
'@wpmedia/rss-google-news-feature-block': minor
'@wpmedia/rss-msn-feature-block': minor
'@wpmedia/sitemap-feature-block': minor
'@wpmedia/sitemap-index-feature-block': minor
'@wpmedia/sitemap-news-feature-block': minor
'@wpmedia/sitemap-video-feature-block': minor
---

add collections, check for nulls in title and description and make packages public
28 changes: 28 additions & 0 deletions .github/workflows/docs-to-alc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: A job to push technical docs to Arc
on:
push:
branches:
- prod

jobs:
md_to_alc_job:
runs-on: ubuntu-latest
steps:
- id: getfiles
uses: lots0logs/gh-action-get-changed-files@2.1.4
with:
token: ${{ secrets.GIT_TOKEN }}
- name: Checkout private repo
uses: actions/checkout@v2
with:
repository: WPMedia/md_to_alc_action
token: ${{ secrets.GIT_TOKEN }}
- id: send-markdown
uses: ./
with:
arcToken: ${{ secrets.ARC_TOKEN }}
repoToken: ${{ secrets.GIT_TOKEN }}
docPath: documentation/
changedFiles: ${{ steps.getfiles.outputs.modified }}
repoName: ${{ github.event.repository.name }}

18 changes: 18 additions & 0 deletions blocks/feeds-source-collections-block/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Collections content source

Searches for a collection by \_id or alias. Articles in a collection do not contain any content_elements.

## Globals

- CONTENT_BASE

## Parameters

- \_id: Collection \_id to search for
- content_alias: Collection alias name to search for
- from: number of rows to skip
- size: number of rows to return

### Usage

The `/content/v4/collections` content-api endpoint is used
1 change: 1 addition & 0 deletions blocks/feeds-source-collections-block/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = {}
46 changes: 46 additions & 0 deletions blocks/feeds-source-collections-block/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

29 changes: 29 additions & 0 deletions blocks/feeds-source-collections-block/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"name": "@wpmedia/feeds-source-collections-block",
"version": "0.0.0",
"description": "Content source to search for a collection",
"main": "index.js",
"files": [
"sources"
],
"license": "UNLICENSED",
"repository": {
"type": "git",
"url": "git+ssh://git@github.com/WPMedia/feed-components.git",
"directory": "blocks/feeds-source-collections-block"
},
"publishConfig": {
"registry": "https://npm.pkg.github.com/",
"access": "public"
},
"author": "Cameron Woodmansee",
"contributors": [
"Iyob Beyene <iyob.beyene@washpost.com>",
"Tim Kosmider <tim.kosmider@washpost.com>"
],
"homepage": "https://github.com/WPMedia/feed-components#readme",
"dependencies": {},
"devDependencies": {
"prop-types": "^15.7.2"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`returns query by alias 1`] = `"content/v4/collections?content_alias=sports page&from=5&size=10&published=true"`;

exports[`returns query search by _id 1`] = `"content/v4/collections?_id=NBXKZJC3ONEGRB2VPINBMQTNFA&published=true"`;
20 changes: 20 additions & 0 deletions blocks/feeds-source-collections-block/sources/collections.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
const params = {
_id: 'text',
content_alias: 'text',
from: 'text',
size: 'text',
}

const resolve = (key = {}) => {
const { 'arc-site': site, _id, content_alias: contentAlias, from, size } = key
return `content/v4/collections?${
_id ? `_id=${_id}` : `content_alias=${contentAlias}`
}${site ? `&website=${site}` : ''}${from ? `&from=${from}` : ''}${
size ? `&size=${size}` : ''
}&published=true`
}

export default {
params,
resolve,
}
32 changes: 32 additions & 0 deletions blocks/feeds-source-collections-block/sources/collections.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
// eslint-disable-next-line no-unused-vars
import Consumer from 'fusion:consumer'
const resolver = require('./collections')

it('validate params', () => {
expect(resolver.default.params).toStrictEqual({
_id: 'text',
content_alias: 'text',
from: 'text',
size: 'text',
})
})

it('returns query search by _id', () => {
const query = resolver.default.resolve({
_id: 'NBXKZJC3ONEGRB2VPINBMQTNFA',
content_alias: '',
from: '',
size: '',
})
expect(query).toMatchSnapshot()
})

it('returns query by alias', () => {
const query = resolver.default.resolve({
_id: '',
content_alias: 'sports page',
from: '5',
size: '10',
})
expect(query).toMatchSnapshot()
})
6 changes: 2 additions & 4 deletions blocks/feeds-source-content-api-block/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,15 @@
},
"publishConfig": {
"registry": "https://npm.pkg.github.com/",
"access": "restricted"
"access": "public"
},
"author": "Cameron Woodmansee",
"contributors": [
"Iyob Beyene <iyob.beyene@washpost.com>",
"Tim Kosmider <tim.kosmider@washpost.com>"
],
"homepage": "https://github.com/WPMedia/feed-components#readme",
"dependencies": {
"xmlbuilder2": "^2.1.2"
},
"dependencies": {},
"devDependencies": {
"prop-types": "^15.7.2"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ Object {
"description": "google news",
"item": Array [
Object {
"description": null,
"description": Object {
"$": "",
},
"guid": Object {
"#": "http://demo-prod.origin.arcpublishing.com/video/2020/04/16/inexact-odyssey-a-volcom-snowboarding-film/",
"@isPermaLink": false,
Expand All @@ -39,7 +41,9 @@ Object {
},
"pubDate": "Thu, 16 Apr 2020 19:55:25 +0000",
"referenceid": undefined,
"title": "Inexact Odyssey, A Volcom Snowboarding Film",
"title": Object {
"$": "Inexact Odyssey, A Volcom Snowboarding Film",
},
},
],
"link": "http://demo-prod.origin.arcpublishing.com",
Expand Down
42 changes: 17 additions & 25 deletions blocks/mrss-feature-block/features/mrss/xml.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import Consumer from 'fusion:consumer'
import moment from 'moment'
import getProperties from 'fusion:properties'
import { resizerKey } from 'fusion:environment'
import { BuildContent } from '@wpmedia/feeds-content-elements'
import { generatePropsForFeed } from '@wpmedia/feeds-prop-types'
import { buildResizerURL } from '@wpmedia/feeds-resizer'
import { findVideo } from '@wpmedia/feeds-find-video-stream'
Expand Down Expand Up @@ -36,7 +35,6 @@ const rssTemplate = (
feedTitle,
feedLanguage,
selectVideo,
mrssBuildContent,
},
) => ({
rss: {
Expand All @@ -62,16 +60,17 @@ const rssTemplate = (
}),

item: elements.map((s) => {
const url = `${domain}${s.website_url}` || s.canonical_url
const url = `${domain}${s.website_url || s.canonical_url || ''}`
const img =
s.promo_items && (s.promo_items.basic || s.promo_items.lead_art)
const videoStream = findVideo(s, selectVideo)
let caption, primarySection

return {
title: `${jmespath.search(s, itemTitle)}`,
title: { $: jmespath.search(s, itemTitle) || '' },
link: url,
...(itemDescription && {
description: jmespath.search(s, itemDescription),
description: { $: jmespath.search(s, itemDescription) || '' },
}),
guid: {
'@isPermaLink': false,
Expand Down Expand Up @@ -112,24 +111,23 @@ const rssTemplate = (
'media:keywords': (
jmespath.search(s, 'taxonomy.seo_keywords[*]') || []
).join(','),
...((s.description &&
s.description.basic && {
...((caption = jmespath.search(
s,
'description.basic || subheadlines.basic',
)) &&
caption && {
'media:caption': {
$: [s.description.basic],
$: caption,
},
}) ||
(s.subheadlines &&
s.subheadlines.basic && {
'media:caption': {
$: [s.subheadlines.basic],
},
})),
}),
...(s.transcript && { 'media:transcript': s.transcript }),

...(s.taxonomy &&
s.taxonomy.primary_section &&
s.taxonomy.primary_section.name && {
'media:category': s.taxonomy.primary_section.name,
...((primarySection = jmespath.search(
s,
'taxonomy.primary_section.name',
)) &&
primarySection && {
'media:category': primarySection,
}),
...(img &&
img.url && {
Expand All @@ -152,11 +150,6 @@ export function Mrss({ globalContent, customFields, arcSite }) {
feedLanguage = '',
} = getProperties(arcSite)

function MrssBuildContent() {
BuildContent.call(this)
}
const mrssBuildContent = new MrssBuildContent()

// can't return null for xml return type, must return valid xml template
return rssTemplate(
jmespath.search(globalContent, 'playlistItems || content_elements || []') ||
Expand All @@ -167,7 +160,6 @@ export function Mrss({ globalContent, customFields, arcSite }) {
domain: feedDomainURL,
feedTitle,
feedLanguage,
mrssBuildContent,
},
)
}
Expand Down
2 changes: 1 addition & 1 deletion blocks/mrss-feature-block/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
},
"publishConfig": {
"registry": "https://npm.pkg.github.com/",
"access": "restricted"
"access": "public"
},
"author": "Saru Kalva <saru.kalva@washpost.com>",
"contributors": [
Expand Down

0 comments on commit 9358763

Please sign in to comment.