diff --git a/install/package.json b/install/package.json index acd5c5af0c..35561d23ba 100644 --- a/install/package.json +++ b/install/package.json @@ -119,7 +119,7 @@ "ioredis": "5.3.1", "request": "2.88.2", "request-promise-native": "1.0.9", - "rimraf": "4.4.1", + "rimraf": "5.0.0", "rss": "1.2.2", "rtlcss": "4.0.0", "sanitize-html": "2.10.0", diff --git a/src/meta/js.js b/src/meta/js.js index ff5dbd6968..7578f6b8f6 100644 --- a/src/meta/js.js +++ b/src/meta/js.js @@ -3,7 +3,6 @@ const path = require('path'); const fs = require('fs'); const mkdirp = require('mkdirp'); -const rimraf = require('rimraf'); const file = require('../file'); const plugins = require('../plugins'); @@ -66,7 +65,7 @@ async function clearModules() { p => path.join(__dirname, '../../build/public/src', p) ); await Promise.all( - builtPaths.map(builtPath => rimraf(builtPath)) + builtPaths.map(builtPath => fs.promises.rm(builtPath, { recursive: true, force: true })) ); } @@ -83,8 +82,7 @@ JS.buildModules = async function () { }; JS.linkStatics = async function () { - await rimraf(path.join(__dirname, '../../build/public/plugins')); - + await fs.promises.rm(path.join(__dirname, '../../build/public/plugins'), { recursive: true, force: true }); await Promise.all(Object.keys(plugins.staticDirs).map(async (mappedPath) => { const sourceDir = plugins.staticDirs[mappedPath]; const destDir = path.join(__dirname, '../../build/public/plugins', mappedPath); diff --git a/src/meta/languages.js b/src/meta/languages.js index 1e354bef70..e15360fb61 100644 --- a/src/meta/languages.js +++ b/src/meta/languages.js @@ -5,7 +5,6 @@ const nconf = require('nconf'); const path = require('path'); const fs = require('fs'); const mkdirp = require('mkdirp'); -const rimraf = require('rimraf'); const file = require('../file'); @@ -133,7 +132,7 @@ async function assignFileToTranslations(translations, path) { } exports.build = async function buildLanguages() { - await rimraf(buildLanguagesPath); + await fs.promises.rm(buildLanguagesPath, { recursive: true, force: true }); const data = await getTranslationMetadata(); await buildTranslations(data); }; diff --git a/src/meta/templates.js b/src/meta/templates.js index 3250635199..ee172342d5 100644 --- a/src/meta/templates.js +++ b/src/meta/templates.js @@ -1,7 +1,6 @@ 'use strict'; const mkdirp = require('mkdirp'); -const rimraf = require('rimraf'); const winston = require('winston'); const path = require('path'); const fs = require('fs'); @@ -109,7 +108,7 @@ async function compileTemplate(filename, source) { Templates.compileTemplate = compileTemplate; async function compile() { - await rimraf(viewsPath); + await fs.promises.rm(viewsPath, { recursive: true, force: true }); await mkdirp(viewsPath); let files = await plugins.getActive(); diff --git a/src/user/delete.js b/src/user/delete.js index d2b11e7f4d..7bf076e7e7 100644 --- a/src/user/delete.js +++ b/src/user/delete.js @@ -4,7 +4,7 @@ const async = require('async'); const _ = require('lodash'); const path = require('path'); const nconf = require('nconf'); -const rimraf = require('rimraf'); +const { rimraf } = require('rimraf'); const db = require('../database'); const posts = require('../posts'); diff --git a/test/build.js b/test/build.js index a7c060de00..9d63f764db 100644 --- a/test/build.js +++ b/test/build.js @@ -4,8 +4,6 @@ const path = require('path'); const fs = require('fs'); const assert = require('assert'); const mkdirp = require('mkdirp'); -const rimraf = require('rimraf'); -const async = require('async'); const db = require('./mocks/databasemock'); const file = require('../src/file'); @@ -89,7 +87,7 @@ describe('Build', () => { const build = require('../src/meta/build'); before(async () => { - await rimraf(path.join(__dirname, '../build/public')); + await fs.promises.rm(path.join(__dirname, '../build/public'), { recursive: true, force: true }); await db.sortedSetAdd('plugins:active', Date.now(), 'nodebb-plugin-markdown'); }); diff --git a/test/mocks/databasemock.js b/test/mocks/databasemock.js index 10e9496919..dc7e9f5d2d 100644 --- a/test/mocks/databasemock.js +++ b/test/mocks/databasemock.js @@ -206,8 +206,9 @@ async function setupMockDefaults() { id: 'nodebb-theme-persona', }); - const rimraf = require('rimraf'); - await rimraf('test/uploads'); + const fs = require('fs'); + await fs.promises.rm('test/uploads', { recursive: true, force: true }); + const mkdirp = require('mkdirp');