Added nextjs config.

This commit is contained in:
SamTV12345 2024-02-24 10:35:46 +01:00
parent 55d41067b9
commit 131c7e322b
9 changed files with 79 additions and 24 deletions

5
src/next-env.d.ts vendored Normal file
View file

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

View file

@ -15,13 +15,18 @@ const handle = app.getRequestHandler()
*/
exports.expressCreateServer = (hookName:string, args: ArgsExpressType, cb:Function): any => {
args.app.get('/admin-new', (req:any, res:any) => {
return app.render(req, res, '/admin', req.query)
app.prepare().then(()=>{
args.app.get('/admin-new', (req:any, res:any) => {
return app.render(req, res, '/admin/admin', req.query)
})
args.app.all('*', (req:any, res:any) => {
return handle(req, res)
})
})
args.app.all('/admin/*', (req:any, res:any) => {
return handle(req, res)
})
args.app.get('/admin', (req:any, res:any) => {
if ('/' !== req.path[req.path.length - 1]) return res.redirect('./admin/');

View file

@ -68,6 +68,7 @@
"socket.io": "^3.1.2",
"socket.io-client": "^4.7.4",
"superagent": "^8.1.2",
"tailwindcss": "^3.4.1",
"terser": "^5.28.1",
"threads": "^1.7.0",
"tinycon": "0.6.8",
@ -88,6 +89,7 @@
"@types/jsdom": "^21.1.6",
"@types/mocha": "^10.0.6",
"@types/node": "^20.11.20",
"@types/react": "18.2.58",
"@types/sinon": "^17.0.3",
"@types/supertest": "^6.0.2",
"@types/underscore": "^1.11.15",

View file

@ -1,7 +0,0 @@
export const Admin = ()=>{
return(
<div>
<h1>Admin</h1>
</div>
)
}

10
src/pages/admin/admin.tsx Normal file
View file

@ -0,0 +1,10 @@
export const Admin = ()=>{
return(
<div>
<h1 className="text-red-50">Admin12345</h1>
</div>
)
}
export default Admin

6
src/postcss.config.js Normal file
View file

@ -0,0 +1,6 @@
module.exports = {
plugins: {
tailwindcss: {},
autoprefixer: {},
},
};

20
src/tailwind.config.ts Normal file
View file

@ -0,0 +1,20 @@
import type { Config } from "tailwindcss";
const config: Config = {
content: [
"./src/pages/**/*.{js,ts,jsx,tsx,mdx}",
"./src/components/**/*.{js,ts,jsx,tsx,mdx}",
"./src/app/**/*.{js,ts,jsx,tsx,mdx}",
],
theme: {
extend: {
backgroundImage: {
"gradient-radial": "radial-gradient(var(--tw-gradient-stops))",
"gradient-conic":
"conic-gradient(from 180deg at 50% 50%, var(--tw-gradient-stops))",
},
},
},
plugins: [],
};
export default config;

View file

@ -2,18 +2,31 @@
"compilerOptions": {
/* Visit https://aka.ms/tsconfig to read more about this file */
"moduleDetection": "force",
"lib": ["ES2023"],
"lib": [
"ES2023"
],
/* Language and Environment */
"target": "es6", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
/* Modules */
"module": "commonjs", /* Specify what module code is generated. */
"esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */
"forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */
/* Type Checking */
"strict": true, /* Enable all strict type-checking options. */
/* Completeness */
"target": "es6", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. *//* Modules */
"module": "commonjs", /* Specify what module code is generated. */
"esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */
"forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. *//* Type Checking */
"strict": true, /* Enable all strict type-checking options. *//* Completeness */
"skipLibCheck": true,
/* Skip type checking all .d.ts files. */
"jsx": "react"
}
"jsx": "preserve",
"allowJs": true,
"noEmit": true,
"incremental": true,
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true
},
"include": [
"next-env.d.ts",
"**/*.ts",
"**/*.tsx"
],
"exclude": [
"node_modules"
]
}