aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tools
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2022-01-03 17:13:11 +0100
committerChocobozzz <me@florianbigard.com>2022-01-06 08:26:14 +0100
commitf8360396ffabd2f95e9ece9c5755173bae0114b6 (patch)
tree83467f70bb5d5c2faa61c45e1d87b538c6c8fe5e /server/tools
parentcea093bca5b9d311b5c1d0539d53e965c901015b (diff)
downloadPeerTube-f8360396ffabd2f95e9ece9c5755173bae0114b6.tar.gz
PeerTube-f8360396ffabd2f95e9ece9c5755173bae0114b6.tar.zst
PeerTube-f8360396ffabd2f95e9ece9c5755173bae0114b6.zip
Stop using tsconfig register
Prefer to replace paths at compile time
Diffstat (limited to 'server/tools')
-rw-r--r--server/tools/cli.ts8
-rw-r--r--server/tools/peertube-auth.ts9
-rw-r--r--server/tools/peertube-get-access-token.ts3
-rw-r--r--server/tools/peertube-import-videos.ts8
-rw-r--r--server/tools/peertube-plugins.ts13
-rw-r--r--server/tools/peertube-redundancy.ts3
-rw-r--r--server/tools/peertube-upload.ts3
-rw-r--r--server/tools/peertube.ts3
-rw-r--r--server/tools/tsconfig.json9
9 files changed, 20 insertions, 39 deletions
diff --git a/server/tools/cli.ts b/server/tools/cli.ts
index 00adcedeb..a844b9dcf 100644
--- a/server/tools/cli.ts
+++ b/server/tools/cli.ts
@@ -2,19 +2,19 @@ import { Command } from 'commander'
2import { Netrc } from 'netrc-parser' 2import { Netrc } from 'netrc-parser'
3import { join } from 'path' 3import { join } from 'path'
4import { createLogger, format, transports } from 'winston' 4import { createLogger, format, transports } from 'winston'
5import { PeerTubeServer } from '@shared/server-commands' 5import { loadLanguages } from '@server/initializers/constants'
6import { root } from '@shared/core-utils'
6import { UserRole } from '@shared/models' 7import { UserRole } from '@shared/models'
8import { PeerTubeServer } from '@shared/server-commands'
7import { VideoPrivacy } from '../../shared/models/videos' 9import { VideoPrivacy } from '../../shared/models/videos'
8import { getAppNumber, isTestInstance } from '../helpers/core-utils' 10import { getAppNumber, isTestInstance } from '../helpers/core-utils'
9import { root } from '@shared/core-utils'
10import { loadLanguages } from '@server/initializers/constants'
11 11
12let configName = 'PeerTube/CLI' 12let configName = 'PeerTube/CLI'
13if (isTestInstance()) configName += `-${getAppNumber()}` 13if (isTestInstance()) configName += `-${getAppNumber()}`
14 14
15const config = require('application-config')(configName) 15const config = require('application-config')(configName)
16 16
17const version = require('../../../package.json').version 17const version = require(join(root(), 'package.json')).version
18 18
19async function getAdminTokenOrDie (server: PeerTubeServer, username: string, password: string) { 19async function getAdminTokenOrDie (server: PeerTubeServer, username: string, password: string) {
20 const token = await server.login.getAccessToken(username, password) 20 const token = await server.login.getAccessToken(username, password)
diff --git a/server/tools/peertube-auth.ts b/server/tools/peertube-auth.ts
index afa19ee08..f8ac8b2ab 100644
--- a/server/tools/peertube-auth.ts
+++ b/server/tools/peertube-auth.ts
@@ -1,12 +1,7 @@
1// eslint-disable @typescript-eslint/no-unnecessary-type-assertion 1import CliTable3 from 'cli-table3'
2
3import { registerTSPaths } from '../helpers/register-ts-paths'
4registerTSPaths()
5
6import { OptionValues, program } from 'commander' 2import { OptionValues, program } from 'commander'
7import { assignToken, buildServer, getNetrc, getSettings, writeSettings } from './cli'
8import { isUserUsernameValid } from '../helpers/custom-validators/users' 3import { isUserUsernameValid } from '../helpers/custom-validators/users'
9import CliTable3 from 'cli-table3' 4import { assignToken, buildServer, getNetrc, getSettings, writeSettings } from './cli'
10 5
11import prompt = require('prompt') 6import prompt = require('prompt')
12 7
diff --git a/server/tools/peertube-get-access-token.ts b/server/tools/peertube-get-access-token.ts
index a67de9180..d59a3632e 100644
--- a/server/tools/peertube-get-access-token.ts
+++ b/server/tools/peertube-get-access-token.ts
@@ -1,6 +1,3 @@
1import { registerTSPaths } from '../helpers/register-ts-paths'
2registerTSPaths()
3
4import { program } from 'commander' 1import { program } from 'commander'
5import { assignToken, buildServer } from './cli' 2import { assignToken, buildServer } from './cli'
6 3
diff --git a/server/tools/peertube-import-videos.ts b/server/tools/peertube-import-videos.ts
index 87aec60ef..661a4cf35 100644
--- a/server/tools/peertube-import-videos.ts
+++ b/server/tools/peertube-import-videos.ts
@@ -1,12 +1,10 @@
1import { registerTSPaths } from '../helpers/register-ts-paths'
2registerTSPaths()
3
4import { program } from 'commander' 1import { program } from 'commander'
5import { accessSync, constants } from 'fs' 2import { accessSync, constants } from 'fs'
6import { remove } from 'fs-extra' 3import { remove } from 'fs-extra'
7import { join } from 'path' 4import { join } from 'path'
8import { sha256 } from '@shared/extra-utils' 5import { YoutubeDLCLI, YoutubeDLInfo, YoutubeDLInfoBuilder } from '@server/helpers/youtube-dl'
9import { wait } from '@shared/core-utils' 6import { wait } from '@shared/core-utils'
7import { sha256 } from '@shared/extra-utils'
10import { doRequestAndSaveToFile } from '../helpers/requests' 8import { doRequestAndSaveToFile } from '../helpers/requests'
11import { 9import {
12 assignToken, 10 assignToken,
@@ -16,7 +14,7 @@ import {
16 getLogger, 14 getLogger,
17 getServerCredentials 15 getServerCredentials
18} from './cli' 16} from './cli'
19import { YoutubeDLCLI, YoutubeDLInfo, YoutubeDLInfoBuilder } from '@server/helpers/youtube-dl' 17
20import prompt = require('prompt') 18import prompt = require('prompt')
21 19
22const processOptions = { 20const processOptions = {
diff --git a/server/tools/peertube-plugins.ts b/server/tools/peertube-plugins.ts
index 9dd3f08c9..47090b3a5 100644
--- a/server/tools/peertube-plugins.ts
+++ b/server/tools/peertube-plugins.ts
@@ -1,13 +1,8 @@
1// eslint-disable @typescript-eslint/no-unnecessary-type-assertion
2
3import { registerTSPaths } from '../helpers/register-ts-paths'
4registerTSPaths()
5
6import { program, Command, OptionValues } from 'commander'
7import { assignToken, buildServer, getServerCredentials } from './cli'
8import { PluginType } from '../../shared/models'
9import { isAbsolute } from 'path'
10import CliTable3 from 'cli-table3' 1import CliTable3 from 'cli-table3'
2import { Command, OptionValues, program } from 'commander'
3import { isAbsolute } from 'path'
4import { PluginType } from '../../shared/models'
5import { assignToken, buildServer, getServerCredentials } from './cli'
11 6
12program 7program
13 .name('plugins') 8 .name('plugins')
diff --git a/server/tools/peertube-redundancy.ts b/server/tools/peertube-redundancy.ts
index 12c412b67..2c62a3c19 100644
--- a/server/tools/peertube-redundancy.ts
+++ b/server/tools/peertube-redundancy.ts
@@ -1,6 +1,3 @@
1import { registerTSPaths } from '../helpers/register-ts-paths'
2registerTSPaths()
3
4import CliTable3 from 'cli-table3' 1import CliTable3 from 'cli-table3'
5import { Command, program } from 'commander' 2import { Command, program } from 'commander'
6import { uniq } from 'lodash' 3import { uniq } from 'lodash'
diff --git a/server/tools/peertube-upload.ts b/server/tools/peertube-upload.ts
index 01fb1fe8d..08bd5f2bb 100644
--- a/server/tools/peertube-upload.ts
+++ b/server/tools/peertube-upload.ts
@@ -1,6 +1,3 @@
1import { registerTSPaths } from '../helpers/register-ts-paths'
2registerTSPaths()
3
4import { program } from 'commander' 1import { program } from 'commander'
5import { access, constants } from 'fs-extra' 2import { access, constants } from 'fs-extra'
6import { isAbsolute } from 'path' 3import { isAbsolute } from 'path'
diff --git a/server/tools/peertube.ts b/server/tools/peertube.ts
index 9e07640f0..1d3158044 100644
--- a/server/tools/peertube.ts
+++ b/server/tools/peertube.ts
@@ -1,8 +1,5 @@
1#!/usr/bin/env node 1#!/usr/bin/env node
2 2
3import { registerTSPaths } from '../helpers/register-ts-paths'
4registerTSPaths()
5
6import { CommandOptions, program } from 'commander' 3import { CommandOptions, program } from 'commander'
7import { getSettings, version } from './cli' 4import { getSettings, version } from './cli'
8 5
diff --git a/server/tools/tsconfig.json b/server/tools/tsconfig.json
index 61e6b8739..8264f5b35 100644
--- a/server/tools/tsconfig.json
+++ b/server/tools/tsconfig.json
@@ -1,11 +1,16 @@
1{ 1{
2 "extends": "../../tsconfig.json", 2 "extends": "../../tsconfig.json",
3 "compilerOptions": { 3 "compilerOptions": {
4 "outDir": "../../dist/server/tools" 4 "baseUrl": "./",
5 "outDir": "../../dist/server/tools",
6 "paths": { // FIXME: https://github.com/benyap/resolve-tspaths/issues/10
7 "@server/*": [ "../../server/*" ],
8 "@shared/*": [ "../../shared/*" ]
9 }
5 }, 10 },
6 "include": [ ".", "../typings" ], 11 "include": [ ".", "../typings" ],
7 "references": [ 12 "references": [
8 { "path": "../" }, 13 { "path": "../" }
9 ], 14 ],
10 "files": [], 15 "files": [],
11 "exclude": [ ] // Overwrite exclude property 16 "exclude": [ ] // Overwrite exclude property