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

fix: metadataConverter writes zip to dir and works outside of project #1252

Merged
merged 4 commits into from
Mar 13, 2024

Conversation

aaron-csetter
Copy link
Contributor

Hello 👋 I'm an engineer from nCino. I tried adopting this tool, but it seemed to have some bugs. I went ahead and fixed them 😄 . I'll check back regularly in case something is astray. Awesome tool btw; looking forward to using it!

What does this PR do?

  • Fixed a bug where output of type zip requires an sfdx-project.json file at directory root.
  • Metadata conversion now writes zip to file when outputDirectory is specified in ZipConfig .

What issues does this PR fix or reference?

None because I was unable to open an issue on this repo lol.

Functionality Before

When executing the following code:

const components = resolver.getComponentsFromPath(`./sample/metadata`);
await converter.convert(components, 'metadata', {
    type: 'zip',
    outputDirectory: './out'
});

This error would occur when not within an SF project with an sfdx-project.json:

SfError [InvalidProjectWorkspaceError]: This directory does not contain a valid Salesforce DX project.

Also, even when executed in a valid project, specifying an outputDirectory would not actually write the zip to file.

Functionality After

Both of these problems are solved. The tool can be executed outside of a SF project and the zip is written to file when outputDirectory is specified.

@aaron-csetter aaron-csetter requested a review from a team as a code owner March 3, 2024 22:28
Copy link

salesforce-cla bot commented Mar 3, 2024

Thanks for the contribution! Before we can merge this, we need @aaron-csetter to sign the Salesforce Inc. Contributor License Agreement.

@aaron-csetter
Copy link
Contributor Author

Thanks for the contribution! Before we can merge this, we need @aaron-csetter to sign the Salesforce Inc. Contributor License Agreement.

I did but got an error 😅

Copy link
Contributor

@shetzel shetzel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks pretty good. Thanks for the contribution. With some small changes and tests it should be all set for the rest of CI tests to run.

src/collections/componentSet.ts Outdated Show resolved Hide resolved
src/convert/metadataConverter.ts Outdated Show resolved Hide resolved
@aaron-csetter aaron-csetter requested a review from shetzel March 13, 2024 15:51
@aaron-csetter aaron-csetter requested a review from shetzel March 13, 2024 20:01
@shetzel shetzel merged commit d947fc6 into forcedotcom:main Mar 13, 2024
68 checks passed
@shetzel
Copy link
Contributor

shetzel commented Mar 13, 2024

Thanks for the contribution @aaron-csetter Look for some kudos in our release notes for an upcoming release!

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

Successfully merging this pull request may close these issues.

3 participants