diff options
author | Chocobozzz <me@florianbigard.com> | 2018-08-27 16:23:34 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-08-27 16:23:34 +0200 |
commit | 62689b942b71cd1dd0d050c6ed05f884a0b325c2 (patch) | |
tree | c45c35d35d7a3e32621fba06edc63646930c8efd /server/initializers/installer.ts | |
parent | 84b6dbcc6e8654f39ec798905e1151ba915cd1aa (diff) | |
download | PeerTube-62689b942b71cd1dd0d050c6ed05f884a0b325c2.tar.gz PeerTube-62689b942b71cd1dd0d050c6ed05f884a0b325c2.tar.zst PeerTube-62689b942b71cd1dd0d050c6ed05f884a0b325c2.zip |
Correctly migrate to fs-extra
Diffstat (limited to 'server/initializers/installer.ts')
-rw-r--r-- | server/initializers/installer.ts | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/server/initializers/installer.ts b/server/initializers/installer.ts index 1926c40dd..e319164e4 100644 --- a/server/initializers/installer.ts +++ b/server/initializers/installer.ts | |||
@@ -1,6 +1,5 @@ | |||
1 | import * as passwordGenerator from 'password-generator' | 1 | import * as passwordGenerator from 'password-generator' |
2 | import { UserRole } from '../../shared' | 2 | import { UserRole } from '../../shared' |
3 | import { mkdirpPromise, rimrafPromise } from '../helpers/core-utils' | ||
4 | import { logger } from '../helpers/logger' | 3 | import { logger } from '../helpers/logger' |
5 | import { createApplicationActor, createUserAccountAndChannel } from '../lib/user' | 4 | import { createApplicationActor, createUserAccountAndChannel } from '../lib/user' |
6 | import { UserModel } from '../models/account/user' | 5 | import { UserModel } from '../models/account/user' |
@@ -9,6 +8,7 @@ import { OAuthClientModel } from '../models/oauth/oauth-client' | |||
9 | import { applicationExist, clientsExist, usersExist } from './checker' | 8 | import { applicationExist, clientsExist, usersExist } from './checker' |
10 | import { CACHE, CONFIG, LAST_MIGRATION_VERSION } from './constants' | 9 | import { CACHE, CONFIG, LAST_MIGRATION_VERSION } from './constants' |
11 | import { sequelizeTypescript } from './database' | 10 | import { sequelizeTypescript } from './database' |
11 | import { remove, ensureDir } from 'fs-extra' | ||
12 | 12 | ||
13 | async function installApplication () { | 13 | async function installApplication () { |
14 | try { | 14 | try { |
@@ -41,7 +41,7 @@ function removeCacheDirectories () { | |||
41 | // Cache directories | 41 | // Cache directories |
42 | for (const key of Object.keys(cacheDirectories)) { | 42 | for (const key of Object.keys(cacheDirectories)) { |
43 | const dir = cacheDirectories[key] | 43 | const dir = cacheDirectories[key] |
44 | tasks.push(rimrafPromise(dir)) | 44 | tasks.push(remove(dir)) |
45 | } | 45 | } |
46 | 46 | ||
47 | return Promise.all(tasks) | 47 | return Promise.all(tasks) |
@@ -52,16 +52,16 @@ function createDirectoriesIfNotExist () { | |||
52 | const cacheDirectories = Object.keys(CACHE) | 52 | const cacheDirectories = Object.keys(CACHE) |
53 | .map(k => CACHE[k].DIRECTORY) | 53 | .map(k => CACHE[k].DIRECTORY) |
54 | 54 | ||
55 | const tasks: Promise<string>[] = [] | 55 | const tasks: Promise<void>[] = [] |
56 | for (const key of Object.keys(storage)) { | 56 | for (const key of Object.keys(storage)) { |
57 | const dir = storage[key] | 57 | const dir = storage[key] |
58 | tasks.push(mkdirpPromise(dir)) | 58 | tasks.push(ensureDir(dir)) |
59 | } | 59 | } |
60 | 60 | ||
61 | // Cache directories | 61 | // Cache directories |
62 | for (const key of Object.keys(cacheDirectories)) { | 62 | for (const key of Object.keys(cacheDirectories)) { |
63 | const dir = cacheDirectories[key] | 63 | const dir = cacheDirectories[key] |
64 | tasks.push(mkdirpPromise(dir)) | 64 | tasks.push(ensureDir(dir)) |
65 | } | 65 | } |
66 | 66 | ||
67 | return Promise.all(tasks) | 67 | return Promise.all(tasks) |