Skip to content

Commit 337b887

Browse files
committed
init nextjs-app from nextjs-pages
1 parent a1835b7 commit 337b887

File tree

171 files changed

+20118
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

171 files changed

+20118
-0
lines changed

apps/nextjs-app/.env.example

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
NEXT_PUBLIC_API_URL=http://localhost:8080/api
2+
NEXT_PUBLIC_ENABLE_API_MOCKING=false
3+
NEXT_PUBLIC_MOCK_API_PORT=8080
4+
NEXT_PUBLIC_URL=http://localhost:3000

apps/nextjs-app/.env.example-e2e

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
NEXT_PUBLIC_API_URL=http://localhost:8080/api
2+
NEXT_PUBLIC_ENABLE_API_MOCKING=false
3+
NEXT_PUBLIC_MOCK_API_PORT=8080
4+
NEXT_PUBLIC_URL=http://localhost:3000

apps/nextjs-app/.eslintrc.cjs

Lines changed: 154 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,154 @@
1+
module.exports = {
2+
root: true,
3+
env: {
4+
node: true,
5+
es6: true,
6+
},
7+
parserOptions: { ecmaVersion: 'latest', sourceType: 'module' },
8+
ignorePatterns: [
9+
'node_modules/*',
10+
'public/mockServiceWorker.js',
11+
'generators/*',
12+
],
13+
extends: ['eslint:recommended', 'next/core-web-vitals'],
14+
plugins: ['check-file'],
15+
overrides: [
16+
{
17+
files: ['**/*.ts', '**/*.tsx'],
18+
parser: '@typescript-eslint/parser',
19+
settings: {
20+
react: { version: 'detect' },
21+
'import/resolver': {
22+
typescript: {},
23+
},
24+
},
25+
env: {
26+
browser: true,
27+
node: true,
28+
es6: true,
29+
},
30+
extends: [
31+
'eslint:recommended',
32+
'plugin:import/errors',
33+
'plugin:import/warnings',
34+
'plugin:import/typescript',
35+
'plugin:@typescript-eslint/recommended',
36+
'plugin:react/recommended',
37+
'plugin:react-hooks/recommended',
38+
'plugin:jsx-a11y/recommended',
39+
'plugin:prettier/recommended',
40+
'plugin:testing-library/react',
41+
'plugin:jest-dom/recommended',
42+
'plugin:tailwindcss/recommended',
43+
'plugin:vitest/legacy-recommended',
44+
],
45+
rules: {
46+
'@next/next/no-img-element': 'off',
47+
'import/no-restricted-paths': [
48+
'error',
49+
{
50+
zones: [
51+
// disables cross-feature imports:
52+
// eg. src/features/discussions should not import from src/features/comments, etc.
53+
{
54+
target: './src/features/auth',
55+
from: './src/features',
56+
except: ['./auth'],
57+
},
58+
{
59+
target: './src/features/comments',
60+
from: './src/features',
61+
except: ['./comments'],
62+
},
63+
{
64+
target: './src/features/discussions',
65+
from: './src/features',
66+
except: ['./discussions'],
67+
},
68+
{
69+
target: './src/features/teams',
70+
from: './src/features',
71+
except: ['./teams'],
72+
},
73+
{
74+
target: './src/features/users',
75+
from: './src/features',
76+
except: ['./users'],
77+
},
78+
// enforce unidirectional codebase:
79+
80+
// e.g. src/app can import from src/features but not the other way around
81+
{
82+
target: './src/features',
83+
from: './src/app',
84+
},
85+
86+
// e.g src/features and src/app can import from these shared modules but not the other way around
87+
{
88+
target: [
89+
'./src/components',
90+
'./src/hooks',
91+
'./src/lib',
92+
'./src/types',
93+
'./src/utils',
94+
],
95+
from: ['./src/features', './src/app'],
96+
},
97+
],
98+
},
99+
],
100+
'import/no-cycle': 'error',
101+
'linebreak-style': ['error', 'unix'],
102+
'react/prop-types': 'off',
103+
'import/order': [
104+
'error',
105+
{
106+
groups: [
107+
'builtin',
108+
'external',
109+
'internal',
110+
'parent',
111+
'sibling',
112+
'index',
113+
'object',
114+
],
115+
'newlines-between': 'always',
116+
alphabetize: { order: 'asc', caseInsensitive: true },
117+
},
118+
],
119+
'import/default': 'off',
120+
'import/no-named-as-default-member': 'off',
121+
'import/no-named-as-default': 'off',
122+
'react/react-in-jsx-scope': 'off',
123+
'jsx-a11y/anchor-is-valid': 'off',
124+
'@typescript-eslint/no-unused-vars': ['error'],
125+
'@typescript-eslint/explicit-function-return-type': ['off'],
126+
'@typescript-eslint/explicit-module-boundary-types': ['off'],
127+
'@typescript-eslint/no-empty-function': ['off'],
128+
'@typescript-eslint/no-explicit-any': ['off'],
129+
'prettier/prettier': ['error', {}, { usePrettierrc: true }],
130+
'check-file/filename-naming-convention': [
131+
'error',
132+
{
133+
'src/!(pages)/*.{ts,tsx}': 'KEBAB_CASE',
134+
},
135+
{
136+
ignoreMiddleExtensions: true,
137+
},
138+
],
139+
},
140+
},
141+
{
142+
plugins: ['check-file'],
143+
files: ['src/**/!(__tests__)/*'],
144+
rules: {
145+
'check-file/folder-naming-convention': [
146+
'error',
147+
{
148+
'**/*': 'KEBAB_CASE',
149+
},
150+
],
151+
},
152+
},
153+
],
154+
};

