From 093312ea8c9264a9551129ded5779d622056ca7a Mon Sep 17 00:00:00 2001 From: imsyy Date: Tue, 4 Jun 2024 10:44:19 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A7=20build:=20fix=20document?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .npmignore | 1 + package.json | 105 ++++++++++++++++++++++++++------------------------- src/index.ts | 30 +++++++-------- 3 files changed, 69 insertions(+), 67 deletions(-) create mode 100644 .npmignore diff --git a/.npmignore b/.npmignore new file mode 100644 index 0000000..b512c09 --- /dev/null +++ b/.npmignore @@ -0,0 +1 @@ +node_modules \ No newline at end of file diff --git a/package.json b/package.json index 561b96d..97287d9 100644 --- a/package.json +++ b/package.json @@ -1,52 +1,53 @@ -{ - "name": "dailyhot_api", - "version": "2.0.0-rc.2", - "description": "An Api on Today's Hot list", - "keywords": [ - "API", - "RSS" - ], - "homepage": "https://github.com/imsyy/DailyHotApi#readme", - "bugs": { - "url": "https://github.com/imsyy/DailyHotApi/issues" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/DIYgod/RSSHub.git" - }, - "license": "MIT", - "author": "imsyy", - "main": "src/index.ts", - "scripts": { - "format": "prettier --write .", - "lint": "eslint . --ext .js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts,.vue --fix", - "dev": "tsx watch --no-cache src/index.ts", - "dev:cache": "tsx watch src/index.ts", - "build": "tsc --project tsconfig.json", - "start": "tsx src/index.ts" - }, - "type": "module", - "dependencies": { - "@hono/node-server": "^1.9.1", - "axios": "^1.6.8", - "cheerio": "1.0.0-rc.12", - "dotenv": "^16.4.5", - "feed": "^4.2.2", - "hono": "^4.2.2", - "md5": "^2.3.0", - "node-cache": "^5.1.2", - "winston": "^3.13.0" - }, - "devDependencies": { - "@types/node": "^20.12.5", - "@typescript-eslint/eslint-plugin": "^7.5.0", - "@typescript-eslint/parser": "^7.5.0", - "eslint": "^8.57.0", - "prettier": "^3.2.5", - "tsx": "^3.14.0", - "typescript": "^5.4.4" - }, - "engines": { - "node": ">=20" - } -} +{ + "name": "dailyhot-api", + "version": "2.0.0-rc.3", + "description": "An Api on Today's Hot list", + "keywords": [ + "API", + "RSS" + ], + "homepage": "https://github.com/imsyy/DailyHotApi#readme", + "bugs": { + "url": "https://github.com/imsyy/DailyHotApi/issues" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/imsyy/DailyHotApi.git" + }, + "license": "MIT", + "author": "imsyy", + "main": "dist/index.js", + "types": "dist/types.js", + "scripts": { + "format": "prettier --write .", + "lint": "eslint . --ext .js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts,.vue --fix", + "dev": "tsx watch --no-cache src/index.ts", + "dev:cache": "tsx watch src/index.ts", + "build": "tsc --project tsconfig.json", + "start": "tsx src/index.ts" + }, + "type": "module", + "dependencies": { + "@hono/node-server": "^1.9.1", + "axios": "^1.6.8", + "cheerio": "1.0.0-rc.12", + "dotenv": "^16.4.5", + "feed": "^4.2.2", + "hono": "^4.2.2", + "md5": "^2.3.0", + "node-cache": "^5.1.2", + "winston": "^3.13.0" + }, + "devDependencies": { + "@types/node": "^20.12.5", + "@typescript-eslint/eslint-plugin": "^7.5.0", + "@typescript-eslint/parser": "^7.5.0", + "eslint": "^8.57.0", + "prettier": "^3.2.5", + "tsx": "^3.14.0", + "typescript": "^5.4.4" + }, + "engines": { + "node": ">=20" + } +} diff --git a/src/index.ts b/src/index.ts index 60274fc..56e1009 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,15 +1,15 @@ -import { serve } from "@hono/node-server"; -import { config } from "./config.js"; -import logger from "./utils/logger.js"; -import app from "./app.js"; - -// 启动服务器 -const server = serve({ - fetch: app.fetch, - port: config.PORT, -}); - -logger.info(`🔥 DailyHot API 成功在端口 ${config.PORT} 上运行`); -logger.info(`🔗 Local: 👉 http://localhost:${config.PORT}`); - -export default server; +import { serve } from "@hono/node-server"; +import { config } from "./config.js"; +import logger from "./utils/logger.js"; +import app from "./app.js"; + +// 启动服务器 +const serveHotApi = serve({ + fetch: app.fetch, + port: config.PORT, +}); + +logger.info(`🔥 DailyHot API 成功在端口 ${config.PORT} 上运行`); +logger.info(`🔗 Local: 👉 http://localhost:${config.PORT}`); + +export default serveHotApi;