project-structure

This commit is contained in:
Guz
2022-04-02 16:47:03 -03:00
parent 66175968bd
commit d6e86038b7
22 changed files with 2439 additions and 537 deletions

16
.editorconfig Normal file
View File

@@ -0,0 +1,16 @@
# editorconfig.org
root = true
[*]
indent_style = tab
end_of_line = crlf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
[*.md]
trim_trailing_whitespace = false
[*.yml]
indent_style = space
indent_size = 2

41
.eslintignore Normal file
View File

@@ -0,0 +1,41 @@
# Files to be ignored by ESlint and Prettier
pnpm-lock.yaml
sw.js
sw.js.map
workbox-*.js
workbox-*.js.map
# dependencies
/node_modules
/.pnp
.pnp.js
# testing
/coverage
# next.js
/.next/
/out/
# production
/build
# misc
.DS_Store
*.pem
# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*
# local env files
.env.local
.env.development.local
.env.test.local
.env.production.local
# vercel
.vercel

3
.eslintrc Normal file
View File

@@ -0,0 +1,3 @@
{
"extends": ["next/core-web-vitals", "prettier"]
}

2
.gitignore vendored
View File

@@ -32,3 +32,5 @@ yarn-error.log*
# vercel
.vercel
.vercel

7
.prettierrc Normal file
View File

@@ -0,0 +1,7 @@
{
"semi": true,
"singleQuote": true,
"jsxSingleQuote": true,
"useTabs": true,
"endOfLine": "crlf"
}

View File

@@ -1,10 +1,13 @@
/** @type {import('next').NextConfig} */
const withPWA = require('next-pwa')
const runtimeCaching = require('next-pwa/cache')
const withPWA = require('next-pwa');
const runtimeCaching = require('next-pwa/cache');
const withPreact = require('next-plugin-preact');
module.exports = withPWA({
pwa: {
dest: 'public',
runtimeCaching,
},
})
module.exports = withPreact(
withPWA({
pwa: {
dest: 'public',
runtimeCaching,
},
})
);

View File

@@ -1,19 +1,46 @@
{
"private": true,
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start"
},
"dependencies": {
"next": "latest",
"next-pwa": "^5.4.1",
"react": "^17.0.2",
"react-dom": "^17.0.2"
},
"devDependencies": {
"@types/node": "17.0.4",
"@types/react": "17.0.38",
"typescript": "4.5.4"
}
"private": true,
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start",
"build:start": "pnpm run build && pnpm run start",
"lint:js": "next lint --ignore-path .eslintignore .",
"lint:prettier": "prettier --ignore-path .eslintignore .",
"lint": "pnpm run lint:js && pnpm run lint:prettier -- --check",
"lint:fix": "pnpm run lint:js -- --fix && pnpm run lint:prettier -- --write --list-different"
},
"dependencies": {
"next": "latest",
"next-plugin-preact": "^3.0.6",
"next-pwa": "^5.4.1",
"preact": "^10.7.0",
"preact-render-to-string": "^5.1.20",
"react": "npm:@preact/compat@^17.0.2",
"react-dom": "npm:@preact/compat@^17.0.2",
"react-ssr-prepass": "npm:preact-ssr-prepass@^1.2.0"
},
"devDependencies": {
"@babel/core": ">=7.0.0 <8.0.0",
"@prefresh/babel-plugin": "^0.4.0",
"@types/node": "17.0.4",
"@types/react": "17.0.38",
"autoprefixer": "^10.4.4",
"cssnano": "^5.1.7",
"eslint": "^8.12.0",
"eslint-config-next": "^12.1.4",
"eslint-config-prettier": "^8.5.0",
"postcss": "^8.4.12",
"postcss-import": "^14.1.0",
"prettier": "^2.6.1",
"prettier-plugin-tailwindcss": "^0.1.8",
"tailwindcss": "^3.0.23",
"typescript": "4.5.4",
"webpack": ">=5.9.0 <6.0.0"
},
"peerDependencies": {
"@babel/core": ">=7.0.0 <8.0.0",
"@prefresh/babel-plugin": "^0.4.0",
"webpack": ">=5.9.0 <6.0.0"
}
}

View File

