Skip to content

Conversation

@e111077
Copy link
Collaborator

@e111077 e111077 commented Mar 27, 2025

Allows for setting the CDN base url. Currently only tested is unpkg and https://cdn.jsdelivr.net/npm via the cdnBaseUrl property and config entry

Copy link
Collaborator Author

@e111077 e111077 left a comment

Choose a reason for hiding this comment

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

Had to change the package.json because unpkg can't serve 2.8.0 for some reason but it can 3.0.0 so this unbreaks the default case in the configurator

@e111077 e111077 marked this pull request as ready for review March 27, 2025 23:12
@e111077 e111077 force-pushed the customize-cdn branch 3 times, most recently from 3f8e15a to cd9d331 Compare March 28, 2025 04:53
Copy link

@sorvell sorvell left a comment

Choose a reason for hiding this comment

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

Thanks so much! optional nits.

@e111077
Copy link
Collaborator Author

e111077 commented Mar 29, 2025

Test failure seems like a flake

Allows for setting the CDN base url. Currently only tested is unpkg and https://cdn.jsdelivr.net/npm via the `cdnBaseUrl` property and config entry
@aomarks aomarks merged commit c08d9b0 into google:main Mar 29, 2025
4 checks passed
Comment on lines +184 to +185
@property({attribute: 'cdn-base-url'})
cdnBaseUrl = 'https://unpkg.com';
Copy link
Collaborator

Choose a reason for hiding this comment

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

do we need this as a separate property on <playground-project> if it's already part of the config property, or the JSON in projectSrc?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The idea was that the property takes precedence over the config and if neither are defined then it defaults to unpkg.com. But actually what you're pointing out right now as well is that by setting this default on the property, it will by default not read from the config unless you explicitly set ''

I'll work on a lower priority followup to this

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

#423 but I think your original question is still valid. It's a decision I made to support both. My reasoning was that if we wanted to set this across lit.dev, we'd only have to change the base config that is shared across basically all the projects

Copy link
Collaborator

Choose a reason for hiding this comment

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

yeah keeping it in the JSON manifest for the project-src or config property which share the same interface makes sense, and that'll allow us to update that for the whole of lit.dev playground in relatively few places since we extend from just a few base project jsons.

adding the extra cdnBaseUrl property on top of that to <playground-project> that overrides the project manifest doesn't seem as necessary to me and we'd have to clearly document which value takes precedence if we do keep it.

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.

5 participants