require -> import
This commit is contained in:
parent
e02643f32e
commit
4d4e5cd4dc
|
@ -71,6 +71,7 @@
|
||||||
"scripty": "^1.5.0",
|
"scripty": "^1.5.0",
|
||||||
"sequelize": "4.0.0-2",
|
"sequelize": "4.0.0-2",
|
||||||
"typescript": "~2.2.0",
|
"typescript": "~2.2.0",
|
||||||
|
"validator": "^7.0.0",
|
||||||
"winston": "^2.1.1",
|
"winston": "^2.1.1",
|
||||||
"ws": "^2.0.0"
|
"ws": "^2.0.0"
|
||||||
},
|
},
|
||||||
|
@ -86,6 +87,7 @@
|
||||||
"@types/node": "^7.0.18",
|
"@types/node": "^7.0.18",
|
||||||
"@types/request": "^0.0.43",
|
"@types/request": "^0.0.43",
|
||||||
"@types/sequelize": "^4.0.55",
|
"@types/sequelize": "^4.0.55",
|
||||||
|
"@types/validator": "^6.2.0",
|
||||||
"@types/winston": "^2.3.2",
|
"@types/winston": "^2.3.2",
|
||||||
"@types/ws": "^0.0.41",
|
"@types/ws": "^0.0.41",
|
||||||
"chai": "^3.3.0",
|
"chai": "^3.3.0",
|
||||||
|
|
13
server.ts
13
server.ts
|
@ -3,13 +3,14 @@ if ([ 'dev', 'test'].indexOf(process.env.NODE_ENV) !== -1) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----------- Node modules -----------
|
// ----------- Node modules -----------
|
||||||
import bodyParser = require('body-parser')
|
import * as bodyParser from 'body-parser'
|
||||||
import express = require('express')
|
import * as express from 'express'
|
||||||
|
// FIXME: cannot import express-validator
|
||||||
const expressValidator = require('express-validator')
|
const expressValidator = require('express-validator')
|
||||||
import http = require('http')
|
import * as http from 'http'
|
||||||
import morgan = require('morgan')
|
import * as morgan from 'morgan'
|
||||||
import path = require('path')
|
import * as path from 'path'
|
||||||
import bittorrentTracker = require('bittorrent-tracker')
|
import * as bittorrentTracker from 'bittorrent-tracker'
|
||||||
import { Server as WebSocketServer } from 'ws'
|
import { Server as WebSocketServer } from 'ws'
|
||||||
|
|
||||||
const TrackerServer = bittorrentTracker.Server
|
const TrackerServer = bittorrentTracker.Server
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import express = require('express')
|
import * as express from 'express'
|
||||||
|
|
||||||
import { CONFIG } from '../../initializers';
|
import { CONFIG } from '../../initializers';
|
||||||
import { logger } from '../../helpers'
|
import { logger } from '../../helpers'
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import express = require('express')
|
import * as express from 'express'
|
||||||
|
|
||||||
import { CONFIG } from '../../initializers'
|
import { CONFIG } from '../../initializers'
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import express = require('express')
|
import * as express from 'express'
|
||||||
|
|
||||||
import { badRequest } from '../../helpers'
|
import { badRequest } from '../../helpers'
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import express = require('express')
|
import * as express from 'express'
|
||||||
import { waterfall } from 'async'
|
import { waterfall } from 'async'
|
||||||
|
|
||||||
import { database as db } from '../../initializers/database'
|
import { database as db } from '../../initializers/database'
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import express = require('express')
|
import * as express from 'express'
|
||||||
|
|
||||||
import { badRequest } from '../../../helpers'
|
import { badRequest } from '../../../helpers'
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import express = require('express')
|
import * as express from 'express'
|
||||||
import * as waterfall from 'async/waterfall'
|
import * as waterfall from 'async/waterfall'
|
||||||
|
|
||||||
import { database as db } from '../../../initializers/database'
|
import { database as db } from '../../../initializers/database'
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import express = require('express')
|
import * as express from 'express'
|
||||||
import { eachSeries, waterfall } from 'async'
|
import { eachSeries, waterfall } from 'async'
|
||||||
|
|
||||||
import { database as db } from '../../../initializers/database'
|
import { database as db } from '../../../initializers/database'
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import express = require('express')
|
import * as express from 'express'
|
||||||
import { parallel } from 'async'
|
import { parallel } from 'async'
|
||||||
|
|
||||||
import {
|
import {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import express = require('express')
|
import * as express from 'express'
|
||||||
import { waterfall } from 'async'
|
import { waterfall } from 'async'
|
||||||
|
|
||||||
import { database as db } from '../../initializers/database'
|
import { database as db } from '../../initializers/database'
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
import express = require('express')
|
import * as express from 'express'
|
||||||
import { waterfall } from 'async'
|
import { waterfall } from 'async'
|
||||||
|
|
||||||
import { database as db } from '../../../initializers/database'
|
import { database as db } from '../../../initializers/database'
|
||||||
import friends = require('../../../lib/friends')
|
import * as friends from '../../../lib/friends'
|
||||||
import {
|
import {
|
||||||
logger,
|
logger,
|
||||||
getFormatedObjects,
|
getFormatedObjects,
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import express = require('express')
|
import * as express from 'express'
|
||||||
|
|
||||||
import { database as db } from '../../../initializers/database'
|
import { database as db } from '../../../initializers/database'
|
||||||
import { logger } from '../../../helpers'
|
import { logger } from '../../../helpers'
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import express = require('express')
|
import * as express from 'express'
|
||||||
import fs = require('fs')
|
import * as fs from 'fs'
|
||||||
import multer = require('multer')
|
import * as multer from 'multer'
|
||||||
import path = require('path')
|
import * as path from 'path'
|
||||||
import { waterfall } from 'async'
|
import { waterfall } from 'async'
|
||||||
|
|
||||||
import { database as db } from '../../../initializers/database'
|
import { database as db } from '../../../initializers/database'
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import express = require('express')
|
import * as express from 'express'
|
||||||
import { waterfall } from 'async'
|
import { waterfall } from 'async'
|
||||||
|
|
||||||
import { database as db } from '../../../initializers/database'
|
import { database as db } from '../../../initializers/database'
|
||||||
|
|
|
@ -1,10 +1,8 @@
|
||||||
import { parallel } from 'async'
|
import { parallel } from 'async'
|
||||||
import express = require('express')
|
import * as express from 'express'
|
||||||
import fs = require('fs')
|
import * as fs from 'fs'
|
||||||
import { join } from 'path'
|
import { join } from 'path'
|
||||||
import expressValidator = require('express-validator')
|
import * as validator from 'validator'
|
||||||
// TODO: use .validator when express-validator typing will have validator field
|
|
||||||
const validator = expressValidator['validator']
|
|
||||||
|
|
||||||
import { database as db } from '../initializers/database'
|
import { database as db } from '../initializers/database'
|
||||||
import {
|
import {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import express = require('express')
|
import * as express from 'express'
|
||||||
import cors = require('cors')
|
import * as cors from 'cors'
|
||||||
|
|
||||||
import {
|
import {
|
||||||
CONFIG,
|
CONFIG,
|
||||||
|
|
|
@ -1,6 +1,4 @@
|
||||||
import expressValidator = require('express-validator')
|
import * as validator from 'validator'
|
||||||
// TODO: use .validator when express-validator typing will have validator field
|
|
||||||
const validator = expressValidator['validator']
|
|
||||||
|
|
||||||
import { isArray } from './misc'
|
import { isArray } from './misc'
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
import { values } from 'lodash'
|
import { values } from 'lodash'
|
||||||
import expressValidator = require('express-validator')
|
import * as validator from 'validator'
|
||||||
// TODO: use .validator when express-validator typing will have validator field
|
|
||||||
const validator = expressValidator['validator']
|
|
||||||
|
|
||||||
import { CONSTRAINTS_FIELDS, USER_ROLES } from '../../initializers'
|
import { CONSTRAINTS_FIELDS, USER_ROLES } from '../../initializers'
|
||||||
const USERS_CONSTRAINTS_FIELDS = CONSTRAINTS_FIELDS.USERS
|
const USERS_CONSTRAINTS_FIELDS = CONSTRAINTS_FIELDS.USERS
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
import { values } from 'lodash'
|
import { values } from 'lodash'
|
||||||
import expressValidator = require('express-validator')
|
import * as validator from 'validator'
|
||||||
// TODO: use .validator when express-validator typing will have validator field
|
|
||||||
const validator = expressValidator['validator']
|
|
||||||
|
|
||||||
import {
|
import {
|
||||||
CONSTRAINTS_FIELDS,
|
CONSTRAINTS_FIELDS,
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
// TODO: import from ES6 when retry typing file will include errorFilter function
|
// TODO: import from ES6 when retry typing file will include errorFilter function
|
||||||
import retry = require('async/retry')
|
import * as retry from 'async/retry'
|
||||||
|
|
||||||
import { database as db } from '../initializers/database'
|
import { database as db } from '../initializers/database'
|
||||||
import { logger } from './logger'
|
import { logger } from './logger'
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
// Thanks http://tostring.it/2014/06/23/advanced-logging-with-nodejs/
|
// Thanks http://tostring.it/2014/06/23/advanced-logging-with-nodejs/
|
||||||
import mkdirp = require('mkdirp')
|
import * as mkdirp from 'mkdirp'
|
||||||
import path = require('path')
|
import * as path from 'path'
|
||||||
import winston = require('winston')
|
import * as winston from 'winston'
|
||||||
|
|
||||||
// Do not use barrel (dependencies issues)
|
// Do not use barrel (dependencies issues)
|
||||||
import { CONFIG } from '../initializers/constants'
|
import { CONFIG } from '../initializers/constants'
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import crypto = require('crypto')
|
import * as crypto from 'crypto'
|
||||||
import bcrypt = require('bcrypt')
|
import * as bcrypt from 'bcrypt'
|
||||||
import fs = require('fs')
|
import * as fs from 'fs'
|
||||||
import openssl = require('openssl-wrapper')
|
import * as openssl from 'openssl-wrapper'
|
||||||
import { join } from 'path'
|
import { join } from 'path'
|
||||||
|
|
||||||
import {
|
import {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import replay = require('request-replay')
|
import * as replay from 'request-replay'
|
||||||
import request = require('request')
|
import * as request from 'request'
|
||||||
|
|
||||||
import {
|
import {
|
||||||
RETRY_REQUESTS,
|
RETRY_REQUESTS,
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import config = require('config')
|
import * as config from 'config'
|
||||||
|
|
||||||
import { database as db } from './database'
|
import { database as db } from './database'
|
||||||
import { CONFIG } from './constants'
|
import { CONFIG } from './constants'
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import config = require('config')
|
import * as config from 'config'
|
||||||
import { join } from 'path'
|
import { join } from 'path'
|
||||||
|
|
||||||
// Do not use barrels, remain constants as independent as possible
|
// Do not use barrels, remain constants as independent as possible
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import fs = require('fs')
|
import * as fs from 'fs'
|
||||||
import { join } from 'path'
|
import { join } from 'path'
|
||||||
import Sequelize = require('sequelize')
|
import * as Sequelize from 'sequelize'
|
||||||
|
|
||||||
import { CONFIG } from './constants'
|
import { CONFIG } from './constants'
|
||||||
// Do not use barrel, we need to load database first
|
// Do not use barrel, we need to load database first
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
import { join } from 'path'
|
import { join } from 'path'
|
||||||
import config = require('config')
|
import * as config from 'config'
|
||||||
import { each, series } from 'async'
|
import { each, series } from 'async'
|
||||||
import mkdirp = require('mkdirp')
|
import * as mkdirp from 'mkdirp'
|
||||||
import passwordGenerator = require('password-generator')
|
import * as passwordGenerator from 'password-generator'
|
||||||
|
|
||||||
import { database as db } from './database'
|
import { database as db } from './database'
|
||||||
import { USER_ROLES, CONFIG, LAST_MIGRATION_VERSION } from './constants'
|
import { USER_ROLES, CONFIG, LAST_MIGRATION_VERSION } from './constants'
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import { waterfall, eachSeries } from 'async'
|
import { waterfall, eachSeries } from 'async'
|
||||||
import fs = require('fs')
|
import * as fs from 'fs'
|
||||||
import path = require('path')
|
import * as path from 'path'
|
||||||
import * as Sequelize from 'sequelize'
|
import * as Sequelize from 'sequelize'
|
||||||
|
|
||||||
import { database as db } from './database'
|
import { database as db } from './database'
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { each, eachLimit, eachSeries, series, waterfall } from 'async'
|
import { each, eachLimit, eachSeries, series, waterfall } from 'async'
|
||||||
import request = require('request')
|
import * as request from 'request'
|
||||||
|
|
||||||
import { database as db } from '../initializers/database'
|
import { database as db } from '../initializers/database'
|
||||||
import {
|
import {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import OAuthServer = require('express-oauth-server')
|
import * as OAuthServer from 'express-oauth-server'
|
||||||
|
|
||||||
import { OAUTH_LIFETIME } from '../initializers'
|
import { OAUTH_LIFETIME } from '../initializers'
|
||||||
import { logger } from '../helpers'
|
import { logger } from '../helpers'
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
import safeBuffer = require('safe-buffer')
|
import * as safeBuffer from 'safe-buffer'
|
||||||
const Buffer = safeBuffer.Buffer
|
const Buffer = safeBuffer.Buffer
|
||||||
import createTorrent = require('create-torrent')
|
import * as createTorrent from 'create-torrent'
|
||||||
import ffmpeg = require('fluent-ffmpeg')
|
import * as ffmpeg from 'fluent-ffmpeg'
|
||||||
import fs = require('fs')
|
import * as fs from 'fs'
|
||||||
import magnetUtil = require('magnet-uri')
|
import * as magnetUtil from 'magnet-uri'
|
||||||
import { map, values } from 'lodash'
|
import { map, values } from 'lodash'
|
||||||
import { parallel, series } from 'async'
|
import { parallel, series } from 'async'
|
||||||
import parseTorrent = require('parse-torrent')
|
import * as parseTorrent from 'parse-torrent'
|
||||||
import { join } from 'path'
|
import { join } from 'path'
|
||||||
import * as Sequelize from 'sequelize'
|
import * as Sequelize from 'sequelize'
|
||||||
|
|
||||||
|
|
|
@ -92,7 +92,7 @@
|
||||||
"@types/express-serve-static-core" "*"
|
"@types/express-serve-static-core" "*"
|
||||||
"@types/mime" "*"
|
"@types/mime" "*"
|
||||||
|
|
||||||
"@types/validator@*":
|
"@types/validator@*", "@types/validator@^6.2.0":
|
||||||
version "6.2.0"
|
version "6.2.0"
|
||||||
resolved "https://registry.yarnpkg.com/@types/validator/-/validator-6.2.0.tgz#020322fe1929f69889eb675a1bdb5a98394b71f0"
|
resolved "https://registry.yarnpkg.com/@types/validator/-/validator-6.2.0.tgz#020322fe1929f69889eb675a1bdb5a98394b71f0"
|
||||||
|
|
||||||
|
@ -3382,6 +3382,10 @@ validator@^5.6.0:
|
||||||
version "5.7.0"
|
version "5.7.0"
|
||||||
resolved "https://registry.yarnpkg.com/validator/-/validator-5.7.0.tgz#7a87a58146b695ac486071141c0c49d67da05e5c"
|
resolved "https://registry.yarnpkg.com/validator/-/validator-5.7.0.tgz#7a87a58146b695ac486071141c0c49d67da05e5c"
|
||||||
|
|
||||||
|
validator@^7.0.0:
|
||||||
|
version "7.0.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/validator/-/validator-7.0.0.tgz#c74deb8063512fac35547938e6f0b1504a282fd2"
|
||||||
|
|
||||||
validator@~6.2.0:
|
validator@~6.2.0:
|
||||||
version "6.2.1"
|
version "6.2.1"
|
||||||
resolved "https://registry.yarnpkg.com/validator/-/validator-6.2.1.tgz#bc575b78d15beb2e338a665ba9530c7f409ef667"
|
resolved "https://registry.yarnpkg.com/validator/-/validator-6.2.1.tgz#bc575b78d15beb2e338a665ba9530c7f409ef667"
|
||||||
|
|
Loading…
Reference in New Issue