Skip to content

Commit

Permalink
feat(SmartNTT): support new file name
Browse files Browse the repository at this point in the history
  • Loading branch information
IanKrieger committed Oct 11, 2024
1 parent 18d1e74 commit dd02b19
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
4 changes: 2 additions & 2 deletions lib/ntpUtil.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ const isValidSchemaVersion = (version) => {
return version === jsonSchemaVersion
}

const prepareAssets = (jsonFileUrl, targetResourceDir, targetJsonFileName) => {
const prepareAssets = (jsonFileUrl, targetResourceDir, targetJsonFileName = 'photo.json') => {
return new Promise(function (resolve, reject) {
let jsonFileBody = '{}'

Expand Down Expand Up @@ -126,7 +126,7 @@ const prepareAssets = (jsonFileUrl, targetResourceDir, targetJsonFileName) => {
return reject(error)
}

createPhotoJsonFile(path.join(targetResourceDir, 'photo.json'), JSON.stringify(photoData))
createPhotoJsonFile(path.join(targetResourceDir, targetJsonFileName), JSON.stringify(photoData))

// Download image files that specified in jsonFileUrl
const imageFileNameList = getImageFileNameListFrom(photoData)
Expand Down
8 changes: 6 additions & 2 deletions scripts/ntp-sponsored-images/generate.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,12 @@ async function generateNTPSponsoredImages (dataUrl, targetComponents) {
const targetResourceDir = path.join(rootResourceDir, regionPlatformName)
mkdirp.sync(targetResourceDir)
const regionPlatformPath = regionPlatformName.replace('-', '/')
const sourceJsonFileUrl = `${dataUrl}${regionPlatformPath}/photo.json`
await ntpUtil.prepareAssets(sourceJsonFileUrl, targetResourceDir)
const baseJsonFileUrl = `${dataUrl}${regionPlatformPath}`

await Promise.all([
ntpUtil.prepareAssets(`${baseJsonFileUrl}/photo.json`, targetResourceDir),
ntpUtil.prepareAssets(`${baseJsonFileUrl}/si-photo.json`, targetResourceDir, 'si-photo.json')
])
}
}

Expand Down

0 comments on commit dd02b19

Please sign in to comment.