Skip to content

Commit

Permalink
chore: run server:dev use node instead of vercel (#2933)
Browse files Browse the repository at this point in the history
  • Loading branch information
lizheming authored Jan 29, 2025
1 parent edc560c commit 595eff7
Show file tree
Hide file tree
Showing 7 changed files with 71 additions and 6 deletions.
4 changes: 4 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
LEAN_ID=<Your LeanCloud ID>
LEAN_KEY=<Your LeanCloud Key>
LEAN_MASTER_KEY=<Your LeanCloud Master Key>
LEAN_SERVER=<Your LeanCloud Server>
4 changes: 2 additions & 2 deletions docs/src/advanced/contribution.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ order: -1

::: tip

为了使 `@waline/server` 能在本地正常运行,你需要配置必要的本地环境变量至 `example/.env`
为了使 `@waline/server` 能在本地正常运行,你需要配置必要的本地环境变量至 `.env`

`example/.env.example` 我们准备了示例供你参考
`.env.example` 我们准备了示例供你参考

:::
4 changes: 2 additions & 2 deletions docs/src/en/advanced/contribution.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ If you want to contribute to waline, here is a guide.

::: tip

In order to run `@waline/server` locally, you need to configure some local environment variables to `example/.env`.
In order to run `@waline/server` locally, you need to configure some local environment variables to `.env`.

We provide an example for you in `example/.env.example`.
We provide an example for you in `.env.example`.

:::
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@
"packages:check-update": "pnpm dlx npm-check-updates --deep",
"packages:update": "pnpm dlx npm-check-updates --deep -u && pnpm i && pnpm -r up",
"prepare": "husky",
"server:dev": "vercel dev ./example --listen 9090",
"server:dev": "pnpm --dir=packages/server dev",
"server:vercel": "vercel dev ./example --listen 9090",
"test": "vitest"
},
"nano-staged": {
Expand Down
29 changes: 29 additions & 0 deletions packages/server/development.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
const path = require('node:path');

require('dotenv').config({
path: path.join(__dirname, '../../.env'),
});

const watcher = require('think-watcher');
const Application = require('thinkjs');

const instance = new Application({
ROOT_PATH: __dirname,
APP_PATH: path.join(__dirname, 'src'),
proxy: false,
watcher: watcher,
env: 'development',
});

instance.run();

let config = {};

try {
config = require('./config.js');
} catch {
// do nothing
}
for (const k in config) {
think.config(k, config[k]);
}
9 changes: 8 additions & 1 deletion packages/server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
},
"license": "MIT",
"author": "lizheming <[email protected]>",
"scripts": {
"dev": "node development.js 9090"
},
"dependencies": {
"@cloudbase/node-sdk": "^3.4.0",
"@koa/cors": "^5.0.0",
Expand Down Expand Up @@ -51,8 +54,12 @@
"thinkjs": "^3.2.15",
"ua-parser-js": "^2.0.0"
},
"devDependencies": {
"dotenv": "^16.4.7",
"think-watcher": "^3.0.4"
},
"engines": {
"node": ">=16"
"node": ">=20"
},
"publishConfig": {
"provenance": true
Expand Down
24 changes: 24 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 595eff7

Please sign in to comment.