apps/nextjs-app/.gitignore

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
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+
/test-results/
11+
/playwright-report/
12+
/blob-report/
13+
/playwright/.cache/
14+
/e2e/.auth/
15+
16+
# storybook
17+
migration-storybook.log
18+
storybook.log
19+
storybook-static
20+
21+
22+
# production
23+
/dist
24+
25+
# misc
26+
.DS_Store
27+
.env
28+
.env.local
29+
.env.development.local
30+
.env.test.local
31+
.env.production.local
32+
33+
npm-debug.log*
34+
yarn-debug.log*
35+
yarn-error.log*
36+
37+
38+
# local
39+
mocked-db.json
40+
41+
/.next
42+
/.vite
43+
tsconfig.tsbuildinfo

apps/nextjs-app/.prettierignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
*.hbs

apps/nextjs-app/.prettierrc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"singleQuote": true,
3+
"trailingComma": "all",
4+
"printWidth": 80,
5+
"tabWidth": 2,
6+
"useTabs": false
7+
}

apps/nextjs-app/.storybook/main.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
module.exports = {
2+
stories: ['../src/**/*.stories.mdx', '../src/**/*.stories.@(js|jsx|ts|tsx)'],
3+
4+
addons: [
5+
'@storybook/addon-actions',
6+
'@storybook/addon-links',
7+
'@storybook/node-logger',
8+
'@storybook/addon-essentials',
9+
'@storybook/addon-interactions',
10+
'@storybook/addon-docs',
11+
'@storybook/addon-a11y',
12+
],
13+
framework: '@storybook/nextjs',
14+
docs: {
15+
autodocs: 'tag',
16+
},
17+
typescript: {
18+
reactDocgen: 'react-docgen-typescript',
19+
},
20+
};
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import React from 'react';
2+
import '../src/styles/globals.css';
3+
4+
export const parameters = {
5+
actions: { argTypesRegex: '^on[A-Z].*' },
6+
};
7+
8+
export const decorators = [(Story) => <Story />];
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"recommendations": [
3+
"dbaeumer.vscode-eslint",
4+
"esbenp.prettier-vscode",
5+
"dsznajder.es7-react-js-snippets",
6+
"mariusalchimavicius.json-to-ts",
7+
"bradlc.vscode-tailwindcss"
8+
]
9+
}

apps/nextjs-app/.vscode/settings.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"editor.formatOnSave": true,
3+
"editor.codeActionsOnSave": {
4+
"source.fixAll.eslint": "explicit"
5+
}
6+
}

0 commit comments

Comments
 (0)