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

[examples][frameworks] Add support for Astro #6477

Closed
wants to merge 13 commits into from

Conversation

stramel
Copy link

@stramel stramel commented Jul 14, 2021

This adds the framework Astro to the list of frameworks. We're hoping to improve upon this template after getting the initial one added and we find ways to optimize it further.

Example was generated using npm init astro

/cc @FredKSchott @matthewp @natemoo-re @drwpow

@stramel stramel changed the title Add Astro to Frameworks [examples][frameworks][astro] Initial add of Astro Jul 14, 2021
@FredKSchott
Copy link

If it helps to get this looked at, Github published some stats on popularity & growth as a part of merging our syntax into Github.com code syntax highlighting: github-linguist/linguist#5460 (comment)

@stramel
Copy link
Author

stramel commented Jul 26, 2021

@styfle @leerob Could I bug either of you for a review? I noticed you had reviewed similar PRs for this repo.

Copy link
Member

@leerob leerob left a comment

Choose a reason for hiding this comment

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

I can deploy the example to astro.examples.vercel.com once we're ready to go!

'Astro is a next-generation static site generator that mixes lightning-fast performance with modern developer experience.',
description: 'An Astro site, using the default starter kit.',
website: 'https://astro.build',
envPrefix: 'SNOWPACK_PUBLIC_',
Copy link
Member

Choose a reason for hiding this comment

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

Should this be ASTRO_?

Copy link
Author

Choose a reason for hiding this comment

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

I believe this is still SNOWPACK_PUBLIC_ since internally it is using snowpack. I don't believe this has been aliased yet. @FredKSchott can you confirm?

Copy link
Member

Choose a reason for hiding this comment

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

Sorry, I should have been more clear. This is used for Vercel.

https://vercel.com/docs/environment-variables#system-environment-variables

CleanShot 2021-07-26 at 09 57 37@2x

Copy link
Author

@stramel stramel Jul 26, 2021

Choose a reason for hiding this comment

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

Sorry, I think I'm missing the point of this property. The comment on the Framework typing says it is used to inline values into the browser bundle.

  /**
   * The environment variable prefix used to inline values into the browser bundle.
   * @example "NEXT_PUBLIC_"
   */
  envPrefix?: string;

This would be how the developer could utilize the vercel env vars in their builds, correct? If I wanted to use VERCEL_ENV in my browser build I would need to use NEXT_PUBLIC_VERCEL_ENV for next? If so, I believe it would be SNOWPACK_PUBLIC_VERCEL_ENV?

Copy link
Member

@styfle styfle Jul 26, 2021

Choose a reason for hiding this comment

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

Yep, that sounds right. Are there Astro docs that show this usage?

Copy link
Author

@stramel stramel Jul 26, 2021

Choose a reason for hiding this comment

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

@styfle I don't believe there is anything in the docs currently. I know the team just launched the docs site recently. I will file an issue to add it to the docs. In the meantime, you can see that the docs site itself utilizes the SNOWPACK_PUBLIC_ prefix.

https://github.com/snowpackjs/astro/blob/main/docs/README.md
https://github.com/snowpackjs/astro/blob/23735c53cc59e489cf1d0f528a97c2ce535d0a21/docs/src/components/AvatarList.astro#L9

Related issue: withastro/astro#873

Copy link
Member

Choose a reason for hiding this comment

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

Ok lets wait to see what happens with the upstream issue.

I'm also wondering if we should wait for JS files to be hashed so we can cache them per this comment

Copy link
Author

Choose a reason for hiding this comment

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

Sounds good! I will also open a RFC around additional file hashing in the production builds to keep the conversation going.

@styfle styfle changed the title [examples][frameworks][astro] Initial add of Astro [examples][frameworks] Add support for Astro Jul 26, 2021
Copy link
Member

@leerob leerob left a comment

Choose a reason for hiding this comment

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

@styfle if this looks good to you, I can deploy the example!

Copy link
Member

@styfle styfle left a comment

Choose a reason for hiding this comment

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

I think we should wait until Astro 1.0 is released (or at least a RC) before supporting zero config, otherwise we'll have to have two presets to avoid breaking changes:

  • Astro 0.x
  • Astro 1.x

The reason is, we can't safely add caching for JS files so it will have to be versioned.
See this comment.

Furthermore, it sounds like the SNOWPACK env prefix might change to ASTRO.
See this comment.

Putting this on hold until both of those can be addressed by the Astro team.

@FredKSchott
Copy link

Not opposed to that at all, makes sense if this multi-version support would be difficult to manage. Once we reach 1.0 I don't expect larger changes to the degree that your deployment defaults would need to change.

@tony-sull tony-sull mentioned this pull request May 2, 2022
4 tasks
@TooTallNate
Copy link
Member

Superseded by #7747.

@TooTallNate TooTallNate closed this May 6, 2022
@stramel stramel deleted the ms/add-astro-framework branch June 10, 2022 18:28
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.

5 participants