Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Manifest doesn't recognize or emit media files for inherited templates. #174

Closed
aweber1 opened this issue Apr 17, 2019 · 0 comments

Comments

@aweber1
Copy link
Member

commented Apr 17, 2019

Description

Given the following manifest declarations:

export default function(manifest) {
  manifest.addTemplate({
    name: 'Car',
    fields: [
      { name: 'Model', type: CommonFieldTypes.SingleLineText },
      { name: 'Description', type: CommonFieldTypes.RichText },
      { name: 'Thumbnail', type: CommonFieldTypes.Image },
      { name: 'Image', type: CommonFieldTypes.Image },
      { name: 'Code', type: CommonFieldTypes.SingleLineText },
      { name: 'Power', type: CommonFieldTypes.SingleLineText },
      { name: 'Year', type: CommonFieldTypes.SingleLineText },
      { name: 'Features', type: CommonFieldTypes.RichText },
    ],
  });

  manifest.addComponent({
    name: 'CarTeaser',
    icon: SitecoreIcon.DocumentTag,
    inherits: ['Car']
  });
}

and corresponding component data:

- componentName: CarTeaser
    fields:
      Model: BMW 530xd
      Code: bmw
      Description: |
          The Volkswagen Passat is a large family car manufactured and marketed by Volkswagen since 1973, and now in its eighth generation.
      Thumbnail:
        src: /data/media/img/bmw.jpg

It is expected that the manifest would recognize the /data/media/img/bmw.jpg value provided for the CarTeaser component and copy that file to the /sitecore/manifest folder during manifest generation. The import process would then upload that file to the Sitecore media library during import.

However, the file is not recognized or copied to the manifest folder. And the import process then reports errors that the file can't be found.

The issue is that the buildMediaOutput function in packages/sitecore-jss-manifest/src/generator/pipelines/generateMedia/utils.ts does not resolve fields that a template may inherit, it only inspects fields that are directly assigned to a template.

The solution is to resolve inherited templates/fields when building media output for the manifest.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant
You can’t perform that action at this time.