-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 6c7b6ed
Showing
13 changed files
with
10,256 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
node_modules | ||
.DS_Store | ||
dist | ||
dev-dist | ||
# intellij stuff | ||
.idea/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
engine-strict=true | ||
ignore-workspace-root-check=true | ||
shamefully-hoist=true | ||
strict-peer-dependencies=false | ||
auto-install-peers=true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# Contributing Guide | ||
|
||
Hi! We are really excited that you are interested in contributing to `@vite-pwa/astro`. Before submitting your contribution, please make sure to take a moment and read through the following guide. | ||
|
||
Refer also to https://github.com/antfu/contribute. | ||
## Set up your local development environment | ||
|
||
The `@vite-pwa/astro` repo is a monorepo using pnpm workspaces. The package manager used to install and link dependencies must be [pnpm](https://pnpm.io/). | ||
|
||
To develop and test the `@vite-pwa/astro` package: | ||
|
||
1. Fork the `@vite-pwa/astro` repository to your own GitHub account and then clone it to your local device. | ||
|
||
2. Ensure using the latest Node.js (^14.18.0 || >=16.12.0) | ||
|
||
3. `@vite-pwa/astro` uses pnpm v7. If you are working on multiple projects with different versions of pnpm, it's recommend to enable [Corepack](https://github.com/nodejs/corepack) by running `corepack enable`. | ||
|
||
4. Check out a branch where you can work and commit your changes: | ||
```shell | ||
git checkout -b my-new-branch | ||
``` | ||
|
||
5. Run `pnpm i` in `@vite-pwa/astro`'s root folder | ||
|
||
6. Run `pnpm run build` in `@vite-pwa/astro`'s root folder. | ||
|
||
## Testing changes | ||
|
||
From the terminal, change to one of the examples folder and run `pnpm run build && pnpm run preview`. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2022-PRESENT Anthony Fu <https://github.com/antfu> | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,126 @@ | ||
<p align='center'> | ||
<img src='./hero.png' alt="@vite-pwa/remix - Zero-config PWA Plugin for Remix"><br> | ||
Zero-config PWA Plugin for Remix | ||
</p> | ||
|
||
<p align='center'> | ||
<a href='https://www.npmjs.com/package/@vite-pwa/remix' target="__blank"> | ||
<img src='https://img.shields.io/npm/v/@vite-pwa/remix?color=33A6B8&label=' alt="NPM version"> | ||
</a> | ||
<a href="https://www.npmjs.com/package/@vite-pwa/remix" target="__blank"> | ||
<img alt="NPM Downloads" src="https://img.shields.io/npm/dm/@vite-pwa/remix?color=476582&label="> | ||
</a> | ||
<a href="https://vite-pwa-org.netlify.app/frameworks/remix" target="__blank"> | ||
<img src="https://img.shields.io/static/v1?label=&message=docs%20%26%20guides&color=2e859c" alt="Docs & Guides"> | ||
</a> | ||
<br> | ||
<a href="https://github.com/vite-pwa/remix" target="__blank"> | ||
<img alt="GitHub stars" src="https://img.shields.io/github/stars/vite-pwa/remix?style=social"> | ||
</a> | ||
</p> | ||
|
||
<br> | ||
|
||
<p align="center"> | ||
<a href="https://cdn.jsdelivr.net/gh/antfu/static/sponsors.svg"> | ||
<img src='https://cdn.jsdelivr.net/gh/antfu/static/sponsors.svg'/> | ||
</a> | ||
</p> | ||
|
||
|
||
## 🚀 Features | ||
|
||
- 📖 [**Documentation & guides**](https://vite-pwa-org.netlify.app/) | ||
- 👌 **Zero-Config**: sensible built-in default configs for common use cases | ||
- 🔩 **Extensible**: expose the full ability to customize the behavior of the plugin | ||
- 🦾 **Type Strong**: written in [TypeScript](https://www.typescriptlang.org/) | ||
- 🔌 **Offline Support**: generate service worker with offline support (via Workbox) | ||
- ⚡ **Fully tree shakable**: auto inject Web App Manifest | ||
- 💬 **Prompt for new content**: built-in support for Vanilla JavaScript, Vue 3, React, Svelte, SolidJS, Preact and Remix | ||
- ⚙️ **Stale-while-revalidate**: automatic reload when new content is available | ||
- ✨ **Static assets handling**: configure static assets for offline support | ||
- 🐞 **Development Support**: debug your custom service worker logic as you develop your application | ||
- 🛠️ **Versatile**: integration with meta frameworks: [îles](https://github.com/ElMassimo/iles), [SvelteKit](https://github.com/sveltejs/kit), [VitePress](https://github.com/vuejs/vitepress), [Astro](https://github.com/withastro/astro), and [Nuxt 3](https://github.com/nuxt/nuxt) | ||
- 💥 **PWA Assets Generator**: generate all the PWA assets from a single command and a single source image | ||
- 🚀 **PWA Assets Integration**: serving, generating and injecting PWA Assets on the fly in your application | ||
|
||
|
||
## 📦 Install | ||
|
||
`@vite-pwa/remix` requires **Vite 5** and **Astro 2.8.0 or above**. | ||
|
||
```bash | ||
npm i @vite-pwa/remix -D | ||
|
||
# yarn | ||
yarn add @vite-pwa/remix -D | ||
|
||
# pnpm | ||
pnpm add @vite-pwa/remix -D | ||
``` | ||
|
||
## 🦄 Usage | ||
|
||
Add `@vite-pwa/remix` plugin to `vite.config.js` and configure it: | ||
|
||
```ts | ||
// vite.config.js | ||
import { defineConfig } from 'vite' | ||
import { RemixPWA } from '@vite-pwa/remix' | ||
|
||
export default defineConfig({ | ||
plugins: [RemixPWA({ | ||
// Your Remix plugin options | ||
pwa: { | ||
// PWA options | ||
} | ||
})] | ||
}) | ||
``` | ||
Read the [📖 documentation](https://vite-pwa-org.netlify.app/frameworks/remix) for a complete guide on how to configure and use | ||
this plugin. | ||
|
||
## ⚡️ Examples | ||
|
||
You need to stop the dev server once started and then run `npm run build && npm run preview` to see the PWA in action. | ||
<table> | ||
<thead> | ||
<tr> | ||
<th>Example</th> | ||
<th>Source</th> | ||
<th>Playground</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
<tr> | ||
<td><code>Auto Update PWA</code></td> | ||
<td><a href="https://github.com/vite-pwa/remix/tree/main/examples/pwa-simple">GitHub</a></td> | ||
<td> | ||
<a href="https://stackblitz.com/fork/github/vite-pwa/remix/tree/main/examples/pwa-simple" target="_blank" rel="noopener noreferrer"> | ||
<img src="https://developer.stackblitz.com/img/open_in_stackblitz.svg" alt="Open in StackBlitz" width="162" height="32"> | ||
</a> | ||
</td> | ||
</tr> | ||
<tr> | ||
<td><code>Prompt for Update PWA</code></td> | ||
<td><a href="https://github.com/vite-pwa/remix/tree/main/examples/pwa-prompt">GitHub</a></td> | ||
<td> | ||
<a href="https://stackblitz.com/fork/github/vite-pwa/remix/tree/main/examples/pwa-prompt" target="_blank" rel="noopener noreferrer"> | ||
<img src="https://developer.stackblitz.com/img/open_in_stackblitz.svg" alt="Open in StackBlitz" width="162" height="32"> | ||
</a> | ||
</td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
|
||
## 👀 Full config | ||
|
||
Check out the following links for more details: | ||
|
||
- [Web app manifests](https://developer.mozilla.org/en-US/docs/Web/Manifest) | ||
- [Workbox](https://developers.google.com/web/tools/workbox) | ||
|
||
|
||
## 📄 License | ||
|
||
[MIT](./LICENSE) License © 2024-PRESENT [Anthony Fu](https://github.com/antfu) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { defineBuildConfig } from 'unbuild' | ||
|
||
export default defineBuildConfig({ | ||
entries: [ | ||
'src/index', | ||
], | ||
clean: true, | ||
declaration: true, | ||
externals: [ | ||
'vite', | ||
'astro', | ||
'astro-integration', | ||
'vite-plugin-pwa', | ||
'workbox-build', | ||
], | ||
rollup: { | ||
emitCJS: true, | ||
dts: { | ||
respectExternal: true, | ||
}, | ||
}, | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import antfu from '@antfu/eslint-config' | ||
|
||
export default await antfu( | ||
{ | ||
ignores: [ | ||
'**/build/**', | ||
'**/dist/**', | ||
'**/dev-dist/**', | ||
], | ||
}, | ||
{ | ||
rules: { | ||
'node/prefer-global/process': 'off', | ||
'no-restricted-globals': 'off', | ||
}, | ||
}, | ||
{ | ||
files: ['**/examples/**'], | ||
rules: { | ||
'no-console': 'off', | ||
}, | ||
}, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
{ | ||
"name": "@vite-pwa/remix", | ||
"type": "module", | ||
"version": "0.0.0", | ||
"packageManager": "[email protected]", | ||
"description": "Zero-config PWA for Remix", | ||
"author": "antfu <[email protected]>", | ||
"license": "MIT", | ||
"funding": "https://github.com/sponsors/antfu", | ||
"homepage": "https://github.com/vite-pwa/remix#readme", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/vite-pwa/remix.git" | ||
}, | ||
"bugs": "https://github.com/vite-pwa/remix/issues", | ||
"keywords": [ | ||
"remix-integration", | ||
"remix", | ||
"workbox", | ||
"pwa", | ||
"vite", | ||
"vite-plugin" | ||
], | ||
"exports": { | ||
".": { | ||
"import": "./dist/index.mjs", | ||
"require": "./dist/index.cjs" | ||
} | ||
}, | ||
"main": "dist/index.cjs", | ||
"module": "dist/index.mjs", | ||
"types": "dist/index.d.ts", | ||
"files": [ | ||
"dist", | ||
"*.d.ts" | ||
], | ||
"scripts": { | ||
"build": "unbuild", | ||
"lint": "eslint .", | ||
"lint-fix": "nr lint --fix", | ||
"prepublishOnly": "npm run build", | ||
"release": "bumpp && npm publish" | ||
}, | ||
"peerDependencies": { | ||
"@remix-run/dev": ">=2.8.0", | ||
"@vite-pwa/assets-generator": "^0.2.4", | ||
"vite-plugin-pwa": ">=0.19.6 <1" | ||
}, | ||
"peerDependenciesMeta": { | ||
"@remix-run/dev": { | ||
"optional": true | ||
}, | ||
"@vite-pwa/assets-generator": { | ||
"optional": true | ||
} | ||
}, | ||
"dependencies": { | ||
"vite-plugin-pwa": ">=0.19.6 <1" | ||
}, | ||
"devDependencies": { | ||
"@antfu/eslint-config": "^2.9.0", | ||
"@antfu/ni": "^0.21.12", | ||
"@types/debug": "^4.1.8", | ||
"@types/node": "^20.8.7", | ||
"@typescript-eslint/eslint-plugin": "^6.13.1", | ||
"bumpp": "^9.2.0", | ||
"eslint": "^8.57.0", | ||
"esno": "^4.0.0", | ||
"https-localhost": "^4.7.1", | ||
"@remix-run/dev": "^2.8.0", | ||
"typescript": "^5.4.3", | ||
"unbuild": "^2.0.0", | ||
"vite": "^5.2.2" | ||
} | ||
} |
Oops, something went wrong.