Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/babichjacob/sapper-typescript-graphql-template
A template that includes Sapper for Svelte, TypeScript preprocessing, and a GraphQL server through TypeGraphQL
https://github.com/babichjacob/sapper-typescript-graphql-template
apollo-server eslint graphql sapper svelte typegraphql typescript
Last synced: 1 day ago
JSON representation
A template that includes Sapper for Svelte, TypeScript preprocessing, and a GraphQL server through TypeGraphQL
- Host: GitHub
- URL: https://github.com/babichjacob/sapper-typescript-graphql-template
- Owner: babichjacob
- License: mit
- Archived: true
- Created: 2020-05-15T08:32:58.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2020-12-12T20:25:04.000Z (almost 4 years ago)
- Last Synced: 2024-08-02T12:51:55.010Z (3 months ago)
- Topics: apollo-server, eslint, graphql, sapper, svelte, typegraphql, typescript
- Language: TypeScript
- Homepage:
- Size: 753 KB
- Stars: 84
- Watchers: 2
- Forks: 14
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-starred - babichjacob/sapper-typescript-graphql-template - A template that includes Sapper for Svelte, TypeScript preprocessing, and a GraphQL server through TypeGraphQL (graphql)
README
๐ Sapper with TypeScript and GraphQL project base
## โ What is this?
This is an extension to the [official Sapper Rollup template](https://github.com/sveltejs/sapper-template-rollup) with TypeScript preprocessing and a GraphQL server through TypeGraphQL (Apollo Server).
- [Sapper for Svelte](https://sapper.svelte.dev/)
- [Official VS Code Plugin](https://marketplace.visualstudio.com/items?itemName=svelte.svelte-vscode)
- [TypeScript](https://www.typescriptlang.org/)
- [TypeGraphQL](https://typegraphql.com/)
- Inside Svelte components, thanks to [`svelte-preprocess`](https://github.com/kaisermann/svelte-preprocess)
- [Progressive Web App (PWA)](https://developer.mozilla.org/en-US/docs/Web/Progressive_web_apps) best practices set up
- [`manifest.json`](https://developer.mozilla.org/en-US/docs/Web/Manifest)'s most important fields filled out
- High [Lighthouse](https://developers.google.com/web/tools/lighthouse) audit score
- [ESLint](https://eslint.org/)
- [VS Code Plugin](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint)
- `eslint:fix` package scriptIf you're looking for something with much, much more bundled in, check out [my opinionated project base](https://github.com/babichjacob/sapper-firebase-typescript-graphql-tailwindcss-actions-template).
## ๐งญ Project Status
**This project base will continue to be maintained** [until SvelteKit is ready](https://svelte.dev/blog/whats-the-deal-with-sveltekit).Once you are prepared to migrate, check out the [Svelte Adders](https://github.com/babichjacob/svelte-adders) project for information about how to recreate this project base's functionality. You should specifically look at [svelte-add-graphql](https://github.com/babichjacob/svelte-add-graphql).
**Read on to use this project base today:**
## ๐ Copy
Choose either to clone or fork depending on your preference.
### ๐ Clone
```sh
git clone https://github.com/babichjacob/sapper-typescript-graphql-template
```### ๐ด Fork
Click the `Use this template` button on [this project's GitHub page](https://github.com/babichjacob/sapper-typescript-graphql-template).
### โฌ๏ธ Install Dependencies
```sh
cd sapper-typescript-graphql-template
npm install # pnpm also works
```## ๐ Usage
### ๐งช Development
```sh
npm run dev
```### ๐จ Building for Production
```sh
npm run prod
```### ๐ฆ Exporting a Static Site
Your GraphQL server will not be exported with the rest of the site.```sh
npm run export
```## โ Configuration
### โก Web app
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. If you want, you can add [app shortcut definitions for "add to home screen" on Android](https://web.dev/app-shortcuts/#define-app-shortcuts-in-the-web-app-manifest). Once you change `theme_color`, update the `meta name="theme-color"` tag in `src/template.html` to match.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.
### ๐บ Source maps
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`.### ๐ธ Optionally removing the GraphQL server
1. Remove these lines in `src/server.ts`:
1. ```ts
import { createApolloServer } from "./graphql";
```
2. ```ts
const apolloServer = await createApolloServer();
```
3. ```ts
apolloServer.applyMiddleware({ app, path: graphqlPath });
```2. Remove the now-useless `graphqlPath` parameter to `createSapperAndApolloServer` in `src/server.ts`. This is also a good opportunity to rename the function since there is no longer an Apollo Server
3. Delete the `src/graphql` folder
4. Uninstall the `apollo-server-express`, `bufferutil`, `class-validator`, `graphql`, `reflect-metadata`, `type-graphql`, and `utf-8-validate` packages
## ๐ต Help! I have a question
[Create an issue](https://github.com/babichjacob/sapper-typescript-graphql-template/issues/new) and I'll try to help.
## ๐ก Fix! There is something that needs improvement
[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.
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.
## ๐ License
MIT
---
_This README was generated with โค๏ธ by [readme-md-generator](https://github.com/kefranabg/readme-md-generator)_