Skip to content

feat: allow destructive changes with MetadataOptions #1294

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

Merged
merged 5 commits into from
Apr 23, 2024

Conversation

shetzel
Copy link
Contributor

@shetzel shetzel commented Apr 22, 2024

What does this PR do?

Allows defining metadata type/name pairs to be deleted (pre or post) as part of a metadata deploy. Adds snapshot tests for this behavior.

What issues does this PR fix or reference?

@W-15306474@

@shetzel shetzel requested a review from a team as a code owner April 22, 2024 18:00
dirsAreIdentical(path.join(snapshotsDir, 'testOutput', 'post1'), postTestOutputDir);
});

it('2 post-destructive and 2 deployments', async () => {
Copy link
Member

Choose a reason for hiding this comment

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

should/could we add a test covering 1+ pre or post destructive changes, without any constructive? Seems like it'll be working - but would be good to have for future changes

Copy link
Member

Choose a reason for hiding this comment

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

or maybe we don't want to support that? if the CLIs not adding new flags to use this, I'm not sure if other SDR consumers would like that ability

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I can add a test for those cases. 👍

@WillieRuemmele
Copy link
Member

QA Notes

since there's no flags, or exposure through the CLI, I built a small script to test the behavior

    const c = await ComponentSetBuilder.build({metadata:{
      directoryPaths:['force-app/main/default/classes'],
        destructiveEntriesPost: ['ApexClass:myClassPOST'],
        destructiveEntriesPre: ['ApexClass:myClassPRE'],
        metadataEntries: ['ApexClass:myClass']
      }})

    const p = await c.getPackageXml(4, DestructiveChangesType.PRE);
    const x = await c.getPackageXml(4, DestructiveChangesType.POST);

    // eslint-disable-next-line no-console
    console.log(p,x);

✅ : I ensured that both variables, p/x are correct.
✅ : when deployed, the classes were deleted

@WillieRuemmele WillieRuemmele merged commit 7dad1c7 into main Apr 23, 2024
@WillieRuemmele WillieRuemmele deleted the sh/destructive-changes-md branch April 23, 2024 18:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants