Skip to content

Commit 601c7a1

Browse files
docs(pwa): update firebase instructions for deploying pwa (#2916)
* docs(react): update firebase instructions for deploying pwa --------- Co-authored-by: Brett Peary <brett.peary.dev@gmail.com>
1 parent d389d42 commit 601c7a1

File tree

3 files changed

+63
-16
lines changed

3 files changed

+63
-16
lines changed

docs/angular/pwa.md

+17-3
Original file line numberDiff line numberDiff line change
@@ -82,19 +82,33 @@ If it's the first time you use firebase-tools, login to your Google account with
8282

8383
With the Firebase CLI installed, run `firebase init` within your Ionic project. The CLI prompts:
8484

85-
**"Which Firebase CLI features do you want to set up for this folder?"** Choose "Hosting: Configure and deploy Firebase Hosting sites."
85+
**"Which Firebase CLI features do you want to set up for this folder?"** Choose "Hosting: Configure files for Firebase Hosting and (optionally) set up GitHub Action deploys".
86+
87+
Create a new Firebase project or select an existing one.
8688

8789
**"Select a default Firebase project for this directory:"** Choose the project you created on the Firebase website.
8890

8991
**"What do you want to use as your public directory?"** Enter "www".
9092

9193
:::note
92-
Answering these next two questions will ensure that routing, hard reload, and deep linking work in the app:
94+
Answering this next question will ensure that routing, hard reload, and deep linking work in the app:
9395
:::
9496

9597
**Configure as a single-page app (rewrite all urls to /index.html)?"** Enter "Yes".
9698

97-
**"File www/index.html already exists. Overwrite?"** Enter "No".
99+
**"File build/index.html already exists. Overwrite?"** Enter "No".
100+
101+
**Set up automatic builds and deploys with Github?** Enter "Yes".
102+
103+
**For which GitHub repository would you like to set up a Github Workflow?** Enter your project name.
104+
105+
**Set up the workflow to run a build script before every deploy?** Enter "Yes".
106+
107+
**What script should be run before every deploy?** Enter `npm ci && npm run build`.
108+
109+
**Set up automatic deployment to your sites live channel when a PR is merged?** Enter "Yes".
110+
111+
**What is the name of the get hooked branch associated with your sites live channel?** Enter your project's main branch name.
98112

99113
A `firebase.json` config file is generated, configuring the app for deployment.
100114

docs/react/pwa.md

+25-10
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,13 @@ npm install -D vite-plugin-pwa
2424
Next, update your `vite.config.js` or `vite.config.ts` file and add `vite-plugin-pwa`:
2525

2626
```javascript
27-
import { defineConfig } from 'vite'
28-
import react from '@vitejs/plugin-react'
29-
import { VitePWA } from 'vite-plugin-pwa'
27+
import { defineConfig } from 'vite';
28+
import react from '@vitejs/plugin-react';
29+
import { VitePWA } from 'vite-plugin-pwa';
3030

3131
export default defineConfig({
32-
plugins: [
33-
react(),
34-
VitePWA({ registerType: 'autoUpdate' })
35-
],
36-
})
32+
plugins: [react(), VitePWA({ registerType: 'autoUpdate' })],
33+
});
3734
```
3835

3936
This minimal configuration allows your application to generate the Web Application Manifest and Service Worker on build.
@@ -102,22 +99,40 @@ Next, in a Terminal, install the Firebase CLI:
10299
npm install -g firebase-tools
103100
```
104101

102+
:::note
103+
If it's the first time you use firebase-tools, login to your Google account with `firebase login` command.
104+
:::
105+
105106
With the Firebase CLI installed, run `firebase init` within your Ionic project. The CLI prompts:
106107

107-
**"Which Firebase CLI features do you want to set up for this folder?"** Choose "Hosting: Configure and deploy Firebase Hosting sites."
108+
**"Which Firebase CLI features do you want to set up for this folder?"** Choose "Hosting: Configure files for Firebase Hosting and (optionally) set up GitHub Action deploys".
109+
110+
Create a new Firebase project or select an existing one.
108111

109112
**"Select a default Firebase project for this directory:"** Choose the project you created on the Firebase website.
110113

111114
**"What do you want to use as your public directory?"** Enter "build".
112115

113116
:::note
114-
Answering these next two questions will ensure that routing, hard reload, and deep linking work in the app:
117+
Answering this next question will ensure that routing, hard reload, and deep linking work in the app:
115118
:::
116119

117120
**Configure as a single-page app (rewrite all urls to /index.html)?"** Enter "Yes".
118121

119122
**"File build/index.html already exists. Overwrite?"** Enter "No".
120123

124+
**Set up automatic builds and deploys with Github?** Enter "Yes".
125+
126+
**For which GitHub repository would you like to set up a Github Workflow?** Enter your project name.
127+
128+
**Set up the workflow to run a build script before every deploy?** Enter "Yes".
129+
130+
**What script should be run before every deploy?** Enter `npm ci && npm run build`.
131+
132+
**Set up automatic deployment to your sites live channel when a PR is merged?** Enter "Yes".
133+
134+
**What is the name of the get hooked branch associated with your sites live channel?** Enter your project's main branch name.
135+
121136
A `firebase.json` config file is generated, configuring the app for deployment.
122137

123138
The last thing needed is to make sure caching headers are being set correctly. To do this, add a `headers` snippet to the `firebase.json` file. The complete `firebase.json` looks like:

docs/vue/pwa.md

+21-3
Original file line numberDiff line numberDiff line change
@@ -167,21 +167,39 @@ Next, in a Terminal, install the Firebase CLI:
167167
npm install -g firebase-tools
168168
```
169169

170+
:::note
171+
If it's the first time you use firebase-tools, login to your Google account with `firebase login` command.
172+
:::
173+
170174
With the Firebase CLI installed, run `firebase init` within your Ionic project. The CLI prompts:
171175

172-
**"Which Firebase CLI features do you want to set up for this folder?"** Choose "Hosting: Configure and deploy Firebase Hosting sites."
176+
**"Which Firebase CLI features do you want to set up for this folder?"** Choose "Hosting: Configure files for Firebase Hosting and (optionally) set up GitHub Action deploys".
177+
178+
Create a new Firebase project or select an existing one.
173179

174180
**"Select a default Firebase project for this directory:"** Choose the project you created on the Firebase website.
175181

176182
**"What do you want to use as your public directory?"** Enter "dist".
177183

178184
:::note
179-
Answering these next two questions will ensure that routing, hard reload, and deep linking work in the app:
185+
Answering this next question will ensure that routing, hard reload, and deep linking work in the app:
180186
:::
181187

182188
**Configure as a single-page app (rewrite all urls to /index.html)?"** Enter "Yes".
183189

184-
**"File dist/index.html already exists. Overwrite?"** Enter "No".
190+
**"File build/index.html already exists. Overwrite?"** Enter "No".
191+
192+
**Set up automatic builds and deploys with Github?** Enter "Yes".
193+
194+
**For which GitHub repository would you like to set up a Github Workflow?** Enter your project name.
195+
196+
**Set up the workflow to run a build script before every deploy?** Enter "Yes".
197+
198+
**What script should be run before every deploy?** Enter `npm ci && npm run build`.
199+
200+
**Set up automatic deployment to your sites live channel when a PR is merged?** Enter "Yes".
201+
202+
**What is the name of the get hooked branch associated with your sites live channel?** Enter your project's main branch name.
185203

186204
A `firebase.json` config file is generated, configuring the app for deployment.
187205

0 commit comments

Comments
 (0)