Skip to content

Commit

Permalink
Merge pull request #702 from WPMedia/sandbox
Browse files Browse the repository at this point in the history
Stable release: Sandbox -> Prod
  • Loading branch information
vgalatro authored Apr 15, 2024
2 parents f47455b + 432da8d commit 67c9ca3
Show file tree
Hide file tree
Showing 14 changed files with 135 additions and 95 deletions.
15 changes: 15 additions & 0 deletions .changeset/fuzzy-shirts-greet.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
"@wpmedia/rss-google-news-feature-block": patch
"@wpmedia/rss-flipboard-feature-block": patch
"@wpmedia/sitemap-index-feature-block": patch
"@wpmedia/sitemap-video-feature-block": patch
"@wpmedia/sitemap-news-feature-block": patch
"@wpmedia/rss-alexa-feature-block": patch
"@wpmedia/rss-fbia-feature-block": patch
"@wpmedia/rss-msn-feature-block": patch
"@wpmedia/mrss-feature-block": patch
"@wpmedia/ans-feature-block": patch
"@wpmedia/rss-feature-block": patch
---

Add support for a resizerURLs object that can specify a url per environment
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions

name: Pull request builder
name: Pull request verification

on:
push:
branches: [prod]
branches: [develop, sandbox, prod]
pull_request:
branches: [prod]
branches: [develop, sandbox, prod]

jobs:
build:
Expand Down
6 changes: 4 additions & 2 deletions blocks/ans-feature-block/features/ans/json.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import Consumer from 'fusion:consumer'
import getProperties from 'fusion:properties'
import { resizerKey } from 'fusion:environment'
import { resizerKey, ENVIRONMENT } from 'fusion:environment'
import { buildResizerURL } from '@wpmedia/feeds-resizer'

