Skip to content

Commit

Permalink
Force redeploy
Browse files Browse the repository at this point in the history
  • Loading branch information
VitalikL committed Sep 10, 2024
1 parent ad3702c commit ce6ac46
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
14 changes: 10 additions & 4 deletions ops/sync/transfer-document-assets.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,17 @@ let transferDocumentAssets = async function () {
for (let documentImageAsset of documentImageAssets) {
documentImageAsset = `${SOURCE_DIR}/${documentImageAsset}`
let assetResourcePath = parseResourcePath(documentImageAsset)
let assetDir = `${SOURCE_DIR}/${assetResourcePath.language}/${assetResourcePath.type}/${assetResourcePath.title}/${RESOURCE_CONTENT_DIRNAME}/${assetResourcePath.document}/`
let assetDir =
documentImageAsset.indexOf(`${assetResourcePath.title}/assets`) > 0
? `${SOURCE_DIR}/${assetResourcePath.language}/${assetResourcePath.type}/${assetResourcePath.title}/${RESOURCE_ASSETS_DIRNAME}/`
: `${SOURCE_DIR}/${assetResourcePath.language}/${assetResourcePath.type}/${assetResourcePath.title}/${RESOURCE_CONTENT_DIRNAME}/${assetResourcePath.document}/`

let targetImage = path.basename(documentImageAsset)

let remoteURL =
documentImageAsset.indexOf(`${assetResourcePath.title}/assets`) > 0 ?
documentImageAsset.replace(`${SOURCE_DIR}`, MEDIA_URL) :
`${MEDIA_URL}/${assetResourcePath.language}/${assetResourcePath.type}/${assetResourcePath.title}/${RESOURCE_CONTENT_DIRNAME}/${assetResourcePath.section}/${assetResourcePath.document}/${targetImage}`
documentImageAsset.indexOf(`${assetResourcePath.title}/assets`) > 0
? documentImageAsset.replace(`${SOURCE_DIR}`, MEDIA_URL)
: `${MEDIA_URL}/${assetResourcePath.language}/${assetResourcePath.type}/${assetResourcePath.title}/${RESOURCE_CONTENT_DIRNAME}/${assetResourcePath.section}/${assetResourcePath.document}/${targetImage}`

if (assetResourcePath.segment === DOCUMENT_COVER_FILENAME) {
await processDocumentCover(assetResourcePath, remoteURL)
Expand All @@ -70,6 +73,8 @@ let transferDocumentAssets = async function () {
await processDocumentBackground(assetResourcePath, remoteURL)
}



/**
* This command replaces the locally referenced assets in *.md files within the target resource folder
* with the final destination after it had been uploaded.
Expand Down Expand Up @@ -105,6 +110,7 @@ let transferDocumentAssets = async function () {
commands.push(`sed -i -e 's/\\([ [(:]\\)${escapeAssetPathForSed(targetImage)}/\\1${escapeAssetPathForSed(remoteURL)}/g' ${assetDir}**/*.md && rm ${documentImageAsset}`)
}

console.log(`${commands.join("\n")}`)
fs.writeFileSync(OPS_SYNC_TRANSFER_COMMANDS_FILENAME, `\n${commands.join("\n")}`)
}

Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion src/en/devo/test/content/blocks/blocks.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
title: Test document2
title: Test document3
---

{"style":{"text": {"typeface":"Omnes-BlackItalic", "color": "#E5723F", "size": "xl"}}}
Expand Down

0 comments on commit ce6ac46

Please sign in to comment.