aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2022-01-03 16:37:16 +0100
committerChocobozzz <me@florianbigard.com>2022-01-03 16:37:16 +0100
commit9270bd3a7e6802b99a6ab12910c6c702d290fd4b (patch)
tree8b705faa2fc08d9d5a8b6fc3e0ab27555b5b019c
parent36ebdfac6e3cc6296a3049eb44e0621e72b6a184 (diff)
downloadPeerTube-9270bd3a7e6802b99a6ab12910c6c702d290fd4b.tar.gz
PeerTube-9270bd3a7e6802b99a6ab12910c6c702d290fd4b.tar.zst
PeerTube-9270bd3a7e6802b99a6ab12910c6c702d290fd4b.zip
Migrate to --enable-source-maps option
-rw-r--r--package.json1
-rwxr-xr-xscripts/dev/server.sh4
-rw-r--r--server.ts8
-rw-r--r--shared/server-commands/server/server.ts5
-rw-r--r--yarn.lock10
5 files changed, 9 insertions, 19 deletions
diff --git a/package.json b/package.json
index b0df43ffa..0aac4c860 100644
--- a/package.json
+++ b/package.json
@@ -205,7 +205,6 @@
205 "proxy": "^1.0.2", 205 "proxy": "^1.0.2",
206 "resolve-tspaths": "^0.2.1", 206 "resolve-tspaths": "^0.2.1",
207 "socket.io-client": "^4.0.1", 207 "socket.io-client": "^4.0.1",
208 "source-map-support": "^0.5.0",
209 "supertest": "^6.0.1", 208 "supertest": "^6.0.1",
210 "swagger-cli": "^4.0.2", 209 "swagger-cli": "^4.0.2",
211 "ts-node": "10.4.0", 210 "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
5if [ ! -f "./client/dist/en-US/index.html" ]; then 5if [ ! -f "./client/dist/en-US/index.html" ]; then
6 if [ -z ${1+x} ] || [ "$1" != "--skip-client" ]; then 6 if [ -z ${1+x} ] || [ "$1" != "--skip-client" ]; then
7 echo "client/dist/en-US/index.html does not exist, compile client files..." 7 echo "client/dist/en-US/index.html does not exist, compile client files..."
8 npm run build:client -- --light 8 npm run build:client
9 fi 9 fi
10fi 10fi
11 11
@@ -24,5 +24,5 @@ cp -r ./server/static ./server/assets ./dist/server
24cp -r "./server/lib/emails" "./dist/server/lib" 24cp -r "./server/lib/emails" "./dist/server/lib"
25 25
26NODE_ENV=test node node_modules/.bin/concurrently -k \ 26NODE_ENV=test node node_modules/.bin/concurrently -k \
27 "node_modules/.bin/nodemon --delay 1 --watch ./dist dist/server" \ 27 "node_modules/.bin/nodemon --enable-source-maps --delay 1 --watch ./dist dist/server" \
28 "node_modules/.bin/tsc -b -w --preserveWatchOutput" 28 "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 @@
1import { registerTSPaths } from './server/helpers/register-ts-paths' 1import { registerTSPaths } from './server/helpers/register-ts-paths'
2registerTSPaths() 2registerTSPaths()
3 3
4import { isTestInstance } from './server/helpers/core-utils'
5if (isTestInstance()) {
6 require('source-map-support').install()
7}
8
9// ----------- Node modules ----------- 4// ----------- Node modules -----------
10import express from 'express' 5import express from 'express'
11import morgan, { token } from 'morgan' 6import morgan, { token } from 'morgan'
@@ -19,7 +14,7 @@ import { program as cli } from 'commander'
19process.title = 'peertube' 14process.title = 'peertube'
20 15
21// Create our main app 16// Create our main app
22const app = express().disable("x-powered-by") 17const app = express().disable('x-powered-by')
23 18
24// ----------- Core checker ----------- 19// ----------- Core checker -----------
25import { checkMissedConfig, checkFFmpeg, checkNodeVersion } from './server/initializers/checker-before-init' 20import { checkMissedConfig, checkFFmpeg, checkNodeVersion } from './server/initializers/checker-before-init'
@@ -135,6 +130,7 @@ import { HttpStatusCode } from './shared/models/http/http-error-codes'
135import { VideosTorrentCache } from '@server/lib/files-cache/videos-torrent-cache' 130import { VideosTorrentCache } from '@server/lib/files-cache/videos-torrent-cache'
136import { ServerConfigManager } from '@server/lib/server-config-manager' 131import { ServerConfigManager } from '@server/lib/server-config-manager'
137import { VideoViews } from '@server/lib/video-views' 132import { VideoViews } from '@server/lib/video-views'
133import { isTestInstance } from './server/helpers/core-utils'
138 134
139// ----------- Command line ----------- 135// ----------- Command line -----------
140 136
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 {
217 execArgv: options.nodeArgs || [] 217 execArgv: options.nodeArgs || []
218 } 218 }
219 219
220 const peertubeArgs = options.peertubeArgs || []
221 peertubeArgs.push('--enable-source-maps')
222
220 return new Promise<void>((res, rej) => { 223 return new Promise<void>((res, rej) => {
221 const self = this 224 const self = this
222 let aggregatedLogs = '' 225 let aggregatedLogs = ''
223 226
224 this.app = fork(join(root(), 'dist', 'server.js'), options.peertubeArgs || [], forkOptions) 227 this.app = fork(join(root(), 'dist', 'server.js'), peertubeArgs, forkOptions)
225 228
226 const onPeerTubeExit = () => rej(new Error('Process exited:\n' + aggregatedLogs)) 229 const onPeerTubeExit = () => rej(new Error('Process exited:\n' + aggregatedLogs))
227 const onParentExit = () => { 230 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:
7926 resolved "https://registry.yarnpkg.com/source-map-js/-/source-map-js-1.0.1.tgz#a1741c131e3c77d048252adfa24e23b908670caf" 7926 resolved "https://registry.yarnpkg.com/source-map-js/-/source-map-js-1.0.1.tgz#a1741c131e3c77d048252adfa24e23b908670caf"
7927 integrity sha512-4+TN2b3tqOCd/kaGRJ/sTYA0tR0mdXx26ipdolxcwtJVqEnqNYvlCAt1q3ypy4QMlYus+Zh34RNtYLoq2oQ4IA== 7927 integrity sha512-4+TN2b3tqOCd/kaGRJ/sTYA0tR0mdXx26ipdolxcwtJVqEnqNYvlCAt1q3ypy4QMlYus+Zh34RNtYLoq2oQ4IA==
7928 7928
7929source-map-support@^0.5.0:
7930 version "0.5.21"
7931 resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.21.tgz#04fe7c7f9e1ed2d662233c28cb2b35b9f63f6e4f"
7932 integrity sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w==
7933 dependencies:
7934 buffer-from "^1.0.0"
7935 source-map "^0.6.0"
7936
7937source-map@^0.5.0: 7929source-map@^0.5.0:
7938 version "0.5.7" 7930 version "0.5.7"
7939 resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.5.7.tgz#8a039d2d1021d22d1ea14c80d8ea468ba2ef3fcc" 7931 resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.5.7.tgz#8a039d2d1021d22d1ea14c80d8ea468ba2ef3fcc"
7940 integrity sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w= 7932 integrity sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=
7941 7933
7942source-map@^0.6.0, source-map@^0.6.1: 7934source-map@^0.6.1:
7943 version "0.6.1" 7935 version "0.6.1"
7944 resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263" 7936 resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263"
7945 integrity sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g== 7937 integrity sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==