Skip to content

Commit 8265933

Browse files
authored
Update README.md (#180)
Clean up outdated descriptions and add more info in some areas.
1 parent f9a1d02 commit 8265933

File tree

1 file changed

+37
-16
lines changed

1 file changed

+37
-16
lines changed

README.md

Lines changed: 37 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<img width="400" src="https://i.imgur.com/83Y7bWN.png" alt="React & Google Apps Script logos"></a>
44
</p>
55
<p align="center"><i>
6-
Update 2022: Now with support for React v17 and React Fast Refresh
6+
Update 2023: Now with support for React v18 and React Fast Refresh
77
</i></p>
88

99
<div align="center">
@@ -15,7 +15,7 @@
1515

1616
</div>
1717

18-
<p align="center"> 🚀 This is your boilerplate project for developing React apps inside Google Sheets, Docs, Forms and Slides projects. It's perfect for personal projects and for publishing complex add-ons in the G Suite Marketplace.
18+
<p align="center"> 🚀 This is your boilerplate project for developing React apps inside Google Sheets, Docs, Forms and Slides projects. It's perfect for personal projects and for publishing complex add-ons in the Google Workspace Marketplace.
1919
</p>
2020

2121
---
@@ -27,11 +27,11 @@
2727
- [Prerequisites](#prerequisites)
2828
- [Getting started](#getting-started)
2929
- [Deploy](#deploy)
30-
- [[New!] Local Development](#local-development)
30+
- [Local Development](#local-development)
3131
- [Using React DevTools](#dev-tools)
3232
- [Usage](#usage)
3333
- [The included sample app](#the-included-sample-app)
34-
- [[New!] Typescript](#new-typescript)
34+
- [Typescript](#new-typescript)
3535
- [Adding packages](#adding-packages)
3636
- [Styles](#styles)
3737
- [Modifying scopes](#modifying-scopes)
@@ -68,11 +68,11 @@ See [deploy](#deploy) for notes on how to deploy the project and see it live in
6868

6969
### Prerequisites <a name = "prerequisites"></a>
7070

71-
- Make sure you're running at least [Node.js](https://nodejs.org/en/download/) v10 and `npm` v6.
71+
- Make sure you're running at least [Node.js](https://nodejs.org/en/download/) v14 and `npm` v6.
7272

7373
- You'll need to enable the Google Apps Script API. You can do that by visiting [script.google.com/home/usersettings](https://script.google.com/home/usersettings).
7474

75-
- [New!] To use live reload while developing, you'll need to serve your files locally using HTTPS. See [local development](#local-development) below for how to set up your local environment.
75+
- To use live reload while developing, you'll need to serve your files locally using HTTPS. See [local development](#local-development) below for how to set up your local environment.
7676

7777
### 🏁 Getting started <a name = "getting-started"></a>
7878

@@ -145,7 +145,7 @@ Now open Google Sheets and navigate to your new spreadsheet (e.g. the file "My R
145145

146146
<br/>
147147

148-
## 🎈 [NEW!] Local Development <a name="local-development"></a>
148+
## 🎈 Local Development <a name="local-development"></a>
149149

150150
We can develop our client-side React apps locally, and see our changes directly inside our Google Spreadsheet dialog window.
151151

@@ -233,14 +233,35 @@ You will need to use the "standalone" version of React DevTools since our React
233233

234234
The included sample app allows inserting/activating/deleting sheets through a simple HTML dialog, built with React. This simple app demonstrates how a React app can interact with the underlying Spreadsheet using Google Apps Script functions.
235235

236-
The included sample app has three menu items for loading pages in various dialogs and sidebars.
236+
The included sample app has five menu items that demonstrate how to load pages in various dialogs and sidebars. Sample implementations using different component libraries are included.
237237

238-
Two versions of the same app are provided with different styling: the first version uses vanilla React, and the second uses the popular bootstrap library (in this case, it uses [`react-bootstrap`](https://react-bootstrap.github.io/)). The bootstrap example also contains an example of a page built with typescript (see below)
239-
240-
A third app just demonstrates how to load a sidebar dialog.
238+
- `Sheet Editor` - This is a basic app that opens in a dialog window that demonstrates how to select, create and delete sheets in a Google Sheets documents through server calls. It uses vanilla React with no component library.
239+
- `Sheet Editor (Boostrap)` - The same basic app is included but styled with the Bootstrap library using [`react-bootstrap`](https://react-bootstrap.github.io/). The bootstrap example also contains an example of a page built with typescript (see below).
240+
- `Sheet Editor (MUI)` - A similar example using [`Material UI`](https://mui.com/).
241+
- `Sheet Editor (Tailwind CSS)` - Another example, using [`Tailwind`](https://tailwindcss.com/)
242+
- `About me` - This is just a simple page that demonstrates the use of a sidebar dialog.
241243

242244
Access the dialogs through the new menu item that appears. You may need to refresh the spreadsheet and approve the app's permissions the first time you use it.
243245

246+
Note that if you are choosing to use one framework, for example `Tailwind`, for your project, it is advisable to remove the dependencies for the other component libraries.
247+
248+
<details>
249+
<summary>Here are some steps to take to clean up the repo if you are only using a single library</summary>
250+
251+
1. Uninstall unneeded dependencies (`npm uninstall react-bootstrap ...` etc.)
252+
253+
2. Remove the unneeded menu bar items from the server code.
254+
255+
3. Remove the unneeded client code.
256+
257+
4. Update the `clientEntrypoints` in the [webpack config file](./webpack.config.js) to only target the relevant apps.
258+
259+
<br/>
260+
261+
</details>
262+
263+
</br>
264+
244265
### [New!] Typescript
245266

246267
This project now supports typescript!
@@ -263,7 +284,7 @@ For instance, install `react-transition-group` from npm:
263284
npm install react-transition-group
264285
```
265286

266-
Important: Since Google Apps Scripts projects don't let you easily reference external files, this project will bundle an entire app into one HTML file. This can result in large files if you are importing large packages. To help split up the files, you can grab a CDN url for your package and declare it in the [webpack file, here](./webpack.config.js#L157). If set up properly, this will add a script tag that will load packages from a CDN, reducing your bundle size.
287+
Important: Since Google Apps Scripts projects don't let you easily reference external files, this project will bundle an entire app into one HTML file. This can result in large files if you are importing large packages. To help reduce the size of these large HTML files, you can try to externalize packages by using a CDN to load packages. For packages that can be loaded through a CDN (usually they will have a UMD build), you can configure the CDN details here in the [webpack config file](./webpack.config.js#L187). If set up properly, this will add a script tag that will load packages from a CDN, reducing your overall bundle size.
267288

268289
### Styles
269290

@@ -290,8 +311,8 @@ This project uses the [gas-client](https://github.com/enuchi/gas-client) package
290311
```js
291312
// Google's documentation wants you to do this. Boo.
292313
google.script.run
293-
.withSuccessHandler(response => doSomething(response))
294-
.withFailureHandler(err => handleError(err))
314+
.withSuccessHandler((response) => doSomething(response))
315+
.withFailureHandler((err) => handleError(err))
295316
.addSheet(sheetTitle);
296317

297318
// Poof! With a little magic we can now do this:
@@ -301,8 +322,8 @@ const { serverFunctions } = new Server();
301322
// We now have access to all our server functions, which return promises!
302323
serverFunctions
303324
.addSheet(sheetTitle)
304-
.then(response => doSomething(response))
305-
.catch(err => handleError(err));
325+
.then((response) => doSomething(response))
326+
.catch((err) => handleError(err));
306327

307328
// Or we can equally use async/await style:
308329
async () => {

0 commit comments

Comments
 (0)