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

Reduce the repository and homepage warnings when not present in package.json #75

Open
lorenzolewis opened this issue May 3, 2024 · 4 comments
Labels
good first issue Good for newcomers help wanted Extra attention is needed

Comments

@lorenzolewis
Copy link
Contributor

There are use cases where a user doesn't want to publish their theme (such as if private or just testing something). The warnings that are emitted I feel are a tiny bit over-kill (especially when first getting started with the example repo):

22:34:40 [WARN] [my-theme] Add a 'homepage' to your theme's 'package.json'!     Astro uses this value to populate the integrations page https://astro.build/integrations/

        "homepage": "https://github.com/UserName/theme-playground",

22:34:40 [WARN] [my-theme] Add a 'repository' to your theme's 'package.json'!   Astro uses this value to populate the integrations page https://astro.build/integrations/

        "repository": {
            "type": "git",
            "url": "https://github.com/UserName/my-theme",
            "directory": "package"
        },

If the intention is to use this package for preparing a user to submit their theme to the Astro integration page then maybe a validate command could be added? This could check if everything is correct and also give a developer any additional context.

@BryceRussell
Copy link
Member

BryceRussell commented May 3, 2024

Thanks for opening an issue on this! I agree, these warnings can feel like overkill, especially for this use case. I haven't documented this yet, but I tried to get around this by adding the ability to silence these warning if the package.json has "private": true or if the log option is set to false. What do you think about this? This does not solve the issue with the template warnings being scary, but the template is meant for packages. Maybe we could fill these properties with default values in the template, so the warnings don't scare anyone.

Context for these warnings: The main reason I want to support these warning is that the integrations page is populated automatically. This means It is possible for user's to publish their package with undefined fields, which makes it harder for people to discover the theme on the integrations page. The goal of these warnings are to make sure that themes authored with ATP follow best practices and are discoverable by the Astro.

@lorenzolewis
Copy link
Contributor Author

Ahh, awesome! I just tried the "private": true trick and that's exactly what I expected. Possibly just adding a sentence to the log output telling the developer they can do the same would fix it I think. And those who read are annoyed my console messages are maybe those who actually read the messages there and would notice that hint if so ;)

@BryceRussell
Copy link
Member

Good idea! 📋 I also plan on writing some docs to cover these options/use cases

@BryceRussell
Copy link
Member

If anyone is interested in contributing, this is a great first issue!

Here is the code for these warnings: https://github.com/astrolicious/astro-theme-provider/blob/main/package/src/utils/package.ts#L38

If any of these warnings are triggered, we should also warn that they can be silenced with "private": true inside the package.json

@BryceRussell BryceRussell added help wanted Extra attention is needed good first issue Good for newcomers labels May 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants