npm install --global yarn
yarn --version
npx create-next-app .
node -v
で ver 確認出来ます。yarn add @apollo/client graphql @apollo/react-hooks cross-fetch @heroicons/react
yarn add -D msw next-page-tester jest @testing-library/react @types/jest @testing-library/jest-dom @testing-library/dom babel-jest @babel/core @testing-library/user-event 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/react @types/node
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 = {
purge: ['./pages/**/*.tsx', './components/**/*.tsx'],
darkMode: false,
theme: {
extend: {},
},
variants: {
extend: {},
},
plugins: [],
}
@tailwind base;
@tailwind components;
@tailwind utilities;
__tests__
フォルダとHome.test.tsx
ファイルの作成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/cli
yarn graphql-codegen init
yarn
yarn add -D @graphql-codegen/typescript
yarn gen-types