├── templates
├── nextjs-ts-frontend
│ ├── .env
│ ├── .env.example
│ ├── .babelrc
│ ├── .eslintignore
│ ├── .lintstagedrc.json
│ ├── public
│ │ ├── favicon.ico
│ │ └── vercel.svg
│ ├── jest.setup.ts
│ ├── src
│ │ ├── components
│ │ │ ├── add.ts
│ │ │ ├── add.test.ts
│ │ │ ├── hello-world.tsx
│ │ │ └── hello-world.test.tsx
│ │ └── pages
│ │ │ ├── api
│ │ │ └── hello.ts
│ │ │ ├── _app.tsx
│ │ │ └── index.tsx
│ ├── .prettierrc
│ ├── next-env.d.ts
│ ├── styles
│ │ ├── globals.css
│ │ └── Home.module.css
│ ├── .husky
│ │ └── commit-msg
│ ├── .gitignore
│ ├── jest.config.js
│ ├── tsconfig.json
│ ├── README.md
│ ├── .eslintrc.json
│ └── package.json
├── aws-ts-serverless
│ ├── .env.example
│ ├── .nvmrc
│ ├── .eslintignore
│ ├── .gitignore
│ ├── tsconfig.prod.json
│ ├── .prettierrc
│ ├── nodemon.json
│ ├── src
│ │ └── functions
│ │ │ ├── hello.ts
│ │ │ ├── goodbye.ts
│ │ │ └── question.ts
│ ├── jest.config.js
│ ├── .vscode
│ │ └── launch.json
│ ├── serverless.yml
│ ├── package.json
│ ├── .eslintrc.js
│ └── tsconfig.json
├── gql-ts-serverless
│ ├── .nvmrc
│ ├── .eslintignore
│ ├── .gitignore
│ ├── tsconfig.prod.json
│ ├── .prettierrc
│ ├── src
│ │ ├── environments.ts
│ │ ├── graphql
│ │ │ ├── resolvers.ts
│ │ │ └── typedefs.ts
│ │ └── apollo-server.ts
│ ├── jest.config.js
│ ├── serverless.yml
│ ├── webpack.config.js
│ ├── package.json
│ ├── .eslintrc.js
│ └── tsconfig.json
├── node-ts-backend
│ ├── .env.example
│ ├── src
│ │ ├── add
│ │ │ ├── add.unit.test.ts
│ │ │ └── add.ts
│ │ └── index.ts
│ ├── __tests__
│ │ └── int
│ │ │ └── add.int.test.ts
│ ├── .lintstagedrc.json
│ ├── README.md
│ ├── .prettierrc.json
│ ├── tsconfig.eslint.json
│ ├── .husky
│ │ └── commit-msg
│ ├── jest.config.js
│ ├── LICENSE
│ ├── tsconfig.json
│ ├── package.json
│ ├── .eslintrc.json
│ └── .gitignore
├── nextjs-ts-materialUI
│ ├── .husky
│ │ ├── .gitignore
│ │ ├── pre-commit
│ │ └── commit-msg
│ ├── .eslintignore
│ ├── .lintstagedrc
│ ├── next-env.d.ts
│ ├── jest.setup.ts
│ ├── src
│ │ ├── add.ts
│ │ ├── add.test.ts
│ │ └── components
│ │ │ ├── helloWorld.tsx
│ │ │ └── helloWorld.test.tsx
│ ├── .prettierrc
│ ├── pages
│ │ ├── api
│ │ │ └── hello.ts
│ │ ├── _app.tsx
│ │ ├── _document.tsx
│ │ └── index.tsx
│ ├── styles
│ │ ├── globals.css
│ │ ├── theme.ts
│ │ └── Home.module.css
│ ├── .gitignore
│ ├── CONTRIBUTING.md
│ ├── .babelrc
│ ├── jest.config.js
│ ├── public
│ │ └── vercel.svg
│ ├── README.md
│ ├── package.json
│ ├── tsconfig.json
│ └── .eslintrc.js
├── gql-ts-prisma-codegen-apolloserver
│ ├── .nvmrc
│ ├── .env.example
│ ├── .gitignore
│ ├── .env.test
│ ├── .eslintignore
│ ├── tsconfig.prod.json
│ ├── src
│ │ ├── lib
│ │ │ ├── prisma
│ │ │ │ ├── prismaClient.ts
│ │ │ │ └── prismaContext.ts
│ │ │ ├── interfaces
│ │ │ │ ├── IPrismaContext.ts
│ │ │ │ └── IApolloServerContext.ts
│ │ │ └── config
│ │ │ │ ├── apolloServerContext.ts
│ │ │ │ └── apolloServerConfig.ts
│ │ ├── graphql
│ │ │ ├── schema
│ │ │ │ ├── resolvers
│ │ │ │ │ ├── query
│ │ │ │ │ │ ├── query.ts
│ │ │ │ │ │ ├── getAllBooksQuery.ts
│ │ │ │ │ │ └── getAllAuthorsQuery.ts
│ │ │ │ │ ├── mutation
│ │ │ │ │ │ ├── mutation.ts
│ │ │ │ │ │ ├── createAuthorMutation.ts
│ │ │ │ │ │ └── createBookMutation.ts
│ │ │ │ │ └── resolvers.ts
│ │ │ │ ├── typedefs
│ │ │ │ │ ├── CreateAuthorInput.ts
│ │ │ │ │ ├── QueryType.ts
│ │ │ │ │ ├── MutationType.ts
│ │ │ │ │ ├── CreateBookInput.ts
│ │ │ │ │ ├── AuthorType.ts
│ │ │ │ │ └── BookType.ts
│ │ │ │ └── schema.ts
│ │ │ └── generated
│ │ │ │ └── schema.graphql
│ │ ├── __tests__
│ │ │ ├── __mocks__
│ │ │ │ └── prismaMock.ts
│ │ │ └── integration
│ │ │ │ └── graphql
│ │ │ │ └── schema
│ │ │ │ └── resolvers
│ │ │ │ └── mutation
│ │ │ │ └── createBookMutation.int.test.ts
│ │ ├── index.ts
│ │ ├── data
│ │ │ ├── authorService.ts
│ │ │ ├── bookService.ts
│ │ │ └── bookService.unit.test.ts
│ │ └── codegen.ts
│ ├── .prettierrc
│ ├── nodemon.json
│ ├── codegen.yml
│ ├── jest.config.js
│ ├── prisma
│ │ └── schema.prisma
│ ├── Dockerfile
│ ├── docker-compose.yml
│ ├── .eslintrc.js
│ ├── package.json
│ └── tsconfig.json
├── nextjs-ts-reactquery
│ ├── .babelrc
│ ├── .eslintignore
│ ├── src
│ │ ├── lib
│ │ │ └── interfaces
│ │ │ │ ├── ITodo.ts
│ │ │ │ ├── IPerson.ts
│ │ │ │ ├── IPaginatedTodos.ts
│ │ │ │ └── IInfinitePage.ts
│ │ └── components
│ │ │ └── PersonComponent.tsx
│ ├── jest.setup.ts
│ ├── .prettierrc
│ ├── next-env.d.ts
│ ├── pages
│ │ ├── api
│ │ │ ├── hello.ts
│ │ │ ├── todo.ts
│ │ │ ├── person
│ │ │ │ ├── create.ts
│ │ │ │ ├── index.ts
│ │ │ │ └── [id].ts
│ │ │ └── todo
│ │ │ │ ├── [page].ts
│ │ │ │ └── infinite
│ │ │ │ └── [cursor].ts
│ │ ├── _app.tsx
│ │ ├── ssr
│ │ │ ├── initialData.tsx
│ │ │ └── hydration.tsx
│ │ ├── todo
│ │ │ ├── infinite.tsx
│ │ │ └── paginated.tsx
│ │ ├── person
│ │ │ ├── [id].tsx
│ │ │ └── index.tsx
│ │ └── index.tsx
│ ├── styles
│ │ ├── globals.css
│ │ └── Home.module.css
│ ├── .gitignore
│ ├── jest.config.js
│ ├── public
│ │ └── vercel.svg
│ ├── LICENSE
│ ├── README.md
│ ├── package.json
│ ├── tsconfig.json
│ └── .eslintrc.js
├── nextjs-ts-materialui-reacthookform
│ ├── .eslintignore
│ ├── .lintstagedrc
│ ├── next-env.d.ts
│ ├── jest.setup.ts
│ ├── .prettierrc
│ ├── pages
│ │ ├── api
│ │ │ └── hello.ts
│ │ ├── _app.tsx
│ │ ├── _document.tsx
│ │ └── index.tsx
│ ├── styles
│ │ ├── globals.css
│ │ ├── theme.ts
│ │ └── Home.module.css
│ ├── .gitignore
│ ├── CONTRIBUTING.md
│ ├── .babelrc
│ ├── jest.config.js
│ ├── public
│ │ └── vercel.svg
│ ├── README.md
│ ├── package.json
│ ├── tsconfig.json
│ └── .eslintrc.js
└── nextjs-ts-reactquery-graphqlrequest
│ ├── .babelrc
│ ├── .eslintignore
│ ├── .env
│ ├── jest.setup.ts
│ ├── src
│ ├── graphql
│ │ ├── GetAllAuthorsQuery.graphql
│ │ ├── GetBooksByAuthor.graphql
│ │ ├── CreateAuthorMutation.graphql
│ │ └── GetAllBooksQuery.graphql
│ ├── lib
│ │ ├── interfaces
│ │ │ └── IBook.ts
│ │ └── clients
│ │ │ └── graphqlRequestClient.ts
│ └── components
│ │ ├── AuthorsList.tsx
│ │ └── BooksByAuthorList.tsx
│ ├── .prettierrc
│ ├── next-env.d.ts
│ ├── pages
│ ├── api
│ │ └── hello.ts
│ ├── _app.tsx
│ ├── graphqlquery.tsx
│ ├── graphqlmutation.tsx
│ └── index.tsx
│ ├── codegen.yml
│ ├── styles
│ ├── globals.css
│ └── Home.module.css
│ ├── .gitignore
│ ├── public
│ └── vercel.svg
│ ├── LICENSE
│ ├── README.md
│ ├── package.json
│ ├── tsconfig.json
│ └── .eslintrc.js
├── .gitignore
├── .prettierrc
├── .eslintrc.js
├── createDirectoryContents.js
├── package.json
└── index.js
/templates/nextjs-ts-frontend/.env:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | node_modules
2 | dist
3 |
--------------------------------------------------------------------------------
/templates/nextjs-ts-frontend/.env.example:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/templates/aws-ts-serverless/.env.example:
--------------------------------------------------------------------------------
1 | MY_NAME=
--------------------------------------------------------------------------------
/templates/aws-ts-serverless/.nvmrc:
--------------------------------------------------------------------------------
1 | v14.15.4
2 |
--------------------------------------------------------------------------------
/templates/gql-ts-serverless/.nvmrc:
--------------------------------------------------------------------------------
1 | v12.19.0
2 |
--------------------------------------------------------------------------------
/templates/node-ts-backend/.env.example:
--------------------------------------------------------------------------------
1 | APP_PORT=
--------------------------------------------------------------------------------
/templates/node-ts-backend/src/add/add.unit.test.ts:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/templates/nextjs-ts-materialUI/.husky/.gitignore:
--------------------------------------------------------------------------------
1 | _
2 |
--------------------------------------------------------------------------------
/templates/node-ts-backend/__tests__/int/add.int.test.ts:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/templates/gql-ts-prisma-codegen-apolloserver/.nvmrc:
--------------------------------------------------------------------------------
1 | v14.15.4
2 |
--------------------------------------------------------------------------------
/templates/gql-ts-prisma-codegen-apolloserver/.env.example:
--------------------------------------------------------------------------------
1 | DATABASE_URL=
--------------------------------------------------------------------------------
/templates/aws-ts-serverless/.eslintignore:
--------------------------------------------------------------------------------
1 | dist
2 | node_modules
3 | coverage
--------------------------------------------------------------------------------
/templates/gql-ts-serverless/.eslintignore:
--------------------------------------------------------------------------------
1 | dist
2 | node_modules
3 | coverage
--------------------------------------------------------------------------------
/templates/nextjs-ts-frontend/.babelrc:
--------------------------------------------------------------------------------
1 | {
2 | "presets": ["next/babel"]
3 | }
--------------------------------------------------------------------------------
/templates/nextjs-ts-frontend/.eslintignore:
--------------------------------------------------------------------------------
1 | node_modules
2 | coverage
3 | .next
--------------------------------------------------------------------------------
/templates/nextjs-ts-materialUI/.eslintignore:
--------------------------------------------------------------------------------
1 | node_modules
2 | coverage
3 | .next
--------------------------------------------------------------------------------
/templates/nextjs-ts-reactquery/.babelrc:
--------------------------------------------------------------------------------
1 | {
2 | "presets": ["next/babel"]
3 | }
--------------------------------------------------------------------------------
/templates/nextjs-ts-reactquery/.eslintignore:
--------------------------------------------------------------------------------
1 | node_modules
2 | coverage
3 | .next
--------------------------------------------------------------------------------
/templates/nextjs-ts-materialUI/.lintstagedrc:
--------------------------------------------------------------------------------
1 | {
2 | "*.(js|ts)": "eslint --fix"
3 | }
--------------------------------------------------------------------------------
/templates/node-ts-backend/.lintstagedrc.json:
--------------------------------------------------------------------------------
1 | {
2 | "*.(js|ts)": "eslint --fix"
3 | }
--------------------------------------------------------------------------------
/templates/nextjs-ts-frontend/.lintstagedrc.json:
--------------------------------------------------------------------------------
1 | {
2 | "*.(js|ts)": "eslint --fix"
3 | }
--------------------------------------------------------------------------------
/templates/nextjs-ts-materialui-reacthookform/.eslintignore:
--------------------------------------------------------------------------------
1 | node_modules
2 | coverage
3 | .next
--------------------------------------------------------------------------------
/templates/nextjs-ts-reactquery-graphqlrequest/.babelrc:
--------------------------------------------------------------------------------
1 | {
2 | "presets": ["next/babel"]
3 | }
--------------------------------------------------------------------------------
/templates/nextjs-ts-reactquery-graphqlrequest/.eslintignore:
--------------------------------------------------------------------------------
1 | node_modules
2 | coverage
3 | .next
--------------------------------------------------------------------------------
/templates/gql-ts-prisma-codegen-apolloserver/.gitignore:
--------------------------------------------------------------------------------
1 | node_modules
2 | dist
3 | coverage
4 | .env
--------------------------------------------------------------------------------
/templates/nextjs-ts-materialui-reacthookform/.lintstagedrc:
--------------------------------------------------------------------------------
1 | {
2 | "*.(js|ts)": "eslint --fix"
3 | }
--------------------------------------------------------------------------------
/templates/nextjs-ts-reactquery-graphqlrequest/.env:
--------------------------------------------------------------------------------
1 | NEXT_PUBLIC_GRAPHQL_ENDPOINT=http://localhost:4000/graphql
--------------------------------------------------------------------------------
/templates/node-ts-backend/src/add/add.ts:
--------------------------------------------------------------------------------
1 | export const add = (a: number, b: number): number => a + b;
2 |
--------------------------------------------------------------------------------
/templates/node-ts-backend/README.md:
--------------------------------------------------------------------------------
1 | # node-okta-auth-tutorial
2 | Okta Authentication Tutorial with Node.js
3 |
--------------------------------------------------------------------------------
/templates/aws-ts-serverless/.gitignore:
--------------------------------------------------------------------------------
1 | node_modules
2 | dist
3 | coverage
4 | .env
5 | .serverless
6 | .build
--------------------------------------------------------------------------------
/templates/gql-ts-serverless/.gitignore:
--------------------------------------------------------------------------------
1 | node_modules
2 | dist
3 | coverage
4 | .env
5 | .env.*
6 | .serverless
--------------------------------------------------------------------------------
/templates/gql-ts-prisma-codegen-apolloserver/.env.test:
--------------------------------------------------------------------------------
1 | DATABASE_URL="postgresql://prisma:prisma@localhost:5432/tests"
2 |
3 |
--------------------------------------------------------------------------------
/templates/nextjs-ts-materialUI/next-env.d.ts:
--------------------------------------------------------------------------------
1 | ///
2 | ///
3 |
--------------------------------------------------------------------------------
/templates/nextjs-ts-materialUI/.husky/pre-commit:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | . "$(dirname "$0")/_/husky.sh"
3 |
4 | yarn lint-staged && yarn test
--------------------------------------------------------------------------------
/templates/nextjs-ts-reactquery/src/lib/interfaces/ITodo.ts:
--------------------------------------------------------------------------------
1 | export interface ITodo {
2 | id: number;
3 | message: string;
4 | }
5 |
--------------------------------------------------------------------------------
/templates/nextjs-ts-materialui-reacthookform/next-env.d.ts:
--------------------------------------------------------------------------------
1 | ///
2 | ///
3 |
--------------------------------------------------------------------------------
/templates/gql-ts-prisma-codegen-apolloserver/.eslintignore:
--------------------------------------------------------------------------------
1 | dist
2 | node_modules
3 | coverage
4 | src/graphql/generated
5 | .env.development
6 | .env.test
--------------------------------------------------------------------------------
/templates/nextjs-ts-frontend/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/leoroese/template-cli/HEAD/templates/nextjs-ts-frontend/public/favicon.ico
--------------------------------------------------------------------------------
/templates/aws-ts-serverless/tsconfig.prod.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "./tsconfig",
3 | "exclude": ["src/__tests__/", "**/*.test.ts", "**/*.mock.ts"]
4 | }
--------------------------------------------------------------------------------
/templates/gql-ts-serverless/tsconfig.prod.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "./tsconfig",
3 | "exclude": ["src/__tests__/", "**/*.test.ts", "**/*.mock.ts"]
4 | }
--------------------------------------------------------------------------------
/templates/nextjs-ts-frontend/jest.setup.ts:
--------------------------------------------------------------------------------
1 | // jest.setup.ts
2 | import '@testing-library/jest-dom';
3 | import '@testing-library/jest-dom/extend-expect';
4 |
--------------------------------------------------------------------------------
/templates/nextjs-ts-reactquery/src/lib/interfaces/IPerson.ts:
--------------------------------------------------------------------------------
1 | export interface IPerson {
2 | id: string;
3 | name: string;
4 | age: number;
5 | }
6 |
--------------------------------------------------------------------------------
/templates/nextjs-ts-frontend/src/components/add.ts:
--------------------------------------------------------------------------------
1 | // src/add.test.ts
2 | const add = (a: number, b: number): number => a + b;
3 |
4 | export default add;
5 |
--------------------------------------------------------------------------------
/templates/nextjs-ts-materialUI/jest.setup.ts:
--------------------------------------------------------------------------------
1 | // jest.setup.ts
2 | import '@testing-library/jest-dom';
3 | import '@testing-library/jest-dom/extend-expect';
4 |
--------------------------------------------------------------------------------
/templates/nextjs-ts-reactquery/jest.setup.ts:
--------------------------------------------------------------------------------
1 | // jest.setup.ts
2 | import '@testing-library/jest-dom';
3 | import '@testing-library/jest-dom/extend-expect';
4 |
--------------------------------------------------------------------------------
/templates/gql-ts-prisma-codegen-apolloserver/tsconfig.prod.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "./tsconfig",
3 | "exclude": ["src/__tests__/", "**/*.test.ts", "**/*.mock.ts"]
4 | }
--------------------------------------------------------------------------------
/templates/nextjs-ts-materialUI/src/add.ts:
--------------------------------------------------------------------------------
1 | // src/add.test.ts
2 | const add = (a: number, b: number): number => {
3 | return a + b;
4 | };
5 |
6 | export default add;
7 |
--------------------------------------------------------------------------------
/templates/nextjs-ts-materialui-reacthookform/jest.setup.ts:
--------------------------------------------------------------------------------
1 | // jest.setup.ts
2 | import '@testing-library/jest-dom';
3 | import '@testing-library/jest-dom/extend-expect';
4 |
--------------------------------------------------------------------------------
/templates/nextjs-ts-reactquery-graphqlrequest/jest.setup.ts:
--------------------------------------------------------------------------------
1 | // jest.setup.ts
2 | import '@testing-library/jest-dom';
3 | import '@testing-library/jest-dom/extend-expect';
4 |
--------------------------------------------------------------------------------
/templates/nextjs-ts-reactquery-graphqlrequest/src/graphql/GetAllAuthorsQuery.graphql:
--------------------------------------------------------------------------------
1 | query GetAllAuthors {
2 | authors {
3 | authorId
4 | username
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/templates/node-ts-backend/.prettierrc.json:
--------------------------------------------------------------------------------
1 | {
2 | "printWidth": 80,
3 | "tabWidth": 2,
4 | "semi":true,
5 | "singleQuote": true,
6 | "trailingComma": "es5"
7 | }
--------------------------------------------------------------------------------
/templates/nextjs-ts-frontend/.prettierrc:
--------------------------------------------------------------------------------
1 | {
2 | "semi": true,
3 | "tabWidth": 2,
4 | "printWidth": 120,
5 | "singleQuote": true,
6 | "trailingComma": "es5"
7 | }
--------------------------------------------------------------------------------
/templates/nextjs-ts-materialUI/.prettierrc:
--------------------------------------------------------------------------------
1 | {
2 | "tabWidth": 2,
3 | "printWidth": 120,
4 | "singleQuote": true,
5 | "trailingComma": "es5",
6 | "semi": true
7 | }
--------------------------------------------------------------------------------
/templates/nextjs-ts-reactquery/.prettierrc:
--------------------------------------------------------------------------------
1 | {
2 | "tabWidth": 2,
3 | "printWidth": 120,
4 | "singleQuote": true,
5 | "trailingComma": "es5",
6 | "semi": true
7 | }
--------------------------------------------------------------------------------
/.prettierrc:
--------------------------------------------------------------------------------
1 | {
2 | "tabWidth": 2,
3 | "printWidth": 100,
4 | "singleQuote": true,
5 | "trailingComma": "es5",
6 | "arrowParens": "avoid",
7 | "semi": true
8 | }
--------------------------------------------------------------------------------
/templates/nextjs-ts-reactquery/next-env.d.ts:
--------------------------------------------------------------------------------
1 | ///
2 | ///
3 | ///
4 |
--------------------------------------------------------------------------------
/templates/gql-ts-prisma-codegen-apolloserver/src/lib/prisma/prismaClient.ts:
--------------------------------------------------------------------------------
1 | import { PrismaClient } from '@prisma/client';
2 |
3 | const prisma = new PrismaClient();
4 | export default prisma;
5 |
--------------------------------------------------------------------------------
/templates/nextjs-ts-materialui-reacthookform/.prettierrc:
--------------------------------------------------------------------------------
1 | {
2 | "tabWidth": 2,
3 | "printWidth": 120,
4 | "singleQuote": true,
5 | "trailingComma": "es5",
6 | "semi": true
7 | }
--------------------------------------------------------------------------------
/templates/nextjs-ts-reactquery-graphqlrequest/.prettierrc:
--------------------------------------------------------------------------------
1 | {
2 | "tabWidth": 2,
3 | "printWidth": 120,
4 | "singleQuote": true,
5 | "trailingComma": "es5",
6 | "semi": true
7 | }
--------------------------------------------------------------------------------
/templates/nextjs-ts-reactquery-graphqlrequest/next-env.d.ts:
--------------------------------------------------------------------------------
1 | ///
2 | ///
3 | ///
4 |
--------------------------------------------------------------------------------
/templates/nextjs-ts-reactquery/src/lib/interfaces/IPaginatedTodos.ts:
--------------------------------------------------------------------------------
1 | import { ITodo } from './ITodo';
2 |
3 | export interface IPaginatedTodos {
4 | todos: ITodo[];
5 | hasMore: boolean;
6 | }
7 |
--------------------------------------------------------------------------------
/templates/node-ts-backend/tsconfig.eslint.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "./tsconfig.json",
3 | "include": ["src/**/*.ts", "src/**/*.unit.test.ts", "jest.config.js", "__tests__/**/*.int.test.ts"],
4 | }
--------------------------------------------------------------------------------
/templates/gql-ts-prisma-codegen-apolloserver/src/lib/interfaces/IPrismaContext.ts:
--------------------------------------------------------------------------------
1 | import { PrismaClient } from '@prisma/client';
2 |
3 | export interface IPrismaContext {
4 | prisma: PrismaClient;
5 | }
6 |
--------------------------------------------------------------------------------
/templates/nextjs-ts-reactquery-graphqlrequest/src/graphql/GetBooksByAuthor.graphql:
--------------------------------------------------------------------------------
1 | query GetBooksByAuthor($authorId: Int) {
2 | booksByAuthor(authorId: $authorId) {
3 | bookId
4 | title
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/templates/aws-ts-serverless/.prettierrc:
--------------------------------------------------------------------------------
1 | {
2 | "tabWidth": 2,
3 | "printWidth": 120,
4 | "singleQuote": true,
5 | "trailingComma": "es5",
6 | "arrowParens": "avoid",
7 | "semi": true
8 | }
9 |
--------------------------------------------------------------------------------
/templates/gql-ts-serverless/.prettierrc:
--------------------------------------------------------------------------------
1 | {
2 | "tabWidth": 2,
3 | "printWidth": 120,
4 | "singleQuote": true,
5 | "trailingComma": "es5",
6 | "arrowParens": "avoid",
7 | "semi": true
8 | }
9 |
--------------------------------------------------------------------------------
/templates/nextjs-ts-reactquery-graphqlrequest/src/graphql/CreateAuthorMutation.graphql:
--------------------------------------------------------------------------------
1 | mutation CreateAuthor($input: CreateAuthorInput) {
2 | createAuthor(input: $input) {
3 | authorId
4 | username
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/templates/nextjs-ts-reactquery-graphqlrequest/src/lib/interfaces/IBook.ts:
--------------------------------------------------------------------------------
1 | export interface IBook {
2 | bookId: string;
3 | title: string;
4 | author: {
5 | authorId: string;
6 | username: string;
7 | };
8 | }
9 |
--------------------------------------------------------------------------------
/templates/nextjs-ts-materialUI/src/add.test.ts:
--------------------------------------------------------------------------------
1 | // src/add.test.ts
2 | import add from '@src/add';
3 |
4 | describe('add tests', () => {
5 | it('should return 3', () => {
6 | expect(add(1, 2)).toBe(3);
7 | });
8 | });
9 |
--------------------------------------------------------------------------------
/templates/gql-ts-prisma-codegen-apolloserver/.prettierrc:
--------------------------------------------------------------------------------
1 | {
2 | "tabWidth": 2,
3 | "printWidth": 80,
4 | "singleQuote": true,
5 | "trailingComma": "es5",
6 | "arrowParens": "avoid",
7 | "semi": true
8 | }
9 |
--------------------------------------------------------------------------------
/templates/nextjs-ts-reactquery-graphqlrequest/src/graphql/GetAllBooksQuery.graphql:
--------------------------------------------------------------------------------
1 | query GetAllBooks {
2 | books {
3 | bookId
4 | title
5 | author {
6 | authorId
7 | username
8 | }
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/templates/nextjs-ts-frontend/src/pages/api/hello.ts:
--------------------------------------------------------------------------------
1 | import { NextApiRequest, NextApiResponse } from 'next';
2 |
3 | export default (_req: NextApiRequest, res: NextApiResponse): void => {
4 | res.status(200).json({ name: 'John Doe' });
5 | };
6 |
--------------------------------------------------------------------------------
/templates/nextjs-ts-materialUI/pages/api/hello.ts:
--------------------------------------------------------------------------------
1 | import { NextApiRequest, NextApiResponse } from 'next';
2 |
3 | export default (_req: NextApiRequest, res: NextApiResponse): void => {
4 | res.status(200).json({ name: 'John Doe' });
5 | };
6 |
--------------------------------------------------------------------------------
/templates/nextjs-ts-materialUI/src/components/helloWorld.tsx:
--------------------------------------------------------------------------------
1 | // src/components/helloWorld.tsx
2 | import { FC } from 'react';
3 |
4 | const HelloWorld: FC = () => {
5 | return
Hello World
;
6 | };
7 |
8 | export default HelloWorld;
9 |
--------------------------------------------------------------------------------
/templates/nextjs-ts-reactquery/pages/api/hello.ts:
--------------------------------------------------------------------------------
1 | import { NextApiRequest, NextApiResponse } from 'next';
2 |
3 | export default (_req: NextApiRequest, res: NextApiResponse): void => {
4 | res.status(200).json({ name: 'John Doe' });
5 | };
6 |
--------------------------------------------------------------------------------
/templates/gql-ts-prisma-codegen-apolloserver/src/lib/interfaces/IApolloServerContext.ts:
--------------------------------------------------------------------------------
1 | import { IPrismaContext } from '@src/lib/interfaces/IPrismaContext';
2 |
3 | export interface IApolloServerContext {
4 | prismaContext: IPrismaContext;
5 | }
6 |
--------------------------------------------------------------------------------
/templates/nextjs-ts-frontend/src/components/add.test.ts:
--------------------------------------------------------------------------------
1 | // src/add.test.ts
2 | import add from '@src/components/add';
3 |
4 | describe('add tests', () => {
5 | it('should return 3', () => {
6 | expect(add(1, 2)).toBe(3);
7 | });
8 | });
9 |
--------------------------------------------------------------------------------
/templates/nextjs-ts-materialui-reacthookform/pages/api/hello.ts:
--------------------------------------------------------------------------------
1 | import { NextApiRequest, NextApiResponse } from 'next';
2 |
3 | export default (_req: NextApiRequest, res: NextApiResponse): void => {
4 | res.status(200).json({ name: 'John Doe' });
5 | };
6 |
--------------------------------------------------------------------------------
/templates/nextjs-ts-reactquery-graphqlrequest/pages/api/hello.ts:
--------------------------------------------------------------------------------
1 | import { NextApiRequest, NextApiResponse } from 'next';
2 |
3 | export default (_req: NextApiRequest, res: NextApiResponse): void => {
4 | res.status(200).json({ name: 'John Doe' });
5 | };
6 |
--------------------------------------------------------------------------------
/templates/gql-ts-serverless/src/environments.ts:
--------------------------------------------------------------------------------
1 | type Environment = {
2 | secretMessage: string;
3 | };
4 |
5 | const environment: Environment = {
6 | secretMessage: process.env.SECRET_MESSAGE as string,
7 | };
8 |
9 | export default environment;
10 |
--------------------------------------------------------------------------------
/templates/gql-ts-serverless/src/graphql/resolvers.ts:
--------------------------------------------------------------------------------
1 | import environment from '../environments';
2 |
3 | const resolvers = {
4 | Query: {
5 | testMessage: (): string => environment.secretMessage,
6 | },
7 | };
8 |
9 | export default resolvers;
10 |
--------------------------------------------------------------------------------
/templates/nextjs-ts-reactquery/src/lib/interfaces/IInfinitePage.ts:
--------------------------------------------------------------------------------
1 | import { ITodo } from './ITodo';
2 |
3 | export interface IInfinitePage {
4 | nextCursor: number | undefined;
5 | page: {
6 | todos: ITodo[];
7 | hasMore: boolean;
8 | };
9 | }
10 |
--------------------------------------------------------------------------------
/templates/nextjs-ts-frontend/src/components/hello-world.tsx:
--------------------------------------------------------------------------------
1 | // src/components/helloWorld.tsx
2 | import React, { FC } from 'react';
3 |
4 | const HelloWorld: FC = () => (
5 | <>
6 | Hello World
7 | >
8 | );
9 |
10 | export default HelloWorld;
11 |
--------------------------------------------------------------------------------
/templates/gql-ts-serverless/src/graphql/typedefs.ts:
--------------------------------------------------------------------------------
1 | import { gql } from 'apollo-server-lambda';
2 |
3 | const typeDefs = gql`
4 | type Query {
5 | """
6 | A test message.
7 | """
8 | testMessage: String!
9 | }
10 | `;
11 |
12 | export default typeDefs;
13 |
--------------------------------------------------------------------------------
/templates/node-ts-backend/src/index.ts:
--------------------------------------------------------------------------------
1 | import dotenv from 'dotenv-safe';
2 | import { add } from './add/add';
3 | // load the environment variables from the .env file
4 | dotenv.config({
5 | path: '.env',
6 | });
7 |
8 | console.log(process.env.APP_PORT);
9 | console.log(add(1, 2));
10 |
--------------------------------------------------------------------------------
/templates/aws-ts-serverless/nodemon.json:
--------------------------------------------------------------------------------
1 | {
2 | "watch": ["src"],
3 | "ext": "ts,js,json",
4 | "ignore": ["node_modules", "coverage", "dist"],
5 | "exec": "ts-node -r tsconfig-paths/register ./src/index.ts",
6 | "restartable": "rs",
7 | "env": {
8 | "NODE_ENV": "development"
9 | }
10 | }
--------------------------------------------------------------------------------
/templates/gql-ts-prisma-codegen-apolloserver/src/lib/prisma/prismaContext.ts:
--------------------------------------------------------------------------------
1 | import { IPrismaContext } from '@src/lib/interfaces/IPrismaContext';
2 | import prisma from '@src/lib/prisma/prismaClient';
3 |
4 | const prismaContext: IPrismaContext = {
5 | prisma,
6 | };
7 |
8 | export default prismaContext;
9 |
--------------------------------------------------------------------------------
/templates/nextjs-ts-frontend/next-env.d.ts:
--------------------------------------------------------------------------------
1 | ///
2 | ///
3 | ///
4 |
5 | // NOTE: This file should not be edited
6 | // see https://nextjs.org/docs/basic-features/typescript for more information.
7 |
--------------------------------------------------------------------------------
/templates/nextjs-ts-reactquery/pages/api/todo.ts:
--------------------------------------------------------------------------------
1 | import { NextApiRequest, NextApiResponse } from 'next';
2 | import { ITodo } from '@src/lib/interfaces/ITodo';
3 |
4 | export default (_req: NextApiRequest, res: NextApiResponse): void => {
5 | res.status(200).json({ id: 1, message: 'I am a todo' });
6 | };
7 |
--------------------------------------------------------------------------------
/templates/gql-ts-prisma-codegen-apolloserver/nodemon.json:
--------------------------------------------------------------------------------
1 | {
2 | "watch": ["src"],
3 | "ext": "ts,js,json",
4 | "ignore": ["node_modules", "coverage", "dist"],
5 | "exec": "ts-node -r tsconfig-paths/register ./src/index.ts",
6 | "restartable": "rs",
7 | "env": {
8 | "NODE_ENV": "development"
9 | }
10 | }
--------------------------------------------------------------------------------
/.eslintrc.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | env: {
3 | es2021: true,
4 | node: true,
5 | },
6 | extends: ['eslint:recommended', 'plugin:prettier/recommended'],
7 | parserOptions: {
8 | ecmaVersion: 12,
9 | sourceType: 'module',
10 | },
11 | rules: {
12 | 'prettier/prettier': 'error',
13 | },
14 | };
15 |
--------------------------------------------------------------------------------
/templates/nextjs-ts-reactquery-graphqlrequest/codegen.yml:
--------------------------------------------------------------------------------
1 | schema: http://localhost:4000/graphql
2 | documents: './src/**/*.graphql'
3 | generates:
4 | ./src/generated/graphql.ts:
5 | plugins:
6 | - typescript
7 | - typescript-operations
8 | - typescript-react-query
9 | config:
10 | fetcher: graphql-request
11 |
--------------------------------------------------------------------------------
/templates/nextjs-ts-reactquery/pages/api/person/create.ts:
--------------------------------------------------------------------------------
1 | import { NextApiRequest, NextApiResponse } from 'next';
2 | import { IPerson } from '@src/lib/interfaces/IPerson';
3 |
4 | export default (req: NextApiRequest, res: NextApiResponse): void => {
5 | const data: IPerson = JSON.parse(req.body);
6 | res.status(200).json(data);
7 | };
8 |
--------------------------------------------------------------------------------
/templates/gql-ts-prisma-codegen-apolloserver/src/lib/config/apolloServerContext.ts:
--------------------------------------------------------------------------------
1 | import { IApolloServerContext } from '@src/lib/interfaces/IApolloServerContext';
2 | import prismaContext from '@src/lib/prisma/prismaContext';
3 |
4 | const apolloServerContext: IApolloServerContext = {
5 | prismaContext,
6 | };
7 |
8 | export default apolloServerContext;
9 |
--------------------------------------------------------------------------------
/templates/nextjs-ts-reactquery/pages/api/person/index.ts:
--------------------------------------------------------------------------------
1 | import { NextApiRequest, NextApiResponse } from 'next';
2 | import { IPerson } from '@src/lib/interfaces/IPerson';
3 |
4 | export default (_req: NextApiRequest, res: NextApiResponse): void => {
5 | console.log('getting person');
6 | res.status(200).json({ id: '1', name: 'John Doe', age: 25 });
7 | };
8 |
--------------------------------------------------------------------------------
/templates/nextjs-ts-frontend/styles/globals.css:
--------------------------------------------------------------------------------
1 | html,
2 | body {
3 | padding: 0;
4 | margin: 0;
5 | font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Oxygen,
6 | Ubuntu, Cantarell, Fira Sans, Droid Sans, Helvetica Neue, sans-serif;
7 | }
8 |
9 | a {
10 | color: inherit;
11 | text-decoration: none;
12 | }
13 |
14 | * {
15 | box-sizing: border-box;
16 | }
17 |
--------------------------------------------------------------------------------
/templates/gql-ts-serverless/src/apollo-server.ts:
--------------------------------------------------------------------------------
1 | import { ApolloServer } from 'apollo-server-lambda';
2 | import resolvers from './graphql/resolvers';
3 | import typeDefs from './graphql/typedefs';
4 |
5 | const apolloServer = new ApolloServer({ resolvers, typeDefs });
6 |
7 | // eslint-disable-next-line import/prefer-default-export
8 | export const graphqlHandler = apolloServer.createHandler();
9 |
--------------------------------------------------------------------------------
/templates/nextjs-ts-frontend/src/pages/_app.tsx:
--------------------------------------------------------------------------------
1 | // _app.tsx
2 | import '@styles/globals.css';
3 |
4 | import React, { FC } from 'react';
5 | import { AppProps } from 'next/app';
6 |
7 | const MyApp: FC = ({ Component, pageProps }: AppProps) => (
8 | // eslint-disable-next-line react/jsx-props-no-spreading
9 |
10 | );
11 | export default MyApp;
12 |
--------------------------------------------------------------------------------
/templates/nextjs-ts-materialUI/styles/globals.css:
--------------------------------------------------------------------------------
1 | html,
2 | body {
3 | padding: 0;
4 | margin: 0;
5 | font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Oxygen,
6 | Ubuntu, Cantarell, Fira Sans, Droid Sans, Helvetica Neue, sans-serif;
7 | }
8 |
9 | a {
10 | color: inherit;
11 | text-decoration: none;
12 | }
13 |
14 | * {
15 | box-sizing: border-box;
16 | }
17 |
--------------------------------------------------------------------------------
/templates/nextjs-ts-reactquery/styles/globals.css:
--------------------------------------------------------------------------------
1 | html,
2 | body {
3 | padding: 0;
4 | margin: 0;
5 | font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Oxygen,
6 | Ubuntu, Cantarell, Fira Sans, Droid Sans, Helvetica Neue, sans-serif;
7 | }
8 |
9 | a {
10 | color: inherit;
11 | text-decoration: none;
12 | }
13 |
14 | * {
15 | box-sizing: border-box;
16 | }
17 |
--------------------------------------------------------------------------------
/templates/gql-ts-prisma-codegen-apolloserver/codegen.yml:
--------------------------------------------------------------------------------
1 | overwrite: true
2 | schema: 'src/graphql/generated/schema.graphql'
3 | documents: null
4 | generates:
5 | src/graphql/generated/graphql.ts:
6 | plugins:
7 | - 'typescript'
8 | - 'typescript-resolvers'
9 | config:
10 | contextType: src/lib/interfaces/IPrismaContext#IPrismaContext
11 | useIndexSignature: true
12 |
--------------------------------------------------------------------------------
/templates/nextjs-ts-materialUI/.husky/commit-msg:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | if ! head -1 "$1" | grep -qE "^(feat|fix|ci|chore|docs|test|style|refactor|perf|build|revert)(\(.+?\))?: .{1,}$"; then
3 | echo "Aborting commit. Your commit message is invalid." >&2
4 | exit 1
5 | fi
6 | if ! head -1 "$1" | grep -qE "^.{1,88}$"; then
7 | echo "Aborting commit. Your commit message is too long." >&2
8 | exit 1
9 | fi
--------------------------------------------------------------------------------
/templates/gql-ts-prisma-codegen-apolloserver/src/lib/config/apolloServerConfig.ts:
--------------------------------------------------------------------------------
1 | import apolloServerContext from '@src/lib/config/apolloServerContext';
2 | import schema from '@src/graphql/schema/schema';
3 |
4 | const apolloServerConfig = {
5 | schema,
6 | playground: process.env.NODE_ENV !== 'production',
7 | context: apolloServerContext,
8 | };
9 |
10 | export default apolloServerConfig;
11 |
--------------------------------------------------------------------------------
/templates/nextjs-ts-materialui-reacthookform/styles/globals.css:
--------------------------------------------------------------------------------
1 | html,
2 | body {
3 | padding: 0;
4 | margin: 0;
5 | font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Oxygen,
6 | Ubuntu, Cantarell, Fira Sans, Droid Sans, Helvetica Neue, sans-serif;
7 | }
8 |
9 | a {
10 | color: inherit;
11 | text-decoration: none;
12 | }
13 |
14 | * {
15 | box-sizing: border-box;
16 | }
17 |
--------------------------------------------------------------------------------
/templates/nextjs-ts-reactquery-graphqlrequest/styles/globals.css:
--------------------------------------------------------------------------------
1 | html,
2 | body {
3 | padding: 0;
4 | margin: 0;
5 | font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Oxygen,
6 | Ubuntu, Cantarell, Fira Sans, Droid Sans, Helvetica Neue, sans-serif;
7 | }
8 |
9 | a {
10 | color: inherit;
11 | text-decoration: none;
12 | }
13 |
14 | * {
15 | box-sizing: border-box;
16 | }
17 |
--------------------------------------------------------------------------------
/templates/node-ts-backend/.husky/commit-msg:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | if ! head -1 "$1" | grep -qE "^(feat|fix|ci|chore|docs|test|style|refactor|perf|build|revert)(\(.+?\))?: .{1,}$"; then
3 | echo "Aborting commit. Your commit message is invalid." >&2
4 | exit 1
5 | fi
6 | if ! head -1 "$1" | grep -qE "^.{1,88}$"; then
7 | echo "Aborting commit. Your commit message is too long." >&2
8 | exit 1
9 | fi
10 |
--------------------------------------------------------------------------------
/templates/nextjs-ts-frontend/.husky/commit-msg:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | if ! head -1 "$1" | grep -qE "^(feat|fix|ci|chore|docs|test|style|refactor|perf|build|revert)(\(.+?\))?: .{1,}$"; then
3 | echo "Aborting commit. Your commit message is invalid." >&2
4 | exit 1
5 | fi
6 | if ! head -1 "$1" | grep -qE "^.{1,88}$"; then
7 | echo "Aborting commit. Your commit message is too long." >&2
8 | exit 1
9 | fi
10 |
--------------------------------------------------------------------------------
/templates/nextjs-ts-reactquery-graphqlrequest/src/lib/clients/graphqlRequestClient.ts:
--------------------------------------------------------------------------------
1 | import { GraphQLClient } from 'graphql-request';
2 |
3 | const requestHeaders = {
4 | authorization: 'Bearer MY_TOKEN',
5 | };
6 |
7 | const graphqlRequestClient = new GraphQLClient(process.env.NEXT_PUBLIC_GRAPHQL_ENDPOINT as string, {
8 | headers: requestHeaders,
9 | });
10 |
11 | export default graphqlRequestClient;
12 |
--------------------------------------------------------------------------------
/templates/node-ts-backend/jest.config.js:
--------------------------------------------------------------------------------
1 | /** @type {import('ts-jest/dist/types').InitialOptionsTsJest} */
2 | module.exports = {
3 | preset: 'ts-jest',
4 | testEnvironment: 'node',
5 | collectCoverageFrom: ['src/**/*.ts'],
6 | coverageThreshold: {
7 | global: {
8 | branches: 0,
9 | functions: 0,
10 | lines: 0,
11 | statements: 0,
12 | },
13 | },
14 | moduleDirectories: ['node_modules', 'src'],
15 | };
16 |
--------------------------------------------------------------------------------
/templates/gql-ts-prisma-codegen-apolloserver/src/graphql/schema/resolvers/query/query.ts:
--------------------------------------------------------------------------------
1 | import { getAllBooksQueryResolver } from '@src/graphql/schema/resolvers/query/getAllBooksQuery';
2 | import { getAllAuthorsResolver } from '@src/graphql/schema/resolvers/query/getAllAuthorsQuery';
3 |
4 | const query = {
5 | books: {
6 | resolve: getAllBooksQueryResolver,
7 | },
8 | authors: {
9 | resolve: getAllAuthorsResolver,
10 | },
11 | };
12 |
13 | export default query;
14 |
--------------------------------------------------------------------------------
/templates/nextjs-ts-materialUI/src/components/helloWorld.test.tsx:
--------------------------------------------------------------------------------
1 | // helloWorld.test.tsx
2 | import { render } from '@testing-library/react';
3 | import HelloWorld from '@src/components/helloWorld';
4 |
5 | test('renders a message', () => {
6 | const { container, getByText } = render();
7 | expect(getByText('Hello World')).toBeInTheDocument();
8 | expect(container.firstChild).toMatchInlineSnapshot(`
9 |
10 | Hello World
11 |
12 | `);
13 | });
14 |
--------------------------------------------------------------------------------
/templates/aws-ts-serverless/src/functions/hello.ts:
--------------------------------------------------------------------------------
1 | import { APIGatewayProxyEvent, APIGatewayProxyResult } from 'aws-lambda';
2 |
3 | export const handler = async (_event: APIGatewayProxyEvent): Promise => {
4 | try {
5 | const response = {
6 | statusCode: 200,
7 | body: 'HELLO YOU ARE MY FRIEND!!!',
8 | };
9 | return response;
10 | } catch (err) {
11 | return {
12 | statusCode: 500,
13 | body: 'An error occured',
14 | };
15 | }
16 | };
17 |
--------------------------------------------------------------------------------
/templates/nextjs-ts-frontend/src/components/hello-world.test.tsx:
--------------------------------------------------------------------------------
1 | // helloWorld.test.tsx
2 | import React from 'react';
3 | import { render } from '@testing-library/react';
4 | import HelloWorld from '@src/components/hello-world';
5 |
6 | test('renders a message', () => {
7 | const { container, getByText } = render();
8 | expect(getByText('Hello World')).toBeInTheDocument();
9 | expect(container.firstChild).toMatchInlineSnapshot(`
10 |
11 | Hello World
12 |
13 | `);
14 | });
15 |
--------------------------------------------------------------------------------
/templates/aws-ts-serverless/src/functions/goodbye.ts:
--------------------------------------------------------------------------------
1 | import { APIGatewayProxyEvent, APIGatewayProxyResult } from 'aws-lambda';
2 |
3 | export const handler = async (event: APIGatewayProxyEvent): Promise => {
4 | try {
5 | const parsedBody = JSON.parse(event.body || '');
6 | return {
7 | statusCode: 200,
8 | body: `Goodbye ${parsedBody?.name}`,
9 | };
10 | } catch (err) {
11 | return {
12 | statusCode: 500,
13 | body: 'An error occured',
14 | };
15 | }
16 | };
17 |
--------------------------------------------------------------------------------
/templates/gql-ts-prisma-codegen-apolloserver/src/graphql/schema/resolvers/mutation/mutation.ts:
--------------------------------------------------------------------------------
1 | import { createBookMutationResolver } from '@src/graphql/schema/resolvers/mutation/createBookMutation';
2 | import { createAuthorMutationResolver } from '@src/graphql/schema/resolvers/mutation/createAuthorMutation';
3 |
4 | const mutation = {
5 | createBook: {
6 | resolve: createBookMutationResolver,
7 | },
8 | createAuthor: {
9 | resolve: createAuthorMutationResolver,
10 | },
11 | };
12 |
13 | export default mutation;
14 |
--------------------------------------------------------------------------------
/templates/gql-ts-prisma-codegen-apolloserver/src/graphql/schema/typedefs/CreateAuthorInput.ts:
--------------------------------------------------------------------------------
1 | import { GraphQLInputObjectType, GraphQLNonNull, GraphQLString } from 'graphql';
2 |
3 | const CreateAuthorInput: GraphQLInputObjectType = new GraphQLInputObjectType({
4 | name: 'CreateAuthorInput',
5 | description: 'Create author input',
6 | fields: {
7 | username: {
8 | type: new GraphQLNonNull(GraphQLString),
9 | description: 'The authors username',
10 | },
11 | },
12 | });
13 |
14 | export default CreateAuthorInput;
15 |
--------------------------------------------------------------------------------
/templates/gql-ts-prisma-codegen-apolloserver/src/graphql/schema/typedefs/QueryType.ts:
--------------------------------------------------------------------------------
1 | import { GraphQLObjectType } from 'graphql';
2 | import getAllAuthorsQuery from '@src/graphql/schema/resolvers/query/getAllAuthorsQuery';
3 | import getAllBooksQuery from '@src/graphql/schema/resolvers/query/getAllBooksQuery';
4 |
5 | const queryType: GraphQLObjectType = new GraphQLObjectType({
6 | name: 'Query',
7 | fields: {
8 | books: getAllBooksQuery,
9 | authors: getAllAuthorsQuery,
10 | },
11 | });
12 |
13 | export default queryType;
14 |
--------------------------------------------------------------------------------
/templates/gql-ts-prisma-codegen-apolloserver/src/__tests__/__mocks__/prismaMock.ts:
--------------------------------------------------------------------------------
1 | import { mockDeep, mockReset, MockProxy } from 'jest-mock-extended';
2 | import { PrismaClient } from '@prisma/client';
3 | import prisma from '@src/lib/prisma/prismaClient';
4 |
5 | jest.mock('@src/lib/prisma/prismaClient', () => ({
6 | __esModule: true,
7 | default: mockDeep(),
8 | }));
9 |
10 | const prismaMock = (prisma as unknown) as MockProxy;
11 |
12 | beforeEach(() => {
13 | mockReset(prismaMock);
14 | });
15 |
16 | export default prismaMock;
17 |
--------------------------------------------------------------------------------
/templates/aws-ts-serverless/jest.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | preset: 'ts-jest',
3 | testEnvironment: 'node',
4 | coverageDirectory: 'coverage',
5 | collectCoverageFrom: ['src/**/*.{js,ts}'],
6 | coverageThreshold: {
7 | global: {
8 | branches: 0,
9 | functions: 0,
10 | lines: 0,
11 | statements: 0,
12 | },
13 | },
14 | moduleNameMapper: {
15 | 'src/(.*)': '/src/$1',
16 | },
17 | moduleDirectories: ['node_modules', 'src'],
18 | testPathIgnorePatterns: ['/dist/', '/node_modules/'],
19 | };
20 |
--------------------------------------------------------------------------------
/templates/gql-ts-serverless/jest.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | preset: 'ts-jest',
3 | testEnvironment: 'node',
4 | coverageDirectory: 'coverage',
5 | collectCoverageFrom: ['src/**/*.{js,ts}'],
6 | coverageThreshold: {
7 | global: {
8 | branches: 0,
9 | functions: 0,
10 | lines: 0,
11 | statements: 0,
12 | },
13 | },
14 | moduleNameMapper: {
15 | 'src/(.*)': '/src/$1',
16 | },
17 | moduleDirectories: ['node_modules', 'src'],
18 | testPathIgnorePatterns: ['/dist/', '/node_modules/'],
19 | };
20 |
--------------------------------------------------------------------------------
/templates/nextjs-ts-reactquery/pages/api/person/[id].ts:
--------------------------------------------------------------------------------
1 | import { NextApiRequest, NextApiResponse } from 'next';
2 | import { IPerson } from '@src/lib/interfaces/IPerson';
3 |
4 | export default (req: NextApiRequest, res: NextApiResponse): void => {
5 | const {
6 | query: { id },
7 | } = req;
8 |
9 | if (typeof id === 'string') {
10 | console.log(`getting person by id: ${id}`);
11 | res.status(200).json({ id, name: 'John Doe', age: 25 });
12 | } else {
13 | res.status(500).json(new Error('id is not of correct type'));
14 | }
15 | };
16 |
--------------------------------------------------------------------------------
/templates/gql-ts-prisma-codegen-apolloserver/src/graphql/schema/typedefs/MutationType.ts:
--------------------------------------------------------------------------------
1 | import { GraphQLObjectType } from 'graphql';
2 | import createAuthorMutation from '@src/graphql/schema/resolvers/mutation/createAuthorMutation';
3 | import createBookMutation from '@src/graphql/schema/resolvers/mutation/createBookMutation';
4 |
5 | const mutationType: GraphQLObjectType = new GraphQLObjectType({
6 | name: 'Mutation',
7 | fields: {
8 | createBook: createBookMutation,
9 | createAuthor: createAuthorMutation,
10 | },
11 | });
12 |
13 | export default mutationType;
14 |
--------------------------------------------------------------------------------
/templates/nextjs-ts-frontend/.gitignore:
--------------------------------------------------------------------------------
1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2 |
3 | # dependencies
4 | /node_modules
5 | /.pnp
6 | .pnp.js
7 |
8 | # testing
9 | /coverage
10 |
11 | # next.js
12 | /.next/
13 | /out/
14 |
15 | # production
16 | /build
17 |
18 | # misc
19 | .DS_Store
20 | *.pem
21 |
22 | # debug
23 | npm-debug.log*
24 | yarn-debug.log*
25 | yarn-error.log*
26 |
27 | # local env files
28 | .env.local
29 | .env.development.local
30 | .env.test.local
31 | .env.production.local
32 |
33 | # vercel
34 | .vercel
35 | .vscode
36 |
--------------------------------------------------------------------------------
/templates/nextjs-ts-materialUI/.gitignore:
--------------------------------------------------------------------------------
1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2 |
3 | # dependencies
4 | /node_modules
5 | /.pnp
6 | .pnp.js
7 |
8 | # testing
9 | /coverage
10 |
11 | # next.js
12 | /.next/
13 | /out/
14 |
15 | # production
16 | /build
17 |
18 | # misc
19 | .DS_Store
20 | *.pem
21 |
22 | # debug
23 | npm-debug.log*
24 | yarn-debug.log*
25 | yarn-error.log*
26 |
27 | # local env files
28 | .env.local
29 | .env.development.local
30 | .env.test.local
31 | .env.production.local
32 |
33 | # vercel
34 | .vercel
35 | .vscode
36 |
--------------------------------------------------------------------------------
/templates/nextjs-ts-reactquery/.gitignore:
--------------------------------------------------------------------------------
1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2 |
3 | # dependencies
4 | /node_modules
5 | /.pnp
6 | .pnp.js
7 |
8 | # testing
9 | /coverage
10 |
11 | # next.js
12 | /.next/
13 | /out/
14 |
15 | # production
16 | /build
17 |
18 | # misc
19 | .DS_Store
20 | *.pem
21 |
22 | # debug
23 | npm-debug.log*
24 | yarn-debug.log*
25 | yarn-error.log*
26 |
27 | # local env files
28 | .env.local
29 | .env.development.local
30 | .env.test.local
31 | .env.production.local
32 |
33 | # vercel
34 | .vercel
35 | .vscode
36 |
--------------------------------------------------------------------------------
/templates/gql-ts-serverless/serverless.yml:
--------------------------------------------------------------------------------
1 | service: demo-apollo-server-lambda
2 | provider:
3 | name: aws
4 | runtime: nodejs12.x
5 | region: us-west-1
6 | functions:
7 | graphql:
8 | handler: src/apollo-server.graphqlHandler
9 | events:
10 | - http:
11 | path: graphql
12 | method: post
13 | cors: true
14 | - http:
15 | path: graphql
16 | method: get
17 | cors: true
18 | plugins:
19 | - serverless-dotenv-plugin
20 | - serverless-webpack
21 | - serverless-offline
22 | custom:
23 | webpack:
24 | includeModules: true
--------------------------------------------------------------------------------
/templates/nextjs-ts-materialui-reacthookform/.gitignore:
--------------------------------------------------------------------------------
1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2 |
3 | # dependencies
4 | /node_modules
5 | /.pnp
6 | .pnp.js
7 |
8 | # testing
9 | /coverage
10 |
11 | # next.js
12 | /.next/
13 | /out/
14 |
15 | # production
16 | /build
17 |
18 | # misc
19 | .DS_Store
20 | *.pem
21 |
22 | # debug
23 | npm-debug.log*
24 | yarn-debug.log*
25 | yarn-error.log*
26 |
27 | # local env files
28 | .env.local
29 | .env.development.local
30 | .env.test.local
31 | .env.production.local
32 |
33 | # vercel
34 | .vercel
35 | .vscode
36 |
--------------------------------------------------------------------------------
/templates/nextjs-ts-reactquery-graphqlrequest/.gitignore:
--------------------------------------------------------------------------------
1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2 |
3 | # dependencies
4 | /node_modules
5 | /.pnp
6 | .pnp.js
7 |
8 | # testing
9 | /coverage
10 |
11 | # next.js
12 | /.next/
13 | /out/
14 |
15 | # production
16 | /build
17 |
18 | # misc
19 | .DS_Store
20 | *.pem
21 |
22 | # debug
23 | npm-debug.log*
24 | yarn-debug.log*
25 | yarn-error.log*
26 |
27 | # local env files
28 | .env.local
29 | .env.development.local
30 | .env.test.local
31 | .env.production.local
32 |
33 | # vercel
34 | .vercel
35 | .vscode
36 |
--------------------------------------------------------------------------------
/templates/nextjs-ts-reactquery/src/components/PersonComponent.tsx:
--------------------------------------------------------------------------------
1 | import { useQuery, UseQueryResult } from 'react-query';
2 | // eslint-disable-next-line import/no-cycle
3 | import { fetchPerson } from '@pages/person';
4 | import { IPerson } from '@src/lib/interfaces/IPerson';
5 |
6 | const PersonComponent = () => {
7 | const { data }: UseQueryResult = useQuery('person', fetchPerson);
8 |
9 | return (
10 | <>
11 | {data?.id}
12 | {data?.name}
13 | {data?.age}
14 | >
15 | );
16 | };
17 |
18 | export default PersonComponent;
19 |
--------------------------------------------------------------------------------
/templates/gql-ts-prisma-codegen-apolloserver/jest.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | preset: 'ts-jest',
3 | rootDir: '.',
4 | testEnvironment: 'node',
5 | coverageDirectory: 'coverage',
6 | collectCoverageFrom: ['src/**/*.{js,ts}'],
7 | coverageThreshold: {
8 | global: {
9 | branches: 0,
10 | functions: 0,
11 | lines: 0,
12 | statements: 0,
13 | },
14 | },
15 | moduleNameMapper: {
16 | '@src/(.*)': '/src/$1',
17 | },
18 | moduleDirectories: ['src', 'node_modules'],
19 | testPathIgnorePatterns: ['/dist/', '/node_modules/', '/src/__tests__/__mocks__/'],
20 | };
21 |
--------------------------------------------------------------------------------
/templates/aws-ts-serverless/src/functions/question.ts:
--------------------------------------------------------------------------------
1 | import { SNSHandler, SNSEvent, SNSEventRecord } from 'aws-lambda';
2 |
3 | /*
4 | SNS Topics don't expect a return value. Usually you either publish to another topic or just do some work and finish
5 | */
6 | export const handler: SNSHandler = async (event: SNSEvent) => {
7 | const records: SNSEventRecord[] = event.Records;
8 | // For the sake of this tutorial I am just using a fire and forget with this forEach. If you want to try and catch you can use await Promise.all or something
9 | records.forEach(record => {
10 | console.log('Message is: ', record.Sns.Message);
11 | });
12 | };
13 |
--------------------------------------------------------------------------------
/templates/gql-ts-prisma-codegen-apolloserver/src/index.ts:
--------------------------------------------------------------------------------
1 | import { ApolloServer } from 'apollo-server';
2 | import dotenv from 'dotenv-safe';
3 | import { performAstCodegen } from '@src/codegen';
4 | import apolloServerConfig from '@src/lib/config/apolloServerConfig';
5 |
6 | dotenv.config();
7 |
8 | const startServer = () => {
9 | performAstCodegen();
10 |
11 | const server = new ApolloServer(apolloServerConfig);
12 |
13 | server
14 | .listen()
15 | .then(({ url }) => {
16 | console.log(`🚀 Server ready at ${url}graphql`);
17 | })
18 | .catch(err => console.log('Error launching server', err));
19 | };
20 |
21 | startServer();
22 |
--------------------------------------------------------------------------------
/templates/gql-ts-prisma-codegen-apolloserver/prisma/schema.prisma:
--------------------------------------------------------------------------------
1 | // This is your Prisma schema file,
2 | // learn more about it in the docs: https://pris.ly/d/prisma-schema
3 |
4 | datasource db {
5 | provider = "postgresql"
6 | url = env("DATABASE_URL")
7 | }
8 |
9 | generator client {
10 | provider = "prisma-client-js"
11 | }
12 |
13 | model Book {
14 | bookId Int @id @default(autoincrement())
15 | title String
16 | author Author @relation(fields: [authorId], references: [authorId])
17 | authorId Int
18 | }
19 |
20 | model Author {
21 | authorId Int @id @default(autoincrement())
22 | username String
23 | books Book[]
24 | }
25 |
--------------------------------------------------------------------------------
/templates/gql-ts-prisma-codegen-apolloserver/src/graphql/schema/schema.ts:
--------------------------------------------------------------------------------
1 | import { gql, makeExecutableSchema } from 'apollo-server';
2 | import { GraphQLSchema, printSchema } from 'graphql';
3 | import mutationType from '@src/graphql/schema/typedefs/MutationType';
4 | import queryType from '@src/graphql/schema/typedefs/QueryType';
5 | import resolvers from '@src/graphql/schema/resolvers/resolvers';
6 |
7 | const schema = makeExecutableSchema({
8 | typeDefs: gql(
9 | printSchema(
10 | new GraphQLSchema({
11 | query: queryType,
12 | mutation: mutationType,
13 | })
14 | )
15 | ),
16 | resolvers,
17 | });
18 |
19 | export default schema;
20 |
--------------------------------------------------------------------------------
/templates/gql-ts-prisma-codegen-apolloserver/src/graphql/schema/typedefs/CreateBookInput.ts:
--------------------------------------------------------------------------------
1 | import {
2 | GraphQLInputObjectType,
3 | GraphQLInt,
4 | GraphQLNonNull,
5 | GraphQLString,
6 | } from 'graphql';
7 |
8 | const CreateBookInput: GraphQLInputObjectType = new GraphQLInputObjectType({
9 | name: 'CreateBookInput',
10 | description: 'Create book input',
11 | fields: {
12 | title: {
13 | type: new GraphQLNonNull(GraphQLString),
14 | description: 'The books title.',
15 | },
16 | authorId: {
17 | type: new GraphQLNonNull(GraphQLInt),
18 | description: 'The authors id.',
19 | },
20 | },
21 | });
22 |
23 | export default CreateBookInput;
24 |
--------------------------------------------------------------------------------
/templates/nextjs-ts-materialUI/CONTRIBUTING.md:
--------------------------------------------------------------------------------
1 | [](http://commitizen.github.io/cz-cli/)
2 |
3 | # ReceitaClient [![Build status]] TODO: Get Build status from Vercel
4 |
5 | ### Tools
6 | - Husky
7 | - Commitizen
8 | - Conventional Commits
9 |
10 | ### `Conventional Commits`
11 |
12 | https://www.conventionalcommits.org/en/v1.0.0/
13 |
14 | #### `Installation`
15 |
16 | - Fresh yarn install will install husky dependencies as post install
17 | - After installation run
18 | - commitizen init cz-conventional-changelog --yarn --dev --exact
19 |
20 |
21 | #### `Contributing Flow`
22 | - git add
23 | - git cz
24 | - git push
--------------------------------------------------------------------------------
/templates/nextjs-ts-materialui-reacthookform/CONTRIBUTING.md:
--------------------------------------------------------------------------------
1 | [](http://commitizen.github.io/cz-cli/)
2 |
3 | # ReceitaClient [![Build status]] TODO: Get Build status from Vercel
4 |
5 | ### Tools
6 | - Husky
7 | - Commitizen
8 | - Conventional Commits
9 |
10 | ### `Conventional Commits`
11 |
12 | https://www.conventionalcommits.org/en/v1.0.0/
13 |
14 | #### `Installation`
15 |
16 | - Fresh yarn install will install husky dependencies as post install
17 | - After installation run
18 | - commitizen init cz-conventional-changelog --yarn --dev --exact
19 |
20 |
21 | #### `Contributing Flow`
22 | - git add
23 | - git cz
24 | - git push
--------------------------------------------------------------------------------
/templates/nextjs-ts-frontend/jest.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | testEnvironment: 'jest-environment-jsdom',
3 | setupFilesAfterEnv: ['/jest.setup.ts'],
4 | testPathIgnorePatterns: ['/.next/', '/node_modules/', '/coverage', '/dist'],
5 | moduleDirectories: ['/node_modules', '/src'],
6 | moduleNameMapper: {
7 | '@src/(.*)': '/src/$1',
8 | '@styles/(.*)': '/styles/$1',
9 | },
10 | coverageDirectory: 'coverage',
11 | collectCoverageFrom: ['src/**/*.{js,jsx,ts,tsx}'],
12 | coverageThreshold: {
13 | global: {
14 | branches: 0,
15 | functions: 0,
16 | lines: 0,
17 | statements: 0,
18 | },
19 | },
20 | };
21 |
--------------------------------------------------------------------------------
/templates/gql-ts-prisma-codegen-apolloserver/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM node:14.15.4-alpine3.10 AS base
2 |
3 | WORKDIR /app
4 |
5 | RUN apk update && apk add bash
6 |
7 |
8 | COPY package*.json yarn.lock /app/
9 |
10 | COPY .env.example /app/.env.example
11 | COPY .env.test /app/.env.test
12 |
13 | # copy source files
14 | COPY src /app/src
15 |
16 | COPY tsconfig.json /app/tsconfig.json
17 |
18 | COPY tsconfig.prod.json /app/tsconfig.prod.json
19 |
20 | COPY jest.config.js /app/jest.config.js
21 |
22 | COPY bin /app/bin
23 |
24 | COPY prisma /app/prisma
25 |
26 | COPY codegen.yml /app/codegen.yml
27 |
28 | RUN yarn install --frozen-lockfile
29 |
30 | RUN yarn generate
31 | RUN yarn prisma generate
32 |
33 | RUN yarn build
34 | CMD [ "yarn", "start" ]
35 |
--------------------------------------------------------------------------------
/templates/gql-ts-prisma-codegen-apolloserver/src/data/authorService.ts:
--------------------------------------------------------------------------------
1 | import { Author, prisma } from '@prisma/client';
2 | import prismaContext from '@src/lib/prisma/prismaContext';
3 |
4 | export const getAllAuthors = async (): Promise => {
5 | const authors = await prismaContext.prisma.author.findMany();
6 | return authors;
7 | };
8 |
9 | export const getAuthorById = async (
10 | authorId: number
11 | ): Promise => {
12 | return prismaContext.prisma.author.findUnique({
13 | where: {
14 | authorId,
15 | },
16 | });
17 | };
18 |
19 | export const createAuthor = async (username: string): Promise => {
20 | const author = await prismaContext.prisma.author.create({
21 | data: { username },
22 | });
23 | return author;
24 | };
25 |
--------------------------------------------------------------------------------
/templates/gql-ts-serverless/webpack.config.js:
--------------------------------------------------------------------------------
1 | /* eslint-disable @typescript-eslint/no-var-requires */
2 | const nodeExternals = require('webpack-node-externals');
3 | const serverlessWebpack = require('serverless-webpack');
4 |
5 | module.exports = {
6 | devtool: 'inline-cheap-module-source-map',
7 | entry: serverlessWebpack.lib.entries,
8 | mode: serverlessWebpack.lib.webpack.isLocal ? 'development' : 'production',
9 | module: {
10 | rules: [
11 | {
12 | exclude: /node_modules/,
13 | test: /\.ts$/,
14 | use: 'ts-loader',
15 | },
16 | ],
17 | },
18 | node: false,
19 | externals: [nodeExternals()],
20 | optimization: {
21 | minimize: false,
22 | },
23 | resolve: {
24 | extensions: ['.ts', '.js'],
25 | },
26 | target: 'node',
27 | };
28 |
--------------------------------------------------------------------------------
/templates/nextjs-ts-materialUI/.babelrc:
--------------------------------------------------------------------------------
1 | {
2 | "presets": ["next/babel"],
3 | "plugins": [
4 | [
5 | "babel-plugin-import",
6 | {
7 | "libraryName": "@material-ui/core",
8 | // Use ""libraryDirectory": ""," if your bundler does not support ES modules
9 | "libraryDirectory": "",
10 | "camel2DashComponentName": false
11 | },
12 | "core"
13 | ],
14 | [
15 | "babel-plugin-import",
16 | {
17 | "libraryName": "@material-ui/icons",
18 | // Use ""libraryDirectory": ""," if your bundler does not support ES modules
19 | "libraryDirectory": "",
20 | "camel2DashComponentName": false
21 | },
22 | "icons"
23 | ]
24 | ]
25 | }
--------------------------------------------------------------------------------
/templates/nextjs-ts-materialUI/jest.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | testEnvironment: 'jest-environment-jsdom',
3 | setupFilesAfterEnv: ['/jest.setup.ts'],
4 | testPathIgnorePatterns: ['/.next/', '/node_modules/', '/coverage', '/dist'],
5 | moduleDirectories: ['/node_modules', '/src', '/pages'],
6 | moduleNameMapper: {
7 | '@src/(.*)': '/src/$1',
8 | '@pages/(.*)': '/pages/$1',
9 | '@styles/(.*)': '/styles/$1',
10 | },
11 | coverageDirectory: 'coverage',
12 | collectCoverageFrom: ['src/**/*.{js,jsx,ts,tsx}', 'pages/**/*.{js,jsx,ts,tsx}'],
13 | coverageThreshold: {
14 | global: {
15 | branches: 0,
16 | functions: 0,
17 | lines: 0,
18 | statements: 0,
19 | },
20 | },
21 | };
22 |
--------------------------------------------------------------------------------
/templates/nextjs-ts-reactquery/jest.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | testEnvironment: 'jest-environment-jsdom',
3 | setupFilesAfterEnv: ['/jest.setup.ts'],
4 | testPathIgnorePatterns: ['/.next/', '/node_modules/', '/coverage', '/dist'],
5 | moduleDirectories: ['/node_modules', '/src', '/pages'],
6 | moduleNameMapper: {
7 | '@src/(.*)': '/src/$1',
8 | '@pages/(.*)': '/pages/$1',
9 | '@styles/(.*)': '/styles/$1',
10 | },
11 | coverageDirectory: 'coverage',
12 | collectCoverageFrom: ['src/**/*.{js,jsx,ts,tsx}', 'pages/**/*.{js,jsx,ts,tsx}'],
13 | coverageThreshold: {
14 | global: {
15 | branches: 0,
16 | functions: 0,
17 | lines: 0,
18 | statements: 0,
19 | },
20 | },
21 | };
22 |
--------------------------------------------------------------------------------
/templates/nextjs-ts-materialui-reacthookform/.babelrc:
--------------------------------------------------------------------------------
1 | {
2 | "presets": ["next/babel"],
3 | "plugins": [
4 | [
5 | "babel-plugin-import",
6 | {
7 | "libraryName": "@material-ui/core",
8 | // Use ""libraryDirectory": ""," if your bundler does not support ES modules
9 | "libraryDirectory": "",
10 | "camel2DashComponentName": false
11 | },
12 | "core"
13 | ],
14 | [
15 | "babel-plugin-import",
16 | {
17 | "libraryName": "@material-ui/icons",
18 | // Use ""libraryDirectory": ""," if your bundler does not support ES modules
19 | "libraryDirectory": "",
20 | "camel2DashComponentName": false
21 | },
22 | "icons"
23 | ]
24 | ]
25 | }
--------------------------------------------------------------------------------
/templates/nextjs-ts-materialui-reacthookform/jest.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | testEnvironment: 'jest-environment-jsdom',
3 | setupFilesAfterEnv: ['/jest.setup.ts'],
4 | testPathIgnorePatterns: ['/.next/', '/node_modules/', '/coverage', '/dist'],
5 | moduleDirectories: ['/node_modules', '/src', '/pages'],
6 | moduleNameMapper: {
7 | '@src/(.*)': '/src/$1',
8 | '@pages/(.*)': '/pages/$1',
9 | '@styles/(.*)': '/styles/$1',
10 | },
11 | coverageDirectory: 'coverage',
12 | collectCoverageFrom: ['src/**/*.{js,jsx,ts,tsx}', 'pages/**/*.{js,jsx,ts,tsx}'],
13 | coverageThreshold: {
14 | global: {
15 | branches: 0,
16 | functions: 0,
17 | lines: 0,
18 | statements: 0,
19 | },
20 | },
21 | };
22 |
--------------------------------------------------------------------------------
/templates/nextjs-ts-reactquery-graphqlrequest/pages/_app.tsx:
--------------------------------------------------------------------------------
1 | /* eslint-disable react/jsx-props-no-spreading */
2 | // _app.tsx
3 | import '@styles/globals.css';
4 |
5 | import React, { FC } from 'react';
6 | import { AppProps } from 'next/app';
7 | import { QueryClient, QueryClientProvider } from 'react-query';
8 | import { ReactQueryDevtools } from 'react-query/devtools';
9 |
10 | const queryClient = new QueryClient({
11 | defaultOptions: {
12 | queries: {
13 | staleTime: 5 * 1000,
14 | },
15 | },
16 | });
17 |
18 | const MyApp: FC = ({ Component, pageProps }: AppProps) => {
19 | return (
20 |
21 |
22 |
23 |
24 | );
25 | };
26 |
27 | export default MyApp;
28 |
--------------------------------------------------------------------------------
/templates/gql-ts-prisma-codegen-apolloserver/docker-compose.yml:
--------------------------------------------------------------------------------
1 | # Set the version of docker compose to use
2 | version: '3.9'
3 |
4 | # The containers that compose the project
5 | services:
6 | server:
7 | container_name: server
8 | environment:
9 | DATABASE_URL: postgresql://prisma:prisma@db:5432/bookdb?schema=public
10 | build:
11 | context: '.'
12 | target: base
13 | ports:
14 | - '4000:4000'
15 | depends_on:
16 | - db
17 | networks:
18 | - test_vm
19 | db:
20 | image: postgres:13
21 | restart: always
22 | container_name: db
23 | ports:
24 | - '5432:5432'
25 | environment:
26 | POSTGRES_USER: prisma
27 | POSTGRES_PASSWORD: prisma
28 | POSTGRES_DB: tests
29 | networks:
30 | - test_vm
31 | networks:
32 | test_vm:
33 | name: test_vm
34 | driver: bridge
35 |
--------------------------------------------------------------------------------
/templates/gql-ts-prisma-codegen-apolloserver/src/graphql/schema/typedefs/AuthorType.ts:
--------------------------------------------------------------------------------
1 | import {
2 | GraphQLNonNull,
3 | GraphQLObjectType,
4 | GraphQLString,
5 | GraphQLID,
6 | GraphQLList,
7 | } from 'graphql';
8 | // eslint-disable-next-line import/no-cycle
9 | import BookType from '@src/graphql/schema/typedefs/BookType';
10 |
11 | const AuthorType: GraphQLObjectType = new GraphQLObjectType({
12 | name: 'Author',
13 | description: 'A author',
14 | // thunk for cyclical horribly documented
15 | fields: () => ({
16 | authorId: {
17 | type: GraphQLNonNull(GraphQLID),
18 | description: 'id of the author',
19 | },
20 | username: {
21 | type: GraphQLString,
22 | description: 'authors username',
23 | },
24 | books: {
25 | type: GraphQLList(BookType),
26 | description: 'list of authors books',
27 | },
28 | }),
29 | });
30 |
31 | export default AuthorType;
32 |
--------------------------------------------------------------------------------
/templates/aws-ts-serverless/.vscode/launch.json:
--------------------------------------------------------------------------------
1 | {
2 | // Use IntelliSense to learn about possible attributes.
3 | // Hover to view descriptions of existing attributes.
4 | // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5 | "version": "0.2.0",
6 | "configurations": [
7 | {
8 | "type": "node",
9 | "request": "launch",
10 | "name": "Launch Serverless Offline",
11 | "program": "${workspaceFolder}/node_modules/serverless/bin/serverless",
12 | "args": ["offline", "start", "--httpPort", "4000", "--noTimeout"],
13 | "protocol": "inspector",
14 | "runtimeExecutable": "node",
15 | "env": {}, // in case env variables are needed
16 | "windows": {
17 | "program": "${workspaceFolder}/node_modules/serverless/bin/serverless"
18 | }
19 | }
20 | ]
21 | }
--------------------------------------------------------------------------------
/templates/gql-ts-prisma-codegen-apolloserver/src/graphql/schema/resolvers/query/getAllBooksQuery.ts:
--------------------------------------------------------------------------------
1 | import { GraphQLFieldConfig, GraphQLFieldResolver, GraphQLList } from 'graphql';
2 | import { Book } from '@prisma/client';
3 | import { IApolloServerContext } from '@src/lib/interfaces/IApolloServerContext';
4 | import { getAllBooks } from '@src/data/bookService';
5 | import BookType from '@src/graphql/schema/typedefs/BookType';
6 |
7 | export const getAllBooksQueryResolver: GraphQLFieldResolver<
8 | unknown,
9 | IApolloServerContext
10 | > = async (_source, _args, _context, _info): Promise => {
11 | const books = await getAllBooks();
12 | return books;
13 | };
14 |
15 | const getAllBooksQuery: GraphQLFieldConfig = {
16 | description: 'Get all books query',
17 | type: GraphQLList(BookType),
18 | resolve: getAllBooksQueryResolver,
19 | };
20 |
21 | export default getAllBooksQuery;
22 |
--------------------------------------------------------------------------------
/templates/gql-ts-prisma-codegen-apolloserver/src/graphql/schema/resolvers/query/getAllAuthorsQuery.ts:
--------------------------------------------------------------------------------
1 | import { GraphQLFieldConfig, GraphQLFieldResolver, GraphQLList } from 'graphql';
2 | import { Author } from '@prisma/client';
3 | import { IApolloServerContext } from '@src/lib/interfaces/IApolloServerContext';
4 | import { getAllAuthors } from '@src/data/authorService';
5 | import AuthorType from '@src/graphql/schema/typedefs/AuthorType';
6 |
7 | export const getAllAuthorsResolver: GraphQLFieldResolver<
8 | unknown,
9 | IApolloServerContext
10 | > = async (_source, _args, _context, _info): Promise => {
11 | const authors = await getAllAuthors();
12 | return authors;
13 | };
14 |
15 | const getAllAuthorsQuery: GraphQLFieldConfig = {
16 | description: 'Get all authors query',
17 | type: GraphQLList(AuthorType),
18 | resolve: getAllAuthorsResolver,
19 | };
20 |
21 | export default getAllAuthorsQuery;
22 |
--------------------------------------------------------------------------------
/templates/gql-ts-prisma-codegen-apolloserver/src/data/bookService.ts:
--------------------------------------------------------------------------------
1 | import { Book } from '@prisma/client';
2 | import prismaContext from '@src/lib/prisma/prismaContext';
3 |
4 | export const getAllBooks = async (): Promise => {
5 | const books = await prismaContext.prisma.book.findMany();
6 | return books;
7 | };
8 |
9 | export const getBookById = async (bookId: number): Promise => {
10 | return prismaContext.prisma.book.findFirst({
11 | where: {
12 | bookId,
13 | },
14 | });
15 | };
16 |
17 | export const getBooksByAuthor = async (authorId: number): Promise => {
18 | return prismaContext.prisma.book.findMany({
19 | where: {
20 | authorId,
21 | },
22 | });
23 | };
24 |
25 | export const createBook = async (
26 | title: string,
27 | authorId: number
28 | ): Promise => {
29 | const book = await prismaContext.prisma.book.create({
30 | data: { title, authorId },
31 | });
32 | return book;
33 | };
34 |
--------------------------------------------------------------------------------
/templates/gql-ts-prisma-codegen-apolloserver/src/graphql/schema/typedefs/BookType.ts:
--------------------------------------------------------------------------------
1 | import {
2 | GraphQLNonNull,
3 | GraphQLObjectType,
4 | GraphQLString,
5 | GraphQLID,
6 | GraphQLInt,
7 | } from 'graphql';
8 | // eslint-disable-next-line import/no-cycle
9 | import AuthorType from '@src/graphql/schema/typedefs/AuthorType';
10 |
11 | const BookType: GraphQLObjectType = new GraphQLObjectType({
12 | name: 'Book',
13 | description: 'A book',
14 | // thunk to refer to author type
15 | fields: () => ({
16 | bookId: {
17 | type: GraphQLNonNull(GraphQLID),
18 | description: 'id of the book',
19 | },
20 | title: {
21 | type: GraphQLString,
22 | description: 'title of book',
23 | },
24 | author: {
25 | type: AuthorType,
26 | description: 'author of book',
27 | },
28 | authorId: {
29 | type: GraphQLInt,
30 | description: 'id of the author',
31 | },
32 | }),
33 | });
34 |
35 | export default BookType;
36 |
--------------------------------------------------------------------------------
/templates/nextjs-ts-frontend/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | /* Paths */
4 | "baseUrl": ".",
5 | "outDir": "dist",
6 | "paths": {
7 | "@src/*": ["src/*"],
8 | "@styles/*": ["styles/*"]
9 | },
10 |
11 | /* Project */
12 | "target": "es5",
13 | "lib": [
14 | "dom",
15 | "dom.iterable",
16 | "esnext"
17 | ],
18 | "allowJs": true,
19 |
20 | /* Imports */
21 | "skipLibCheck": true,
22 | "forceConsistentCasingInFileNames": true,
23 | "module": "esnext",
24 | "moduleResolution": "node",
25 | "resolveJsonModule": true,
26 | "isolatedModules": true,
27 |
28 |
29 | /* Additional */
30 | "strict": true,
31 | "noEmit": true,
32 | "esModuleInterop": true,
33 | "jsx": "preserve"
34 | },
35 | "include": [
36 | "next-env.d.ts",
37 | "**/*.ts",
38 | "**/*.tsx"
39 | ],
40 | "exclude": [
41 | "node_modules", "dist", "coverage", ".next"
42 | ]
43 | }
44 |
--------------------------------------------------------------------------------
/templates/nextjs-ts-reactquery-graphqlrequest/pages/graphqlquery.tsx:
--------------------------------------------------------------------------------
1 | // index.tsx
2 | import { FC } from 'react';
3 | import { GetAllBooksQuery, useGetAllBooksQuery } from '@src/generated/graphql';
4 | import graphqlRequestClient from '@src/lib/clients/graphqlRequestClient';
5 |
6 | const GqlRequestQuery: FC = () => {
7 | const { isLoading, error, data } = useGetAllBooksQuery(graphqlRequestClient, {});
8 |
9 | if (isLoading) return Loading...
;
10 | if (error) return Boom boy{error.message}
;
11 |
12 | return (
13 | <>
14 | {data?.books?.map((book) => {
15 | return (
16 |
17 |
{book?.title}
18 |
AuthorId: {book?.author?.authorId}
19 |
Username: {book?.author?.username}
20 |
BookId: {book?.bookId}
21 |
22 | );
23 | })}
24 | >
25 | );
26 | };
27 |
28 | export default GqlRequestQuery;
29 |
--------------------------------------------------------------------------------
/templates/nextjs-ts-reactquery/pages/api/todo/[page].ts:
--------------------------------------------------------------------------------
1 | import { NextApiRequest, NextApiResponse } from 'next';
2 | import { IPaginatedTodos } from '@src/lib/interfaces/IPaginatedTodos';
3 | import { ITodo } from '@src/lib/interfaces/ITodo';
4 |
5 | export default (req: NextApiRequest, res: NextApiResponse): void => {
6 | const {
7 | query: { page },
8 | } = req;
9 |
10 | if (typeof page === 'string') {
11 | console.log(`getting page number: ${page}`);
12 | const returnTodos: ITodo[] = [];
13 | // eslint-disable-next-line radix
14 | const nums = parseInt(page) * 5;
15 | for (let i = nums; i < nums + 5; i += 1) {
16 | const returnTodo: ITodo = {
17 | id: i,
18 | message: `Todo number: ${i}`,
19 | };
20 | returnTodos.push(returnTodo);
21 | }
22 |
23 | res.status(200).json({ todos: returnTodos, hasMore: page !== '4' });
24 | } else {
25 | res.status(500).json(new Error('id is not of correct type'));
26 | }
27 | };
28 |
--------------------------------------------------------------------------------
/templates/nextjs-ts-reactquery-graphqlrequest/src/components/AuthorsList.tsx:
--------------------------------------------------------------------------------
1 | // index.tsx
2 | import { FC } from 'react';
3 | import { GetAllAuthorsQuery, useGetAllAuthorsQuery } from '@src/generated/graphql';
4 | import graphqlRequestClient from '@src/lib/clients/graphqlRequestClient';
5 | import BooksByAuthorList from './BooksByAuthorList';
6 |
7 | const AuthorsList: FC = () => {
8 | const { isLoading, error, data } = useGetAllAuthorsQuery(graphqlRequestClient, {});
9 |
10 | if (isLoading) return Loading...
;
11 | if (error) return Boom boy{error.message}
;
12 |
13 | return (
14 | <>
15 | {data?.authors?.map((author) => {
16 | return (
17 |
18 |
{author?.username}
19 |
AuthorId: {author?.authorId}
20 |
21 |
22 | );
23 | })}
24 | >
25 | );
26 | };
27 |
28 | export default AuthorsList;
29 |
--------------------------------------------------------------------------------
/templates/nextjs-ts-materialUI/styles/theme.ts:
--------------------------------------------------------------------------------
1 | // styles/theme.ts
2 |
3 | import { createMuiTheme } from '@material-ui/core/styles';
4 |
5 | // Create a theme instance.
6 | const theme = createMuiTheme({
7 | palette: {
8 | common: {
9 | black: '#19192B',
10 | white: '#ffffff',
11 | },
12 | primary: {
13 | light: '#B3E5FC',
14 | main: '#03A9F4',
15 | dark: '#0288D1',
16 | contrastText: '#212121',
17 | },
18 | secondary: {
19 | main: '#607D8B', // omitting light and dark will calculate from main
20 | contrastText: '#757575',
21 | },
22 | grey: {
23 | '500': '#bcbcbc',
24 | '700': '#79797a',
25 | },
26 | info: {
27 | main: '#1bb2f1',
28 | },
29 | success: {
30 | main: '#00d589',
31 | },
32 | error: {
33 | main: '#832838',
34 | },
35 | background: {
36 | default: '#fff',
37 | },
38 | },
39 | typography: {
40 | fontFamily: 'Roboto',
41 | },
42 | });
43 |
44 | export default theme;
45 |
--------------------------------------------------------------------------------
/createDirectoryContents.js:
--------------------------------------------------------------------------------
1 | import * as fs from 'fs';
2 | const CURR_DIR = process.cwd();
3 |
4 | const createDirectoryContents = (templatePath, newProjectPath) => {
5 | const filesToCreate = fs.readdirSync(templatePath);
6 |
7 | filesToCreate.forEach(file => {
8 | const origFilePath = `${templatePath}/${file}`;
9 |
10 | // get stats about the current file
11 | const stats = fs.statSync(origFilePath);
12 |
13 | if (stats.isFile()) {
14 | const contents = fs.readFileSync(origFilePath, 'utf8');
15 |
16 | // Rename
17 | if (file === '.npmignore') file = '.gitignore';
18 |
19 | const writePath = `${CURR_DIR}/${newProjectPath}/${file}`;
20 | fs.writeFileSync(writePath, contents, 'utf8');
21 | } else if (stats.isDirectory()) {
22 | fs.mkdirSync(`${CURR_DIR}/${newProjectPath}/${file}`);
23 |
24 | // recursive call
25 | createDirectoryContents(`${templatePath}/${file}`, `${newProjectPath}/${file}`);
26 | }
27 | });
28 | };
29 |
30 | export default createDirectoryContents;
31 |
--------------------------------------------------------------------------------
/templates/gql-ts-prisma-codegen-apolloserver/src/data/bookService.unit.test.ts:
--------------------------------------------------------------------------------
1 | // import { Book } from '@prisma/client';
2 | // import prismaMock from '@src/__tests__/__mocks__/prismaMock';
3 | // import { createBook } from '@src/data/bookService';
4 |
5 | // describe('book service tests', () => {
6 | // describe('create book test', () => {
7 | // test('it should create book with passed in args', async () => {
8 | // const mockBook: Book = {
9 | // id: 1,
10 | // title: 'book title',
11 | // author: 'super guy',
12 | // };
13 |
14 | // prismaMock.book.create.mockResolvedValue(mockBook);
15 |
16 | // const bookCreated = await createBook(mockBook.title, mockBook.author);
17 |
18 | // expect(bookCreated).toBe(mockBook);
19 | // expect(prismaMock.book.create).toHaveBeenCalledTimes(1);
20 | // expect(prismaMock.book.create).toHaveBeenCalledWith({
21 | // data: { title: mockBook.title, author: mockBook.author },
22 | // });
23 | // });
24 | // });
25 | // });
26 |
--------------------------------------------------------------------------------
/templates/nextjs-ts-reactquery/pages/_app.tsx:
--------------------------------------------------------------------------------
1 | /* eslint-disable react/jsx-props-no-spreading */
2 | // _app.tsx
3 | import '@styles/globals.css';
4 |
5 | import { FC, useState } from 'react';
6 | import { AppProps } from 'next/app';
7 | import { QueryClientProvider, QueryClient } from 'react-query';
8 | import { ReactQueryDevtools } from 'react-query/devtools';
9 | import { Hydrate } from 'react-query/hydration';
10 |
11 | const MyApp: FC = ({ Component, pageProps }: AppProps) => {
12 | const [queryClient] = useState(
13 | () =>
14 | new QueryClient({
15 | defaultOptions: {
16 | queries: {
17 | staleTime: 20 * 1000,
18 | },
19 | },
20 | })
21 | );
22 | return (
23 |
24 |
25 |
26 |
27 |
28 |
29 | );
30 | };
31 |
32 | export default MyApp;
33 |
--------------------------------------------------------------------------------
/templates/nextjs-ts-materialui-reacthookform/styles/theme.ts:
--------------------------------------------------------------------------------
1 | // styles/theme.ts
2 |
3 | import { createMuiTheme } from '@material-ui/core/styles';
4 |
5 | // Create a theme instance.
6 | const theme = createMuiTheme({
7 | palette: {
8 | common: {
9 | black: '#19192B',
10 | white: '#ffffff',
11 | },
12 | primary: {
13 | light: '#B3E5FC',
14 | main: '#03A9F4',
15 | dark: '#0288D1',
16 | contrastText: '#212121',
17 | },
18 | secondary: {
19 | main: '#008000', // omitting light and dark will calculate from main
20 | contrastText: '#ffffff',
21 | },
22 | grey: {
23 | '500': '#bcbcbc',
24 | '700': '#79797a',
25 | },
26 | info: {
27 | main: '#1bb2f1',
28 | },
29 | success: {
30 | main: '#00d589',
31 | },
32 | error: {
33 | main: '#832838',
34 | },
35 | background: {
36 | default: '#fff',
37 | },
38 | },
39 | typography: {
40 | fontFamily: 'Roboto',
41 | },
42 | });
43 |
44 | export default theme;
45 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "template-cli",
3 | "version": "1.0.0",
4 | "description": "Project for instantiating projects via cli",
5 | "main": "index.js",
6 | "type": "module",
7 | "bin": {
8 | "template-cli": "./index.js"
9 | },
10 | "scripts": {
11 | "test": "echo \"Error: no test specified\" && exit 1"
12 | },
13 | "repository": {
14 | "type": "git",
15 | "url": "git+https://github.com/leoroese/template-cli.git"
16 | },
17 | "author": "Leonardo Roese",
18 | "license": "ISC",
19 | "bugs": {
20 | "url": "https://github.com/leoroese/template-cli/issues"
21 | },
22 | "homepage": "https://github.com/leoroese/template-cli#readme",
23 | "dependencies": {
24 | "inquirer": "^8.0.0"
25 | },
26 | "devDependencies": {
27 | "@babel/core": "^7.13.10",
28 | "eslint": "^7.22.0",
29 | "eslint-config-airbnb-base": "^14.2.1",
30 | "eslint-config-prettier": "^8.1.0",
31 | "eslint-plugin-import": "^2.22.1",
32 | "eslint-plugin-prettier": "^3.3.1",
33 | "prettier": "^2.2.1"
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/templates/nextjs-ts-frontend/public/vercel.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/templates/nextjs-ts-materialUI/public/vercel.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/templates/nextjs-ts-reactquery/public/vercel.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/templates/aws-ts-serverless/serverless.yml:
--------------------------------------------------------------------------------
1 | service: serverlessSetup
2 |
3 | provider:
4 | name: aws
5 | runtime: nodejs12.x
6 | region: us-west-1
7 |
8 | # functions
9 | functions:
10 | hello:
11 | handler: src/functions/hello.handler
12 | events: # The events that trigger this function
13 | - http:
14 | path: serverlessSetup/hello
15 | method: get
16 | goodbye:
17 | handler: src/functions/goodbye.handler
18 | events:
19 | - http:
20 | path: serverlessSetup/goodbye
21 | method: post
22 | question:
23 | handler: src/functions/question.handler
24 | dependsOn: SNSHelloEvent
25 | events:
26 | - sns:
27 | arn: !Ref SNSHelloEvent
28 | topicName: hello-event
29 |
30 | # Serverless plugins
31 | plugins:
32 | - serverless-plugin-typescript
33 | - serverless-offline
34 |
35 | # Resources your functions use
36 | resources:
37 | Resources:
38 | # SNS Topics
39 | SNSHelloEvent:
40 | Type: AWS::SNS::Topic
41 | Properties:
42 | DisplayName: Hello Event Topic
43 | TopicName: hello-event
44 |
--------------------------------------------------------------------------------
/templates/nextjs-ts-materialui-reacthookform/public/vercel.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/templates/nextjs-ts-reactquery-graphqlrequest/public/vercel.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/templates/gql-ts-prisma-codegen-apolloserver/src/graphql/schema/resolvers/mutation/createAuthorMutation.ts:
--------------------------------------------------------------------------------
1 | import { GraphQLFieldConfig, GraphQLFieldResolver } from 'graphql';
2 | import { Author } from '@prisma/client';
3 | import { IApolloServerContext } from '@src/lib/interfaces/IApolloServerContext';
4 | import { createAuthor } from '@src/data/authorService';
5 | import AuthorType from '@src/graphql/schema/typedefs/AuthorType';
6 | import CreateAuthorInput from '@src/graphql/schema/typedefs/CreateAuthorInput';
7 |
8 | export const createAuthorMutationResolver: GraphQLFieldResolver<
9 | unknown,
10 | IApolloServerContext
11 | > = async (
12 | _source,
13 | { input: { username } },
14 | _context,
15 | _info
16 | ): Promise => {
17 | return createAuthor(username);
18 | };
19 |
20 | const createAuthorMutation: GraphQLFieldConfig<
21 | unknown,
22 | IApolloServerContext
23 | > = {
24 | description: 'create author',
25 | type: AuthorType,
26 | args: {
27 | input: {
28 | type: CreateAuthorInput,
29 | },
30 | },
31 | resolve: createAuthorMutationResolver,
32 | };
33 |
34 | export default createAuthorMutation;
35 |
--------------------------------------------------------------------------------
/templates/nextjs-ts-reactquery-graphqlrequest/src/components/BooksByAuthorList.tsx:
--------------------------------------------------------------------------------
1 | // index.tsx
2 | import { FC } from 'react';
3 | import { GetBooksByAuthorQuery, useGetBooksByAuthorQuery } from '@src/generated/graphql';
4 | import graphqlRequestClient from '@src/lib/clients/graphqlRequestClient';
5 |
6 | interface BooksByAuthorListProps {
7 | authorId: string;
8 | }
9 |
10 | const BooksByAuthorList: FC = ({ authorId }: BooksByAuthorListProps) => {
11 | const { isLoading, error, data } = useGetBooksByAuthorQuery(graphqlRequestClient, {
12 | // eslint-disable-next-line radix
13 | authorId: parseInt(authorId),
14 | });
15 |
16 | if (isLoading) return Loading...
;
17 | if (error) return Boom boy{error.message}
;
18 |
19 | return (
20 | <>
21 | {data?.booksByAuthor?.map((book) => {
22 | return (
23 |
24 |
BookTitle: {book?.title}
25 |
BookId: {book?.bookId}
26 |
27 | );
28 | })}
29 | >
30 | );
31 | };
32 |
33 | export default BooksByAuthorList;
34 |
--------------------------------------------------------------------------------
/templates/gql-ts-prisma-codegen-apolloserver/src/graphql/schema/resolvers/mutation/createBookMutation.ts:
--------------------------------------------------------------------------------
1 | /* eslint-disable @typescript-eslint/no-explicit-any */
2 | import { GraphQLFieldConfig, GraphQLFieldResolver } from 'graphql';
3 | import { Book } from '@prisma/client';
4 | import { IApolloServerContext } from '@src/lib/interfaces/IApolloServerContext';
5 | import { createBook } from '@src/data/bookService';
6 | import BookType from '@src/graphql/schema/typedefs/BookType';
7 | import CreateBookInput from '@src/graphql/schema/typedefs/CreateBookInput';
8 |
9 | export const createBookMutationResolver: GraphQLFieldResolver<
10 | unknown,
11 | IApolloServerContext
12 | > = async (
13 | _source,
14 | { input: { title, authorId } },
15 | _context,
16 | _info
17 | ): Promise => {
18 | return createBook(title, authorId);
19 | };
20 |
21 | const createBookMutation: GraphQLFieldConfig = {
22 | description: 'Create book',
23 | type: BookType,
24 | args: {
25 | input: {
26 | type: CreateBookInput,
27 | },
28 | },
29 | resolve: createBookMutationResolver,
30 | };
31 |
32 | export default createBookMutation;
33 |
--------------------------------------------------------------------------------
/templates/node-ts-backend/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2021 Leonardo Roese
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/templates/nextjs-ts-reactquery/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2021 Leonardo Roese
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/templates/gql-ts-prisma-codegen-apolloserver/src/graphql/generated/schema.graphql:
--------------------------------------------------------------------------------
1 | type Query {
2 | """Get all books query"""
3 | books: [Book]
4 |
5 | """Get all authors query"""
6 | authors: [Author]
7 | }
8 |
9 | """A book"""
10 | type Book {
11 | """id of the book"""
12 | bookId: ID!
13 |
14 | """title of book"""
15 | title: String
16 |
17 | """author of book"""
18 | author: Author
19 |
20 | """id of the author"""
21 | authorId: Int
22 | }
23 |
24 | """A author"""
25 | type Author {
26 | """id of the author"""
27 | authorId: ID!
28 |
29 | """authors username"""
30 | username: String
31 |
32 | """list of authors books"""
33 | books: [Book]
34 | }
35 |
36 | type Mutation {
37 | """Create book"""
38 | createBook(input: CreateBookInput): Book
39 |
40 | """create author"""
41 | createAuthor(input: CreateAuthorInput): Author
42 | }
43 |
44 | """Create book input"""
45 | input CreateBookInput {
46 | """The books title."""
47 | title: String!
48 |
49 | """The authors id."""
50 | authorId: Int!
51 | }
52 |
53 | """Create author input"""
54 | input CreateAuthorInput {
55 | """The authors username"""
56 | username: String!
57 | }
58 |
--------------------------------------------------------------------------------
/templates/nextjs-ts-reactquery-graphqlrequest/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2021 Leonardo Roese
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/templates/nextjs-ts-materialUI/pages/_app.tsx:
--------------------------------------------------------------------------------
1 | // pages/_app.tsx
2 | /* eslint-disable react/jsx-props-no-spreading */
3 | import { FC, useEffect } from 'react';
4 | import CssBaseline from '@material-ui/core/CssBaseline';
5 | import { ThemeProvider } from '@material-ui/core/styles';
6 | import { AppProps } from 'next/app';
7 | import Head from 'next/head';
8 | import theme from '@styles/theme';
9 |
10 | const MyApp: FC = ({ Component, pageProps }: AppProps) => {
11 | useEffect(() => {
12 | // Remove the server-side injected CSS.
13 | const jssStyles = document.querySelector('#jss-server-side');
14 | if (jssStyles) {
15 | jssStyles?.parentElement?.removeChild(jssStyles);
16 | }
17 | }, []);
18 |
19 | return (
20 | <>
21 |
22 | My App
23 |
24 |
25 |
26 | {/* CssBaseline kickstart an elegant, consistent, and simple baseline to build upon. */}
27 |
28 |
29 |
30 | >
31 | );
32 | };
33 |
34 | export default MyApp;
35 |
--------------------------------------------------------------------------------
/templates/node-ts-backend/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "baseUrl": ".",
4 | "target": "es6", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
5 | "module": "commonjs", /* Specify what module code is generated. */
6 | "outDir": "dist", /* Specify an output folder for all emitted files. */
7 | "removeComments": true, /* Disable emitting comments. */
8 | "esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables `allowSyntheticDefaultImports` for type compatibility. */
9 | "forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */
10 | "strict": true, /* Enable all strict type-checking options. */
11 | "skipLibCheck": true, /* Skip type checking all .d.ts files. */
12 | },
13 | "include": ["src/**/*.ts"],
14 | "exclude": ["node_modules", "dist", "__tests__", "coverage"]
15 | }
16 |
--------------------------------------------------------------------------------
/templates/nextjs-ts-materialui-reacthookform/pages/_app.tsx:
--------------------------------------------------------------------------------
1 | // pages/_app.tsx
2 | /* eslint-disable react/jsx-props-no-spreading */
3 | import { FC, useEffect } from 'react';
4 | import CssBaseline from '@material-ui/core/CssBaseline';
5 | import { ThemeProvider } from '@material-ui/core/styles';
6 | import { AppProps } from 'next/app';
7 | import Head from 'next/head';
8 | import theme from '@styles/theme';
9 |
10 | const MyApp: FC = ({ Component, pageProps }: AppProps) => {
11 | useEffect(() => {
12 | // Remove the server-side injected CSS.
13 | const jssStyles = document.querySelector('#jss-server-side');
14 | if (jssStyles) {
15 | jssStyles?.parentElement?.removeChild(jssStyles);
16 | }
17 | }, []);
18 |
19 | return (
20 | <>
21 |
22 | My App
23 |
24 |
25 |
26 | {/* CssBaseline kickstart an elegant, consistent, and simple baseline to build upon. */}
27 |
28 |
29 |
30 | >
31 | );
32 | };
33 |
34 | export default MyApp;
35 |
--------------------------------------------------------------------------------
/templates/nextjs-ts-reactquery-graphqlrequest/pages/graphqlmutation.tsx:
--------------------------------------------------------------------------------
1 | /* eslint-disable @typescript-eslint/no-unused-vars */
2 | /* eslint-disable no-unused-vars */
3 | // index.tsx
4 | import { FC } from 'react';
5 | import { useQueryClient } from 'react-query';
6 | import AuthorsList from '@src/components/AuthorsList';
7 | import BooksByAuthorList from '@src/components/BooksByAuthorList';
8 | import { CreateAuthorMutation, CreateAuthorMutationVariables, useCreateAuthorMutation } from '@src/generated/graphql';
9 | import graphqlRequestClient from '@src/lib/clients/graphqlRequestClient';
10 |
11 | const GraphqlMutation: FC = () => {
12 | const queryClient = useQueryClient();
13 | const { mutate } = useCreateAuthorMutation(graphqlRequestClient, {
14 | onSuccess: (data: CreateAuthorMutation, _variables: CreateAuthorMutationVariables, _context: unknown) => {
15 | queryClient.invalidateQueries('GetAllAuthors');
16 | return console.log('mutation data', data);
17 | },
18 | });
19 |
20 | return (
21 | <>
22 |
25 |
26 | >
27 | );
28 | };
29 |
30 | export default GraphqlMutation;
31 |
--------------------------------------------------------------------------------
/index.js:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env node
2 |
3 | import inquirer from 'inquirer';
4 | import * as fs from 'fs';
5 | import { dirname } from 'path';
6 | import { fileURLToPath } from 'url';
7 | import createDirectoryContents from './createDirectoryContents.js';
8 | const CURR_DIR = process.cwd();
9 | const __dirname = dirname(fileURLToPath(import.meta.url));
10 |
11 | const CHOICES = fs.readdirSync(`${__dirname}/templates`);
12 |
13 | const QUESTIONS = [
14 | {
15 | name: 'project-choice',
16 | type: 'list',
17 | message: 'What project template would you like to generate?',
18 | choices: CHOICES,
19 | },
20 | {
21 | name: 'project-name',
22 | type: 'input',
23 | message: 'Project name:',
24 | validate: function (input) {
25 | if (/^([A-Za-z\-\\_\d])+$/.test(input)) return true;
26 | else return 'Project name may only include letters, numbers, underscores and hashes.';
27 | },
28 | },
29 | ];
30 |
31 | inquirer.prompt(QUESTIONS).then(answers => {
32 | const projectChoice = answers['project-choice'];
33 | const projectName = answers['project-name'];
34 | const templatePath = `${__dirname}/templates/${projectChoice}`;
35 |
36 | fs.mkdirSync(`${CURR_DIR}/${projectName}`);
37 |
38 | createDirectoryContents(templatePath, projectName);
39 | });
40 |
--------------------------------------------------------------------------------
/templates/nextjs-ts-reactquery/pages/ssr/initialData.tsx:
--------------------------------------------------------------------------------
1 | import React, { FC } from 'react';
2 | import { GetServerSideProps } from 'next';
3 | import { UseQueryResult, useQuery } from 'react-query';
4 | import { fetchPerson } from '@pages/person';
5 | import { IPerson } from '@src/lib/interfaces/IPerson';
6 |
7 | interface InitialDataExamplePageProps {
8 | person: IPerson;
9 | }
10 |
11 | const InitialDataExamplePage: FC = ({ person }: InitialDataExamplePageProps) => {
12 | const { isLoading, isError, error, data }: UseQueryResult = useQuery(
13 | 'person',
14 | fetchPerson,
15 | { initialData: person }
16 | );
17 |
18 | if (isLoading) {
19 | return (
20 |
23 | );
24 | }
25 | if (isError) return Boom boy: Error is -- {error?.message}
;
26 |
27 | return (
28 | <>
29 | Person
30 | {data?.id}
31 | {data?.name}
32 | {data?.age}
33 | >
34 | );
35 | };
36 |
37 | export const getServerSideProps: GetServerSideProps = async (): Promise<{ props: { person: IPerson } }> => {
38 | const person = await fetchPerson();
39 | return { props: { person } };
40 | };
41 |
42 | export default InitialDataExamplePage;
43 |
--------------------------------------------------------------------------------
/templates/nextjs-ts-reactquery/pages/ssr/hydration.tsx:
--------------------------------------------------------------------------------
1 | import React, { FC } from 'react';
2 | import { GetServerSideProps } from 'next';
3 | import { UseQueryResult, useQuery, QueryClient } from 'react-query';
4 | import { dehydrate, DehydratedState } from 'react-query/hydration';
5 | import { fetchPerson } from '@pages/person';
6 | import { IPerson } from '@src/lib/interfaces/IPerson';
7 |
8 | const HydrationExamplePage: FC = () => {
9 | const { isLoading, isError, error, data }: UseQueryResult = useQuery(
10 | 'person',
11 | fetchPerson
12 | );
13 |
14 | if (isLoading) {
15 | return (
16 |
19 | );
20 | }
21 | if (isError) return Boom boy: Error is -- {error?.message}
;
22 |
23 | return (
24 | <>
25 | Person
26 | {data?.id}
27 | {data?.name}
28 | {data?.age}
29 | >
30 | );
31 | };
32 |
33 | export const getServerSideProps: GetServerSideProps = async (): Promise<{
34 | props: { dehydratedState: DehydratedState };
35 | }> => {
36 | const queryClient = new QueryClient();
37 | await queryClient.prefetchQuery('person', fetchPerson);
38 | return { props: { dehydratedState: dehydrate(queryClient) } };
39 | };
40 |
41 | export default HydrationExamplePage;
42 |
--------------------------------------------------------------------------------
/templates/gql-ts-prisma-codegen-apolloserver/src/codegen.ts:
--------------------------------------------------------------------------------
1 | import * as fs from 'fs';
2 | import * as schemaAstPlugin from '@graphql-codegen/schema-ast';
3 | import { parse, printSchema } from 'graphql';
4 | import { Types } from '@graphql-codegen/plugin-helpers';
5 | import { codegen } from '@graphql-codegen/core';
6 | import path from 'path';
7 | import schema from '@src/graphql/schema/schema';
8 | import prismaContext from '@src/lib/prisma/prismaContext';
9 |
10 | async function performCodegen(options: Types.GenerateOptions): Promise {
11 | const output = await codegen(options);
12 | fs.writeFile(
13 | path.join(__dirname, '/graphql/generated/', options.filename),
14 | output,
15 | () => {
16 | console.log('Outputs generated!');
17 | }
18 | );
19 | }
20 |
21 | // eslint-disable-next-line import/prefer-default-export
22 | export async function performAstCodegen(): Promise {
23 | const options: Types.GenerateOptions = {
24 | config: {
25 | numericEnums: true,
26 | contextType: prismaContext,
27 | useIndexSignature: true,
28 | },
29 | documents: [],
30 | filename: 'schema.graphql',
31 | schema: parse(printSchema(schema)),
32 | plugins: [{ 'schema-ast': {} }],
33 | pluginMap: {
34 | 'schema-ast': schemaAstPlugin,
35 | },
36 | };
37 | performCodegen(options);
38 | }
39 |
--------------------------------------------------------------------------------
/templates/gql-ts-prisma-codegen-apolloserver/src/graphql/schema/resolvers/resolvers.ts:
--------------------------------------------------------------------------------
1 | import { GraphQLResolverMap } from 'apollo-graphql';
2 | import { Author, Book } from '@prisma/client';
3 | import { getAuthorById } from '@src/data/authorService';
4 | import { getBooksByAuthor } from '@src/data/bookService';
5 | import { IApolloServerContext } from '@src/lib/interfaces/IApolloServerContext';
6 | import mutation from '@src/graphql/schema/resolvers/mutation/mutation';
7 | import query from '@src/graphql/schema/resolvers/query/query';
8 |
9 | const resolvers: GraphQLResolverMap = {
10 | Query: query,
11 | Mutation: mutation,
12 | Book: {
13 | author(book: Book): Promise {
14 | return getAuthorById(book.authorId);
15 | },
16 | },
17 | Author: {
18 | books(author: Author): Promise {
19 | return getBooksByAuthor(author.authorId);
20 | },
21 | },
22 | // User: {
23 | // // eslint-disable-next-line no-underscore-dangle
24 | // __resolveReference(book, _args, context: IApolloServerContext) {
25 | // console.log('calling resolveRefearance');
26 | // return context.prismaContext.prisma.user.findUnique({
27 | // where: {
28 | // id: book.userId,
29 | // },
30 | // });
31 | // },
32 | // },
33 | };
34 |
35 | export default resolvers;
36 |
--------------------------------------------------------------------------------
/templates/nextjs-ts-reactquery/pages/api/todo/infinite/[cursor].ts:
--------------------------------------------------------------------------------
1 | import { NextApiRequest, NextApiResponse } from 'next';
2 | import { IInfinitePage } from '@src/lib/interfaces/IInfinitePage';
3 | import { ITodo } from '@src/lib/interfaces/ITodo';
4 |
5 | export default (
6 | req: NextApiRequest,
7 | res: NextApiResponse<{ page: { todos: ITodo[]; hasMore: boolean } } | Error>
8 | ): void => {
9 | const {
10 | query: { cursor },
11 | } = req;
12 |
13 | if (typeof cursor === 'string') {
14 | console.log(`getting infinite page cursor: ${cursor}`);
15 | const returnTodos: ITodo[] = [];
16 | // eslint-disable-next-line radix
17 | const numberCursor = parseInt(cursor);
18 | // eslint-disable-next-line radix
19 | const nums = numberCursor * 5;
20 | for (let i = nums; i < nums + 5; i += 1) {
21 | const returnTodo: ITodo = {
22 | id: i,
23 | message: `Todo number: ${i}`,
24 | };
25 | returnTodos.push(returnTodo);
26 | }
27 |
28 | const testPage: IInfinitePage = {
29 | nextCursor: numberCursor + 1 < 4 ? numberCursor + 1 : undefined,
30 | page: {
31 | todos: returnTodos,
32 | hasMore: cursor !== '4',
33 | },
34 | };
35 |
36 | res.status(200).json(testPage);
37 | } else {
38 | res.status(500).json(new Error('id is not of correct type'));
39 | }
40 | };
41 |
--------------------------------------------------------------------------------
/templates/nextjs-ts-reactquery/pages/todo/infinite.tsx:
--------------------------------------------------------------------------------
1 | /* eslint-disable no-nested-ternary */
2 | /* eslint-disable import/no-cycle */
3 | // index.tsx
4 | import React, { FC } from 'react';
5 | import { useInfiniteQuery } from 'react-query';
6 | import { IInfinitePage } from '@src/lib/interfaces/IInfinitePage';
7 |
8 | const fetchTodos = ({ pageParam = 0 }) => fetch(`/api/todo/infinite/${pageParam}`).then((res) => res.json());
9 |
10 | const PaginatedTodoPage: FC = () => {
11 | const { data, hasNextPage, fetchNextPage, isFetchingNextPage } = useInfiniteQuery(
12 | 'infinite',
13 | fetchTodos,
14 | {
15 | getNextPageParam: (lastPage) => lastPage.nextCursor,
16 | }
17 | );
18 |
19 | return (
20 | <>
21 | {data?.pages.map((infinitePage, i) => {
22 | return (
23 | // eslint-disable-next-line react/no-array-index-key
24 |
25 | {infinitePage.page.todos.map((todo) => (
26 | {todo.message}
27 | ))}
28 |
29 | );
30 | })}
31 |
32 |
35 | >
36 | );
37 | };
38 |
39 | export default PaginatedTodoPage;
40 |
--------------------------------------------------------------------------------
/templates/gql-ts-serverless/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "payments-service",
3 | "version": "1.0.0",
4 | "description": "Payments service with stripe",
5 | "main": "index.js",
6 | "repository": "https://github.com/leoroese/blog-tube",
7 | "author": "Leonardo Roese",
8 | "license": "MIT",
9 | "scripts": {
10 | "dev": "serverless offline start",
11 | "deploy": "",
12 | "test": "jest",
13 | "test:watch": "jest --watch",
14 | "test:coverage": "jest --coverage"
15 | },
16 | "devDependencies": {
17 | "@types/dotenv-safe": "^8.1.1",
18 | "@types/jest": "^26.0.20",
19 | "@types/node": "^14.14.33",
20 | "@typescript-eslint/eslint-plugin": "^4.17.0",
21 | "@typescript-eslint/parser": "^4.17.0",
22 | "eslint": "^7.21.0",
23 | "eslint-config-airbnb-base": "^14.2.1",
24 | "eslint-config-prettier": "^8.1.0",
25 | "eslint-import-resolver-typescript": "^2.4.0",
26 | "eslint-plugin-import": "^2.22.1",
27 | "eslint-plugin-prettier": "^3.3.1",
28 | "jest": "^26.6.3",
29 | "prettier": "^2.2.1",
30 | "serverless-dotenv-plugin": "^3.9.0",
31 | "serverless-offline": "^6.9.0",
32 | "serverless-webpack": "^5.4.1",
33 | "ts-jest": "^26.5.3",
34 | "ts-loader": "^8.1.0",
35 | "ts-node": "^9.1.1",
36 | "typescript": "^4.2.3",
37 | "webpack": "^5.32.0",
38 | "webpack-node-externals": "^2.5.2"
39 | },
40 | "dependencies": {
41 | "apollo-server-lambda": "^2.22.2",
42 | "graphql": "^15.5.0",
43 | "serverless": "^2.35.0"
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/templates/aws-ts-serverless/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "aws-ts-serverless",
3 | "version": "1.0.0",
4 | "description": "AWS Serverless setup with Typescript Functions",
5 | "main": "index.js",
6 | "repository": "https://github.com/leoroese/blog-tube",
7 | "author": "Leonardo Roese",
8 | "license": "MIT",
9 | "scripts": {
10 | "dev": "sls offline -s dev",
11 | "test": "jest",
12 | "test:watch": "jest --watch",
13 | "test:coverage": "jest --coverage"
14 | },
15 | "devDependencies": {
16 | "@types/aws-lambda": "^8.10.80",
17 | "@types/dotenv-safe": "^8.1.2",
18 | "@types/jest": "^26.0.24",
19 | "@types/node": "^16.4.1",
20 | "@types/serverless": "^1.78.32",
21 | "@typescript-eslint/eslint-plugin": "^4.28.4",
22 | "@typescript-eslint/parser": "^4.28.4",
23 | "eslint": "^7.31.0",
24 | "eslint-config-airbnb-base": "^14.2.1",
25 | "eslint-config-prettier": "^8.3.0",
26 | "eslint-import-resolver-typescript": "^2.4.0",
27 | "eslint-plugin-import": "^2.23.4",
28 | "eslint-plugin-prettier": "^3.4.0",
29 | "jest": "^27.0.6",
30 | "nodemon": "^2.0.12",
31 | "prettier": "^2.3.2",
32 | "serverless": "^2.52.1",
33 | "serverless-offline": "^7.0.0",
34 | "serverless-plugin-typescript": "^1.1.9",
35 | "ts-jest": "^27.0.4",
36 | "ts-node": "^10.1.0",
37 | "tsconfig-paths": "^3.10.1",
38 | "typescript": "^4.3.5"
39 | },
40 | "dependencies": {
41 | "aws-lambda": "^1.0.6",
42 | "cross-env": "^7.0.3",
43 | "dotenv-safe": "^8.2.0"
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/templates/gql-ts-prisma-codegen-apolloserver/src/__tests__/integration/graphql/schema/resolvers/mutation/createBookMutation.int.test.ts:
--------------------------------------------------------------------------------
1 | /* eslint-disable no-underscore-dangle */
2 | import { ApolloServer, gql } from 'apollo-server';
3 | import apolloServerConfig from '@src/lib/config/apolloServerConfig';
4 | import { CreateBookInput } from '@src/graphql/generated/graphql';
5 | import prismaContext from '@src/lib/prisma/prismaContext';
6 |
7 | const CREATE_BOOK_MUTATION = gql`
8 | mutation CreateBook($input: CreateBookInput!) {
9 | createBook(input: $input) {
10 | __typename
11 | bookId
12 | title
13 | author
14 | }
15 | }
16 | `;
17 |
18 | describe('tests', () => {
19 | let server: ApolloServer;
20 | const typename = 'Book';
21 |
22 | beforeAll(() => {
23 | server = new ApolloServer(apolloServerConfig);
24 | });
25 |
26 | afterAll(async () => {
27 | prismaContext.prisma.book.deleteMany();
28 | await prismaContext.prisma.$disconnect();
29 | });
30 |
31 | it('should pass', async () => {
32 | const mockBook: CreateBookInput = {
33 | title: 'dumb title',
34 | author: 'smart author',
35 | };
36 |
37 | const result = await server.executeOperation({
38 | query: CREATE_BOOK_MUTATION,
39 | variables: { input: mockBook },
40 | });
41 |
42 | expect(result.data).toBeDefined();
43 | expect(result?.data?.createBook).toBeDefined();
44 | const createdBook = result?.data?.createBook;
45 | expect(createdBook.__typename).toBe(typename);
46 | expect(createdBook.bookId).toBeDefined();
47 | expect(createdBook.title).toBe(mockBook.title);
48 | expect(createdBook.author).toBe(mockBook.author);
49 | });
50 | });
51 |
--------------------------------------------------------------------------------
/templates/nextjs-ts-frontend/README.md:
--------------------------------------------------------------------------------
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.js`. 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.js`.
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.
35 |
--------------------------------------------------------------------------------
/templates/nextjs-ts-reactquery/README.md:
--------------------------------------------------------------------------------
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.js`. 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.js`.
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.
35 |
--------------------------------------------------------------------------------
/templates/node-ts-backend/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "node-typescript-backend",
3 | "version": "1.0.0",
4 | "description": "Backend Node.js with Typescript",
5 | "main": "index.ts",
6 | "scripts": {
7 | "dev": "nodemon src/index.ts",
8 | "test": "jest",
9 | "test:unit": "jest unit",
10 | "test:int": "jest int",
11 | "test:coverage": "jest --coverage",
12 | "prepare": "husky install"
13 | },
14 | "keywords": [
15 | "Typescript",
16 | "Node"
17 | ],
18 | "author": "Leonardo Roese",
19 | "license": "MIT",
20 | "devDependencies": {
21 | "@types/dotenv-safe": "^8.1.2",
22 | "@types/jest": "^27.0.1",
23 | "@types/node": "^16.7.9",
24 | "@typescript-eslint/eslint-plugin": "^4.30.0",
25 | "@typescript-eslint/parser": "^4.30.0",
26 | "commitizen": "^4.2.4",
27 | "cz-conventional-changelog": "^3.3.0",
28 | "eslint": "^7.32.0",
29 | "eslint-config-airbnb-base": "^14.2.1",
30 | "eslint-config-airbnb-typescript": "^14.0.0",
31 | "eslint-config-prettier": "^8.3.0",
32 | "eslint-plugin-eslint-comments": "^3.2.0",
33 | "eslint-plugin-import": "^2.24.2",
34 | "eslint-plugin-jest": "^24.4.0",
35 | "eslint-plugin-prettier": "^4.0.0",
36 | "eslint-plugin-promise": "^5.1.0",
37 | "husky": "^7.0.2",
38 | "jest": "^27.1.0",
39 | "lint-staged": "^11.1.2",
40 | "nodemon": "^2.0.12",
41 | "prettier": "^2.3.2",
42 | "ts-jest": "^27.0.5",
43 | "ts-node": "^10.2.1",
44 | "typescript": "^4.4.2"
45 | },
46 | "dependencies": {
47 | "dotenv-safe": "^8.2.0",
48 | "express-session": "^1.17.2"
49 | },
50 | "config": {
51 | "commitizen": {
52 | "path": "./node_modules/cz-conventional-changelog"
53 | }
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/templates/nextjs-ts-reactquery-graphqlrequest/README.md:
--------------------------------------------------------------------------------
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.js`. 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.js`.
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.
35 |
--------------------------------------------------------------------------------
/templates/nextjs-ts-reactquery/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "reactquery-ts-tutorial",
3 | "version": "0.1.0",
4 | "private": true,
5 | "scripts": {
6 | "dev": "cross-env NODE_OPTIONS='--inspect' next dev",
7 | "build": "next build",
8 | "start": "next start",
9 | "test": "jest",
10 | "test:watch": "jest --watch",
11 | "test:coverage": "jest --coverage"
12 | },
13 | "dependencies": {
14 | "cross-env": "^7.0.3",
15 | "next": "11.0.1",
16 | "react": "17.0.2",
17 | "react-dom": "17.0.2",
18 | "react-query": "^3.19.0"
19 | },
20 | "devDependencies": {
21 | "@testing-library/dom": "^8.1.0",
22 | "@testing-library/jest-dom": "^5.14.1",
23 | "@testing-library/react": "^12.0.0",
24 | "@testing-library/user-event": "^13.2.0",
25 | "@types/jest": "^26.0.24",
26 | "@types/node": "^16.4.1",
27 | "@types/react": "^17.0.14",
28 | "@types/react-dom": "^17.0.9",
29 | "@typescript-eslint/eslint-plugin": "^4.28.4",
30 | "@typescript-eslint/parser": "^4.28.4",
31 | "axe-core": "^4.3.1",
32 | "eslint": "^7.31.0",
33 | "eslint-config-airbnb": "^18.2.1",
34 | "eslint-config-prettier": "^8.3.0",
35 | "eslint-import-resolver-typescript": "^2.4.0",
36 | "eslint-plugin-import": "^2.23.4",
37 | "eslint-plugin-jest-dom": "^3.9.0",
38 | "eslint-plugin-jsx-a11y": "^6.4.1",
39 | "eslint-plugin-prettier": "^3.4.0",
40 | "eslint-plugin-react": "^7.24.0",
41 | "eslint-plugin-react-hooks": "^4.2.0",
42 | "eslint-plugin-testing-library": "^4.10.1",
43 | "jest": "^27.0.6",
44 | "jest-environment-jsdom": "^27.0.6",
45 | "prettier": "^2.3.2",
46 | "ts-jest": "^27.0.4",
47 | "ts-node": "^10.1.0",
48 | "typescript": "^4.3.5"
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/templates/gql-ts-serverless/.eslintrc.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | env: {
3 | es2021: true,
4 | node: true,
5 | jest: true,
6 | },
7 | extends: [
8 | 'eslint:recommended',
9 | 'plugin:@typescript-eslint/recommended',
10 | 'airbnb-base',
11 | 'plugin:prettier/recommended',
12 | 'plugin:import/errors',
13 | 'plugin:import/warnings',
14 | 'plugin:import/typescript',
15 | ],
16 | parser: '@typescript-eslint/parser',
17 | parserOptions: {
18 | ecmaVersion: 12,
19 | sourceType: 'module',
20 | },
21 | plugins: ['@typescript-eslint', 'prettier', 'import'],
22 | rules: {
23 | 'prettier/prettier': 'error',
24 | 'import/extensions': 'off',
25 | 'import/no-unresolved': 'error',
26 | 'no-console': 'off',
27 | 'no-unused-vars': ['off', { args: 'all', argsIgnorePattern: '^_' }],
28 | '@typescript-eslint/no-unused-vars': ['off', { args: 'all', argsIgnorePattern: '^_' }],
29 | 'import/order': [
30 | 'error',
31 | {
32 | 'newlines-between': 'never',
33 | groups: [
34 | ['builtin', 'external'],
35 | ['internal', 'parent', 'sibling', 'index'],
36 | ],
37 | },
38 | ],
39 | },
40 | settings: {
41 | 'import/parsers': {
42 | '@typescript-eslint/parser': ['.ts'],
43 | },
44 | 'import/resolver': {
45 | typescript: {
46 | alwaysTryTypes: true, // always try to resolve types under `@types` directory even it doesn't contain any source code, like `@types/unist`
47 |
48 | // Choose from one of the "project" configs below or omit to use /tsconfig.json by default
49 |
50 | // use /path/to/folder/tsconfig.json
51 | project: './tsconfig.json',
52 | },
53 | },
54 | },
55 | };
56 |
--------------------------------------------------------------------------------
/templates/gql-ts-prisma-codegen-apolloserver/.eslintrc.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | env: {
3 | es2021: true,
4 | node: true,
5 | jest: true,
6 | },
7 | extends: [
8 | 'eslint:recommended',
9 | 'plugin:@typescript-eslint/recommended',
10 | 'airbnb-base',
11 | 'plugin:prettier/recommended',
12 | 'plugin:import/errors',
13 | 'plugin:import/warnings',
14 | 'plugin:import/typescript',
15 | ],
16 | parser: '@typescript-eslint/parser',
17 | parserOptions: {
18 | ecmaVersion: 12,
19 | sourceType: 'module',
20 | },
21 | plugins: ['@typescript-eslint', 'prettier', 'import'],
22 | rules: {
23 | 'prettier/prettier': 'error',
24 | 'import/extensions': 'off',
25 | 'import/no-unresolved': 'error',
26 | 'no-console': 'off',
27 | 'no-unused-vars': ['off', { args: 'all', argsIgnorePattern: '^_' }],
28 | '@typescript-eslint/no-unused-vars': ['off', { args: 'all', argsIgnorePattern: '^_' }],
29 | 'import/order': [
30 | 'error',
31 | {
32 | 'newlines-between': 'never',
33 | groups: [
34 | ['builtin', 'external'],
35 | ['internal', 'parent', 'sibling', 'index'],
36 | ],
37 | },
38 | ],
39 | },
40 | settings: {
41 | 'import/parsers': {
42 | '@typescript-eslint/parser': ['.ts'],
43 | },
44 | 'import/resolver': {
45 | typescript: {
46 | alwaysTryTypes: true, // always try to resolve types under `@types` directory even it doesn't contain any source code, like `@types/unist`
47 |
48 | // Choose from one of the "project" configs below or omit to use /tsconfig.json by default
49 |
50 | // use /path/to/folder/tsconfig.json
51 | project: './tsconfig.json',
52 | },
53 | },
54 | },
55 | };
56 |
--------------------------------------------------------------------------------
/templates/node-ts-backend/.eslintrc.json:
--------------------------------------------------------------------------------
1 | {
2 | "env": {
3 | "es2021": true,
4 | "node": true,
5 | "jest": true
6 | },
7 | "extends": [
8 | "airbnb-base",
9 | "airbnb-typescript/base",
10 | "plugin:@typescript-eslint/recommended",
11 | "plugin:eslint-comments/recommended",
12 | "plugin:jest/recommended",
13 | "plugin:promise/recommended",
14 | "prettier"
15 | ],
16 | "parser": "@typescript-eslint/parser",
17 | "parserOptions": {
18 | "project": "./tsconfig.eslint.json"
19 | },
20 | "plugins": [
21 | "@typescript-eslint",
22 | "eslint-comments",
23 | "jest",
24 | "promise",
25 | "import",
26 | "prettier"
27 | ],
28 | "rules": {
29 | "prettier/prettier": "error",
30 | "import/prefer-default-export": "off",
31 | "import/no-default-export": "error",
32 | "no-use-before-define": [
33 | "error",
34 | {
35 | "functions": false,
36 | "classes": true,
37 | "variables": true
38 | }
39 | ],
40 | "@typescript-eslint/explicit-function-return-type": "off",
41 | "@typescript-eslint/no-use-before-define": [
42 | "error",
43 | {
44 | "functions": false,
45 | "classes": true,
46 | "variables": true,
47 | "typedefs": true
48 | }
49 | ],
50 | "import/no-extraneous-dependencies": "off"
51 | },
52 | "settings": {
53 | "import/resolver": {
54 | "typescript": {
55 | "alwaysTryTypes": true,
56 | "project": "./tsconfig.json"
57 | }
58 | }
59 | }
60 | }
--------------------------------------------------------------------------------
/templates/aws-ts-serverless/.eslintrc.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | env: {
3 | es2021: true,
4 | node: true,
5 | jest: true,
6 | },
7 | extends: [
8 | 'eslint:recommended',
9 | 'plugin:@typescript-eslint/recommended',
10 | 'airbnb-base',
11 | 'plugin:prettier/recommended',
12 | 'plugin:import/errors',
13 | 'plugin:import/warnings',
14 | 'plugin:import/typescript',
15 | ],
16 | parser: '@typescript-eslint/parser',
17 | parserOptions: {
18 | ecmaVersion: 12,
19 | sourceType: 'module',
20 | },
21 | plugins: ['@typescript-eslint', 'prettier', 'import'],
22 | rules: {
23 | 'prettier/prettier': 'error',
24 | 'import/extensions': 'off',
25 | 'import/no-unresolved': 'error',
26 | 'no-console': 'off',
27 | 'no-unused-vars': ['off', { args: 'all', argsIgnorePattern: '^_' }],
28 | '@typescript-eslint/no-unused-vars': ['off', { args: 'all', argsIgnorePattern: '^_' }],
29 | 'import/prefer-default-export': 'off',
30 | 'import/order': [
31 | 'error',
32 | {
33 | 'newlines-between': 'never',
34 | groups: [
35 | ['builtin', 'external'],
36 | ['internal', 'parent', 'sibling', 'index'],
37 | ],
38 | },
39 | ],
40 | },
41 | settings: {
42 | 'import/parsers': {
43 | '@typescript-eslint/parser': ['.ts'],
44 | },
45 | 'import/resolver': {
46 | typescript: {
47 | alwaysTryTypes: true, // always try to resolve types under `@types` directory even it doesn't contain any source code, like `@types/unist`
48 |
49 | // Choose from one of the "project" configs below or omit to use /tsconfig.json by default
50 |
51 | // use /path/to/folder/tsconfig.json
52 | project: './tsconfig.json',
53 | },
54 | },
55 | },
56 | };
57 |
--------------------------------------------------------------------------------
/templates/nextjs-ts-materialUI/README.md:
--------------------------------------------------------------------------------
1 | [](http://commitizen.github.io/cz-cli/)
2 |
3 | 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).
4 |
5 | ## Getting Started
6 |
7 | First, run the development server:
8 |
9 | ```bash
10 | npm run dev
11 | # or
12 | yarn dev
13 | ```
14 |
15 | Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
16 |
17 | You can start editing the page by modifying `pages/index.js`. The page auto-updates as you edit the file.
18 |
19 | [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.js`.
20 |
21 | 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.
22 |
23 | ## Learn More
24 |
25 | To learn more about Next.js, take a look at the following resources:
26 |
27 | - [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
28 | - [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.
29 |
30 | You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions are welcome!
31 |
32 | ## Deploy on Vercel
33 |
34 | 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.
35 |
36 | Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details.
37 |
--------------------------------------------------------------------------------
/templates/nextjs-ts-materialui-reacthookform/README.md:
--------------------------------------------------------------------------------
1 | [](http://commitizen.github.io/cz-cli/)
2 |
3 | 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).
4 |
5 | ## Getting Started
6 |
7 | First, run the development server:
8 |
9 | ```bash
10 | npm run dev
11 | # or
12 | yarn dev
13 | ```
14 |
15 | Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
16 |
17 | You can start editing the page by modifying `pages/index.js`. The page auto-updates as you edit the file.
18 |
19 | [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.js`.
20 |
21 | 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.
22 |
23 | ## Learn More
24 |
25 | To learn more about Next.js, take a look at the following resources:
26 |
27 | - [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
28 | - [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.
29 |
30 | You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions are welcome!
31 |
32 | ## Deploy on Vercel
33 |
34 | 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.
35 |
36 | Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details.
37 |
--------------------------------------------------------------------------------
/templates/nextjs-ts-reactquery/pages/person/[id].tsx:
--------------------------------------------------------------------------------
1 | // index.tsx
2 | import React, { FC } from 'react';
3 | import { useRouter } from 'next/dist/client/router';
4 | import Link from 'next/link';
5 | import { useQuery } from 'react-query';
6 | import { IPerson } from '@src/lib/interfaces/IPerson';
7 |
8 | const getPersonById = async (id: string | string[] | undefined): Promise => {
9 | if (typeof id === 'string') {
10 | const res = await fetch(`/api/person/${id}`);
11 | if (res.ok) {
12 | return res.json();
13 | }
14 | throw new Error('error fetching user with id');
15 | }
16 | throw new Error('invalid id'); // need to throw because react-query functions need to have error thrown to know its in error state
17 | };
18 |
19 | const PersonPage: FC = () => {
20 | const {
21 | query: { id },
22 | } = useRouter();
23 |
24 | const { isLoading, isError, error, data } = useQuery(['person', id], () => getPersonById(id), {
25 | enabled: !!id, // enabled will stop a query from running, so will only call when id is available (dependent queries)
26 | });
27 |
28 | // Cached key would be ['person', ]
29 | // const name = 'Tlw';
30 | // const { isLoading, isError, error, data } = useQuery(['person', id, name], () => getPersonById(id, name), {
31 | // enabled: Boolean(id), // enabled will stop a query from running, so will only call when id is available
32 | // });
33 |
34 | if (isLoading) {
35 | return (
36 |
39 | );
40 | }
41 | if (isError) return Boom boy: Error is -- {error?.message}
;
42 | return (
43 | <>
44 |
45 | Home
46 |
47 | {data?.id}
48 | {data?.name}
49 | {data?.age}
50 | >
51 | );
52 | };
53 |
54 | export default PersonPage;
55 |
--------------------------------------------------------------------------------
/templates/nextjs-ts-frontend/.eslintrc.json:
--------------------------------------------------------------------------------
1 | {
2 | "env": {
3 | "browser": true,
4 | "es2021": true,
5 | "node": true,
6 | "jest": true
7 | },
8 | "extends": [
9 | "next",
10 | "next/core-web-vitals",
11 | "airbnb",
12 | "airbnb-typescript",
13 | "plugin:@typescript-eslint/recommended",
14 | "plugin:eslint-comments/recommended",
15 | "plugin:jest/recommended",
16 | "plugin:promise/recommended",
17 | "plugin:unicorn/recommended",
18 | "prettier" // Prettier must be last brodie.
19 | ],
20 | "parser": "@typescript-eslint/parser",
21 | "parserOptions": {
22 | "project": "./tsconfig.json"
23 | },
24 | "plugins": [
25 | "@typescript-eslint",
26 | "eslint-comments",
27 | "jest",
28 | "promise",
29 | "import",
30 | "unicorn",
31 | "prettier"
32 | ],
33 | "rules": {
34 | // I suggest you add at least those two rules:
35 | "prettier/prettier": "error",
36 | "@typescript-eslint/no-unused-vars": "error",
37 | "@typescript-eslint/explicit-module-boundary-types": "off",
38 | "@typescript-eslint/no-explicit-any": "error",
39 | "import/prefer-default-export": "off",
40 | "import/no-default-export": "off",
41 | "no-use-before-define": "off",
42 | "@typescript-eslint/explicit-function-return-type": "off",
43 | "@typescript-eslint/no-use-before-define": ["error"],
44 | "unicorn/prevent-abbreviations": "off",
45 | // Airbnb prefers forEach
46 | "unicorn/no-array-for-each": "off",
47 | // It's not accurate in the monorepo style
48 | "import/no-extraneous-dependencies": "off"
49 | },
50 | "settings": {
51 | "import/parsers": {
52 | "@typescript-eslint/parser": [".ts", ".tsx"]
53 | },
54 | "import/resolver": {
55 | "typescript": {
56 | "alwaysTryTypes": true,
57 | "project": "./tsconfig.json"
58 | }
59 | }
60 | }
61 | }
62 |
--------------------------------------------------------------------------------
/templates/nextjs-ts-reactquery-graphqlrequest/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "reactquery-ts-graphqlrequest-tutorial",
3 | "version": "0.1.0",
4 | "private": true,
5 | "scripts": {
6 | "dev": "cross-env NODE_OPTIONS='--inspect' next dev",
7 | "build": "next build",
8 | "start": "next start",
9 | "test": "jest",
10 | "test:watch": "jest --watch",
11 | "test:coverage": "jest --coverage",
12 | "generate": "graphql-codegen --config codegen.yml"
13 | },
14 | "dependencies": {
15 | "@graphql-codegen/cli": "^1.21.6",
16 | "@graphql-codegen/typescript": "^1.22.4",
17 | "@graphql-codegen/typescript-operations": "^1.18.3",
18 | "@graphql-codegen/typescript-react-query": "^1.3.4",
19 | "cross-env": "^7.0.3",
20 | "graphql": "^15.5.1",
21 | "graphql-request": "^3.4.0",
22 | "next": "11.0.1",
23 | "react": "17.0.2",
24 | "react-dom": "17.0.2",
25 | "react-query": "^3.18.1"
26 | },
27 | "devDependencies": {
28 | "@testing-library/dom": "^8.1.0",
29 | "@testing-library/jest-dom": "^5.14.1",
30 | "@testing-library/react": "^12.0.0",
31 | "@testing-library/user-event": "^13.2.0",
32 | "@types/jest": "^26.0.24",
33 | "@types/node": "^16.4.1",
34 | "@types/react": "^17.0.14",
35 | "@types/react-dom": "^17.0.9",
36 | "@typescript-eslint/eslint-plugin": "^4.28.4",
37 | "@typescript-eslint/parser": "^4.28.4",
38 | "axe-core": "^4.3.1",
39 | "eslint": "^7.31.0",
40 | "eslint-config-airbnb": "^18.2.1",
41 | "eslint-config-prettier": "^8.3.0",
42 | "eslint-import-resolver-typescript": "^2.4.0",
43 | "eslint-plugin-import": "^2.23.4",
44 | "eslint-plugin-jest-dom": "^3.9.0",
45 | "eslint-plugin-jsx-a11y": "^6.4.1",
46 | "eslint-plugin-prettier": "^3.4.0",
47 | "eslint-plugin-react": "^7.24.0",
48 | "eslint-plugin-react-hooks": "^4.2.0",
49 | "eslint-plugin-testing-library": "^4.10.1",
50 | "jest": "^27.0.6",
51 | "jest-environment-jsdom": "^27.0.6",
52 | "prettier": "^2.3.2",
53 | "ts-jest": "^27.0.4",
54 | "ts-node": "^10.1.0",
55 | "typescript": "^4.3.5"
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/templates/nextjs-ts-materialUI/pages/_document.tsx:
--------------------------------------------------------------------------------
1 | /* eslint-disable react/jsx-props-no-spreading */
2 | import React from 'react';
3 | import { ServerStyleSheets } from '@material-ui/core/styles';
4 | import Document, { Html, Head, Main, NextScript } from 'next/document';
5 |
6 | export default class MyDocument extends Document {
7 | // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
8 | render() {
9 | return (
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 | );
20 | }
21 | }
22 |
23 | // `getInitialProps` belongs to `_document` (instead of `_app`),
24 | // it's compatible with server-side generation (SSG).
25 | MyDocument.getInitialProps = async (ctx) => {
26 | // Resolution order
27 | //
28 | // On the server:
29 | // 1. app.getInitialProps
30 | // 2. page.getInitialProps
31 | // 3. document.getInitialProps
32 | // 4. app.render
33 | // 5. page.render
34 | // 6. document.render
35 | //
36 | // On the server with error:
37 | // 1. document.getInitialProps
38 | // 2. app.render
39 | // 3. page.render
40 | // 4. document.render
41 | //
42 | // On the client
43 | // 1. app.getInitialProps
44 | // 2. page.getInitialProps
45 | // 3. app.render
46 | // 4. page.render
47 |
48 | // Render app and page and get the context of the page with collected side effects.
49 | const sheets = new ServerStyleSheets();
50 | const originalRenderPage = ctx.renderPage;
51 |
52 | ctx.renderPage = () =>
53 | originalRenderPage({
54 | enhanceApp: (App) => (props) => sheets.collect(),
55 | });
56 |
57 | const initialProps = await Document.getInitialProps(ctx);
58 |
59 | return {
60 | ...initialProps,
61 | // Styles fragment is rendered after the app and page rendering finish.
62 | styles: [...React.Children.toArray(initialProps.styles), sheets.getStyleElement()],
63 | };
64 | };
65 |
--------------------------------------------------------------------------------
/templates/nextjs-ts-materialui-reacthookform/pages/_document.tsx:
--------------------------------------------------------------------------------
1 | /* eslint-disable react/jsx-props-no-spreading */
2 | import React from 'react';
3 | import { ServerStyleSheets } from '@material-ui/core/styles';
4 | import Document, { Html, Head, Main, NextScript } from 'next/document';
5 |
6 | export default class MyDocument extends Document {
7 | // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
8 | render() {
9 | return (
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 | );
20 | }
21 | }
22 |
23 | // `getInitialProps` belongs to `_document` (instead of `_app`),
24 | // it's compatible with server-side generation (SSG).
25 | MyDocument.getInitialProps = async (ctx) => {
26 | // Resolution order
27 | //
28 | // On the server:
29 | // 1. app.getInitialProps
30 | // 2. page.getInitialProps
31 | // 3. document.getInitialProps
32 | // 4. app.render
33 | // 5. page.render
34 | // 6. document.render
35 | //
36 | // On the server with error:
37 | // 1. document.getInitialProps
38 | // 2. app.render
39 | // 3. page.render
40 | // 4. document.render
41 | //
42 | // On the client
43 | // 1. app.getInitialProps
44 | // 2. page.getInitialProps
45 | // 3. app.render
46 | // 4. page.render
47 |
48 | // Render app and page and get the context of the page with collected side effects.
49 | const sheets = new ServerStyleSheets();
50 | const originalRenderPage = ctx.renderPage;
51 |
52 | ctx.renderPage = () =>
53 | originalRenderPage({
54 | enhanceApp: (App) => (props) => sheets.collect(),
55 | });
56 |
57 | const initialProps = await Document.getInitialProps(ctx);
58 |
59 | return {
60 | ...initialProps,
61 | // Styles fragment is rendered after the app and page rendering finish.
62 | styles: [...React.Children.toArray(initialProps.styles), sheets.getStyleElement()],
63 | };
64 | };
65 |
--------------------------------------------------------------------------------
/templates/nextjs-ts-frontend/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "nextjs-ts-frontend",
3 | "version": "0.1.0",
4 | "private": true,
5 | "keywords": [
6 | "Next",
7 | "Typescript"
8 | ],
9 | "author": "Leonardo Roese",
10 | "license": "MIT",
11 | "scripts": {
12 | "dev": "cross-env NODE_OPTIONS='--inspect' next dev",
13 | "build": "next build",
14 | "start": "next start",
15 | "test": "jest",
16 | "test:watch": "jest --watch",
17 | "test:coverage": "jest --coverage",
18 | "prepare": "husky install"
19 | },
20 | "dependencies": {
21 | "cross-env": "^7.0.3",
22 | "next": "11.1.2",
23 | "react": "17.0.2",
24 | "react-dom": "17.0.2"
25 | },
26 | "devDependencies": {
27 | "@testing-library/dom": "^8.2.0",
28 | "@testing-library/jest-dom": "^5.14.1",
29 | "@testing-library/react": "^12.0.0",
30 | "@testing-library/user-event": "^13.2.1",
31 | "@types/jest": "^27.0.1",
32 | "@types/node": "^16.7.10",
33 | "@types/react": "^17.0.20",
34 | "@types/react-dom": "^17.0.9",
35 | "@typescript-eslint/eslint-plugin": "^4.30.0",
36 | "@typescript-eslint/parser": "^4.30.0",
37 | "axe-core": "^4.3.3",
38 | "commitizen": "^4.2.4",
39 | "cz-conventional-changelog": "^3.3.0",
40 | "dotenv-safe": "^8.2.0",
41 | "eslint": "^7.32.0",
42 | "eslint-config-airbnb": "^18.2.1",
43 | "eslint-config-airbnb-typescript": "^14.0.0",
44 | "eslint-config-next": "^11.1.2",
45 | "eslint-config-prettier": "^8.3.0",
46 | "eslint-import-resolver-typescript": "^2.4.0",
47 | "eslint-plugin-eslint-comments": "^3.2.0",
48 | "eslint-plugin-import": "^2.24.2",
49 | "eslint-plugin-jest": "^24.4.0",
50 | "eslint-plugin-prettier": "^4.0.0",
51 | "eslint-plugin-promise": "^5.1.0",
52 | "eslint-plugin-unicorn": "^35.0.0",
53 | "husky": "^7.0.2",
54 | "jest": "^27.1.0",
55 | "jest-environment-jsdom": "^27.1.0",
56 | "lint-staged": "^11.1.2",
57 | "prettier": "^2.3.2",
58 | "ts-node": "^10.2.1",
59 | "typescript": "^4.4.2"
60 | },
61 | "config": {
62 | "commitizen": {
63 | "path": "./node_modules/cz-conventional-changelog"
64 | }
65 | }
66 | }
67 |
--------------------------------------------------------------------------------
/templates/node-ts-backend/.gitignore:
--------------------------------------------------------------------------------
1 | # Logs
2 | logs
3 | *.log
4 | npm-debug.log*
5 | yarn-debug.log*
6 | yarn-error.log*
7 | lerna-debug.log*
8 |
9 | # Diagnostic reports (https://nodejs.org/api/report.html)
10 | report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
11 |
12 | # Runtime data
13 | pids
14 | *.pid
15 | *.seed
16 | *.pid.lock
17 |
18 | # Directory for instrumented libs generated by jscoverage/JSCover
19 | lib-cov
20 |
21 | # Coverage directory used by tools like istanbul
22 | coverage
23 | *.lcov
24 |
25 | # nyc test coverage
26 | .nyc_output
27 |
28 | # Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
29 | .grunt
30 |
31 | # Bower dependency directory (https://bower.io/)
32 | bower_components
33 |
34 | # node-waf configuration
35 | .lock-wscript
36 |
37 | # Compiled binary addons (https://nodejs.org/api/addons.html)
38 | build/Release
39 |
40 | # Dependency directories
41 | node_modules/
42 | jspm_packages/
43 |
44 | # TypeScript v1 declaration files
45 | typings/
46 |
47 | # TypeScript cache
48 | *.tsbuildinfo
49 |
50 | # Optional npm cache directory
51 | .npm
52 |
53 | # Optional eslint cache
54 | .eslintcache
55 |
56 | # Microbundle cache
57 | .rpt2_cache/
58 | .rts2_cache_cjs/
59 | .rts2_cache_es/
60 | .rts2_cache_umd/
61 |
62 | # Optional REPL history
63 | .node_repl_history
64 |
65 | # Output of 'npm pack'
66 | *.tgz
67 |
68 | # Yarn Integrity file
69 | .yarn-integrity
70 |
71 | # dotenv environment variables file
72 | .env
73 | .env.test
74 |
75 | # parcel-bundler cache (https://parceljs.org/)
76 | .cache
77 |
78 | # Next.js build output
79 | .next
80 |
81 | # Nuxt.js build / generate output
82 | .nuxt
83 | dist
84 |
85 | # Gatsby files
86 | .cache/
87 | # Comment in the public line in if your project uses Gatsby and *not* Next.js
88 | # https://nextjs.org/blog/next-9-1#public-directory-support
89 | # public
90 |
91 | # vuepress build output
92 | .vuepress/dist
93 |
94 | # Serverless directories
95 | .serverless/
96 |
97 | # FuseBox cache
98 | .fusebox/
99 |
100 | # DynamoDB Local files
101 | .dynamodb/
102 |
103 | # TernJS port file
104 | .tern-port
105 |
--------------------------------------------------------------------------------
/templates/nextjs-ts-frontend/src/pages/index.tsx:
--------------------------------------------------------------------------------
1 | // index.tsx
2 | import React, { FC } from 'react';
3 | import Head from 'next/head';
4 | import styles from '@styles/Home.module.css';
5 |
6 | const Home: FC = () => (
7 |
8 |
9 |
Create Next App
10 |
11 |
12 |
13 |
14 |
15 | Welcome to Next.js!
16 |
17 |
18 |
19 | Get started by editing pages/index.js
20 |
21 |
22 |
46 |
47 |
48 |
57 |
58 | );
59 |
60 | export default Home;
61 |
--------------------------------------------------------------------------------
/templates/nextjs-ts-materialUI/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "next-ts-frontend",
3 | "version": "0.1.0",
4 | "private": true,
5 | "scripts": {
6 | "dev": "cross-env NODE_OPTIONS='--inspect' next dev",
7 | "build": "next build",
8 | "start": "next start",
9 | "test": "jest",
10 | "test:watch": "jest --watch",
11 | "test:coverage": "jest --coverage",
12 | "lint": "eslint .",
13 | "lint:fix": "eslint --fix .",
14 | "prepare": "husky install"
15 | },
16 | "dependencies": {
17 | "@material-ui/core": "^4.12.2",
18 | "@material-ui/icons": "^4.11.2",
19 | "@material-ui/lab": "^4.0.0-alpha.60",
20 | "cross-env": "^7.0.3",
21 | "next": "11.0.1",
22 | "react": "17.0.2",
23 | "react-dom": "17.0.2"
24 | },
25 | "devDependencies": {
26 | "@testing-library/dom": "^8.1.0",
27 | "@testing-library/jest-dom": "^5.14.1",
28 | "@testing-library/react": "^12.0.0",
29 | "@testing-library/user-event": "^13.2.0",
30 | "@types/jest": "^26.0.24",
31 | "@types/node": "^16.4.1",
32 | "@types/react": "^17.0.14",
33 | "@types/react-dom": "^17.0.9",
34 | "@typescript-eslint/eslint-plugin": "^4.28.4",
35 | "@typescript-eslint/parser": "^4.28.4",
36 | "axe-core": "^4.3.1",
37 | "babel-plugin-import": "^1.13.3",
38 | "commitizen": "^4.2.4",
39 | "cz-conventional-changelog": "3.3.0",
40 | "eslint": "^7.31.0",
41 | "eslint-config-airbnb": "^18.2.1",
42 | "eslint-config-prettier": "^8.3.0",
43 | "eslint-import-resolver-typescript": "^2.4.0",
44 | "eslint-plugin-import": "^2.23.4",
45 | "eslint-plugin-jest-dom": "^3.9.0",
46 | "eslint-plugin-jsx-a11y": "^6.4.1",
47 | "eslint-plugin-prettier": "^3.4.0",
48 | "eslint-plugin-react": "^7.24.0",
49 | "eslint-plugin-react-hooks": "^4.2.0",
50 | "eslint-plugin-testing-library": "^4.10.1",
51 | "husky": "^7.0.1",
52 | "jest": "^27.0.6",
53 | "jest-environment-jsdom": "^27.0.6",
54 | "lint-staged": "^11.1.0",
55 | "prettier": "^2.3.2",
56 | "ts-jest": "^27.0.4",
57 | "ts-node": "^10.1.0",
58 | "typescript": "^4.3.5"
59 | },
60 | "config": {
61 | "commitizen": {
62 | "path": "./node_modules/cz-conventional-changelog"
63 | }
64 | }
65 | }
66 |
--------------------------------------------------------------------------------
/templates/nextjs-ts-materialUI/pages/index.tsx:
--------------------------------------------------------------------------------
1 | // index.tsx
2 | import { FC } from 'react';
3 | import Head from 'next/head';
4 | import styles from '../styles/Home.module.css';
5 |
6 | const Home: FC = () => {
7 | return (
8 |
9 |
10 |
ReceitaClient
11 |
12 |
13 |
14 |
15 |
16 | Welcome to Next.js!
17 |
18 |
19 |
20 | Get started by editing pages/index.js
21 |
22 |
23 |
47 |
48 |
49 |
58 |
59 | );
60 | };
61 |
62 | export default Home;
63 |
--------------------------------------------------------------------------------
/templates/nextjs-ts-reactquery/pages/index.tsx:
--------------------------------------------------------------------------------
1 | // index.tsx
2 | import { FC } from 'react';
3 | import Head from 'next/head';
4 | import styles from '../styles/Home.module.css';
5 |
6 | const Home: FC = () => {
7 | return (
8 |
9 |
10 |
Create Next App
11 |
12 |
13 |
14 |
15 |
16 | Welcome to Next.js!
17 |
18 |
19 |
20 | Get started by editing pages/index.js
21 |
22 |
23 |
47 |
48 |
49 |
58 |
59 | );
60 | };
61 |
62 | export default Home;
63 |
--------------------------------------------------------------------------------
/templates/nextjs-ts-materialui-reacthookform/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "next-ts-materialui-reacthookform",
3 | "version": "0.1.0",
4 | "private": true,
5 | "scripts": {
6 | "dev": "cross-env NODE_OPTIONS='--inspect' next dev",
7 | "build": "next build",
8 | "start": "next start",
9 | "test": "jest",
10 | "test:watch": "jest --watch",
11 | "test:coverage": "jest --coverage",
12 | "lint": "eslint .",
13 | "lint:fix": "eslint --fix ."
14 | },
15 | "dependencies": {
16 | "@hookform/resolvers": "^2.6.1",
17 | "@material-ui/core": "^4.12.2",
18 | "@material-ui/icons": "^4.11.2",
19 | "@material-ui/lab": "^4.0.0-alpha.60",
20 | "cross-env": "^7.0.3",
21 | "next": "11.0.1",
22 | "react": "17.0.2",
23 | "react-dom": "17.0.2",
24 | "react-hook-form": "^7.11.1",
25 | "yup": "^0.32.9"
26 | },
27 | "devDependencies": {
28 | "@testing-library/dom": "^8.1.0",
29 | "@testing-library/jest-dom": "^5.14.1",
30 | "@testing-library/react": "^12.0.0",
31 | "@testing-library/user-event": "^13.2.0",
32 | "@types/jest": "^26.0.24",
33 | "@types/node": "^16.4.1",
34 | "@types/react": "^17.0.14",
35 | "@types/react-dom": "^17.0.9",
36 | "@typescript-eslint/eslint-plugin": "^4.28.4",
37 | "@typescript-eslint/parser": "^4.28.4",
38 | "axe-core": "^4.3.1",
39 | "babel-plugin-import": "^1.13.3",
40 | "commitizen": "^4.2.4",
41 | "cz-conventional-changelog": "3.3.0",
42 | "eslint": "^7.31.0",
43 | "eslint-config-airbnb": "^18.2.1",
44 | "eslint-config-prettier": "^8.3.0",
45 | "eslint-import-resolver-typescript": "^2.4.0",
46 | "eslint-plugin-import": "^2.23.4",
47 | "eslint-plugin-jest-dom": "^3.9.0",
48 | "eslint-plugin-jsx-a11y": "^6.4.1",
49 | "eslint-plugin-prettier": "^3.4.0",
50 | "eslint-plugin-react": "^7.24.0",
51 | "eslint-plugin-react-hooks": "^4.2.0",
52 | "eslint-plugin-testing-library": "^4.10.1",
53 | "jest": "^27.0.6",
54 | "jest-environment-jsdom": "^27.0.6",
55 | "lint-staged": "^11.1.0",
56 | "prettier": "^2.3.2",
57 | "ts-jest": "^27.0.4",
58 | "ts-node": "^10.1.0",
59 | "typescript": "^4.3.5"
60 | },
61 | "config": {
62 | "commitizen": {
63 | "path": "./node_modules/cz-conventional-changelog"
64 | }
65 | }
66 | }
67 |
--------------------------------------------------------------------------------
/templates/nextjs-ts-reactquery-graphqlrequest/pages/index.tsx:
--------------------------------------------------------------------------------
1 | // index.tsx
2 | import { FC } from 'react';
3 | import Head from 'next/head';
4 | import styles from '../styles/Home.module.css';
5 |
6 | const Home: FC = () => {
7 | return (
8 |
9 |
10 |
Create Next App
11 |
12 |
13 |
14 |
15 |
16 | Welcome to Next.js!
17 |
18 |
19 |
20 | Get started by editing pages/index.js
21 |
22 |
23 |
47 |
48 |
49 |
58 |
59 | );
60 | };
61 |
62 | export default Home;
63 |
--------------------------------------------------------------------------------
/templates/nextjs-ts-reactquery/pages/todo/paginated.tsx:
--------------------------------------------------------------------------------
1 | /* eslint-disable import/no-cycle */
2 | // index.tsx
3 | import React, { FC, useState, useEffect } from 'react';
4 | import { useQuery, useQueryClient } from 'react-query';
5 | import { IPaginatedTodos } from '@src/lib/interfaces/IPaginatedTodos';
6 | import { ITodo } from '@src/lib/interfaces/ITodo';
7 |
8 | const PaginatedTodoPage: FC = () => {
9 | const [page, setPage] = useState(0);
10 |
11 | const fetchTodos = (pageNumber = 0) => fetch(`/api/todo/${pageNumber}`).then((res) => res.json());
12 |
13 | const queryClient = useQueryClient();
14 |
15 | // is fetching dictates if currently fetching in the background
16 | // isPreviousData tells whether current data is previous or curren t
17 | const { isLoading, data, isFetching, isPreviousData } = useQuery(
18 | ['todos', page], // key is ['todos', pageNumber]
19 | () => fetchTodos(page), // function is call fetchTodos with state page
20 | { keepPreviousData: true } // keepPreviousData adds cool stuff
21 | );
22 |
23 | // Prefetch the next 2 pages on every page load!
24 | useEffect(() => {
25 | if (data?.hasMore) {
26 | queryClient.prefetchQuery(['todos', page + 1], () => fetchTodos(page + 1));
27 | queryClient.prefetchQuery(['todos', page + 2], () => fetchTodos(page + 2));
28 | }
29 | }, [data, page, queryClient]);
30 |
31 | if (isLoading) {
32 | return Loading...
;
33 | }
34 |
35 | return (
36 | <>
37 | {data?.todos.map((todo) => (
38 | {todo.message}
39 | ))}
40 | Current Page: {page + 1}
41 |
42 |
45 |
57 | {isFetching ? Loading... : null}{' '}
58 | >
59 | );
60 | };
61 |
62 | export default PaginatedTodoPage;
63 |
--------------------------------------------------------------------------------
/templates/nextjs-ts-materialUI/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "target": "es5", // Specify ECMAScript target version
4 | "lib": [
5 | "dom",
6 | "dom.iterable",
7 | "esnext"
8 | ], // List of library files to be included in the compilation
9 | "allowJs": true, // Allow JavaScript files to be compiled
10 | "skipLibCheck": true, // Skip type checking of all declaration files
11 | "esModuleInterop": true, // Disables namespace imports (import * as fs from "fs") and enables CJS/AMD/UMD style imports (import fs from "fs")
12 | "allowSyntheticDefaultImports": true, // Allow default imports from modules with no default export
13 | "strict": true, // Enable all strict type checking options
14 | "forceConsistentCasingInFileNames": true, // Disallow inconsistently-cased references to the same file.
15 | "module": "esnext", // Specify module code generation
16 | "moduleResolution": "node", // Resolve modules using Node.js style
17 | "isolatedModules": true, // Unconditionally emit imports for unresolved files
18 | "resolveJsonModule": true, // Include modules imported with .json extension
19 | "noEmit": true, // Do not emit output (meaning do not compile code, only perform type checking)
20 | "jsx": "preserve", // Support JSX in .tsx files
21 | "sourceMap": true, // Generate corrresponding .map file
22 | "declaration": true, // Generate corresponding .d.ts file
23 | "noUnusedLocals": true, // Report errors on unused locals
24 | "noUnusedParameters": true, // Report errors on unused parameters
25 | "noFallthroughCasesInSwitch": true, // Report errors for fallthrough cases in switch statement
26 | "rootDir": ".",
27 | "baseUrl": ".",
28 | "paths": { //alias pathing for absolute paths
29 | "@src/*": ["src/*"],
30 | "@pages/*": ["pages/*"],
31 | "@styles/*": ["styles/*"]
32 | },
33 | "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */
34 | "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */
35 | },
36 | "include": [
37 | "next-env.d.ts", "pages/**/*", "src/**/*", "styles/**/*" // *** The files TypeScript should type check ***
38 | ],
39 | "exclude": ["node_modules", "coverage"] // *** The files to not type check ***
40 | }
--------------------------------------------------------------------------------
/templates/nextjs-ts-reactquery/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "target": "es5", // Specify ECMAScript target version
4 | "lib": [
5 | "dom",
6 | "dom.iterable",
7 | "esnext"
8 | ], // List of library files to be included in the compilation
9 | "allowJs": true, // Allow JavaScript files to be compiled
10 | "skipLibCheck": true, // Skip type checking of all declaration files
11 | "esModuleInterop": true, // Disables namespace imports (import * as fs from "fs") and enables CJS/AMD/UMD style imports (import fs from "fs")
12 | "allowSyntheticDefaultImports": true, // Allow default imports from modules with no default export
13 | "strict": true, // Enable all strict type checking options
14 | "forceConsistentCasingInFileNames": true, // Disallow inconsistently-cased references to the same file.
15 | "module": "esnext", // Specify module code generation
16 | "moduleResolution": "node", // Resolve modules using Node.js style
17 | "isolatedModules": true, // Unconditionally emit imports for unresolved files
18 | "resolveJsonModule": true, // Include modules imported with .json extension
19 | "noEmit": true, // Do not emit output (meaning do not compile code, only perform type checking)
20 | "jsx": "preserve", // Support JSX in .tsx files
21 | "sourceMap": true, // Generate corrresponding .map file
22 | "declaration": true, // Generate corresponding .d.ts file
23 | "noUnusedLocals": true, // Report errors on unused locals
24 | "noUnusedParameters": true, // Report errors on unused parameters
25 | "noFallthroughCasesInSwitch": true, // Report errors for fallthrough cases in switch statement
26 | "rootDir": ".",
27 | "baseUrl": ".",
28 | "paths": { //alias pathing for absolute paths
29 | "@src/*": ["src/*"],
30 | "@pages/*": ["pages/*"],
31 | "@styles/*": ["styles/*"]
32 | },
33 | "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */
34 | "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */
35 | },
36 | "include": [
37 | "next-env.d.ts", "pages/**/*", "src/**/*", "styles/**/*" // *** The files TypeScript should type check ***
38 | ],
39 | "exclude": ["node_modules", "coverage"] // *** The files to not type check ***
40 | }
--------------------------------------------------------------------------------
/templates/nextjs-ts-materialui-reacthookform/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "target": "es5", // Specify ECMAScript target version
4 | "lib": [
5 | "dom",
6 | "dom.iterable",
7 | "esnext"
8 | ], // List of library files to be included in the compilation
9 | "allowJs": true, // Allow JavaScript files to be compiled
10 | "skipLibCheck": true, // Skip type checking of all declaration files
11 | "esModuleInterop": true, // Disables namespace imports (import * as fs from "fs") and enables CJS/AMD/UMD style imports (import fs from "fs")
12 | "allowSyntheticDefaultImports": true, // Allow default imports from modules with no default export
13 | "strict": true, // Enable all strict type checking options
14 | "forceConsistentCasingInFileNames": true, // Disallow inconsistently-cased references to the same file.
15 | "module": "esnext", // Specify module code generation
16 | "moduleResolution": "node", // Resolve modules using Node.js style
17 | "isolatedModules": true, // Unconditionally emit imports for unresolved files
18 | "resolveJsonModule": true, // Include modules imported with .json extension
19 | "noEmit": true, // Do not emit output (meaning do not compile code, only perform type checking)
20 | "jsx": "preserve", // Support JSX in .tsx files
21 | "sourceMap": true, // Generate corrresponding .map file
22 | "declaration": true, // Generate corresponding .d.ts file
23 | "noUnusedLocals": true, // Report errors on unused locals
24 | "noUnusedParameters": true, // Report errors on unused parameters
25 | "noFallthroughCasesInSwitch": true, // Report errors for fallthrough cases in switch statement
26 | "rootDir": ".",
27 | "baseUrl": ".",
28 | "paths": { //alias pathing for absolute paths
29 | "@src/*": ["src/*"],
30 | "@pages/*": ["pages/*"],
31 | "@styles/*": ["styles/*"]
32 | },
33 | "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */
34 | "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */
35 | },
36 | "include": [
37 | "next-env.d.ts", "pages/**/*", "src/**/*", "styles/**/*" // *** The files TypeScript should type check ***
38 | ],
39 | "exclude": ["node_modules", "coverage"] // *** The files to not type check ***
40 | }
--------------------------------------------------------------------------------
/templates/nextjs-ts-reactquery-graphqlrequest/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "target": "es5", // Specify ECMAScript target version
4 | "lib": [
5 | "dom",
6 | "dom.iterable",
7 | "esnext"
8 | ], // List of library files to be included in the compilation
9 | "allowJs": true, // Allow JavaScript files to be compiled
10 | "skipLibCheck": true, // Skip type checking of all declaration files
11 | "esModuleInterop": true, // Disables namespace imports (import * as fs from "fs") and enables CJS/AMD/UMD style imports (import fs from "fs")
12 | "allowSyntheticDefaultImports": true, // Allow default imports from modules with no default export
13 | "strict": true, // Enable all strict type checking options
14 | "forceConsistentCasingInFileNames": true, // Disallow inconsistently-cased references to the same file.
15 | "module": "esnext", // Specify module code generation
16 | "moduleResolution": "node", // Resolve modules using Node.js style
17 | "isolatedModules": true, // Unconditionally emit imports for unresolved files
18 | "resolveJsonModule": true, // Include modules imported with .json extension
19 | "noEmit": true, // Do not emit output (meaning do not compile code, only perform type checking)
20 | "jsx": "preserve", // Support JSX in .tsx files
21 | "sourceMap": true, // Generate corrresponding .map file
22 | "declaration": true, // Generate corresponding .d.ts file
23 | "noUnusedLocals": true, // Report errors on unused locals
24 | "noUnusedParameters": true, // Report errors on unused parameters
25 | "noFallthroughCasesInSwitch": true, // Report errors for fallthrough cases in switch statement
26 | "rootDir": ".",
27 | "baseUrl": ".",
28 | "paths": { //alias pathing for absolute paths
29 | "@src/*": ["src/*"],
30 | "@pages/*": ["pages/*"],
31 | "@styles/*": ["styles/*"]
32 | },
33 | "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */
34 | "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */
35 | },
36 | "include": [
37 | "next-env.d.ts", "pages/**/*", "src/**/*", "styles/**/*" // *** The files TypeScript should type check ***
38 | ],
39 | "exclude": ["node_modules", "coverage"] // *** The files to not type check ***
40 | }
--------------------------------------------------------------------------------
/templates/nextjs-ts-frontend/styles/Home.module.css:
--------------------------------------------------------------------------------
1 | .container {
2 | min-height: 100vh;
3 | padding: 0 0.5rem;
4 | display: flex;
5 | flex-direction: column;
6 | justify-content: center;
7 | align-items: center;
8 | }
9 |
10 | .main {
11 | padding: 5rem 0;
12 | flex: 1;
13 | display: flex;
14 | flex-direction: column;
15 | justify-content: center;
16 | align-items: center;
17 | }
18 |
19 | .footer {
20 | width: 100%;
21 | height: 100px;
22 | border-top: 1px solid #eaeaea;
23 | display: flex;
24 | justify-content: center;
25 | align-items: center;
26 | }
27 |
28 | .footer img {
29 | margin-left: 0.5rem;
30 | }
31 |
32 | .footer a {
33 | display: flex;
34 | justify-content: center;
35 | align-items: center;
36 | }
37 |
38 | .title a {
39 | color: #0070f3;
40 | text-decoration: none;
41 | }
42 |
43 | .title a:hover,
44 | .title a:focus,
45 | .title a:active {
46 | text-decoration: underline;
47 | }
48 |
49 | .title {
50 | margin: 0;
51 | line-height: 1.15;
52 | font-size: 4rem;
53 | }
54 |
55 | .title,
56 | .description {
57 | text-align: center;
58 | }
59 |
60 | .description {
61 | line-height: 1.5;
62 | font-size: 1.5rem;
63 | }
64 |
65 | .code {
66 | background: #fafafa;
67 | border-radius: 5px;
68 | padding: 0.75rem;
69 | font-size: 1.1rem;
70 | font-family: Menlo, Monaco, Lucida Console, Liberation Mono, DejaVu Sans Mono,
71 | Bitstream Vera Sans Mono, Courier New, monospace;
72 | }
73 |
74 | .grid {
75 | display: flex;
76 | align-items: center;
77 | justify-content: center;
78 | flex-wrap: wrap;
79 | max-width: 800px;
80 | margin-top: 3rem;
81 | }
82 |
83 | .card {
84 | margin: 1rem;
85 | flex-basis: 45%;
86 | padding: 1.5rem;
87 | text-align: left;
88 | color: inherit;
89 | text-decoration: none;
90 | border: 1px solid #eaeaea;
91 | border-radius: 10px;
92 | transition: color 0.15s ease, border-color 0.15s ease;
93 | }
94 |
95 | .card:hover,
96 | .card:focus,
97 | .card:active {
98 | color: #0070f3;
99 | border-color: #0070f3;
100 | }
101 |
102 | .card h3 {
103 | margin: 0 0 1rem 0;
104 | font-size: 1.5rem;
105 | }
106 |
107 | .card p {
108 | margin: 0;
109 | font-size: 1.25rem;
110 | line-height: 1.5;
111 | }
112 |
113 | .logo {
114 | height: 1em;
115 | }
116 |
117 | @media (max-width: 600px) {
118 | .grid {
119 | width: 100%;
120 | flex-direction: column;
121 | }
122 | }
123 |
--------------------------------------------------------------------------------
/templates/nextjs-ts-materialUI/styles/Home.module.css:
--------------------------------------------------------------------------------
1 | .container {
2 | min-height: 100vh;
3 | padding: 0 0.5rem;
4 | display: flex;
5 | flex-direction: column;
6 | justify-content: center;
7 | align-items: center;
8 | }
9 |
10 | .main {
11 | padding: 5rem 0;
12 | flex: 1;
13 | display: flex;
14 | flex-direction: column;
15 | justify-content: center;
16 | align-items: center;
17 | }
18 |
19 | .footer {
20 | width: 100%;
21 | height: 100px;
22 | border-top: 1px solid #eaeaea;
23 | display: flex;
24 | justify-content: center;
25 | align-items: center;
26 | }
27 |
28 | .footer img {
29 | margin-left: 0.5rem;
30 | }
31 |
32 | .footer a {
33 | display: flex;
34 | justify-content: center;
35 | align-items: center;
36 | }
37 |
38 | .title a {
39 | color: #0070f3;
40 | text-decoration: none;
41 | }
42 |
43 | .title a:hover,
44 | .title a:focus,
45 | .title a:active {
46 | text-decoration: underline;
47 | }
48 |
49 | .title {
50 | margin: 0;
51 | line-height: 1.15;
52 | font-size: 4rem;
53 | }
54 |
55 | .title,
56 | .description {
57 | text-align: center;
58 | }
59 |
60 | .description {
61 | line-height: 1.5;
62 | font-size: 1.5rem;
63 | }
64 |
65 | .code {
66 | background: #fafafa;
67 | border-radius: 5px;
68 | padding: 0.75rem;
69 | font-size: 1.1rem;
70 | font-family: Menlo, Monaco, Lucida Console, Liberation Mono, DejaVu Sans Mono,
71 | Bitstream Vera Sans Mono, Courier New, monospace;
72 | }
73 |
74 | .grid {
75 | display: flex;
76 | align-items: center;
77 | justify-content: center;
78 | flex-wrap: wrap;
79 | max-width: 800px;
80 | margin-top: 3rem;
81 | }
82 |
83 | .card {
84 | margin: 1rem;
85 | flex-basis: 45%;
86 | padding: 1.5rem;
87 | text-align: left;
88 | color: inherit;
89 | text-decoration: none;
90 | border: 1px solid #eaeaea;
91 | border-radius: 10px;
92 | transition: color 0.15s ease, border-color 0.15s ease;
93 | }
94 |
95 | .card:hover,
96 | .card:focus,
97 | .card:active {
98 | color: #0070f3;
99 | border-color: #0070f3;
100 | }
101 |
102 | .card h3 {
103 | margin: 0 0 1rem 0;
104 | font-size: 1.5rem;
105 | }
106 |
107 | .card p {
108 | margin: 0;
109 | font-size: 1.25rem;
110 | line-height: 1.5;
111 | }
112 |
113 | .logo {
114 | height: 1em;
115 | }
116 |
117 | @media (max-width: 600px) {
118 | .grid {
119 | width: 100%;
120 | flex-direction: column;
121 | }
122 | }
123 |
--------------------------------------------------------------------------------
/templates/nextjs-ts-reactquery/styles/Home.module.css:
--------------------------------------------------------------------------------
1 | .container {
2 | min-height: 100vh;
3 | padding: 0 0.5rem;
4 | display: flex;
5 | flex-direction: column;
6 | justify-content: center;
7 | align-items: center;
8 | }
9 |
10 | .main {
11 | padding: 5rem 0;
12 | flex: 1;
13 | display: flex;
14 | flex-direction: column;
15 | justify-content: center;
16 | align-items: center;
17 | }
18 |
19 | .footer {
20 | width: 100%;
21 | height: 100px;
22 | border-top: 1px solid #eaeaea;
23 | display: flex;
24 | justify-content: center;
25 | align-items: center;
26 | }
27 |
28 | .footer img {
29 | margin-left: 0.5rem;
30 | }
31 |
32 | .footer a {
33 | display: flex;
34 | justify-content: center;
35 | align-items: center;
36 | }
37 |
38 | .title a {
39 | color: #0070f3;
40 | text-decoration: none;
41 | }
42 |
43 | .title a:hover,
44 | .title a:focus,
45 | .title a:active {
46 | text-decoration: underline;
47 | }
48 |
49 | .title {
50 | margin: 0;
51 | line-height: 1.15;
52 | font-size: 4rem;
53 | }
54 |
55 | .title,
56 | .description {
57 | text-align: center;
58 | }
59 |
60 | .description {
61 | line-height: 1.5;
62 | font-size: 1.5rem;
63 | }
64 |
65 | .code {
66 | background: #fafafa;
67 | border-radius: 5px;
68 | padding: 0.75rem;
69 | font-size: 1.1rem;
70 | font-family: Menlo, Monaco, Lucida Console, Liberation Mono, DejaVu Sans Mono,
71 | Bitstream Vera Sans Mono, Courier New, monospace;
72 | }
73 |
74 | .grid {
75 | display: flex;
76 | align-items: center;
77 | justify-content: center;
78 | flex-wrap: wrap;
79 | max-width: 800px;
80 | margin-top: 3rem;
81 | }
82 |
83 | .card {
84 | margin: 1rem;
85 | flex-basis: 45%;
86 | padding: 1.5rem;
87 | text-align: left;
88 | color: inherit;
89 | text-decoration: none;
90 | border: 1px solid #eaeaea;
91 | border-radius: 10px;
92 | transition: color 0.15s ease, border-color 0.15s ease;
93 | }
94 |
95 | .card:hover,
96 | .card:focus,
97 | .card:active {
98 | color: #0070f3;
99 | border-color: #0070f3;
100 | }
101 |
102 | .card h3 {
103 | margin: 0 0 1rem 0;
104 | font-size: 1.5rem;
105 | }
106 |
107 | .card p {
108 | margin: 0;
109 | font-size: 1.25rem;
110 | line-height: 1.5;
111 | }
112 |
113 | .logo {
114 | height: 1em;
115 | }
116 |
117 | @media (max-width: 600px) {
118 | .grid {
119 | width: 100%;
120 | flex-direction: column;
121 | }
122 | }
123 |
--------------------------------------------------------------------------------
/templates/nextjs-ts-materialui-reacthookform/styles/Home.module.css:
--------------------------------------------------------------------------------
1 | .container {
2 | min-height: 100vh;
3 | padding: 0 0.5rem;
4 | display: flex;
5 | flex-direction: column;
6 | justify-content: center;
7 | align-items: center;
8 | }
9 |
10 | .main {
11 | padding: 5rem 0;
12 | flex: 1;
13 | display: flex;
14 | flex-direction: column;
15 | justify-content: center;
16 | align-items: center;
17 | }
18 |
19 | .footer {
20 | width: 100%;
21 | height: 100px;
22 | border-top: 1px solid #eaeaea;
23 | display: flex;
24 | justify-content: center;
25 | align-items: center;
26 | }
27 |
28 | .footer img {
29 | margin-left: 0.5rem;
30 | }
31 |
32 | .footer a {
33 | display: flex;
34 | justify-content: center;
35 | align-items: center;
36 | }
37 |
38 | .title a {
39 | color: #0070f3;
40 | text-decoration: none;
41 | }
42 |
43 | .title a:hover,
44 | .title a:focus,
45 | .title a:active {
46 | text-decoration: underline;
47 | }
48 |
49 | .title {
50 | margin: 0;
51 | line-height: 1.15;
52 | font-size: 4rem;
53 | }
54 |
55 | .title,
56 | .description {
57 | text-align: center;
58 | }
59 |
60 | .description {
61 | line-height: 1.5;
62 | font-size: 1.5rem;
63 | }
64 |
65 | .code {
66 | background: #fafafa;
67 | border-radius: 5px;
68 | padding: 0.75rem;
69 | font-size: 1.1rem;
70 | font-family: Menlo, Monaco, Lucida Console, Liberation Mono, DejaVu Sans Mono,
71 | Bitstream Vera Sans Mono, Courier New, monospace;
72 | }
73 |
74 | .grid {
75 | display: flex;
76 | align-items: center;
77 | justify-content: center;
78 | flex-wrap: wrap;
79 | max-width: 800px;
80 | margin-top: 3rem;
81 | }
82 |
83 | .card {
84 | margin: 1rem;
85 | flex-basis: 45%;
86 | padding: 1.5rem;
87 | text-align: left;
88 | color: inherit;
89 | text-decoration: none;
90 | border: 1px solid #eaeaea;
91 | border-radius: 10px;
92 | transition: color 0.15s ease, border-color 0.15s ease;
93 | }
94 |
95 | .card:hover,
96 | .card:focus,
97 | .card:active {
98 | color: #0070f3;
99 | border-color: #0070f3;
100 | }
101 |
102 | .card h3 {
103 | margin: 0 0 1rem 0;
104 | font-size: 1.5rem;
105 | }
106 |
107 | .card p {
108 | margin: 0;
109 | font-size: 1.25rem;
110 | line-height: 1.5;
111 | }
112 |
113 | .logo {
114 | height: 1em;
115 | }
116 |
117 | @media (max-width: 600px) {
118 | .grid {
119 | width: 100%;
120 | flex-direction: column;
121 | }
122 | }
123 |
--------------------------------------------------------------------------------
/templates/nextjs-ts-materialUI/.eslintrc.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | env: {
3 | browser: true,
4 | es2021: true,
5 | node: true,
6 | jest: true,
7 | },
8 | extends: [
9 | 'plugin:@typescript-eslint/recommended',
10 | 'plugin:react/recommended',
11 | 'plugin:react-hooks/recommended',
12 | 'airbnb',
13 | 'plugin:prettier/recommended',
14 | 'plugin:import/errors',
15 | 'plugin:import/warnings',
16 | 'plugin:import/typescript',
17 | 'plugin:jsx-a11y/recommended',
18 | 'plugin:jest-dom/recommended',
19 | ],
20 | parser: '@typescript-eslint/parser',
21 | parserOptions: {
22 | ecmaFeatures: {
23 | jsx: true,
24 | },
25 | ecmaVersion: 12,
26 | sourceType: 'module',
27 | },
28 | plugins: [
29 | 'react',
30 | 'react-hooks',
31 | '@typescript-eslint',
32 | 'prettier',
33 | 'import',
34 | 'jsx-a11y',
35 | 'testing-library',
36 | 'jest-dom',
37 | ],
38 | rules: {
39 | 'prettier/prettier': 'error',
40 | 'react/react-in-jsx-scope': 'off',
41 | 'react/jsx-filename-extension': 'off',
42 | 'import/extensions': 'off',
43 | 'import/no-unresolved': 'error',
44 | 'import/order': [
45 | 'error',
46 | {
47 | groups: ['builtin', 'external', 'internal', ['parent', 'sibling', 'object', 'index']],
48 | pathGroups: [
49 | {
50 | pattern: 'react',
51 | group: 'external',
52 | position: 'before',
53 | },
54 | ],
55 | pathGroupsExcludedImportTypes: ['react'],
56 | 'newlines-between': 'never',
57 | alphabetize: {
58 | order: 'asc',
59 | caseInsensitive: true,
60 | },
61 | },
62 | ],
63 | 'import/no-extraneous-dependencies': [
64 | 'error',
65 | { devDependencies: ['jest.setup.ts', '**/*.test.tsx', '**/*.spec.tsx', '**/*.test.ts', '**/*.spec.ts'] },
66 | ],
67 | },
68 | overrides: [
69 | {
70 | // only run testling library linting on test files not entire codebase
71 | files: ['**/__tests__/**/*.[jt]s?(x)', '**/?(*.)+(spec|test).[jt]s?(x)'],
72 | extends: ['plugin:testing-library/react'],
73 | },
74 | ],
75 | settings: {
76 | react: {
77 | version: 'detect', // Tells eslint-plugin-react to automatically detect the version of React to use
78 | },
79 | 'import/resolver': {
80 | // use /tsconfig.json
81 | typescript: {
82 | project: '.',
83 | },
84 | },
85 | },
86 | };
87 |
--------------------------------------------------------------------------------
/templates/nextjs-ts-reactquery-graphqlrequest/styles/Home.module.css:
--------------------------------------------------------------------------------
1 | .container {
2 | min-height: 100vh;
3 | padding: 0 0.5rem;
4 | display: flex;
5 | flex-direction: column;
6 | justify-content: center;
7 | align-items: center;
8 | }
9 |
10 | .main {
11 | padding: 5rem 0;
12 | flex: 1;
13 | display: flex;
14 | flex-direction: column;
15 | justify-content: center;
16 | align-items: center;
17 | }
18 |
19 | .footer {
20 | width: 100%;
21 | height: 100px;
22 | border-top: 1px solid #eaeaea;
23 | display: flex;
24 | justify-content: center;
25 | align-items: center;
26 | }
27 |
28 | .footer img {
29 | margin-left: 0.5rem;
30 | }
31 |
32 | .footer a {
33 | display: flex;
34 | justify-content: center;
35 | align-items: center;
36 | }
37 |
38 | .title a {
39 | color: #0070f3;
40 | text-decoration: none;
41 | }
42 |
43 | .title a:hover,
44 | .title a:focus,
45 | .title a:active {
46 | text-decoration: underline;
47 | }
48 |
49 | .title {
50 | margin: 0;
51 | line-height: 1.15;
52 | font-size: 4rem;
53 | }
54 |
55 | .title,
56 | .description {
57 | text-align: center;
58 | }
59 |
60 | .description {
61 | line-height: 1.5;
62 | font-size: 1.5rem;
63 | }
64 |
65 | .code {
66 | background: #fafafa;
67 | border-radius: 5px;
68 | padding: 0.75rem;
69 | font-size: 1.1rem;
70 | font-family: Menlo, Monaco, Lucida Console, Liberation Mono, DejaVu Sans Mono,
71 | Bitstream Vera Sans Mono, Courier New, monospace;
72 | }
73 |
74 | .grid {
75 | display: flex;
76 | align-items: center;
77 | justify-content: center;
78 | flex-wrap: wrap;
79 | max-width: 800px;
80 | margin-top: 3rem;
81 | }
82 |
83 | .card {
84 | margin: 1rem;
85 | flex-basis: 45%;
86 | padding: 1.5rem;
87 | text-align: left;
88 | color: inherit;
89 | text-decoration: none;
90 | border: 1px solid #eaeaea;
91 | border-radius: 10px;
92 | transition: color 0.15s ease, border-color 0.15s ease;
93 | }
94 |
95 | .card:hover,
96 | .card:focus,
97 | .card:active {
98 | color: #0070f3;
99 | border-color: #0070f3;
100 | }
101 |
102 | .card h3 {
103 | margin: 0 0 1rem 0;
104 | font-size: 1.5rem;
105 | }
106 |
107 | .card p {
108 | margin: 0;
109 | font-size: 1.25rem;
110 | line-height: 1.5;
111 | }
112 |
113 | .logo {
114 | height: 1em;
115 | }
116 |
117 | @media (max-width: 600px) {
118 | .grid {
119 | width: 100%;
120 | flex-direction: column;
121 | }
122 | }
123 |
--------------------------------------------------------------------------------
/templates/nextjs-ts-reactquery/.eslintrc.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | env: {
3 | browser: true,
4 | es2021: true,
5 | node: true,
6 | jest: true,
7 | },
8 | extends: [
9 | 'plugin:@typescript-eslint/recommended',
10 | 'plugin:react/recommended',
11 | 'plugin:react-hooks/recommended',
12 | 'airbnb',
13 | 'plugin:prettier/recommended',
14 | 'plugin:import/errors',
15 | 'plugin:import/warnings',
16 | 'plugin:import/typescript',
17 | 'plugin:jsx-a11y/recommended',
18 | 'plugin:jest-dom/recommended',
19 | ],
20 | parser: '@typescript-eslint/parser',
21 | parserOptions: {
22 | ecmaFeatures: {
23 | jsx: true,
24 | },
25 | ecmaVersion: 12,
26 | sourceType: 'module',
27 | },
28 | plugins: [
29 | 'react',
30 | 'react-hooks',
31 | '@typescript-eslint',
32 | 'prettier',
33 | 'import',
34 | 'jsx-a11y',
35 | 'testing-library',
36 | 'jest-dom',
37 | ],
38 | rules: {
39 | 'prettier/prettier': 'error',
40 | 'react/react-in-jsx-scope': 'off',
41 | 'react/jsx-filename-extension': 'off',
42 | 'import/extensions': 'off',
43 | 'import/no-unresolved': 'error',
44 | 'import/order': [
45 | 'error',
46 | {
47 | groups: ['builtin', 'external', 'internal', ['parent', 'sibling', 'object', 'index']],
48 | pathGroups: [
49 | {
50 | pattern: 'react',
51 | group: 'external',
52 | position: 'before',
53 | },
54 | ],
55 | pathGroupsExcludedImportTypes: ['react'],
56 | 'newlines-between': 'never',
57 | alphabetize: {
58 | order: 'asc',
59 | caseInsensitive: true,
60 | },
61 | },
62 | ],
63 | 'import/no-extraneous-dependencies': [
64 | 'error',
65 | { devDependencies: ['jest.setup.ts', '**/*.test.tsx', '**/*.spec.tsx', '**/*.test.ts', '**/*.spec.ts'] },
66 | ],
67 | },
68 | overrides: [
69 | {
70 | // only run testling library linting on test files not entire codebase
71 | files: ['**/__tests__/**/*.[jt]s?(x)', '**/?(*.)+(spec|test).[jt]s?(x)'],
72 | extends: ['plugin:testing-library/react'],
73 | },
74 | ],
75 | settings: {
76 | react: {
77 | version: 'detect', // Tells eslint-plugin-react to automatically detect the version of React to use
78 | },
79 | 'import/resolver': {
80 | // use /tsconfig.json
81 | typescript: {
82 | project: '.',
83 | },
84 | },
85 | },
86 | };
87 |
--------------------------------------------------------------------------------
/templates/aws-ts-serverless/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | /* Visit https://aka.ms/tsconfig.json to read more about this file */
4 |
5 | /* Basic Options */
6 | "target": "es6", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', or 'ESNEXT'. */
7 | "module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'. */
8 | "lib": ["dom", "esnext"], /* Specify library files to be included in the compilation. */
9 | "allowJs": true, /* Allow javascript files to be compiled. */
10 | "removeComments": true, /* Do not emit comments to output. */
11 | /* Strict Type-Checking Options */
12 | "strict": true, /* Enable all strict type-checking options. */
13 | "noImplicitAny": false, /* Raise error on expressions and declarations with an implied 'any' type. */
14 | /* Module Resolution Options */
15 | "sourceMap": true,
16 | "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */
17 | "baseUrl": ".", /* Base directory to resolve non-absolute module names. */
18 | "paths": { /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */
19 | "@src/*": ["src/*"]
20 | },
21 | "esModuleInterop": true, /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */
22 | /* Experimental Options */
23 | "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */
24 | "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */
25 |
26 | /* Advanced Options */
27 | "skipLibCheck": true, /* Skip type checking of declaration files. */
28 | "forceConsistentCasingInFileNames": true /* Disallow inconsistently-cased references to the same file. */
29 | },
30 | "exclude": ["node_modules", "dist", "coverage"],
31 | "include": ["src"]
32 | }
33 |
--------------------------------------------------------------------------------
/templates/nextjs-ts-materialui-reacthookform/.eslintrc.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | env: {
3 | browser: true,
4 | es2021: true,
5 | node: true,
6 | jest: true,
7 | },
8 | extends: [
9 | 'plugin:@typescript-eslint/recommended',
10 | 'plugin:react/recommended',
11 | 'plugin:react-hooks/recommended',
12 | 'airbnb',
13 | 'plugin:prettier/recommended',
14 | 'plugin:import/errors',
15 | 'plugin:import/warnings',
16 | 'plugin:import/typescript',
17 | 'plugin:jsx-a11y/recommended',
18 | 'plugin:jest-dom/recommended',
19 | ],
20 | parser: '@typescript-eslint/parser',
21 | parserOptions: {
22 | ecmaFeatures: {
23 | jsx: true,
24 | },
25 | ecmaVersion: 12,
26 | sourceType: 'module',
27 | },
28 | plugins: [
29 | 'react',
30 | 'react-hooks',
31 | '@typescript-eslint',
32 | 'prettier',
33 | 'import',
34 | 'jsx-a11y',
35 | 'testing-library',
36 | 'jest-dom',
37 | ],
38 | rules: {
39 | 'prettier/prettier': 'error',
40 | 'react/react-in-jsx-scope': 'off',
41 | 'react/jsx-filename-extension': 'off',
42 | 'import/extensions': 'off',
43 | 'import/no-unresolved': 'error',
44 | 'import/order': [
45 | 'error',
46 | {
47 | groups: ['builtin', 'external', 'internal', ['parent', 'sibling', 'object', 'index']],
48 | pathGroups: [
49 | {
50 | pattern: 'react',
51 | group: 'external',
52 | position: 'before',
53 | },
54 | ],
55 | pathGroupsExcludedImportTypes: ['react'],
56 | 'newlines-between': 'never',
57 | alphabetize: {
58 | order: 'asc',
59 | caseInsensitive: true,
60 | },
61 | },
62 | ],
63 | 'import/no-extraneous-dependencies': [
64 | 'error',
65 | { devDependencies: ['jest.setup.ts', '**/*.test.tsx', '**/*.spec.tsx', '**/*.test.ts', '**/*.spec.ts'] },
66 | ],
67 | },
68 | overrides: [
69 | {
70 | // only run testling library linting on test files not entire codebase
71 | files: ['**/__tests__/**/*.[jt]s?(x)', '**/?(*.)+(spec|test).[jt]s?(x)'],
72 | extends: ['plugin:testing-library/react'],
73 | },
74 | ],
75 | settings: {
76 | react: {
77 | version: 'detect', // Tells eslint-plugin-react to automatically detect the version of React to use
78 | },
79 | 'import/resolver': {
80 | // use /tsconfig.json
81 | typescript: {
82 | project: '.',
83 | },
84 | },
85 | },
86 | };
87 |
--------------------------------------------------------------------------------
/templates/nextjs-ts-reactquery-graphqlrequest/.eslintrc.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | env: {
3 | browser: true,
4 | es2021: true,
5 | node: true,
6 | jest: true,
7 | },
8 | extends: [
9 | 'plugin:@typescript-eslint/recommended',
10 | 'plugin:react/recommended',
11 | 'plugin:react-hooks/recommended',
12 | 'airbnb',
13 | 'plugin:prettier/recommended',
14 | 'plugin:import/errors',
15 | 'plugin:import/warnings',
16 | 'plugin:import/typescript',
17 | 'plugin:jsx-a11y/recommended',
18 | 'plugin:jest-dom/recommended',
19 | ],
20 | parser: '@typescript-eslint/parser',
21 | parserOptions: {
22 | ecmaFeatures: {
23 | jsx: true,
24 | },
25 | ecmaVersion: 12,
26 | sourceType: 'module',
27 | },
28 | plugins: [
29 | 'react',
30 | 'react-hooks',
31 | '@typescript-eslint',
32 | 'prettier',
33 | 'import',
34 | 'jsx-a11y',
35 | 'testing-library',
36 | 'jest-dom',
37 | ],
38 | rules: {
39 | 'prettier/prettier': 'error',
40 | 'react/react-in-jsx-scope': 'off',
41 | 'react/jsx-filename-extension': 'off',
42 | 'import/extensions': 'off',
43 | 'import/no-unresolved': 'error',
44 | 'import/order': [
45 | 'error',
46 | {
47 | groups: ['builtin', 'external', 'internal', ['parent', 'sibling', 'object', 'index']],
48 | pathGroups: [
49 | {
50 | pattern: 'react',
51 | group: 'external',
52 | position: 'before',
53 | },
54 | ],
55 | pathGroupsExcludedImportTypes: ['react'],
56 | 'newlines-between': 'never',
57 | alphabetize: {
58 | order: 'asc',
59 | caseInsensitive: true,
60 | },
61 | },
62 | ],
63 | 'import/no-extraneous-dependencies': [
64 | 'error',
65 | { devDependencies: ['jest.setup.ts', '**/*.test.tsx', '**/*.spec.tsx', '**/*.test.ts', '**/*.spec.ts'] },
66 | ],
67 | },
68 | overrides: [
69 | {
70 | // only run testling library linting on test files not entire codebase
71 | files: ['**/__tests__/**/*.[jt]s?(x)', '**/?(*.)+(spec|test).[jt]s?(x)'],
72 | extends: ['plugin:testing-library/react'],
73 | },
74 | ],
75 | settings: {
76 | react: {
77 | version: 'detect', // Tells eslint-plugin-react to automatically detect the version of React to use
78 | },
79 | 'import/resolver': {
80 | // use /tsconfig.json
81 | typescript: {
82 | project: '.',
83 | },
84 | },
85 | },
86 | };
87 |
--------------------------------------------------------------------------------
/templates/gql-ts-prisma-codegen-apolloserver/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "apollo-federation-test",
3 | "version": "1.0.0",
4 | "description": "GQL microservice project structure with prisma, codegen, apolloserver and typescript",
5 | "main": "index.js",
6 | "repository": "https://github.com/leoroese/blog-tube",
7 | "author": "Leonardo Roese",
8 | "license": "MIT",
9 | "scripts": {
10 | "dev": "nodemon",
11 | "start": "node -r ts-node/register/transpile-only -r tsconfig-paths/register ./dist/src/index.js",
12 | "build": "tsc -p tsconfig.prod.json",
13 | "test": "yarn test:unit && yarn test:integration",
14 | "test:unit": "jest unit",
15 | "test:integration": "dotenv -e ./.env.test yarn generate:reset && dotenv -e ./.env.test jest int -i",
16 | "test:watch": "jest --watch",
17 | "test:coverage": "jest --coverage",
18 | "lint:fix": "eslint --fix .",
19 | "generate": "graphql-codegen --config codegen.yml",
20 | "generate:migration": "npx prisma migrate dev",
21 | "generate:reset": "npx prisma migrate reset --force",
22 | "prisma:studio": "npx prisma studio",
23 | "test:environment:docker": "yarn docker:up && yarn docker:test:run & yarn docker:down",
24 | "docker:up": "docker-compose up -d --build",
25 | "docker:down": "docker compose down",
26 | "docker:test:run": "docker exec server ./bin/wait-for-it.sh db:5432 -- yarn test"
27 | },
28 | "devDependencies": {
29 | "@graphql-codegen/cli": "1.21.5",
30 | "@graphql-codegen/typescript": "1.22.1",
31 | "@graphql-codegen/typescript-resolvers": "1.19.2",
32 | "@types/dotenv-safe": "^8.1.1",
33 | "@types/jest": "^26.0.20",
34 | "@types/node": "^14.14.33",
35 | "@typescript-eslint/eslint-plugin": "^4.17.0",
36 | "@typescript-eslint/parser": "^4.17.0",
37 | "eslint": "^7.21.0",
38 | "eslint-config-airbnb-base": "^14.2.1",
39 | "eslint-config-prettier": "^8.1.0",
40 | "eslint-import-resolver-typescript": "^2.4.0",
41 | "eslint-plugin-import": "^2.22.1",
42 | "eslint-plugin-prettier": "^3.3.1",
43 | "jest": "^26.6.3",
44 | "jest-mock-extended": "^1.0.15",
45 | "nodemon": "^2.0.7",
46 | "prettier": "^2.2.1",
47 | "prisma": "^2.24.1",
48 | "ts-jest": "^26.5.3",
49 | "ts-node": "^9.1.1",
50 | "tsconfig-paths": "^3.9.0",
51 | "typescript": "^4.2.3"
52 | },
53 | "dependencies": {
54 | "apollo-graphql": "^0.9.3",
55 | "@graphql-codegen/core": "^1.17.10",
56 | "@graphql-codegen/plugin-helpers": "^1.18.7",
57 | "@graphql-codegen/schema-ast": "^1.18.3",
58 | "@prisma/client": "^2.24.1",
59 | "apollo-server": "^2.25.1",
60 | "dotenv-cli": "^4.0.0",
61 | "dotenv-safe": "^8.2.0",
62 | "graphql": "^15.5.0"
63 | }
64 | }
65 |
--------------------------------------------------------------------------------
/templates/gql-ts-serverless/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | /* Visit https://aka.ms/tsconfig.json to read more about this file */
4 |
5 | /* Basic Options */
6 | "target": "es6", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', or 'ESNEXT'. */
7 | "module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'. */
8 | "lib": ["dom", "esnext"], /* Specify library files to be included in the compilation. */
9 | "allowJs": true, /* Allow javascript files to be compiled. */
10 | "outDir": "dist", /* Redirect output structure to the directory. */
11 | "rootDir": ".", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */
12 | "removeComments": true, /* Do not emit comments to output. */
13 | /* Strict Type-Checking Options */
14 | "strict": true, /* Enable all strict type-checking options. */
15 | "noImplicitAny": false, /* Raise error on expressions and declarations with an implied 'any' type. */
16 | /* Module Resolution Options */
17 | "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */
18 | "baseUrl": ".", /* Base directory to resolve non-absolute module names. */
19 | "paths": { /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */
20 | "@src/*": ["src/*"]
21 | },
22 | "sourceMap": true,
23 | "esModuleInterop": true, /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */
24 | /* Experimental Options */
25 | "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */
26 | "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */
27 |
28 | /* Advanced Options */
29 | "skipLibCheck": true, /* Skip type checking of declaration files. */
30 | "forceConsistentCasingInFileNames": true /* Disallow inconsistently-cased references to the same file. */
31 | },
32 | "exclude": ["node_modules", "dist", "coverage", "src/**/*.test.ts"],
33 | "include": ["src"]
34 | }
35 |
--------------------------------------------------------------------------------
/templates/gql-ts-prisma-codegen-apolloserver/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | /* Visit https://aka.ms/tsconfig.json to read more about this file */
4 |
5 | /* Basic Options */
6 | "target": "es6", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', or 'ESNEXT'. */
7 | "module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'. */
8 | "lib": ["dom", "esnext"], /* Specify library files to be included in the compilation. */
9 | "allowJs": true, /* Allow javascript files to be compiled. */
10 | "outDir": "dist", /* Redirect output structure to the directory. */
11 | "rootDir": ".", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */
12 | "removeComments": true, /* Do not emit comments to output. */
13 | /* Strict Type-Checking Options */
14 | "strict": true, /* Enable all strict type-checking options. */
15 | "noImplicitAny": false, /* Raise error on expressions and declarations with an implied 'any' type. */
16 | /* Module Resolution Options */
17 | "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */
18 | "baseUrl": ".", /* Base directory to resolve non-absolute module names. */
19 | "paths": { /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */
20 | "@src/*": ["src/*"]
21 | },
22 | "sourceMap": true,
23 | "esModuleInterop": true, /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */
24 | /* Experimental Options */
25 | "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */
26 | "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */
27 |
28 | /* Advanced Options */
29 | "skipLibCheck": true, /* Skip type checking of declaration files. */
30 | "forceConsistentCasingInFileNames": true /* Disallow inconsistently-cased references to the same file. */
31 | },
32 | "exclude": ["node_modules", "dist", "coverage"],
33 | "include": ["src", "__tests__"]
34 | }
35 |
--------------------------------------------------------------------------------
/templates/nextjs-ts-materialui-reacthookform/pages/index.tsx:
--------------------------------------------------------------------------------
1 | /* eslint-disable react/jsx-props-no-spreading */
2 | // index.tsx
3 | import React, { FC } from 'react';
4 | import { yupResolver } from '@hookform/resolvers/yup';
5 | import { TextField } from '@material-ui/core';
6 | import Head from 'next/head';
7 | import { useForm, SubmitHandler, Controller } from 'react-hook-form';
8 | import * as yup from 'yup';
9 | import styles from '../styles/Home.module.css';
10 |
11 | interface IFormInputs {
12 | email: string;
13 | password: string;
14 | }
15 |
16 | const schema = yup.object().shape({
17 | email: yup.string().email(),
18 | password: yup.string().min(4).max(20).required(),
19 | });
20 |
21 | const Home: FC = () => {
22 | const {
23 | register,
24 | control,
25 | handleSubmit,
26 | watch,
27 | formState: { errors },
28 | } = useForm({
29 | resolver: yupResolver(schema),
30 | });
31 |
32 | const onSubmit: SubmitHandler = (data) => console.log('data submitted: ', data);
33 |
34 | console.log(watch('email'));
35 | console.log('errors are', errors);
36 |
37 | return (
38 |
39 |
40 |
ReceitaClient
41 |
42 |
43 |
44 |
45 |
46 | Welcome to Next.js!
47 |
48 |
49 |
50 | Get started by editing pages/index.js
51 |
52 |
89 |
90 |
91 |
100 |
101 | );
102 | };
103 |
104 | export default Home;
--------------------------------------------------------------------------------
/templates/nextjs-ts-reactquery/pages/person/index.tsx:
--------------------------------------------------------------------------------
1 | /* eslint-disable import/no-cycle */
2 | // index.tsx
3 | import React, { FC, useState } from 'react';
4 | import Link from 'next/link';
5 | import { Query, QueryKey, useQueries, useQuery, useQueryClient, UseQueryResult } from 'react-query';
6 | import person from '@pages/api/person';
7 | import PersonComponent from '@src/components/PersonComponent';
8 | import { IPerson } from '@src/lib/interfaces/IPerson';
9 | import { ITodo } from '@src/lib/interfaces/ITodo';
10 |
11 | export const fetchPerson = async (): Promise => {
12 | const res = await fetch(`/api/person`);
13 | // need to do this with fetch since doesn't automatically throw errors axios and graphql-request do
14 | if (res.ok) {
15 | return res.json();
16 | }
17 | throw new Error('Network response not ok'); // need to throw because react-query functions need to have error thrown to know its in error state
18 | };
19 |
20 | const fetchTodo = async (): Promise => {
21 | const res = await fetch(`/api/todo`);
22 | // need to do this with fetch since doesn't automatically throw errors axios and graphql-request do
23 | if (res.ok) {
24 | return res.json();
25 | }
26 | throw new Error('Network response not ok'); // need to throw because react-query functions need to have error thrown to know its in error state
27 | };
28 |
29 | const PersonPage: FC = () => {
30 | const [enabled, setEnabled] = useState(true);
31 | const { isLoading, isError, isSuccess: personSuccess, error, data }: UseQueryResult = useQuery<
32 | IPerson,
33 | Error
34 | >('person', fetchPerson, {
35 | enabled,
36 | });
37 |
38 | const { isSuccess: todoSuccess, data: todoData }: UseQueryResult = useQuery(
39 | 'todo',
40 | fetchTodo,
41 | {
42 | enabled,
43 | }
44 | );
45 |
46 | // dynamic parallel queries wooooo
47 | const userQueries = useQueries(
48 | ['1', '2', '3'].map((id) => {
49 | return {
50 | queryKey: ['todo', { page: id }],
51 | queryFn: () => {
52 | return id;
53 | },
54 | enabled,
55 | };
56 | })
57 | );
58 |
59 | const queryClient = useQueryClient();
60 |
61 | // const { status, error, data }: UseQueryResult = useQuery(
62 | // 'person',
63 | // async () => {
64 | // const res = await fetch('/api/person');
65 | // return res.json();
66 | // },
67 | // {
68 | // select: (person) => person.name,
69 | // }
70 | // );
71 |
72 | // if (personSuccess && todoSuccess) {
73 | // queryClient.invalidateQueries();
74 | // }
75 |
76 | if (personSuccess && todoSuccess && enabled) {
77 | setEnabled(false);
78 | }
79 |
80 | if (isLoading) {
81 | return (
82 |
85 | );
86 | }
87 | if (isError) return Boom boy: Error is -- {error?.message}
;
88 |
89 | return (
90 | <>
91 |
92 | Home
93 |
94 |
95 |
104 |
105 |
114 |
115 |
129 | {data?.id}
130 | {data?.name}
131 | {data?.age}
132 | Person component
133 | >
134 | );
135 | };
136 |
137 | export default PersonPage;
138 |
--------------------------------------------------------------------------------