Skip to content
This repository has been archived by the owner on Oct 4, 2023. It is now read-only.

feat: move to nextjs #165

Open
wants to merge 1 commit into
base: graphql-types-and-subscriptions
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 0 additions & 21 deletions .envrc

This file was deleted.

180 changes: 0 additions & 180 deletions .eslintrc.js

This file was deleted.

20 changes: 20 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"env": {
"browser": true,
"es6": true,
"jest": true,
"node": true
},
"extends": ["next/core-web-vitals", "plugin:@typescript-eslint/recommended"],
"rules": {
"@typescript-eslint/no-unused-vars": [
"error",
{
"args": "after-used",
"ignoreRestSiblings": true,
"varsIgnorePattern": "^_",
"argsIgnorePattern": "^_"
}
]
}
}
24 changes: 19 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,11 +1,25 @@
node_modules/
public/bundles/
build/
src/dist/
coverage/
.gvars.json
yarn-error.log
.env
.vscode/
.DS_Store
src/modules

public/bundles

# next.js
/.next/
/out/

# production
/build

# local env files
.env*.local

# vercel
.vercel

# typescript
*.tsbuildinfo
next-env.d.ts
3 changes: 2 additions & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ public/vendor/
build/
coverage/
.vscode
.gvars.json

.next/

**/*.yaml
**/*.yml
9 changes: 3 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,7 @@ In the project directory:
yarn install

# In a terminal
yarn dev:bundler

# In another terminal
yarn dev:server
yarn dev
```

Open [http://localhost:3000](http://localhost:3000) to view it in the browser.
Expand All @@ -36,8 +33,8 @@ In the project directory:
yarn install

# To build the app under the `build` folder
yarn build:all
yarn build

# To start the app
yarn prod:start
yarn start
```
4 changes: 4 additions & 0 deletions jest-globals.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { TextDecoder, TextEncoder } from "util"

global.TextEncoder = TextEncoder
global.TextDecoder = TextDecoder
36 changes: 28 additions & 8 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,30 @@
module.exports = {
roots: ["<rootDir>/src"],
transform: {
"^.+\\.tsx?$": "ts-jest",
// eslint-disable-next-line @typescript-eslint/no-var-requires
const nextJest = require("next/jest")

const createJestConfig = nextJest({
// Provide the path to your Next.js app to load next.config.js and .env files in your test environment
dir: "./",
})

// Add any custom config to be passed to Jest
/** @type {import('jest').Config} */
const customJestConfig = {
// Add more setup options before each test is run
// setupFilesAfterEnv: ['<rootDir>/jest.setup.js'],
// if using TypeScript with a baseUrl set to the root directory then you need the below for alias' to work
moduleDirectories: ["node_modules", "<rootDir>/"],

// If you're using [Module Path Aliases](https://nextjs.org/docs/advanced-features/module-path-aliases),
// you will have to add the moduleNameMapper in order for jest to resolve your absolute paths.
// The paths have to be matching with the paths option within the compilerOptions in the tsconfig.json
// For example:

moduleNameMapper: {
"@/(.*)$": "<rootDir>/src/$1",
},
modulePaths: ["<rootDir>/src"],
setupFilesAfterEnv: ["<rootDir>/src/jest/setupTests.ts"],
testEnvironment: "<rootDir>/src/jest/custom-env.ts",
testPathIgnorePatterns: ["/node_modules/"],
testEnvironment: "jest-environment-jsdom",
setupFilesAfterEnv: ["<rootDir>/jest-globals.js"],
}

// createJestConfig is exported this way to ensure that next/jest can load the Next.js config which is async
module.exports = createJestConfig(customJestConfig)
6 changes: 6 additions & 0 deletions next.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/** @type {import('next').NextConfig} */
const nextConfig = {
reactStrictMode: true,
}

module.exports = nextConfig
Loading