Skip to content

Commit

Permalink
#748: standardize asset-template's main extract's file name
Browse files Browse the repository at this point in the history
content.asset-template-meta.html
  • Loading branch information
JoernBerkefeld committed Feb 17, 2023
1 parent f7776e3 commit ba8b301
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
1 change: 1 addition & 0 deletions boilerplate/files/.vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"*-meta.ssjs": "${capture}-meta.json",
"*.asset-asset-meta.html": "${dirname}.asset-asset-meta.json",
"*.asset-message-meta.html": "${dirname}.asset-message-meta.json",
"*.asset-template-meta.html": "${dirname}.asset-template-meta.json",
"*.css": "${capture}.asset-code-meta.json",
"*.docx": "${capture}.asset-document-meta.json",
"*.eps": "${capture}.asset-image-meta.json",
Expand Down
4 changes: 4 additions & 0 deletions boilerplate/forcedUpdates.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
[
{
"version": "4.3.4",
"files": [".vscode/settings.json"]
},
{
"version": "4.1.12",
"files": [".vscode/settings.json"]
Expand Down
12 changes: 5 additions & 7 deletions lib/metadataTypes/Asset.js
Original file line number Diff line number Diff line change
Expand Up @@ -865,30 +865,28 @@ class Asset extends MetadataType {
// this complex type always creates its own subdir per asset
subDirArr = [this.definition.type, subType];
readDirArr = [deployDir, ...subDirArr, templateName || customerKey];
const fileName = 'content' + subtypeExtension;

const fileExtArr = ['html']; // eslint-disable-line no-case-declarations
for (const ext of fileExtArr) {
if (
await File.pathExists(
File.normalizePath([
...readDirArr,
`${templateName || customerKey}${subtypeExtension}.${ext}`,
])
File.normalizePath([...readDirArr, `${fileName}.${ext}`])
)
) {
// the main content can be empty (=not set up yet) hence check if we did extract sth or else readFile() will print error msgs
if (!fileListOnly) {
metadata.content = await File.readFilteredFilename(
readDirArr,
(templateName || customerKey) + subtypeExtension,
fileName,
ext
);
}
if (templateName) {
// to use this method in templating, store a copy of the info in fileList
fileList.push({
subFolder: subDirArr,
fileName: (templateName || customerKey) + subtypeExtension,
fileName: fileName,
fileExt: ext,
content: metadata.content,
});
Expand Down Expand Up @@ -1204,7 +1202,7 @@ class Asset extends MetadataType {
if (metadata?.content?.length) {
codeArr.push({
subFolder: null,
fileName: customerKey,
fileName: 'content',
fileExt: fileExt,
content: metadata.content,
});
Expand Down

0 comments on commit ba8b301

Please sign in to comment.