export function ANSFeed({ globalContent = {}, customFields, arcSite }) {
const { resizerURL = '', feedDomainURL = '' } = getProperties(arcSite)
let { resizerURL = '' } = getProperties(arcSite)
const { feedDomainURL = '', resizerURLs = {} } = getProperties(arcSite)
const { width = 0, height = 0 } = customFields.resizerKVP || {}
resizerURL = resizerURLs?.[ENVIRONMENT] || resizerURL

const resizeImage = (img) => {
if (img && img.url) {
Expand Down
7 changes: 5 additions & 2 deletions blocks/mrss-feature-block/features/mrss/xml.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import PropTypes from 'fusion:prop-types'
import Consumer from 'fusion:consumer'
import moment from 'moment'
import getProperties from 'fusion:properties'
import { resizerKey } from 'fusion:environment'
import { resizerKey, ENVIRONMENT } from 'fusion:environment'
import { BuildPromoItems } from '@wpmedia/feeds-promo-items'
import { generatePropsForFeed } from '@wpmedia/feeds-prop-types'
import { buildResizerURL } from '@wpmedia/feeds-resizer'
Expand Down Expand Up @@ -99,12 +99,15 @@ const rssTemplate = (
})

export function Mrss({ globalContent, customFields, arcSite, requestUri }) {
let { resizerURL = '' } = getProperties(arcSite)
const {
resizerURL = '',
resizerURLs = {},
feedDomainURL = 'http://localhost.com',
feedTitle = '',
feedLanguage = '',
} = getProperties(arcSite)

resizerURL = resizerURLs?.[ENVIRONMENT] || resizerURL
const channelLanguage = customFields.channelLanguage || feedLanguage
const { width = 0, height = 0 } = customFields.resizerKVP || {}
const requestPath = new URL.URL(requestUri, feedDomainURL).pathname
Expand Down
6 changes: 4 additions & 2 deletions blocks/rss-alexa-feature-block/features/rss/xml.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import PropTypes from 'fusion:prop-types'
import Consumer from 'fusion:consumer'
import moment from 'moment'
import getProperties from 'fusion:properties'
import { resizerKey } from 'fusion:environment'
import { resizerKey, ENVIRONMENT } from 'fusion:environment'
import { BuildContent } from '@wpmedia/feeds-content-elements'
import { generatePropsForFeed } from '@wpmedia/feeds-prop-types'
import { buildResizerURL } from '@wpmedia/feeds-resizer'
Expand Down Expand Up @@ -119,14 +119,16 @@ const rssTemplate = (
})

export function Rss({ globalContent, customFields, arcSite }) {
let { resizerURL = '' } = getProperties(arcSite)
const {
resizerURL = '',
resizerURLs = {},
feedDomainURL = '',
feedTitle = '',
feedLanguage = '',
} = getProperties(arcSite)
const channelLanguage = customFields.channelLanguage || feedLanguage
const rssBuildContent = new BuildContent()
resizerURL = resizerURLs?.[ENVIRONMENT] || resizerURL

// can't return null for xml return type, must return valid xml template
return rssTemplate(globalContent.content_elements || [], {
Expand Down
6 changes: 4 additions & 2 deletions blocks/rss-fbia-feature-block/features/rss/xml.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import PropTypes from 'fusion:prop-types'
import Consumer from 'fusion:consumer'
import moment from 'moment'
import getProperties from 'fusion:properties'
import { resizerKey } from 'fusion:environment'
import { resizerKey, ENVIRONMENT } from 'fusion:environment'
import { BuildContent } from '@wpmedia/feeds-content-elements'
import { BuildPromoItems } from '@wpmedia/feeds-promo-items'
import { generatePropsForFeed } from '@wpmedia/feeds-prop-types'
Expand Down Expand Up @@ -167,12 +167,14 @@ const rssTemplate = (
})

export function FbiaRss({ globalContent, customFields, arcSite, requestUri }) {
let { resizerURL = '' } = getProperties(arcSite)
const {
resizerURL = '',
resizerURLs = {},
feedDomainURL = 'http://localhost.com',
feedTitle = '',
feedLanguage = '',
} = getProperties(arcSite)
resizerURL = resizerURLs?.[ENVIRONMENT] || resizerURL
const channelLanguage = customFields.channelLanguage || feedLanguage
const { width = 0, height = 0 } = customFields.resizerKVP || {}
const requestPath = new URL.URL(requestUri, feedDomainURL).pathname
Expand Down
6 changes: 4 additions & 2 deletions blocks/rss-feature-block/features/rss/xml.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { BuildPromoItems } from '@wpmedia/feeds-promo-items'
import { generatePropsForFeed } from '@wpmedia/feeds-prop-types'
import { buildResizerURL } from '@wpmedia/feeds-resizer'

import { resizerKey } from 'fusion:environment'
import { resizerKey, ENVIRONMENT } from 'fusion:environment'
import Consumer from 'fusion:consumer'
import PropTypes from 'fusion:prop-types'
import getProperties from 'fusion:properties'
Expand Down Expand Up @@ -159,12 +159,14 @@ const rssTemplate = (
})

export function Rss({ globalContent, customFields, arcSite, requestUri }) {
let { resizerURL = '' } = getProperties(arcSite)
const {
resizerURL = '',
resizerURLs = {},
feedDomainURL = 'http://localhost.com',
feedTitle = '',
feedLanguage = '',
} = getProperties(arcSite)
resizerURL = resizerURLs?.[ENVIRONMENT] || resizerURL

const channelLanguage = customFields.channelLanguage || feedLanguage
const { width = 0, height = 0 } = customFields.resizerKVP || {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import PropTypes from 'fusion:prop-types'
import Consumer from 'fusion:consumer'
import moment from 'moment'
import getProperties from 'fusion:properties'
import { resizerKey } from 'fusion:environment'
import { resizerKey, ENVIRONMENT } from 'fusion:environment'
import { BuildContent } from '@wpmedia/feeds-content-elements'
import { BuildPromoItems } from '@wpmedia/feeds-promo-items'
import { generatePropsForFeed } from '@wpmedia/feeds-prop-types'
Expand Down Expand Up @@ -159,12 +159,14 @@ export function FlipboardRss({
arcSite,
requestUri,
}) {
let { resizerURL = '' } = getProperties(arcSite)
const {
resizerURL = '',
resizerURLs = {},
feedDomainURL = 'http://localhost.com',
feedTitle = '',
feedLanguage = '',
} = getProperties(arcSite)
resizerURL = resizerURLs?.[ENVIRONMENT] || resizerURL
const channelLanguage = customFields.channelLanguage || feedLanguage
const { width = 0, height = 0 } = customFields.resizerKVP || {}
const requestPath = new URL.URL(requestUri, feedDomainURL).pathname
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import PropTypes from 'fusion:prop-types'
import Consumer from 'fusion:consumer'
import moment from 'moment'
import getProperties from 'fusion:properties'
import { resizerKey } from 'fusion:environment'
import { resizerKey, ENVIRONMENT } from 'fusion:environment'
import { BuildContent } from '@wpmedia/feeds-content-elements'
import { BuildPromoItems } from '@wpmedia/feeds-promo-items'
import { generatePropsForFeed } from '@wpmedia/feeds-prop-types'
Expand Down Expand Up @@ -159,12 +159,15 @@ export function GoogleNewsRss({
arcSite,
requestUri,
}) {
let { resizerURL = '' } = getProperties(arcSite)
const {
resizerURL = '',
resizerURLs = {},
feedDomainURL = 'http://localhost.com',
feedTitle = '',
feedLanguage = '',
} = getProperties(arcSite)
resizerURL = resizerURLs?.[ENVIRONMENT] || resizerURL

const channelLanguage = customFields.channelLanguage || feedLanguage
const { width = 0, height = 0 } = customFields.resizerKVP || {}
const requestPath = new URL.URL(requestUri, feedDomainURL).pathname
Expand Down
6 changes: 4 additions & 2 deletions blocks/rss-msn-feature-block/features/msn-rss/xml.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import PropTypes from 'fusion:prop-types'
import Consumer from 'fusion:consumer'
import moment from 'moment'
import getProperties from 'fusion:properties'
import { resizerKey } from 'fusion:environment'
import { resizerKey, ENVIRONMENT } from 'fusion:environment'
import { BuildContent } from '@wpmedia/feeds-content-elements'
import { BuildPromoItems } from '@wpmedia/feeds-promo-items'
import { generatePropsForFeed } from '@wpmedia/feeds-prop-types'
Expand Down Expand Up @@ -161,12 +161,14 @@ const rssTemplate = (
})

export function MsnRss({ globalContent, customFields, arcSite, requestUri }) {
let { resizerURL = '' } = getProperties(arcSite)
const {
resizerURL = '',
resizerURLs = {},
feedDomainURL = 'http://localhost.com',
feedTitle = '',
feedLanguage = '',
} = getProperties(arcSite)
resizerURL = resizerURLs?.[ENVIRONMENT] || resizerURL
const channelLanguage = customFields.channelLanguage || feedLanguage
const { width = 0, height = 0 } = customFields.resizerKVP || {}
const requestPath = new URL.URL(requestUri, feedDomainURL).pathname
Expand Down
7 changes: 5 additions & 2 deletions blocks/sitemap-feature-block/features/sitemap/xml.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import PropTypes from 'fusion:prop-types'
import Consumer from 'fusion:consumer'
import getProperties from 'fusion:properties'
import { resizerKey } from 'fusion:environment'
import { resizerKey, ENVIRONMENT } from 'fusion:environment'
import { generatePropsForFeed } from '@wpmedia/feeds-prop-types'
import { BuildPromoItems } from '@wpmedia/feeds-promo-items'

Expand Down Expand Up @@ -59,7 +59,10 @@ const sitemapTemplate = (
})

export function Sitemap({ globalContent, customFields, arcSite }) {
const { resizerURL = '', feedDomainURL = '' } = getProperties(arcSite)
let { resizerURL = '' } = getProperties(arcSite)
const { resizerURLs = {}, feedDomainURL = '' } = getProperties(arcSite)
resizerURL = resizerURLs?.[ENVIRONMENT] || resizerURL

const { width = 0, height = 0 } = customFields.resizerKVP || {}

const PromoItems = new BuildPromoItems()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import PropTypes from 'fusion:prop-types'
import Consumer from 'fusion:consumer'
import getProperties from 'fusion:properties'
import { resizerKey } from 'fusion:environment'
import { resizerKey, ENVIRONMENT } from 'fusion:environment'
import { BuildPromoItems } from '@wpmedia/feeds-promo-items'
import { generatePropsForFeed } from '@wpmedia/feeds-prop-types'
const jmespath = require('jmespath')
Expand Down Expand Up @@ -92,12 +92,14 @@ const sitemapTemplate = (
})

export function GoogleSitemap({ globalContent, customFields, arcSite }) {
let { resizerURL = '' } = getProperties(arcSite)
const {
resizerURL = '',
resizerURLs = {},
feedDomainURL = '',
feedTitle = '',
feedLanguage = '',
} = getProperties(arcSite)
resizerURL = resizerURLs?.[ENVIRONMENT] || resizerURL
const { width = 0, height = 0 } = customFields.resizerKVP || {}
const newsLanguage = customFields.newsLanguage || feedLanguage
const newsKeywordsJmespath =
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import PropTypes from 'fusion:prop-types'
import Consumer from 'fusion:consumer'
import getProperties from 'fusion:properties'
import { resizerKey } from 'fusion:environment'
import { resizerKey, ENVIRONMENT } from 'fusion:environment'
import { buildResizerURL } from '@wpmedia/feeds-resizer'
import { generatePropsForFeed } from '@wpmedia/feeds-prop-types'
import { findVideo } from '@wpmedia/feeds-find-video-stream'
Expand Down Expand Up @@ -77,7 +77,9 @@ const sitemapTemplate = (
})

export function VideoSitemap({ globalContent, customFields, arcSite }) {
const { resizerURL = '', feedDomainURL = '' } = getProperties(arcSite)
let { resizerURL = '' } = getProperties(arcSite)
const { resizerURLs = {}, feedDomainURL = '' } = getProperties(arcSite)
resizerURL = resizerURLs?.[ENVIRONMENT] || resizerURL
const { width = 0, height = 0 } = customFields.resizerKVP || {}

// can't return null for xml return type, must return valid xml template
Expand Down
Loading

0 comments on commit 67c9ca3

Please sign in to comment.