Skip to content

Commit 16eaa47

Browse files
authored
Merge pull request #1 from decayedCell/setup-phase-1
MTM Setup phase 1
2 parents b5598f2 + a2784ef commit 16eaa47

26 files changed

+9197
-329
lines changed

.eslintrc.json

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"extends": ["next/core-web-vitals", "prettier"]
3+
}

.prettierrc.json

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"singleQuote": true,
3+
"trailingComma": "es5",
4+
"bracketSpacing": false,
5+
"jsxBracketSameLine": true,
6+
"printWidth": 80
7+
}

.vscode/settings.json

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"editor.codeActionsOnSave": {
3+
"source.fixAll.eslint": true
4+
},
5+
"editor.formatOnSave": true,
6+
"editor.defaultFormatter": "esbenp.prettier-vscode"
7+
}

Dockerfile

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
FROM node:18-alpine AS deps
2+
RUN apk add --no-cache libc6-compat
3+
WORKDIR /app
4+
5+
COPY package.json package-lock.json ./
6+
RUN npm install --production
7+
8+
FROM node:18-alpine AS builder
9+
WORKDIR /app
10+
COPY --from=deps /app/node_modules ./node_modules
11+
COPY . .
12+
13+
ENV NEXT_TELEMTRY_DISABLED 1
14+
15+
RUN npm run build
16+
17+
FROM node:18-alpine AS runner
18+
WORKDIR /app
19+
20+
ENV NODE_ENV production
21+
ENV NEXT_TELEMETRY_DISABLED 1
22+
23+
RUN addgroup --system --gid 1001 nodejs
24+
RUN adduser --system --uid 1001 nextjs
25+
26+
COPY --from=builder --chown=nextjs:nodejs /app/.next ./.next
27+
COPY --from=builder /app/node_modules ./node_modules
28+
COPY --from=builder /app/package.json ./package.json
29+
30+
USER nextjs
31+
32+
EXPOSE 3000
33+
34+
ENV PORT 3000
35+
36+
CMD ["npm", "start"]

__tests__/index.test.tsx

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import {render, screen} from '@testing-library/react';
2+
import Home from '../pages';
3+
import '@testing-library/jest-dom';
4+
5+
describe('Home', () => {
6+
it('renders a heading', () => {
7+
render(<Home />);
8+
9+
const heading = screen.getByRole('heading', {
10+
name: /Lyrify/,
11+
});
12+
13+
expect(heading).toBeInTheDocument();
14+
});
15+
});

components/layout.module.scss

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
.container {
2+
display: flex;
3+
justify-content: center;
4+
align-items: center;
5+
}

components/layout.tsx

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import {ReactElement} from 'react';
2+
3+
import styles from './layout.module.scss';
4+
5+
interface LayoutProps {
6+
children: React.ReactNode;
7+
}
8+
9+
export default function Layout({children}: LayoutProps) {
10+
return <div className={styles.container}>{children}</div>;
11+
}

docker-compose.yml

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
version: '3.8'
2+
services:
3+
web:
4+
build:
5+
context: ./
6+
target: runner
7+
volumes:
8+
- .:/app
9+
command: npm run dev
10+
ports:
11+
- '3000:3000'
12+
environment:
13+
NODE_ENV: development

jest.config.mjs

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import nextJest from 'next/jest.js';
2+
3+
const createJestConfig = nextJest({
4+
dir: './',
5+
});
6+
7+
// Add any custom config to be passed to Jest
8+
/** @type {import('jest').Config} */
9+
const config = {
10+
// Add more setup options before each test is run
11+
// setupFilesAfterEnv: ['<rootDir>/jest.setup.js'],
12+
13+
testEnvironment: 'jest-environment-jsdom',
14+
};
15+
16+
// createJestConfig is exported this way to ensure that next/jest can load the Next.js config which is async
17+
export default createJestConfig(config);

next-env.d.ts

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
/// <reference types="next" />
2+
/// <reference types="next/image-types/global" />
3+
4+
// NOTE: This file should not be edited
5+
// see https://nextjs.org/docs/basic-features/typescript for more information.

next-i18next.config.js

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
module.exports = {
2+
i18n: {
3+
defaultLocale: 'en',
4+
locales: ['en'],
5+
},
6+
};

next.config.js

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
const {i18n} = require('./next-i18next.config');
2+
3+
module.exports = {
4+
i18n,
5+
};

0 commit comments

Comments
 (0)