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 · 2 comments
Closed

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

aweber1 opened this issue Apr 17, 2019 · 2 comments
Assignees
Labels

Comments

@aweber1
Copy link
Contributor

@aweber1 aweber1 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.

@jfmanuel
Copy link

@jfmanuel jfmanuel commented May 8, 2020

Hi,
I still experience the same issue as of 05/08/2020.
I've got base templates for Link and Base Content:
`// eslint-disable-next-line no-unused-vars
import { CommonFieldTypes, Manifest } from '@sitecore-jss/sitecore-jss-manifest';

/**

  • This is the data template for an individual item in the Styleguide's Content List field demo.
    */
    export default function(manifest: Manifest) {
    manifest.addTemplate({
    name: '_BaseLinkContent',
    icon: 'Office/32x32/template.png',
    id: 'base-link-content',
    fields: [
    {
    name: 'LinkTitle',
    displayName: 'Link Title',
    type: CommonFieldTypes.SingleLineText,
    section: "Link"
    },
    {
    name: 'Link',
    displayName: 'Link',
    type: CommonFieldTypes.GeneralLink,
    section: "Link"
    }
    ],
    });
    }
    // eslint-disable-next-line no-unused-vars
    import { CommonFieldTypes, Manifest } from '@sitecore-jss/sitecore-jss-manifest';

/**

  • This is the data template for an individual item in the Styleguide's Content List field demo.
    */
    export default function(manifest: Manifest) {
    manifest.addTemplate({
    name: '_BaseContent',
    icon: 'Office/32x32/template.png',
    id: 'base-content',
    fields: [
    {
    name: 'Title',
    displayName: 'Title',
    type: CommonFieldTypes.SingleLineText,
    section: "Content"
    },
    {
    name: 'Description',
    displayName: 'Description',
    type: CommonFieldTypes.RichText,
    section: "Content"
    },
    {
    name: 'Image',
    displayName: 'Image',
    type: CommonFieldTypes.Image,
    section: "Conent"
    },
    ],
    });
    }
    Then I inherit to my banner component template.import { SitecoreIcon, Manifest } from '@sitecore-jss/sitecore-jss-manifest';

/**

  • Adds the banner component to the disconnected manifest.
  • This function is invoked by convention (*.sitecore.ts) when jss manifest is run.
    */
    export default function(manifest: Manifest) {
    manifest.addComponent({
    name: 'Banner',
    icon: SitecoreIcon.DocumentTag,
    fields: [],
    inherits: ['base-link-content','base-content'],
    });
    }
    then supply my content:- componentName: Banner
    fields:
    Title: We’re here to help you save
    Image:
    src: /data/media/img/marquee-image-covid-2800x1200-girl-mom.jpg
    alt: Wer are here to help you save
    LinkTitle: Save energy and money
    Link:
    href: /
    title: Save energy and money`

But turns out when tried to deploy it is show this issue that the image doesn't exist:
IMPORT ERROR(S) OCCURRED! Import media file /data/media/img/marquee-image-covid-2800x1200-girl-mom.jpg does not exist in the import data.

Loading

@KanchanMishra-ecx
Copy link

@KanchanMishra-ecx KanchanMishra-ecx commented Jun 12, 2020

I'm having the same issue. I inherited a template and the images are in en.yml. I can see these working in disconnected mode. but when I try to deploy the app I get
IMPORT ERROR(S) OCCURRED!
Import media file /data/media/img/....png does not exist in the import data.
Import media file /data/media/img/....png does not exist in the import data.
Import media file /data/media/img/....png does not exist in the import data.

Loading

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

3 participants