From 68dd4e12764e4a97a57216a6a45ffe5c91c715b8 Mon Sep 17 00:00:00 2001 From: bangbang93 Date: Wed, 21 Dec 2022 13:59:03 +0800 Subject: [PATCH] =?UTF-8?q?chore:=20=E4=BC=98=E5=8C=96import=EF=BC=8C?= =?UTF-8?q?=E4=BD=BF=E7=94=A8node=2018=E5=86=85=E7=BD=AE=E7=9A=84source=20?= =?UTF-8?q?map=20support?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfile | 2 +- package-lock.json | 15 ++++++++++----- package.json | 3 +-- src/index.ts | 7 +++---- src/measure.route.ts | 2 +- 5 files changed, 16 insertions(+), 13 deletions(-) diff --git a/Dockerfile b/Dockerfile index e997d4c..446fbe4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -23,4 +23,4 @@ COPY nginx/ /opt/openbmclapi/nginx ENV CLUSTER_PORT=4000 EXPOSE $CLUSTER_PORT VOLUME /opt/openbmclapi/cache -CMD ["node", "dist/index.js"] +CMD ["node", "--enable-source-maps", "dist/index.js"] diff --git a/package-lock.json b/package-lock.json index 458f41a..5fff017 100644 --- a/package-lock.json +++ b/package-lock.json @@ -22,8 +22,7 @@ "morgan": "^1.9.1", "ms": "^2.1.2", "progress": "^2.0.3", - "socket.io-client": "^4.5.1", - "source-map-support": "^0.5.21" + "socket.io-client": "^4.5.1" }, "bin": { "openbmclapi": "dist/index.js" @@ -1022,7 +1021,8 @@ "node_modules/buffer-from": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz", - "integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==" + "integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==", + "dev": true }, "node_modules/bytes": { "version": "3.1.2", @@ -3988,6 +3988,7 @@ "version": "0.6.1", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true, "engines": { "node": ">=0.10.0" } @@ -3996,6 +3997,7 @@ "version": "0.5.21", "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.21.tgz", "integrity": "sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w==", + "dev": true, "dependencies": { "buffer-from": "^1.0.0", "source-map": "^0.6.0" @@ -5278,7 +5280,8 @@ "buffer-from": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz", - "integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==" + "integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==", + "dev": true }, "bytes": { "version": "3.1.2", @@ -7527,12 +7530,14 @@ "source-map": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", - "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==" + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true }, "source-map-support": { "version": "0.5.21", "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.21.tgz", "integrity": "sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w==", + "dev": true, "requires": { "buffer-from": "^1.0.0", "source-map": "^0.6.0" diff --git a/package.json b/package.json index bb9f5ee..c197706 100644 --- a/package.json +++ b/package.json @@ -33,8 +33,7 @@ "morgan": "^1.9.1", "ms": "^2.1.2", "progress": "^2.0.3", - "socket.io-client": "^4.5.1", - "source-map-support": "^0.5.21" + "socket.io-client": "^4.5.1" }, "devDependencies": { "@tsconfig/node18": "^1.0.1", diff --git a/src/index.ts b/src/index.ts index 684cdc4..cc5c691 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,12 +1,11 @@ import cluster from 'cluster' import {config} from 'dotenv' -import * as fs from 'fs' +import {readFileSync} from 'fs' import ms from 'ms' -import * as path from 'path' -import 'source-map-support' +import {join} from 'path' import {bootstrap} from './bootstrap' -const packageJson = JSON.parse(fs.readFileSync(path.join(__dirname, '../package.json'), 'utf8')) +const packageJson = JSON.parse(readFileSync(join(__dirname, '../package.json'), 'utf8')) config() if (process.env.NO_DAEMON || !cluster.isPrimary) { diff --git a/src/measure.route.ts b/src/measure.route.ts index 9a66a5d..f08c576 100644 --- a/src/measure.route.ts +++ b/src/measure.route.ts @@ -1,4 +1,4 @@ -import express = require('express') +import express from 'express' const router = express.Router()