refactor: directory structure for server and web

This commit is contained in:
tsukino
2024-02-20 21:46:22 +08:00
committed by tsukino
parent 2b7b747266
commit 7ddd5674ca
28 changed files with 13 additions and 12 deletions

View File

@@ -3,6 +3,6 @@ node_modules
wasm
tlsn
postcss.config.js
webpack.config.js
webpack.web.config.js
*.json
*.scss

View File

@@ -4,12 +4,12 @@
"description": "",
"main": "index.js",
"scripts": {
"build:ui": "NODE_ENV=production webpack --config webpack.config.js",
"build:ui": "NODE_ENV=production webpack --config webpack.web.config.js",
"build:server": "NODE_ENV=production webpack --config webpack.server.config.js",
"watch:server": "webpack --config webpack.server.config.js --watch",
"nodemon:server": "nodemon build/server/index.js",
"nodemon:server": "nodemon build/server/index.bundle.js",
"dev:server": "NODE_ENV=development concurrently npm:watch:server npm:nodemon:server",
"dev:ui": "NODE_ENV=development webpack-dev-server --config webpack.config.js --hot"
"dev:ui": "NODE_ENV=development webpack-dev-server --config webpack.web.config.js --hot"
},
"repository": {
"type": "git",

View File

@@ -1,3 +1,3 @@
import express from 'express';
console.log('hi')
console.log('hi');

View File

@@ -1,6 +1,6 @@
/** @type {import('tailwindcss').Config} */
module.exports = {
content: ['./src/**/*.{js,jsx,ts,tsx}'],
content: ['./web/**/*.{js,jsx,ts,tsx}'],
theme: {
extend: {
colors: {

View File

@@ -15,6 +15,8 @@
"noEmit": false,
"jsx": "react"
},
"include": ["src"],
"include": [
"web"
],
"exclude": ["build", "node_modules"]
}

View File

@@ -37,7 +37,6 @@ var options = {
],
},
plugins: [
isDevelopment && new ReactRefreshWebpackPlugin(),
new CleanWebpackPlugin({ verbose: false }),
new webpack.ProgressPlugin(),
new webpack.EnvironmentPlugin(["NODE_ENV"]),

View File

@@ -33,11 +33,11 @@ var options = {
/ResizeObserver loop completed with undelivered notifications/
],
entry: {
index: path.join(__dirname, "src", "index.tsx"),
index: path.join(__dirname, "web", "index.tsx"),
},
output: {
filename: "[name].bundle.js",
path: path.resolve(__dirname, "build"),
path: path.resolve(__dirname, "build", "ui"),
clean: true,
publicPath: ASSET_PATH,
},
@@ -46,7 +46,7 @@ var options = {
{
// look for .css or .scss files
test: /\.(css|scss)$/,
// in the `src` directory
// in the `web` directory
use: [
{
loader: "style-loader",
@@ -132,7 +132,7 @@ var options = {
patterns: [
{
from: "node_modules/tlsn-js/build",
to: path.join(__dirname, "build"),
to: path.join(__dirname, "build", "ui"),
force: true,
},
]