Stop using tsconfig register

Prefer to replace paths at compile time
This commit is contained in:
Chocobozzz
2022-01-03 17:13:11 +01:00
parent cea093bca5
commit f8360396ff
47 changed files with 191 additions and 609 deletions

View File

@@ -2,19 +2,19 @@ import { Command } from 'commander'
import { Netrc } from 'netrc-parser'
import { join } from 'path'
import { createLogger, format, transports } from 'winston'
import { PeerTubeServer } from '@shared/server-commands'
import { loadLanguages } from '@server/initializers/constants'
import { root } from '@shared/core-utils'
import { UserRole } from '@shared/models'
import { PeerTubeServer } from '@shared/server-commands'
import { VideoPrivacy } from '../../shared/models/videos'
import { getAppNumber, isTestInstance } from '../helpers/core-utils'
import { root } from '@shared/core-utils'
import { loadLanguages } from '@server/initializers/constants'
let configName = 'PeerTube/CLI'
if (isTestInstance()) configName += `-${getAppNumber()}`
const config = require('application-config')(configName)
const version = require('../../../package.json').version
const version = require(join(root(), 'package.json')).version
async function getAdminTokenOrDie (server: PeerTubeServer, username: string, password: string) {
const token = await server.login.getAccessToken(username, password)

View File

@@ -1,12 +1,7 @@
// eslint-disable @typescript-eslint/no-unnecessary-type-assertion
import { registerTSPaths } from '../helpers/register-ts-paths'
registerTSPaths()
import { OptionValues, program } from 'commander'
import { assignToken, buildServer, getNetrc, getSettings, writeSettings } from './cli'
import { isUserUsernameValid } from '../helpers/custom-validators/users'
import CliTable3 from 'cli-table3'
import { OptionValues, program } from 'commander'
import { isUserUsernameValid } from '../helpers/custom-validators/users'
import { assignToken, buildServer, getNetrc, getSettings, writeSettings } from './cli'
import prompt = require('prompt')

View File

@@ -1,6 +1,3 @@
import { registerTSPaths } from '../helpers/register-ts-paths'
registerTSPaths()
import { program } from 'commander'
import { assignToken, buildServer } from './cli'

View File

@@ -1,12 +1,10 @@
import { registerTSPaths } from '../helpers/register-ts-paths'
registerTSPaths()
import { program } from 'commander'
import { accessSync, constants } from 'fs'
import { remove } from 'fs-extra'
import { join } from 'path'
import { sha256 } from '@shared/extra-utils'
import { YoutubeDLCLI, YoutubeDLInfo, YoutubeDLInfoBuilder } from '@server/helpers/youtube-dl'
import { wait } from '@shared/core-utils'
import { sha256 } from '@shared/extra-utils'
import { doRequestAndSaveToFile } from '../helpers/requests'
import {
assignToken,
@@ -16,7 +14,7 @@ import {
getLogger,
getServerCredentials
} from './cli'
import { YoutubeDLCLI, YoutubeDLInfo, YoutubeDLInfoBuilder } from '@server/helpers/youtube-dl'
import prompt = require('prompt')
const processOptions = {

View File

@@ -1,13 +1,8 @@
// eslint-disable @typescript-eslint/no-unnecessary-type-assertion
import { registerTSPaths } from '../helpers/register-ts-paths'
registerTSPaths()
import { program, Command, OptionValues } from 'commander'
import { assignToken, buildServer, getServerCredentials } from './cli'
import { PluginType } from '../../shared/models'
import { isAbsolute } from 'path'
import CliTable3 from 'cli-table3'
import { Command, OptionValues, program } from 'commander'
import { isAbsolute } from 'path'
import { PluginType } from '../../shared/models'
import { assignToken, buildServer, getServerCredentials } from './cli'
program
.name('plugins')

View File

@@ -1,6 +1,3 @@
import { registerTSPaths } from '../helpers/register-ts-paths'
registerTSPaths()
import CliTable3 from 'cli-table3'
import { Command, program } from 'commander'
import { uniq } from 'lodash'

View File

@@ -1,6 +1,3 @@
import { registerTSPaths } from '../helpers/register-ts-paths'
registerTSPaths()
import { program } from 'commander'
import { access, constants } from 'fs-extra'
import { isAbsolute } from 'path'

View File

@@ -1,8 +1,5 @@
#!/usr/bin/env node
import { registerTSPaths } from '../helpers/register-ts-paths'
registerTSPaths()
import { CommandOptions, program } from 'commander'
import { getSettings, version } from './cli'

View File

@@ -1,11 +1,16 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"outDir": "../../dist/server/tools"
"baseUrl": "./",
"outDir": "../../dist/server/tools",
"paths": { // FIXME: https://github.com/benyap/resolve-tspaths/issues/10
"@server/*": [ "../../server/*" ],
"@shared/*": [ "../../shared/*" ]
}
},
"include": [ ".", "../typings" ],
"references": [
{ "path": "../" },
{ "path": "../" }
],
"files": [],
"exclude": [ ] // Overwrite exclude property