Skip to content

Commit

Permalink
chore(shim): remove shim not required on node>=10
Browse files Browse the repository at this point in the history
  • Loading branch information
edgesite committed Nov 2, 2021
1 parent 3c09d2b commit 019d612
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 44 deletions.
13 changes: 3 additions & 10 deletions lib/commands/index.js
Expand Up @@ -12,18 +12,11 @@
*/
'use strict';

const fs = require('fs');
const fsAsync = require('fs').promises;
const path = require('path');
const promisify = require('util.promisify'); //TODO in node >= 8 could be removed

const utils = require('../utils');

//TODO node >= 10 could be used require('fs').promises()
const _fs = {
readdirAsync: promisify(fs.readdir),
readFileAsync: promisify(fs.readFile)
};

module.exports = (function() {
let scripts;

Expand All @@ -38,7 +31,7 @@ module.exports = (function() {
})();

async function loadScripts(dir) {
const scriptsDir = await _fs.readdirAsync(dir);
const scriptsDir = await fsAsync.readdir(dir);
const luaFiles = scriptsDir.filter(file => path.extname(file) === '.lua');
if (luaFiles.length === 0) {
/**
Expand All @@ -49,7 +42,7 @@ async function loadScripts(dir) {
}
return Promise.all(
luaFiles.map(async file => {
const lua = await _fs.readFileAsync(path.join(dir, file));
const lua = await fsAsync.readFile(path.join(dir, file));
const longName = path.basename(file, '.lua');

return {
Expand Down
5 changes: 1 addition & 4 deletions lib/process/master.js
Expand Up @@ -9,10 +9,7 @@ let status;
let processor;
let currentJobPromise;

//TODO remove for node >= 10
require('promise.prototype.finally').shim();

const promisify = require('util.promisify');
const { promisify } = require('util');

// same as process.send but waits until the send is complete

Expand Down
3 changes: 0 additions & 3 deletions lib/process/sandbox.js
@@ -1,8 +1,5 @@
'use strict';

//TODO remove for node >= 10
require('promise.prototype.finally').shim();

module.exports = function(processFile, childPool) {
return function process(job) {
return childPool.retain(processFile).then(child => {
Expand Down
5 changes: 1 addition & 4 deletions lib/queue.js
@@ -1,8 +1,5 @@
'use strict';

//TODO remove for node >= 10
require('promise.prototype.finally').shim();

const redis = require('ioredis');
const EventEmitter = require('events');

Expand All @@ -18,7 +15,7 @@ const errors = require('./errors');
const utils = require('./utils');

const TimerManager = require('./timer-manager');
const promisify = require('util.promisify');
const { promisify } = require('util');
const pTimeout = require('p-timeout');
const semver = require('semver');
const debuglog = require('debuglog')('bull');
Expand Down
4 changes: 1 addition & 3 deletions package.json
Expand Up @@ -3,7 +3,7 @@
"version": "4.1.0",
"description": "Job manager",
"engines": {
"node": ">=10"
"node": ">=10.1"
},
"main": "./index.js",
"repository": {
Expand All @@ -26,9 +26,7 @@
"ioredis": "^4.27.0",
"lodash": "^4.17.21",
"p-timeout": "^3.2.0",
"promise.prototype.finally": "^3.1.2",
"semver": "^7.3.2",
"util.promisify": "^1.0.1",
"uuid": "^8.3.0"
},
"devDependencies": {
Expand Down
20 changes: 0 additions & 20 deletions yarn.lock
Expand Up @@ -5487,15 +5487,6 @@ promise-retry@^2.0.1:
err-code "^2.0.2"
retry "^0.12.0"

promise.prototype.finally@^3.1.2:
version "3.1.2"
resolved "https://registry.yarnpkg.com/promise.prototype.finally/-/promise.prototype.finally-3.1.2.tgz#b8af89160c9c673cefe3b4c4435b53cfd0287067"
integrity sha512-A2HuJWl2opDH0EafgdjwEw7HysI8ff/n4lW4QEVBCUXFk9QeGecBWv0Deph0UmLe3tTNYegz8MOjsVuE6SMoJA==
dependencies:
define-properties "^1.1.3"
es-abstract "^1.17.0-next.0"
function-bind "^1.1.1"

promzard@^0.3.0:
version "0.3.0"
resolved "https://registry.yarnpkg.com/promzard/-/promzard-0.3.0.tgz#26a5d6ee8c7dee4cb12208305acfb93ba382a9ee"
Expand Down Expand Up @@ -6837,17 +6828,6 @@ util-deprecate@^1.0.1, util-deprecate@~1.0.1:
resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf"
integrity sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=

util.promisify@^1.0.1:
version "1.1.1"
resolved "https://registry.yarnpkg.com/util.promisify/-/util.promisify-1.1.1.tgz#77832f57ced2c9478174149cae9b96e9918cd54b"
integrity sha512-/s3UsZUrIfa6xDhr7zZhnE9SLQ5RIXyYfiVnMMyMDzOc8WhWN4Nbh36H842OyurKbCDAesZOJaVyvmSl6fhGQw==
dependencies:
call-bind "^1.0.0"
define-properties "^1.1.3"
for-each "^0.3.3"
has-symbols "^1.0.1"
object.getownpropertydescriptors "^2.1.1"

uuid@^3.3.2, uuid@^3.3.3:
version "3.4.0"
resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.4.0.tgz#b23e4358afa8a202fe7a100af1f5f883f02007ee"
Expand Down

0 comments on commit 019d612

Please sign in to comment.