chore: up rimraf to 4.x (#11377)

* chore: up rimraf to 4.x

* chore: oops up rimraf

* test: fix rimraf in tests
isekai-main
Barış Soner Uşaklı 2 years ago committed by GitHub
parent 8ddb302f20
commit 1502068eff
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -119,7 +119,7 @@
"ioredis": "5.3.1",
"request": "2.88.2",
"request-promise-native": "1.0.9",
"rimraf": "3.0.2",
"rimraf": "4.4.0",
"rss": "1.2.2",
"rtlcss": "4.0.0",
"sanitize-html": "2.10.0",

@ -3,12 +3,9 @@
const winston = require('winston');
const nconf = require('nconf');
const fs = require('fs');
const util = require('util');
const path = require('path');
const rimraf = require('rimraf');
const rimrafAsync = util.promisify(rimraf);
const plugins = require('../plugins');
const db = require('../database');
const file = require('../file');
@ -213,7 +210,7 @@ async function getBundleMetadata(target) {
CSS.buildBundle = async function (target, fork) {
if (target === 'client') {
await rimrafAsync(path.join(__dirname, '../../build/public/client*'));
await rimraf(path.join(__dirname, '../../build/public/client*'), { glob: true });
}
const data = await getBundleMetadata(target);

@ -2,12 +2,9 @@
const path = require('path');
const fs = require('fs');
const util = require('util');
const mkdirp = require('mkdirp');
const rimraf = require('rimraf');
const rimrafAsync = util.promisify(rimraf);
const file = require('../file');
const plugins = require('../plugins');
const minifier = require('./minifier');
@ -69,7 +66,7 @@ async function clearModules() {
p => path.join(__dirname, '../../build/public/src', p)
);
await Promise.all(
builtPaths.map(builtPath => rimrafAsync(builtPath))
builtPaths.map(builtPath => rimraf(builtPath))
);
}
@ -86,7 +83,7 @@ JS.buildModules = async function () {
};
JS.linkStatics = async function () {
await rimrafAsync(path.join(__dirname, '../../build/public/plugins'));
await rimraf(path.join(__dirname, '../../build/public/plugins'));
await Promise.all(Object.keys(plugins.staticDirs).map(async (mappedPath) => {
const sourceDir = plugins.staticDirs[mappedPath];

@ -4,13 +4,9 @@ const _ = require('lodash');
const nconf = require('nconf');
const path = require('path');
const fs = require('fs');
const util = require('util');
let mkdirp = require('mkdirp');
mkdirp = mkdirp.hasOwnProperty('native') ? mkdirp : util.promisify(mkdirp);
const mkdirp = require('mkdirp');
const rimraf = require('rimraf');
const rimrafAsync = util.promisify(rimraf);
const file = require('../file');
const Plugins = require('../plugins');
@ -137,7 +133,7 @@ async function assignFileToTranslations(translations, path) {
}
exports.build = async function buildLanguages() {
await rimrafAsync(buildLanguagesPath);
await rimraf(buildLanguagesPath);
const data = await getTranslationMetadata();
await buildTranslations(data);
};

@ -1,9 +1,6 @@
'use strict';
const util = require('util');
let mkdirp = require('mkdirp');
mkdirp = mkdirp.hasOwnProperty('native') ? mkdirp : util.promisify(mkdirp);
const mkdirp = require('mkdirp');
const rimraf = require('rimraf');
const winston = require('winston');
const path = require('path');
@ -113,9 +110,7 @@ async function compileTemplate(filename, source) {
Templates.compileTemplate = compileTemplate;
async function compile() {
const _rimraf = util.promisify(rimraf);
await _rimraf(viewsPath);
await rimraf(viewsPath);
await mkdirp(viewsPath);
let files = await plugins.getActive();

@ -4,8 +4,7 @@ const async = require('async');
const _ = require('lodash');
const path = require('path');
const nconf = require('nconf');
const util = require('util');
const rimrafAsync = util.promisify(require('rimraf'));
const rimraf = require('rimraf');
const db = require('../database');
const posts = require('../posts');
@ -210,8 +209,8 @@ module.exports = function (User) {
async function deleteImages(uid) {
const folder = path.join(nconf.get('upload_path'), 'profile');
await Promise.all([
rimrafAsync(path.join(folder, `${uid}-profilecover*`)),
rimrafAsync(path.join(folder, `${uid}-profileavatar*`)),
rimraf(path.join(folder, `${uid}-profilecover*`), { glob: true }),
rimraf(path.join(folder, `${uid}-profileavatar*`), { glob: true }),
]);
}
};

@ -88,11 +88,9 @@ describe('minifier', () => {
describe('Build', () => {
const build = require('../src/meta/build');
before((done) => {
async.parallel([
async.apply(rimraf, path.join(__dirname, '../build/public')),
async.apply(db.sortedSetAdd, 'plugins:active', Date.now(), 'nodebb-plugin-markdown'),
], done);
before(async () => {
await rimraf(path.join(__dirname, '../build/public'));
await db.sortedSetAdd('plugins:active', Date.now(), 'nodebb-plugin-markdown');
});
it('should build plugin static dirs', (done) => {

@ -206,7 +206,7 @@ async function setupMockDefaults() {
id: 'nodebb-theme-persona',
});
const rimraf = util.promisify(require('rimraf'));
const rimraf = require('rimraf');
await rimraf('test/uploads');
const mkdirp = require('mkdirp');

Loading…
Cancel
Save