@@ -1,38 +0,0 @@
import Head from 'next/head'
import '../styles/globals.css'
import { AppProps } from 'next/app'
export default function MyApp({ Component, pageProps }: AppProps) {
return (
<>
<Head>
<meta charSet="utf-8" />
<meta httpEquiv="X-UA-Compatible" content="IE=edge" />
<meta
name="viewport"
content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no"
/>
<meta name="description" content="Description" />
<meta name="keywords" content="Keywords" />
<title>Next.js PWA Example</title>
<link rel="manifest" href="/manifest.json" />
<link
href="/icons/favicon-16x16.png"
rel="icon"
type="image/png"
sizes="16x16"
/>
<link
href="/icons/favicon-32x32.png"
rel="icon"
type="image/png"
sizes="32x32"
/>
<link rel="apple-touch-icon" href="/apple-icon.png"></link>
<meta name="theme-color" content="#317EFB" />
</Head>
<Component {...pageProps} />
</>
)
}

View File

@@ -1,59 +0,0 @@
import styles from '../styles/Home.module.css'
export default function Home() {
return (
<div className={styles.container}>
<main className={styles.main}>
<h1 className={styles.title}>
Welcome to <a href="https://nextjs.org">Next.js!</a>
</h1>
<p className={styles.description}>
Get started by editing{' '}
<code className={styles.code}>pages/index.js</code>
</p>
<div className={styles.grid}>
<a href="https://nextjs.org/docs" className={styles.card}>
<h3>Documentation &rarr;</h3>
<p>Find in-depth information about Next.js features and API.</p>
</a>
<a href="https://nextjs.org/learn" className={styles.card}>
<h3>Learn &rarr;</h3>
<p>Learn about Next.js in an interactive course with quizzes!</p>
</a>
<a
href="https://github.com/vercel/next.js/tree/canary/examples"
className={styles.card}
>
<h3>Examples &rarr;</h3>
<p>Discover and deploy boilerplate example Next.js projects.</p>
</a>
<a
href="https://vercel.com/new?utm_source=create-next-app&utm_medium=default-template&utm_campaign=create-next-app"
className={styles.card}
>
<h3>Deploy &rarr;</h3>
<p>
Instantly deploy your Next.js site to a public URL with Vercel.
</p>
</a>
</div>
</main>
<footer className={styles.footer}>
<a
href="https://vercel.com?utm_source=create-next-app&utm_medium=default-template&utm_campaign=create-next-app"
target="_blank"
rel="noopener noreferrer"
>
Powered by{' '}
<img src="/vercel.svg" alt="Vercel Logo" className={styles.logo} />
</a>
</footer>
</div>
)
}

2297
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff

9
postcss.config.js Normal file
View File

@@ -0,0 +1,9 @@
module.exports = {
plugins: {
'postcss-import': {},
'tailwindcss/nesting': {},
tailwindcss: {},
autoprefixer: {},
...(process.env.NODE_ENV === 'production' ? { cssnano: {} } : {}),
}
}

View File

@@ -1,53 +1,53 @@
{
"name": "Next.JS Progressive Web App",
"short_name": "Next PWA",
"theme_color": "#ffffff",
"background_color": "#004740",
"display": "fullscreen",
"orientation": "portrait",
"scope": "/",
"start_url": "/",
"icons": [
{
"src": "icons/icon-72x72.png",
"sizes": "72x72",
"type": "image/png"
},
{
"src": "icons/icon-96x96.png",
"sizes": "96x96",
"type": "image/png"
},
{
"src": "icons/icon-128x128.png",
"sizes": "128x128",
"type": "image/png"
},
{
"src": "icons/icon-144x144.png",
"sizes": "144x144",
"type": "image/png"
},
{
"src": "icons/icon-152x152.png",
"sizes": "152x152",
"type": "image/png"
},
{
"src": "icons/icon-192x192.png",
"sizes": "192x192",
"type": "image/png"
},
{
"src": "icons/icon-384x384.png",
"sizes": "384x384",
"type": "image/png"
},
{
"src": "icons/icon-512x512.png",
"sizes": "512x512",
"type": "image/png"
}
],
"splash_pages": null
"name": "Next.JS Progressive Web App",
"short_name": "Next PWA",
"theme_color": "#ffffff",
"background_color": "#004740",
"display": "fullscreen",
"orientation": "portrait",
"scope": "/",
"start_url": "/",
"icons": [
{
"src": "icons/icon-72x72.png",
"sizes": "72x72",
"type": "image/png"
},
{
"src": "icons/icon-96x96.png",
"sizes": "96x96",
"type": "image/png"
},
{
"src": "icons/icon-128x128.png",
"sizes": "128x128",
"type": "image/png"
},
{
"src": "icons/icon-144x144.png",
"sizes": "144x144",
"type": "image/png"
},
{
"src": "icons/icon-152x152.png",
"sizes": "152x152",
"type": "image/png"
},
{
"src": "icons/icon-192x192.png",
"sizes": "192x192",
"type": "image/png"
},
{
"src": "icons/icon-384x384.png",
"sizes": "384x384",
"type": "image/png"
},
{
"src": "icons/icon-512x512.png",
"sizes": "512x512",
"type": "image/png"
}
],
"splash_pages": null
}

