Use typescript paths in cli scripts too
This commit is contained in:
parent
576ddf645f
commit
2aaa1a3fdc
|
@ -1,3 +1,6 @@
|
||||||
|
import { registerTSPaths } from '../server/helpers/register-ts-paths'
|
||||||
|
registerTSPaths()
|
||||||
|
|
||||||
import * as program from 'commander'
|
import * as program from 'commander'
|
||||||
import { resolve } from 'path'
|
import { resolve } from 'path'
|
||||||
import { VideoModel } from '../server/models/video/video'
|
import { VideoModel } from '../server/models/video/video'
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
import { registerTSPaths } from '../server/helpers/register-ts-paths'
|
||||||
|
registerTSPaths()
|
||||||
|
|
||||||
import * as program from 'commander'
|
import * as program from 'commander'
|
||||||
import { VideoModel } from '../server/models/video/video'
|
import { VideoModel } from '../server/models/video/video'
|
||||||
import { initDatabaseModels } from '../server/initializers'
|
import { initDatabaseModels } from '../server/initializers'
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
import { registerTSPaths } from '../../../server/helpers/register-ts-paths'
|
||||||
|
registerTSPaths()
|
||||||
|
|
||||||
import * as Promise from 'bluebird'
|
import * as Promise from 'bluebird'
|
||||||
import * as rimraf from 'rimraf'
|
import * as rimraf from 'rimraf'
|
||||||
import { initDatabaseModels, sequelizeTypescript } from '../../../server/initializers'
|
import { initDatabaseModels, sequelizeTypescript } from '../../../server/initializers'
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
import { registerTSPaths } from '../server/helpers/register-ts-paths'
|
||||||
|
registerTSPaths()
|
||||||
|
|
||||||
import { doRequest } from '../server/helpers/requests'
|
import { doRequest } from '../server/helpers/requests'
|
||||||
import { readFileSync } from 'fs-extra'
|
import { readFileSync } from 'fs-extra'
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
import { registerTSPaths } from '../../server/helpers/register-ts-paths'
|
||||||
|
registerTSPaths()
|
||||||
|
|
||||||
import * as jsToXliff12 from 'xliff/jsToXliff12'
|
import * as jsToXliff12 from 'xliff/jsToXliff12'
|
||||||
import { writeFile } from 'fs-extra'
|
import { writeFile } from 'fs-extra'
|
||||||
import { join } from 'path'
|
import { join } from 'path'
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
import { registerTSPaths } from '../../server/helpers/register-ts-paths'
|
||||||
|
registerTSPaths()
|
||||||
|
|
||||||
import * as xliff12ToJs from 'xliff/xliff12ToJs'
|
import * as xliff12ToJs from 'xliff/xliff12ToJs'
|
||||||
import { readFileSync, unlink, writeFile } from 'fs-extra'
|
import { readFileSync, unlink, writeFile } from 'fs-extra'
|
||||||
import { join } from 'path'
|
import { join } from 'path'
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
import { registerTSPaths } from '../server/helpers/register-ts-paths'
|
||||||
|
registerTSPaths()
|
||||||
|
|
||||||
import { VIDEO_TRANSCODING_FPS } from '../server/initializers/constants'
|
import { VIDEO_TRANSCODING_FPS } from '../server/initializers/constants'
|
||||||
import { getDurationFromVideoFile, getVideoFileBitrate, getVideoFileFPS, getVideoFileResolution } from '../server/helpers/ffmpeg-utils'
|
import { getDurationFromVideoFile, getVideoFileBitrate, getVideoFileFPS, getVideoFileResolution } from '../server/helpers/ffmpeg-utils'
|
||||||
import { getMaxBitrate } from '../shared/models/videos'
|
import { getMaxBitrate } from '../shared/models/videos'
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
import { registerTSPaths } from '../server/helpers/register-ts-paths'
|
||||||
|
registerTSPaths()
|
||||||
|
|
||||||
import * as program from 'commander'
|
import * as program from 'commander'
|
||||||
import { createReadStream, readdir } from 'fs-extra'
|
import { createReadStream, readdir } from 'fs-extra'
|
||||||
import { join } from 'path'
|
import { join } from 'path'
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
import { registerTSPaths } from '../../server/helpers/register-ts-paths'
|
||||||
|
registerTSPaths()
|
||||||
|
|
||||||
import { initDatabaseModels } from '../../server/initializers/database'
|
import { initDatabaseModels } from '../../server/initializers/database'
|
||||||
import * as program from 'commander'
|
import * as program from 'commander'
|
||||||
import { PluginManager } from '../../server/lib/plugins/plugin-manager'
|
import { PluginManager } from '../../server/lib/plugins/plugin-manager'
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
import { registerTSPaths } from '../../server/helpers/register-ts-paths'
|
||||||
|
registerTSPaths()
|
||||||
|
|
||||||
import { initDatabaseModels } from '../../server/initializers/database'
|
import { initDatabaseModels } from '../../server/initializers/database'
|
||||||
import * as program from 'commander'
|
import * as program from 'commander'
|
||||||
import { PluginManager } from '../../server/lib/plugins/plugin-manager'
|
import { PluginManager } from '../../server/lib/plugins/plugin-manager'
|
||||||
|
@ -19,6 +22,7 @@ run()
|
||||||
})
|
})
|
||||||
|
|
||||||
async function run () {
|
async function run () {
|
||||||
|
|
||||||
await initDatabaseModels(true)
|
await initDatabaseModels(true)
|
||||||
|
|
||||||
const toUninstall = program['npmName']
|
const toUninstall = program['npmName']
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
import { registerTSPaths } from '../server/helpers/register-ts-paths'
|
||||||
|
registerTSPaths()
|
||||||
|
|
||||||
import * as prompt from 'prompt'
|
import * as prompt from 'prompt'
|
||||||
import { join } from 'path'
|
import { join } from 'path'
|
||||||
import { CONFIG } from '../server/initializers/config'
|
import { CONFIG } from '../server/initializers/config'
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
import { registerTSPaths } from '../server/helpers/register-ts-paths'
|
||||||
|
registerTSPaths()
|
||||||
|
|
||||||
import * as program from 'commander'
|
import * as program from 'commander'
|
||||||
import { initDatabaseModels } from '../server/initializers'
|
import { initDatabaseModels } from '../server/initializers'
|
||||||
import { UserModel } from '../server/models/account/user'
|
import { UserModel } from '../server/models/account/user'
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
import { registerTSPaths } from '../server/helpers/register-ts-paths'
|
||||||
|
registerTSPaths()
|
||||||
|
|
||||||
import { WEBSERVER } from '../server/initializers/constants'
|
import { WEBSERVER } from '../server/initializers/constants'
|
||||||
import { ActorFollowModel } from '../server/models/activitypub/actor-follow'
|
import { ActorFollowModel } from '../server/models/activitypub/actor-follow'
|
||||||
import { VideoModel } from '../server/models/video/video'
|
import { VideoModel } from '../server/models/video/video'
|
||||||
|
|
11
server.ts
11
server.ts
|
@ -1,13 +1,6 @@
|
||||||
import { resolve } from 'path'
|
import { registerTSPaths } from './server/helpers/register-ts-paths'
|
||||||
|
|
||||||
const tsConfig = require('./tsconfig.json')
|
registerTSPaths()
|
||||||
const tsConfigPaths = require('tsconfig-paths')
|
|
||||||
|
|
||||||
// Thanks: https://github.com/dividab/tsconfig-paths/issues/75#issuecomment-458936883
|
|
||||||
tsConfigPaths.register({
|
|
||||||
baseUrl: resolve(tsConfig.compilerOptions.baseUrl || '', tsConfig.compilerOptions.outDir || ''),
|
|
||||||
paths: tsConfig.compilerOptions.paths
|
|
||||||
})
|
|
||||||
|
|
||||||
// FIXME: https://github.com/nodejs/node/pull/16853
|
// FIXME: https://github.com/nodejs/node/pull/16853
|
||||||
require('tls').DEFAULT_ECDH_CURVE = 'auto'
|
require('tls').DEFAULT_ECDH_CURVE = 'auto'
|
||||||
|
|
|
@ -0,0 +1,16 @@
|
||||||
|
import { resolve } from 'path'
|
||||||
|
const tsConfigPaths = require('tsconfig-paths')
|
||||||
|
|
||||||
|
const tsConfig = require('../../tsconfig.json')
|
||||||
|
|
||||||
|
function registerTSPaths () {
|
||||||
|
// Thanks: https://github.com/dividab/tsconfig-paths/issues/75#issuecomment-458936883
|
||||||
|
tsConfigPaths.register({
|
||||||
|
baseUrl: resolve(tsConfig.compilerOptions.baseUrl || '', tsConfig.compilerOptions.outDir || ''),
|
||||||
|
paths: tsConfig.compilerOptions.paths
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export {
|
||||||
|
registerTSPaths
|
||||||
|
}
|
|
@ -1,3 +1,6 @@
|
||||||
|
import { registerTSPaths } from '../helpers/register-ts-paths'
|
||||||
|
registerTSPaths()
|
||||||
|
|
||||||
import * as program from 'commander'
|
import * as program from 'commander'
|
||||||
import * as prompt from 'prompt'
|
import * as prompt from 'prompt'
|
||||||
import { getNetrc, getSettings, writeSettings } from './cli'
|
import { getNetrc, getSettings, writeSettings } from './cli'
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
import { registerTSPaths } from '../helpers/register-ts-paths'
|
||||||
|
registerTSPaths()
|
||||||
|
|
||||||
import * as program from 'commander'
|
import * as program from 'commander'
|
||||||
import { getClient, Server, serverLogin } from '../../shared/extra-utils'
|
import { getClient, Server, serverLogin } from '../../shared/extra-utils'
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
import { registerTSPaths } from '../helpers/register-ts-paths'
|
||||||
|
registerTSPaths()
|
||||||
|
|
||||||
// FIXME: https://github.com/nodejs/node/pull/16853
|
// FIXME: https://github.com/nodejs/node/pull/16853
|
||||||
require('tls').DEFAULT_ECDH_CURVE = 'auto'
|
require('tls').DEFAULT_ECDH_CURVE = 'auto'
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
import { registerTSPaths } from '../helpers/register-ts-paths'
|
||||||
|
registerTSPaths()
|
||||||
|
|
||||||
import * as program from 'commander'
|
import * as program from 'commander'
|
||||||
import { PluginType } from '../../shared/models/plugins/plugin.type'
|
import { PluginType } from '../../shared/models/plugins/plugin.type'
|
||||||
import { getAccessToken } from '../../shared/extra-utils/users/login'
|
import { getAccessToken } from '../../shared/extra-utils/users/login'
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
import { registerTSPaths } from '../helpers/register-ts-paths'
|
||||||
|
registerTSPaths()
|
||||||
|
|
||||||
import * as repl from 'repl'
|
import * as repl from 'repl'
|
||||||
import * as path from 'path'
|
import * as path from 'path'
|
||||||
import * as _ from 'lodash'
|
import * as _ from 'lodash'
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
import { registerTSPaths } from '../helpers/register-ts-paths'
|
||||||
|
registerTSPaths()
|
||||||
|
|
||||||
import * as program from 'commander'
|
import * as program from 'commander'
|
||||||
import { access, constants } from 'fs-extra'
|
import { access, constants } from 'fs-extra'
|
||||||
import { isAbsolute } from 'path'
|
import { isAbsolute } from 'path'
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
import { registerTSPaths } from '../helpers/register-ts-paths'
|
||||||
|
registerTSPaths()
|
||||||
|
|
||||||
import * as program from 'commander'
|
import * as program from 'commander'
|
||||||
import { join } from 'path'
|
import { join } from 'path'
|
||||||
import { execSync } from 'child_process'
|
import { execSync } from 'child_process'
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
#!/usr/bin/env node
|
#!/usr/bin/env node
|
||||||
|
|
||||||
|
import { registerTSPaths } from '../helpers/register-ts-paths'
|
||||||
|
registerTSPaths()
|
||||||
|
|
||||||
import * as program from 'commander'
|
import * as program from 'commander'
|
||||||
import {
|
import {
|
||||||
version,
|
version,
|
||||||
|
|
Loading…
Reference in New Issue