diff --git a/package.json b/package.json index b0df43ffa..0aac4c860 100644 --- a/package.json +++ b/package.json @@ -205,7 +205,6 @@ "proxy": "^1.0.2", "resolve-tspaths": "^0.2.1", "socket.io-client": "^4.0.1", - "source-map-support": "^0.5.0", "supertest": "^6.0.1", "swagger-cli": "^4.0.2", "ts-node": "10.4.0", diff --git a/scripts/dev/server.sh b/scripts/dev/server.sh index 07d88eb2f..468af0a56 100755 --- a/scripts/dev/server.sh +++ b/scripts/dev/server.sh @@ -5,7 +5,7 @@ set -eu if [ ! -f "./client/dist/en-US/index.html" ]; then if [ -z ${1+x} ] || [ "$1" != "--skip-client" ]; then echo "client/dist/en-US/index.html does not exist, compile client files..." - npm run build:client -- --light + npm run build:client fi fi @@ -24,5 +24,5 @@ cp -r ./server/static ./server/assets ./dist/server cp -r "./server/lib/emails" "./dist/server/lib" NODE_ENV=test node node_modules/.bin/concurrently -k \ - "node_modules/.bin/nodemon --delay 1 --watch ./dist dist/server" \ + "node_modules/.bin/nodemon --enable-source-maps --delay 1 --watch ./dist dist/server" \ "node_modules/.bin/tsc -b -w --preserveWatchOutput" diff --git a/server.ts b/server.ts index f4f448e6b..4f139d31d 100644 --- a/server.ts +++ b/server.ts @@ -1,11 +1,6 @@ import { registerTSPaths } from './server/helpers/register-ts-paths' registerTSPaths() -import { isTestInstance } from './server/helpers/core-utils' -if (isTestInstance()) { - require('source-map-support').install() -} - // ----------- Node modules ----------- import express from 'express' import morgan, { token } from 'morgan' @@ -19,7 +14,7 @@ import { program as cli } from 'commander' process.title = 'peertube' // Create our main app -const app = express().disable("x-powered-by") +const app = express().disable('x-powered-by') // ----------- Core checker ----------- import { checkMissedConfig, checkFFmpeg, checkNodeVersion } from './server/initializers/checker-before-init' @@ -135,6 +130,7 @@ import { HttpStatusCode } from './shared/models/http/http-error-codes' import { VideosTorrentCache } from '@server/lib/files-cache/videos-torrent-cache' import { ServerConfigManager } from '@server/lib/server-config-manager' import { VideoViews } from '@server/lib/video-views' +import { isTestInstance } from './server/helpers/core-utils' // ----------- Command line ----------- diff --git a/shared/server-commands/server/server.ts b/shared/server-commands/server/server.ts index 617069b11..7b81da54d 100644 --- a/shared/server-commands/server/server.ts +++ b/shared/server-commands/server/server.ts @@ -217,11 +217,14 @@ export class PeerTubeServer { execArgv: options.nodeArgs || [] } + const peertubeArgs = options.peertubeArgs || [] + peertubeArgs.push('--enable-source-maps') + return new Promise((res, rej) => { const self = this let aggregatedLogs = '' - this.app = fork(join(root(), 'dist', 'server.js'), options.peertubeArgs || [], forkOptions) + this.app = fork(join(root(), 'dist', 'server.js'), peertubeArgs, forkOptions) const onPeerTubeExit = () => rej(new Error('Process exited:\n' + aggregatedLogs)) const onParentExit = () => { diff --git a/yarn.lock b/yarn.lock index bc4d3326c..de7593720 100644 --- a/yarn.lock +++ b/yarn.lock @@ -7926,20 +7926,12 @@ socks@^2.0.0: resolved "https://registry.yarnpkg.com/source-map-js/-/source-map-js-1.0.1.tgz#a1741c131e3c77d048252adfa24e23b908670caf" integrity sha512-4+TN2b3tqOCd/kaGRJ/sTYA0tR0mdXx26ipdolxcwtJVqEnqNYvlCAt1q3ypy4QMlYus+Zh34RNtYLoq2oQ4IA== -source-map-support@^0.5.0: - version "0.5.21" - resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.21.tgz#04fe7c7f9e1ed2d662233c28cb2b35b9f63f6e4f" - integrity sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w== - dependencies: - buffer-from "^1.0.0" - source-map "^0.6.0" - source-map@^0.5.0: version "0.5.7" resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.5.7.tgz#8a039d2d1021d22d1ea14c80d8ea468ba2ef3fcc" integrity sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w= -source-map@^0.6.0, source-map@^0.6.1: +source-map@^0.6.1: version "0.6.1" resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263" integrity sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==