Skip to content

Commit 928c0bc

Browse files
authored
Initial commit
0 parents  commit 928c0bc

34 files changed

+686
-0
lines changed

.env.example

Whitespace-only changes.

.github/workflows/apollo-studio.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Apollo Studio
2+
on: [push]
3+
# https://www.apollographql.com/docs/rover/ci-cd/#full-example-1
4+
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
5+
jobs:
6+
# This workflow contains a single job called "build"
7+
build:
8+
# The type of runner that the job will run on
9+
runs-on: ubuntu-latest
10+
# https://docs.github.com/en/actions/reference/environments
11+
environment: apollo
12+
# https://docs.github.com/en/actions/reference/encrypted-secrets
13+
# https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idstepsenv
14+
env:
15+
APOLLO_KEY: ${{ secrets.APOLLO_KEY }}
16+
APOLLO_VCS_COMMIT: ${{ github.event.pull_request.head.sha }}
17+
# Steps represent a sequence of tasks that will be executed as part of the job
18+
steps:
19+
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
20+
- uses: actions/checkout@v2
21+
- name: Install Rover
22+
run: |
23+
curl -sSL https://rover.apollo.dev/nix/v0.1.0 | sh
24+
# Add Rover to the $GITHUB_PATH so it can be used in another step
25+
# https://docs.github.com/en/actions/reference/workflow-commands-for-github-actions#adding-a-system-path
26+
echo "$HOME/.rover/bin" >> $GITHUB_PATH
27+
- name: Run check against prod
28+
run: |
29+
rover graph publish TEMPLATE@current --schema ./schema.graphql
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: GraphQL Inspector
2+
3+
on: [push]
4+
5+
# https://www.graphql-inspector.com/docs/products/action
6+
jobs:
7+
test:
8+
name: Check Schema
9+
runs-on: ubuntu-latest
10+
11+
steps:
12+
- name: Checkout
13+
uses: actions/checkout@master
14+
15+
- uses: kamilkisiela/graphql-inspector@master
16+
with:
17+
schema: "master:schema.graphql"
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Github Package
2+
# https://dev.to/cloudx/publish-an-npm-to-github-packages-3pa8
3+
4+
on:
5+
release:
6+
types: [created]
7+
jobs:
8+
publish:
9+
runs-on: ubuntu-latest
10+
permissions:
11+
contents: read
12+
packages: write
13+
steps:
14+
- uses: actions/checkout@v2
15+
- uses: actions/setup-node@v2
16+
with:
17+
node-version: 16
18+
- run: npm install
19+
- run: npm run build
20+
- run: |
21+
echo @lexacode:https://npm.pkg.github.com/ > build/.npmrc
22+
echo '//npm.pkg.github.com/:_authToken=${NPM_TOKEN}' >> build/.npmrc
23+
- run: npm publish
24+
working-directory: ./build
25+
env:
26+
NPM_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/vercel.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: Vercel
2+
on: [push]
3+
jobs:
4+
deploy:
5+
runs-on: ubuntu-latest
6+
steps:
7+
- uses: actions/checkout@v2
8+
with:
9+
submodules: recursiv
10+
token: ${{ secrets.PTA }}
11+
- uses: amondnet/vercel-action@v20
12+
with:
13+
vercel-token: ${{ secrets.VERCEL_ACCESS_TOKEN }} # Required
14+
github-token: ${{ secrets.GITHUB_TOKEN }} #Optional
15+
#vercel-args: '--prod' #Optional
16+
vercel-org-id: ${{ secrets.VERCEL_ORG_ID}} #Required
17+
scope: ${{ secrets.VERCEL_ORG_ID }}
18+
vercel-project-id: ${{ secrets.VERCEL_PROJECT_ID}} #Required

