Skip to content
This repository was archived by the owner on Apr 19, 2021. It is now read-only.

Commit a4ff3c2

Browse files
committed
🚀 revolution: rebase from upstream lightweight TypeScript/GraphQL and PostCSS templates
1 parent da64e8e commit a4ff3c2

24 files changed

+996
-659
lines changed

.vscode/settings.json

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
{
22
"editor.formatOnType": true,
3-
"editor.codeActionsOnSaveTimeout": 2800,
43
"editor.codeActionsOnSave": {
54
"source.fixAll": true
65
},
@@ -19,4 +18,4 @@
1918
"svelte-type-checker.enableDefinitions": true,
2019
"svelte.plugin.typescript.completions.enable": false,
2120
"svelte-type-checker.enableCompletion": true,
22-
}
21+
}

README.md

+64-27
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,64 @@
1-
<h1 align="center">🌐 Opinionated Sapper project base</h1>
1+
<h1 align="center">🌐 Sapper with PostCSS project base</h1>
22

33
## ❓ What is this?
44
The site that builds from this repository can be found [here](https://fir-sapper-tailwindcss.web.app/).
55

66
This is an extremely opinionated Sapper project base intended for my own use. That being said, there is quite a bit of work put into it to make it generalized and adaptable to your own setup, given that you want to use *most* of these things. The lower something is on this list, the easier it is to reconfigure or remove:
7-
* [Sapper for Svelte](https://sapper.svelte.dev/)
8-
* [Official VS Code Plugin (beta)](https://marketplace.visualstudio.com/items?itemName=svelte.svelte-vscode)
9-
* [Type Checker VS Code Plugin](https://marketplace.visualstudio.com/items?itemName=halfnelson.svelte-type-checker-vscode)
10-
* [Firebase](https://firebase.google.com/)
11-
* [Functions](https://firebase.google.com/docs/functions/) for Server Side Rendering (SSR)
12-
* [Hosting](https://firebase.google.com/docs/hosting)
13-
* Thanks to [`sapper-firebase-starter`](https://github.com/Eckhardt-D/sapper-firebase-starter)
14-
* [TypeScript](https://www.typescriptlang.org/)
15-
* [TypeGraphQL](https://typegraphql.ml/)
16-
* Inside Svelte components, thanks to [`svelte-preprocess`](https://github.com/kaisermann/svelte-preprocess)
17-
* [PostCSS](https://postcss.org/)
18-
* [Tailwind CSS](https://tailwindcss.com/)
19-
* [PurgeCSS](https://www.purgecss.com/)
20-
* [CSSNano](https://cssnano.co/)
21-
* Inside Svelte components, thanks to [`svelte-preprocess`](https://github.com/kaisermann/svelte-preprocess)
22-
* [GitHub Actions](https://github.com/features/actions)
23-
* Automatic building and deployment (to Firebase), triggered on commits to master
24-
* [ESLint](https://eslint.org/)
25-
* [VS Code Plugin](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint)
26-
* `eslint:fix` package script
7+
- [Sapper for Svelte](https://sapper.svelte.dev/)
8+
- [Official VS Code Plugin (beta)](https://marketplace.visualstudio.com/items?itemName=svelte.svelte-vscode)
9+
- [Firebase](https://firebase.google.com/)
10+
- [Functions](https://firebase.google.com/docs/functions/) for Server Side Rendering (SSR)
11+
- [Hosting](https://firebase.google.com/docs/hosting)
12+
- Thanks to [`sapper-firebase-starter`](https://github.com/Eckhardt-D/sapper-firebase-starter)
13+
- [TypeScript](https://www.typescriptlang.org/)
14+
- [TypeGraphQL](https://typegraphql.ml/)
15+
- Inside Svelte components, thanks to [`svelte-preprocess`](https://github.com/kaisermann/svelte-preprocess)
16+
- [PostCSS](https://postcss.org/)
17+
- [Tailwind CSS](https://tailwindcss.com/)
18+
- [postcss-import](https://github.com/postcss/postcss-import)
19+
- [PurgeCSS](https://www.purgecss.com/)
20+
- [CSSNano](https://cssnano.co/)
21+
- Inside Svelte components, thanks to [`svelte-preprocess`](https://github.com/kaisermann/svelte-preprocess)
22+
- [GitHub Actions](https://github.com/features/actions)
23+
- Automatic building and deployment to Firebase, triggered on commits to master
24+
- [ESLint](https://eslint.org/)
25+
- [VS Code Plugin](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint)
26+
- `eslint:fix` package script
27+
- [Progressive Web App (PWA)](https://developer.mozilla.org/en-US/docs/Web/Progressive_web_apps) best practices set up
28+
- [`manifest.json`](https://developer.mozilla.org/en-US/docs/Web/Manifest)'s most important fields filled out
29+
- High [Lighthouse](https://developers.google.com/web/tools/lighthouse) audit score
2730

2831
## 📋 Copy
32+
2933
Choose either to clone or fork depending on your preference.
3034

3135
### 🐑 Clone
36+
3237
```sh
3338
git clone https://github.com/babichjacob/sapper-firebase-typescript-graphql-tailwindcss-actions-template
3439
```
3540

3641
### 🍴 Fork
37-
Click the `Use this template` button on [this project's GitHub page](https://github.com/babichjacob/sapper-firebase-typescript-graphql-tailwindcss-actions-template).
3842

43+
Click the `Use this template` button on [this project's GitHub page](https://github.com/babichjacob/sapper-firebase-typescript-graphql-tailwindcss-actions-template).
3944

4045
### ⬇️ Install Dependencies
4146
Both the project root's dependencies,
4247
```sh
4348
cd sapper-firebase-typescript-graphql-tailwindcss-actions-template
44-
npm install
49+
npm install # pnpm also works
4550
```
4651
and the Firebase functions' dependencies (for deploying outside of GitHub Actions) need to be installed.
4752
```sh
4853
cd functions
4954
npm install
5055
```
5156

57+
5258
## 🛠 Usage
53-
### 🔄 Development
59+
60+
### 🧪 Development
61+
5462
```sh
5563
npm run dev
5664
```
@@ -61,7 +69,17 @@ This will create a production build for you before deploying.
6169
npm run deploy
6270
```
6371

72+
If you do not need to include heavy Babel transforms and polyfills to support old browsers on your site, then remove the `--legacy` flag in the `build` package script to lighten it up.
73+
74+
### 🔨 Testing Production Builds Locally
75+
This probably pairs well with [Firebase Emulators](https://firebase.google.com/docs/rules/emulator-setup).
76+
```sh
77+
npm run prod
78+
npm run start
79+
```
80+
6481
## ⚙ Configuration
82+
6583
### 🔥 Firebase and 🐙 GitHub Actions
6684
The least you should need to do to get started is to edit `.firebaserc`, changing the project ID to *your* project (initialized in the [Firebase console](https://console.firebase.google.com/)) ID.
6785

@@ -73,19 +91,38 @@ Then, go to your repository's Settings > Secrets. Copy the result of the command
7391

7492
You can test if it's working by making a commit to `master` and checking the Actions tab of your repository to see if your project successfully builds and deploys to Firebase.
7593

94+
### ⚡ Web app
95+
Many of the fields in `static/manifest.json` (`short_name`, `name`, `description`, `categories`, `theme_color`, and `background_color`) are filled with demonstrative values that won't match your site. Similarly, you've got to take new screenshots to replace the included `static/screenshot-1.png` and `static/screenshot-2.png` files. Once you change `theme_color`, update the `meta name="theme-color"` tag in `src/template.html` to match.
96+
97+
The [Apple touch icon](https://developer.apple.com/library/archive/documentation/AppleApplications/Reference/SafariWebContent/ConfiguringWebApplications/ConfiguringWebApplications.html), favicon, and `logo-` files (also all in the `static` directory) are created by placing the logo within a "safe area" centered circle that takes up 80% of the canvas's dimension. For instance, the constraining circle in `logo-512.png` is 512 × 0.80 = 409.6 ≈ 410 pixels wide and tall.
98+
7699
### 🕸️ TypeGraphQL
77100
Edit the `namedExports` in `rollup.config.js` for `"type-graphql"` [when you need to import something from the library](https://github.com/MichalLytek/type-graphql/issues/378).
78101

102+
### 🗺 Source maps
103+
This project base comes with [source maps](https://blog.teamtreehouse.com/introduction-source-maps) enabled during development and disabled during production for the best compromise between performance and developer experience. You can change this behavior through the `sourcemap` variable in `rollup.config.js`.
104+
105+
### 💨 Optionally removing Tailwind CSS
106+
107+
1. Remove all Tailwind imports in the `src/global.pcss` file
108+
2. Remove the `require("tailwindcss")("./tailwind.config.js"),` line in `postcss.config.js`
109+
3. Delete the `tailwind.config.js` file
110+
4. Uninstall the `tailwindcss` package
111+
79112
## 😵 Help! I have a question
80-
[Create an issue](https://github.com/babichjacob/sapper-firebase-typescript-graphql-tailwindcss-actions-template/issues/new) and I'll try to help.
113+
114+
[Create an issue](https://github.com/babichjacob/sapper-typescript-graphql-template/issues/new) and I'll try to help.
81115

82116
## 😡 Fix! There is something that needs improvement
83-
[Create an issue](https://github.com/babichjacob/sapper-firebase-typescript-graphql-tailwindcss-actions-template/issues/new) or [pull request](https://github.com/babichjacob/sapper-firebase-typescript-graphql-tailwindcss-actions-template/pulls) and I'll try to fix.
117+
118+
[Create an issue](https://github.com/babichjacob/sapper-typescript-graphql-template/issues/new) or [pull request](https://github.com/babichjacob/sapper-typescript-graphql-template/pulls) and I'll try to fix.
84119

85120
I'm sorry, because of my skill level and the fragility of (the combination of) some of these tools, there are likely to be problems in this project. Thank you for bringing them to my attention or fixing them for me.
86121

87122
## 📄 License
123+
88124
MIT
89125

90-
***
126+
---
127+
91128
_This README was generated with ❤️ by [readme-md-generator](https://github.com/kefranabg/readme-md-generator)_

functions/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ const { https: { onRequest } } = require("firebase-functions");
22

33
const { createSapperAndApolloServer } = require("./__sapper__/build/server/server");
44

5-
const appPromise = createSapperAndApolloServer(false);
5+
const appPromise = createSapperAndApolloServer();
66

77
exports.ssr = onRequest(async (...args) => {
88
const app = await appPromise;

0 commit comments

Comments
 (0)