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: add experimental PWA assets generation and injection #621

Merged
merged 38 commits into from Feb 17, 2024

Conversation

userquin
Copy link
Member

@userquin userquin commented Dec 10, 2023

This PR includes PWA assets generator 0.2.2, with the following features:

  • generate all icon assets from the preset, including apple splash screen icons
  • inject icon assets icons in the PWA web manifest icons in dev and build: disabled by default (the plugn will auto-detect if icons present)
  • inject favicon, apple touch icon and apple touch startup image links in the html head: enabled by default
  • inject PWA web manifest color_theme in the html head meta theme-color: enabled by default
  • allow inlined and external pwa assets configuration: external configuration has preference over inlined
  • support for caching resources in dev: using 304 when already requested (using id-modified-since header) and cache invalidation on configuration change
  • pwa assets config file reload support in dev: once configuration reloaded and cache cleared, the client will refresh the page
  • expose 2 new virtual modules for integrations: virtual:pwa-assets/head and virtual:pwa-assets/icons
  • expose internal pwa assets generator in the api: maybe required for some integration

You can run the assets-generator example in dev or building and preview:

  • from root run pnpm install && pnpm build
  • change to assets-generator example: cd examples/assets-generator
  • run the dev script (pnpm dev) or build + preview (pnpm build && pnpm preview)

Copy link

netlify bot commented Dec 10, 2023

Deploy Preview for vite-plugin-pwa-legacy ready!

Name Link
🔨 Latest commit 074ecaf
🔍 Latest deploy log https://app.netlify.com/sites/vite-plugin-pwa-legacy/deploys/65d0b2658ed7c9000825f7d4
😎 Deploy Preview https://deploy-preview-621--vite-plugin-pwa-legacy.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.

src/types.ts Outdated Show resolved Hide resolved
src/types.ts Outdated Show resolved Hide resolved
@Aslemammad
Copy link

Excited for this PR!

src/plugins/main.ts Outdated Show resolved Hide resolved
src/plugins/assets.ts Outdated Show resolved Hide resolved
@userquin userquin changed the title feat: pwa assets generation and injection feat: add experimental PWA assets generation and injection Dec 13, 2023
src/plugins/assets.ts Outdated Show resolved Hide resolved
src/plugins/assets.ts Outdated Show resolved Hide resolved
src/asset-generator.ts Outdated Show resolved Hide resolved
src/asset-generator.ts Outdated Show resolved Hide resolved
src/plugins/build.ts Outdated Show resolved Hide resolved
@userquin userquin marked this pull request as ready for review December 16, 2023 17:05
@userquin
Copy link
Member Author

userquin commented Feb 10, 2024

Moved pwa assets dependency to optional peer, here small repro if someone want to check it https://github.com/userquin/vite-plugin-pwa-assets-generator (local tgz from this PR)

@userquin userquin merged commit d9ffcb5 into main Feb 17, 2024
4 checks passed
@userquin userquin deleted the userquin/feat/experimental-pwa-assets-injection branch February 17, 2024 13:32
renovate bot added a commit to SebastianGoeb/chinese-chart that referenced this pull request Feb 19, 2024
[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [vite-plugin-pwa](https://togithub.com/vite-pwa/vite-plugin-pwa) |
[`^0.18.0` ->
`^0.19.0`](https://renovatebot.com/diffs/npm/vite-plugin-pwa/0.18.1/0.19.0)
|
[![age](https://developer.mend.io/api/mc/badges/age/npm/vite-plugin-pwa/0.19.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/vite-plugin-pwa/0.19.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/vite-plugin-pwa/0.18.1/0.19.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/vite-plugin-pwa/0.18.1/0.19.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|

---

### Release Notes

<details>
<summary>vite-pwa/vite-plugin-pwa (vite-plugin-pwa)</summary>

###
[`v0.19.0`](https://togithub.com/vite-pwa/vite-plugin-pwa/releases/tag/v0.19.0)

[Compare
Source](https://togithub.com/vite-pwa/vite-plugin-pwa/compare/v0.18.2...v0.19.0)

#####    🚨 Breaking Changes

- Add experimental PWA assets generation and injection  -  by
[@&#8203;userquin](https://togithub.com/userquin) in
[vite-pwa/vite-plugin-pwa#621
[<samp>(d9ffc)</samp>](https://togithub.com/vite-pwa/vite-plugin-pwa/commit/d9ffcb5)

#####     [View changes on
GitHub](https://togithub.com/vite-pwa/vite-plugin-pwa/compare/v0.18.2...v0.19.0)

###
[`v0.18.2`](https://togithub.com/vite-pwa/vite-plugin-pwa/releases/tag/v0.18.2)

[Compare
Source](https://togithub.com/vite-pwa/vite-plugin-pwa/compare/v0.18.1...v0.18.2)

#####    🐞 Bug Fixes

- Use `swDest` folder to resolve mjs and map files in Vite build  -  by
[@&#8203;userquin](https://togithub.com/userquin) in
[vite-pwa/vite-plugin-pwa#661
[<samp>(aaa85)</samp>](https://togithub.com/vite-pwa/vite-plugin-pwa/commit/aaa856b)

#####     [View changes on
GitHub](https://togithub.com/vite-pwa/vite-plugin-pwa/compare/v0.18.1...v0.18.2)

</details>

---

### Configuration

📅 **Schedule**: Branch creation - "before 4am on Monday" (UTC),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View
repository job log
[here](https://developer.mend.io/github/SebastianGoeb/chinese-chart).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4xOTEuMCIsInVwZGF0ZWRJblZlciI6IjM3LjE5MS4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiJ9-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
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.

None yet

2 participants