.gitignore

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
.env
2+
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
3+
4+
# dependencies
5+
node_modules
6+
.next
7+
dist
8+
/.pnp
9+
.pnp.js
10+
11+
# testing
12+
/coverage
13+
14+
# next.js
15+
/.next/
16+
/out/
17+
18+
# production
19+
/build
20+
21+
# misc
22+
.DS_Store
23+
*.pem
24+
25+
# debug
26+
npm-debug.log*
27+
yarn-debug.log*
28+
yarn-error.log*
29+
pnpm-lock.yaml
30+
*/.yarn-lock.yaml
31+
32+
# local env files
33+
.env.local
34+
.env.development.local
35+
.env.test.local
36+
.env.production.local
37+
38+
# vercel
39+
.vercel
40+
41+
# typescript
42+
*.tsbuildinfo

.npmignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/examples/

.npmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
@graphql-api:registry = https://npm.pkg.github.com

.prettierignore

Whitespace-only changes.

.prettierrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{ "tabWidth": 2, "useTabs": false }

README.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# @graphql-api/template
2+
3+
### examples
4+
5+
stackblitz
6+
[![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/github/graphql-api/graphql-api-template/tree/main/examples/next)
7+
8+
codesandbox
9+
10+
11+
#### deploy:
12+
13+
koyeb
14+
[![Deploy to Koyeb](https://www.koyeb.com/static/images/deploy/button.svg)](https://app.koyeb.com/deploy?type=git&repository=github.com/koyeb/example-nestjs&branch=main&build_command=yarn%20run%20build&run_command=yarn%20run%20start:prod&name=nestjs-on-koyeb)
15+
16+
gatsby.cloud
17+
18+
netlify
19+
20+
vercel
21+
22+
next

codegen.yaml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
schema:
2+
- src/**/*.graphql
3+
generates:
4+
schema.graphql:
5+
plugins:
6+
- schema-ast
7+
types.ts:
8+
plugins:
9+
- typescript
10+
# https://www.graphql-code-generator.com/plugins/typescript-apollo-client-helpers
11+
helpers/apollo-client.ts:
12+
plugins:
13+
- typescript-apollo-client-helpers
14+
helpers/introspection-result.json:
15+
plugins:
16+
- fragment-matcher
17+
config:
18+
module: es2015
19+
helpers/introspection-result.cjs.json:
20+
plugins:
21+
- fragment-matcher
22+
config:
23+
module: commonjs

examples/next/.eslintrc.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"extends": "next/core-web-vitals"
3+
}

examples/next/README.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app).
2+
3+
## Getting Started
4+
5+
First, run the development server:
6+
7+
```bash
8+
npm run dev
9+
# or
10+
yarn dev
11+
```
12+
13+
Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
14+
15+
You can start editing the page by modifying `pages/index.tsx`. The page auto-updates as you edit the file.
16+
17+
[API routes](https://nextjs.org/docs/api-routes/introduction) can be accessed on [http://localhost:3000/api/hello](http://localhost:3000/api/hello). This endpoint can be edited in `pages/api/hello.ts`.
18+
19+
The `pages/api` directory is mapped to `/api/*`. Files in this directory are treated as [API routes](https://nextjs.org/docs/api-routes/introduction) instead of React pages.
20+
21+
## Learn More
22+
23+
To learn more about Next.js, take a look at the following resources:
24+
25+
- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
26+
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.
27+
28+
You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions are welcome!
29+
30+
## Deploy on Vercel
31+
32+
The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.
33+
34+
Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details.

examples/next/next-env.d.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
/// <reference types="next" />
2+
/// <reference types="next/image-types/global" />
3+
4+
// NOTE: This file should not be edited
5+
// see https://nextjs.org/docs/basic-features/typescript for more information.

examples/next/next.config.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
/** @type {import('next').NextConfig} */
2+
const nextConfig = {
3+
reactStrictMode: true,
4+
}
5+
6+
module.exports = nextConfig

examples/next/package.json

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"name": "graphql-api-template-example",
3+
"private": true,
4+
"scripts": {
5+
"dev": "next dev",
6+
"build": "next build",
7+
"start": "next start",
8+
"lint": "next lint"
9+
},
10+
"dependencies": {
11+
"next": "12.0.10",
12+
"react": "17.0.2",
13+
"react-dom": "17.0.2"
14+
},
15+
"devDependencies": {
16+
"@types/node": "17.0.17",
17+
"@types/react": "17.0.39",
18+
"eslint": "8.9.0",
19+
"eslint-config-next": "12.0.10",
20+
"typescript": "4.5.5"
21+
}
22+
}

examples/next/pages/_app.tsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import '../styles/globals.css'
2+
import type { AppProps } from 'next/app'
3+
4+
function MyApp({ Component, pageProps }: AppProps) {
5+
return <Component {...pageProps} />
6+
}
7+
8+
export default MyApp

examples/next/pages/api/hello.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// Next.js API route support: https://nextjs.org/docs/api-routes/introduction
2+
import type { NextApiRequest, NextApiResponse } from 'next'
3+
4+
type Data = {
5+
name: string
6+
}
7+
8+
export default function handler(
9+
req: NextApiRequest,
10+
res: NextApiResponse<Data>
11+
) {
12+
res.status(200).json({ name: 'John Doe' })
13+
}

examples/next/pages/index.tsx

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
import type { NextPage } from "next";
2+
import Head from "next/head";
3+
import Image from "next/image";
4+
import styles from "../styles/Home.module.css";
5+
6+
const Home: NextPage = () => {
7+
return (
8+
<div className={styles.container}>
9+
<Head>
10+
<title>Create Next App</title>
11+
<meta name="description" content="Generated by create next app" />
12+
<link rel="icon" href="/favicon.ico" />
13+
</Head>
14+
15+
<main className={styles.main}>
16+
<h1 className={styles.title}>
17+
Welcome to <a href="https://nextjs.org">Next.js!</a>
18+
</h1>
19+
20+
<p className={styles.description}>
21+
Get started by editing{" "}
22+
<code className={styles.code}>pages/index.tsx</code>
23+
</p>
24+
25+
<div className={styles.grid}>
26+
<a href="https://nextjs.org/docs" className={styles.card}>
27+
<h2>Documentation &rarr;</h2>
28+
<p>Find in-depth information about Next.js features and API.</p>
29+
</a>
30+
31+
<a href="https://nextjs.org/learn" className={styles.card}>
32+
<h2>Learn &rarr;</h2>
33+
<p>Learn about Next.js in an interactive course with quizzes!</p>
34+
</a>
35+
36+
<a
37+
href="https://github.com/vercel/next.js/tree/canary/examples"
38+
className={styles.card}
39+
>
40+
<h2>Examples &rarr;</h2>
41+
<p>Discover and deploy boilerplate example Next.js projects.</p>
42+
</a>
43+
44+
<a
45+
href="https://vercel.com/new?utm_source=create-next-app&utm_medium=default-template&utm_campaign=create-next-app"
46+
className={styles.card}
47+
>
48+
<h2>Deploy &rarr;</h2>
49+
<p>
50+
Instantly deploy your Next.js site to a public URL with Vercel.
51+
</p>
52+
</a>
53+
</div>
54+
</main>
55+
56+
<footer className={styles.footer}>
57+
<a
58+
href="https://github.com/graphql-api"
59+
target="_blank"
60+
rel="noopener noreferrer"
61+
>
62+
Used by{" "}
63+
<span className={styles.logo}>
64+
<Image src="/favicon.png" alt="graphql logo" width={72} height={16} />
65+
</span>
66+
</a>
67+
</footer>
68+
</div>
69+
);
70+
};
71+
72+
export default Home;

examples/next/public/favicon.ico

10.9 KB
Binary file not shown.

examples/next/public/favicon.png

10.9 KB
Loading

examples/next/public/vercel.svg

Lines changed: 4 additions & 0 deletions
Loading

0 commit comments

Comments
 (0)