npm install --global yarn
yarn --version
npx [email protected] .
yarn add @apollo/[email protected] [email protected] @apollo/[email protected] [email protected] @heroicons/[email protected]
yarn add [email protected] [email protected]
yarn add [email protected]
yarn add -D [email protected] [email protected] [email protected] @testing-library/[email protected] @types/[email protected] @testing-library/[email protected] @testing-library/[email protected] @testing-library/[email protected] [email protected] @babel/[email protected] jest-css-modules
touch .babelrc
{
"presets": ["next/babel"]
}
"jest": {
"testPathIgnorePatterns": [
"<rootDir>/.next/",
"<rootDir>/node_modules/"
],
"moduleNameMapper": {
"\\.(css)$": "<rootDir>/node_modules/jest-css-modules"
}
}
"scripts": {
...
"test": "jest --env=jsdom --verbose"
},
touch .prettierrc
{
"singleQuote": true,
"semi": false
}
https://nextjs.org/learn/excel/typescript/create-tsconfig
touch tsconfig.json
yarn add -D typescript @types/[email protected] @types/[email protected]
yarn dev
import { AppProps } from 'next/app'
function MyApp({ Component, pageProps }: AppProps) {
return <Component {...pageProps} />
}
export default MyApp
https://tailwindcss.com/docs/guides/nextjs
yarn add tailwindcss@latest postcss@latest autoprefixer@latest
npx tailwindcss init -p
module.exports = {
content: [
"./pages/**/*.{js,ts,jsx,tsx}",
"./components/**/*.{js,ts,jsx,tsx}",
],
darkMode: false,
theme: {
extend: {},
},
variants: {
extend: {},
},
plugins: [],
}
@tailwind base;
@tailwind components;
@tailwind utilities;
import { render, screen } from '@testing-library/react'
import '@testing-library/jest-dom/extend-expect'
import Home from '../pages/index'
it('Should render title text', () => {
render(<Home />)
expect(screen.getByText('Next.js!')).toBeInTheDocument()
})
PASS __tests__/Home.test.tsx
✓ Should render hello text (20 ms)
Test Suites: 1 passed, 1 total
Tests: 1 passed, 1 total
Snapshots: 0 total
Time: 1.728 s, estimated 2 s
yarn add -D @graphql-codegen/[email protected]
yarn graphql-codegen init
yarn
yarn add -D @graphql-codegen/[email protected]
yarn gen-types