1
public/sw.js Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

38
src/pages/_app.tsx Normal file
View File

@@ -0,0 +1,38 @@
import Head from 'next/head';
import '../styles/globals.css';
import { AppProps } from 'next/app';
export default function MyApp({ Component, pageProps }: AppProps) {
return (
<>
<Head>
<meta charSet='utf-8' />
<meta httpEquiv='X-UA-Compatible' content='IE=edge' />
<meta
name='viewport'
content='width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no'
/>
<meta name='description' content='Description' />
<meta name='keywords' content='Keywords' />
<title>Next.js PWA Example</title>
<link rel='manifest' href='/manifest.json' />
<link
href='/icons/favicon-16x16.png'
rel='icon'
type='image/png'
sizes='16x16'
/>
<link
href='/icons/favicon-32x32.png'
rel='icon'
type='image/png'
sizes='32x32'
/>
<link rel='apple-touch-icon' href='/apple-icon.png'></link>
<meta name='theme-color' content='#317EFB' />
</Head>
<Component {...pageProps} />
</>
);
}

View File

@@ -1,8 +1,8 @@
// Next.js API route support: https://nextjs.org/docs/api-routes/introduction
import { NextApiRequest, NextApiResponse } from 'next'
import { NextApiRequest, NextApiResponse } from 'next';
const hello = (req: NextApiRequest, res: NextApiResponse) => {
res.status(200).json({ name: 'John Doe' })
}
res.status(200).json({ name: 'John Doe' });
};
export default hello
export default hello;

86
src/pages/index.tsx Normal file
View File

@@ -0,0 +1,86 @@
import type { NextPage } from 'next';
import Head from 'next/head';
import Image from 'next/image';
const Home: NextPage = () => {
return (
<div className='flex min-h-screen flex-col items-center justify-center py-2'>
<Head>
<title>Create Next App</title>
<link rel='icon' href='/favicon.ico' />
</Head>
<main className='flex w-full flex-1 flex-col items-center justify-center px-20 text-center'>
<h1 className='text-6xl font-bold'>
Welcome to{' '}
<a className='text-blue-600' href='https://nextjs.org'>
Next.js!
</a>
</h1>
<p className='mt-3 text-2xl'>
Get started by editing{' '}
<code className='rounded-md bg-gray-100 p-3 font-mono text-lg'>
pages/index.tsx
</code>
</p>
<div className='mt-6 flex max-w-4xl flex-wrap items-center justify-around sm:w-full'>
<a
href='https://nextjs.org/docs'
className='mt-6 w-96 rounded-xl border p-6 text-left hover:text-blue-600 focus:text-blue-600'
>
<h3 className='text-2xl font-bold'>Documentation &rarr;</h3>
<p className='mt-4 text-xl'>
Find in-depth information about Next.js features and API.
</p>
</a>
<a
href='https://nextjs.org/learn'
className='mt-6 w-96 rounded-xl border p-6 text-left hover:text-blue-600 focus:text-blue-600'
>
<h3 className='text-2xl font-bold'>Learn &rarr;</h3>
<p className='mt-4 text-xl'>
Learn about Next.js in an interactive course with quizzes!
</p>
</a>
<a
href='https://github.com/vercel/next.js/tree/canary/examples'
className='mt-6 w-96 rounded-xl border p-6 text-left hover:text-blue-600 focus:text-blue-600'
>
<h3 className='text-2xl font-bold'>Examples &rarr;</h3>
<p className='mt-4 text-xl'>
Discover and deploy boilerplate example Next.js projects.
</p>
</a>
<a
href='https://vercel.com/import?filter=next.js&utm_source=create-next-app&utm_medium=default-template&utm_campaign=create-next-app'
className='mt-6 w-96 rounded-xl border p-6 text-left hover:text-blue-600 focus:text-blue-600'
>
<h3 className='text-2xl font-bold'>Deploy &rarr;</h3>
<p className='mt-4 text-xl'>
Instantly deploy your Next.js site to a public URL with Vercel.
</p>
</a>
</div>
</main>
<footer className='flex h-24 w-full items-center justify-center border-t'>
<a
className='flex items-center justify-center gap-2'
href='https://vercel.com?utm_source=create-next-app&utm_medium=default-template&utm_campaign=create-next-app'
target='_blank'
rel='noopener noreferrer'
>
Powered by{' '}
<Image src='/vercel.svg' alt='Vercel Logo' width={72} height={16} />
</a>
</footer>
</div>
);
};
export default Home;

