Use next scripts to start server

- removed svg from webpack (using it directly in code)
- removed unused import in Form.js
- removed unused server.js (using next scripts)
This commit is contained in:
Hauke Tönjes 2021-06-29 15:59:49 +02:00
parent c0415f9d87
commit 094e7f99fa
No known key found for this signature in database
GPG Key ID: 0BF2BC96C9FAAE9E
8 changed files with 4414 additions and 2153 deletions

View File

@ -1,6 +1,3 @@
const PDFJS = require('pdfjs-dist')
PDFJS.GlobalWorkerOptions.workerSrc = `https://cdnjs.cloudflare.com/ajax/libs/pdf.js/${PDFJS.version}/pdf.worker.js`
import jsQR from "jsqr"
import {saveAs} from 'file-saver'
@ -64,7 +61,7 @@ function Form() {
return
}
var code = jsQR(imageData.data, imageData.width, imageData.height, {
let code = jsQR(imageData.data, imageData.width, imageData.height, {
inversionAttempts: 'dontInvert',
})

View File

@ -1,4 +1,3 @@
import Icon from '../public/favicon.svg'
import Link from 'next/link'
export default Logo
@ -6,8 +5,18 @@ export default Logo
function Logo() {
return (
<Link href="/">
<a className="flex flex-row items-center p-3 justify-center space-x-1" >
<Icon className="fill-current" />
<a className="flex flex-row items-center p-3 justify-center space-x-1">
<svg className="fill-current" xmlns="http://www.w3.org/2000/svg" enableBackground="new 0 0 24 24"
height="48px"
viewBox="0 0 24 24" width="48px" fill="#000000">
<g>
<path d="M0,0h24v24H0V0z" fill="none"/>
</g>
<g>
<path
d="M11.3,2.26l-6,2.25C4.52,4.81,4,5.55,4,6.39v4.71c0,5.05,3.41,9.76,8,10.91c4.59-1.15,8-5.86,8-10.91V6.39 c0-0.83-0.52-1.58-1.3-1.87l-6-2.25C12.25,2.09,11.75,2.09,11.3,2.26z M10.23,14.83l-2.12-2.12c-0.39-0.39-0.39-1.02,0-1.41l0,0 c0.39-0.39,1.02-0.39,1.41,0l1.41,1.41l3.54-3.54c0.39-0.39,1.02-0.39,1.41,0l0,0c0.39,0.39,0.39,1.02,0,1.41l-4.24,4.24 C11.26,15.22,10.62,15.22,10.23,14.83z"/>
</g>
</svg>
<h1 className="text-3xl font-bold">
CovidPass
</h1>

View File

@ -1,9 +0,0 @@
module.exports = {
webpack(config) {
config.module.rules.push({
test: /\.svg$/,
use: ['@svgr/webpack'],
});
return config;
},
}

6482
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -4,9 +4,9 @@
"author": "Marvin Sextro <marvin.sextro@gmail.com>",
"private": true,
"scripts": {
"dev": "node server.js",
"dev": "next dev",
"build": "next build",
"start": "NODE_ENV=production node server.js"
"start": "next start"
},
"dependencies": {
"base45-js": "^1.0.1",
@ -26,7 +26,6 @@
"worker-loader": "^3.0.7"
},
"devDependencies": {
"@svgr/webpack": "^5.5.0",
"autoprefixer": "^10.0.4",
"postcss": "^8.1.10",
"tailwindcss": "^2.1.1"

View File

@ -1,14 +1,13 @@
import Document, { Html, Head, Main, NextScript } from 'next/document'
import Document, {Html, Head, Main, NextScript} from 'next/document'
class CustomDocument extends Document {
render() {
return (
<Html lang="en">
<Head />
<Head/>
<body className="bg-gray-200 dark:bg-gray-900 text-gray-800 dark:text-white">
<Main />
<NextScript />
<Main/>
<NextScript/>
</body>
</Html>
)

View File

@ -1 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" enable-background="new 0 0 24 24" height="48px" viewBox="0 0 24 24" width="48px" fill="#000000"><g><path d="M0,0h24v24H0V0z" fill="none"/></g><g><path d="M11.3,2.26l-6,2.25C4.52,4.81,4,5.55,4,6.39v4.71c0,5.05,3.41,9.76,8,10.91c4.59-1.15,8-5.86,8-10.91V6.39 c0-0.83-0.52-1.58-1.3-1.87l-6-2.25C12.25,2.09,11.75,2.09,11.3,2.26z M10.23,14.83l-2.12-2.12c-0.39-0.39-0.39-1.02,0-1.41l0,0 c0.39-0.39,1.02-0.39,1.41,0l1.41,1.41l3.54-3.54c0.39-0.39,1.02-0.39,1.41,0l0,0c0.39,0.39,0.39,1.02,0,1.41l-4.24,4.24 C11.26,15.22,10.62,15.22,10.23,14.83z"/></g></svg>

Before

Width:  |  Height:  |  Size: 588 B

View File

@ -1,25 +0,0 @@
const { createServer } = require('http')
const { parse } = require('url')
const next = require('next')
const dev = process.env.NODE_ENV !== 'production'
const app = next({ dev })
const handle = app.getRequestHandler()
app.prepare().then(() => {
createServer((req, res) => {
const parsedUrl = parse(req.url, true)
const { pathname, query } = parsedUrl
if (pathname === '/a') {
app.render(req, res, '/a', query)
} else if (pathname === '/b') {
app.render(req, res, '/b', query)
} else {
handle(req, res, parsedUrl)
}
}).listen(3000, (err) => {
if (err) throw err
console.log('> Ready on http://localhost:3000')
})
})