florian-lefebvre / astro-integration-kit

A package that contains utilities to help you build Astro integrations.
https://astro-integration-kit.netlify.app
MIT License
46 stars 8 forks source link

feat: format addDts content #73

Closed florian-lefebvre closed 4 months ago

florian-lefebvre commented 4 months ago
netlify[bot] commented 4 months ago

Deploy Preview for astro-integration-kit ready!

Name Link
Latest commit aa23d2f9ebf538ba19de3a3809705776f78658d4
Latest deploy log https://app.netlify.com/sites/astro-integration-kit/deploys/65e5c7487361060008c8cc6b
Deploy Preview https://deploy-preview-73--astro-integration-kit.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

BryceRussell commented 4 months ago

Works great, I played around with it a bunch and it generates nice looking types

Suggestion for docs: Is it worth documenting a pattern for dynamically generating types? Now that you don't have to manage whitespace on your own it makes it a lot easier to generate dynamic types using a simple string buffer:

let buffer = ""

for() {
  buffer += `\n...`
}

addDts({
    name: "my-integration",
    content: `
      declare module "virtual:my-integration" {
        ${buffer}
      }
    `
})
florian-lefebvre commented 4 months ago

I added a new section related to your comment 🚀