3
src/styles/globals.css Normal file
View File

@@ -0,0 +1,3 @@
@import 'tailwindcss/base';
@import 'tailwindcss/components';
@import 'tailwindcss/utilities';

View File

@@ -1,123 +0,0 @@
.container {
min-height: 100vh;
padding: 0 0.5rem;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}
.main {
padding: 5rem 0;
flex: 1;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}
.footer {
width: 100%;
height: 100px;
border-top: 1px solid #eaeaea;
display: flex;
justify-content: center;
align-items: center;
}
.footer img {
margin-left: 0.5rem;
}
.footer a {
display: flex;
justify-content: center;
align-items: center;
}
.title a {
color: #0070f3;
text-decoration: none;
}
.title a:hover,
.title a:focus,
.title a:active {
text-decoration: underline;
}
.title {
margin: 0;
line-height: 1.15;
font-size: 4rem;
}
.title,
.description {
text-align: center;
}
.description {
line-height: 1.5;
font-size: 1.5rem;
}
.code {
background: #fafafa;
border-radius: 5px;
padding: 0.75rem;
font-size: 1.1rem;
font-family: Menlo, Monaco, Lucida Console, Liberation Mono, DejaVu Sans Mono,
Bitstream Vera Sans Mono, Courier New, monospace;
}
.grid {
display: flex;
align-items: center;
justify-content: center;
flex-wrap: wrap;
max-width: 800px;
margin-top: 3rem;
}
.card {
margin: 1rem;
flex-basis: 45%;
padding: 1.5rem;
text-align: left;
color: inherit;
text-decoration: none;
border: 1px solid #eaeaea;
border-radius: 10px;
transition: color 0.15s ease, border-color 0.15s ease;
}
.card:hover,
.card:focus,
.card:active {
color: #0070f3;
border-color: #0070f3;
}
.card h3 {
margin: 0 0 1rem 0;
font-size: 1.5rem;
}
.card p {
margin: 0;
font-size: 1.25rem;
line-height: 1.5;
}
.logo {
height: 1em;
}
@media (max-width: 600px) {
.grid {
width: 100%;
flex-direction: column;
}
}

View File

@@ -1,16 +0,0 @@
html,
body {
padding: 0;
margin: 0;
font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Oxygen,
Ubuntu, Cantarell, Fira Sans, Droid Sans, Helvetica Neue, sans-serif;
}
a {
color: inherit;
text-decoration: none;
}
* {
box-sizing: border-box;
}

10
tailwind.config.js Normal file
View File

@@ -0,0 +1,10 @@
module.exports = {
content: [
'./src/pages/**/*.{js,ts,jsx,tsx}',
'./src/components/**/*.{js,ts,jsx,tsx}',
],
theme: {
extend: {},
},
plugins: [],
}

View File

@@ -1,20 +1,20 @@
{
"compilerOptions": {
"target": "es5",
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"skipLibCheck": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"noEmit": true,
"esModuleInterop": true,
"module": "esnext",
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "preserve",
"incremental": true
},
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"],
"exclude": ["node_modules"]
"compilerOptions": {
"target": "es5",
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"skipLibCheck": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"noEmit": true,
"esModuleInterop": true,
"module": "esnext",
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "preserve",
"incremental": true
},
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"],
"exclude": ["node_modules"]
}