Skip to content

Commit 2926d71

Browse files
committed
chore(script): add local server script
1 parent 3eb7c82 commit 2926d71

File tree

4 files changed

+330
-14
lines changed

4 files changed

+330
-14
lines changed

.gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
/dist
33
/example/node_modules
44
/example/dist
5+
/example/server/*
56
/**/.dumi/tmp/*
67
/**/.dumi/theme/*
7-
.dumi/tmp-production
8+
/**/.dumi/tmp-production
89
.DS_Store

app.js

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
/* eslint-disable import/no-extraneous-dependencies */
2+
/* eslint-disable no-console */
3+
const express = require('express');
4+
const path = require('path');
5+
6+
const app = express();
7+
8+
// TODO: adapt publicPath field
9+
app.use(express.static(path.join(__dirname, 'example/dist')));
10+
11+
const port = 3001;
12+
13+
app.listen(port, () => {
14+
console.log(`Server is running on port ${port}`);
15+
});

package.json

+2
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
"scripts": {
2222
"build": "father build",
2323
"build:docs": "cross-env APP_ROOT=example dumi build",
24+
"site": "node app.js",
2425
"dev": "father dev",
2526
"docs": "cross-env APP_ROOT=example dumi dev",
2627
"lint": "pnpm run lint:es && pnpm run lint:css",
@@ -72,6 +73,7 @@
7273
"@utopia/eslint-config-react": "^0.0.13",
7374
"@utopia/prettier-config-base": "^0.0.13",
7475
"cross-env": "^7.0.3",
76+
"express": "^4.18.2",
7577
"father": "^4.2.2",
7678
"father-plugin-dumi-theme": "1.0.0-rc.1",
7779
"husky": "^8.0.3",

0 commit comments

Comments
 (0)