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

feat: post-conditions #388

Merged
merged 8 commits into from
Jun 13, 2024
Merged

feat: post-conditions #388

merged 8 commits into from
Jun 13, 2024

Conversation

manuel3108
Copy link
Member

Closes #337 (preconditions already implemented by #368)

Usage:

export const checks = defineAdderChecks({
    options,
    postconditions: [
        {
            name: "scss setup",
            run: async ({ fileExists, fileContains }) => {
                if (options.useSass) {
                    const filePath = `src/variables.scss`;
                    await fileExists(filePath);
                    await fileContains(filePath, "$background: lightgrey;");
                }
            },
        },
    ],
});

Will be helpful for all adders that we cannot check with integration testing, like #338, #339 , etc.

This is currently not implemented for any adder, as all adders are currently testable by integration testing. Future adders will use this feature.

Console output looks like this:
image

Copy link

changeset-bot bot commented Jun 13, 2024

🦋 Changeset detected

Latest commit: 6df0f79

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 11 packages
Name Type
@svelte-add/core Minor
svelte-add Patch
@svelte-add/testing-library Patch
@svelte-add/website Patch
@svelte-add/bootstrap Patch
@svelte-add/bulma Patch
@svelte-add/mdsvex Patch
@svelte-add/routify Patch
@svelte-add/storybook Patch
@svelte-add/tailwindcss Patch
@svelte-add/threlte Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@manuel3108
Copy link
Member Author

@AdrianGonz97 Would you mind reviewing this, even if this is not directly testable?

Copy link
Collaborator

@AdrianGonz97 AdrianGonz97 left a comment

Choose a reason for hiding this comment

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

Code-wise everything looks good! although, I do have a few questions:

So if a postcondition fails for a user, what are the actionable steps that a user should take when an error is thrown? Should it tell the user how to fix it (if it can be fixed)? Should it provide a link to our issue tracker and ask them to raise an issue?

@manuel3108
Copy link
Member Author

Good catch. I added an appropriate text to inform the user that they should create an issue.

image

@manuel3108 manuel3108 enabled auto-merge (squash) June 13, 2024 16:23
@manuel3108 manuel3108 merged commit 9a116d4 into main Jun 13, 2024
3 checks passed
@manuel3108 manuel3108 deleted the feat/postconditions branch June 13, 2024 16:33
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.

Add pre / post-installation checks
2 participants