@stackbit/utils
Advanced tools
Comparing version 0.1.2 to 0.2.0
{ | ||
"name": "@stackbit/utils", | ||
"version": "0.1.2", | ||
"version": "0.2.0", | ||
"description": "Stackbit utilities", | ||
"main": "src/index.js", | ||
"main": "dist/index.js", | ||
"types": "dist/index.d.ts", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1", | ||
"test": "jest", | ||
"build": "tsc", | ||
"prettier": "prettier --write src", | ||
"prepack": "npm test && npm run build", | ||
"version-minor": "npm version minor -m \"bumped version to v%s\"", | ||
@@ -17,3 +21,3 @@ "version-patch": "npm version patch -m \"bumped version to v%s\"" | ||
"stackbit", | ||
"jamstack" | ||
"utilities" | ||
], | ||
@@ -28,6 +32,15 @@ "author": "Stackbit Inc.", | ||
"@iarna/toml": "^2.2.5", | ||
"fs-extra": "^9.0.1", | ||
"js-yaml": "^3.14.0", | ||
"lodash": "^4.17.15" | ||
"fs-extra": "^9.1.0", | ||
"js-yaml": "^4.0.0", | ||
"lodash": "^4.17.21" | ||
}, | ||
"devDependencies": { | ||
"@types/fs-extra": "^9.0.8", | ||
"@types/js-yaml": "^4.0.0", | ||
"@types/lodash": "^4.14.168", | ||
"jest": "^26.6.3", | ||
"prettier": "^2.2.1", | ||
"ts-jest": "^26.5.4", | ||
"typescript": "^4.2.3" | ||
} | ||
} |
const _ = require('lodash'); | ||
let taskTagCounter = 0; | ||
class Task { | ||
constructor(job, tag) { | ||
this.tag = tag || ('task-' + (taskTagCounter++)); | ||
this.tag = tag || 'task-' + taskTagCounter++; | ||
this.promise = new Promise((resolve, reject) => { | ||
this.run = function() { | ||
this.run = function () { | ||
return job().then(resolve, reject); | ||
@@ -16,7 +14,5 @@ }; | ||
} | ||
} | ||
module.exports = class TaskQueue { | ||
constructor(options) { | ||
@@ -69,3 +65,6 @@ this.limit = _.get(options, 'limit', null); | ||
if (this.debug) { | ||
console.log(`[TaskQueue] task run count limit (${this.limit}) reached, queue size: ${this.taskQueue.length}, running tasks: ${this.runCount}, waiting for previous tasks to finish`); | ||
console.log( | ||
`[TaskQueue] task run count limit (${this.limit}) reached, queue size: ${this.taskQueue.length}, ` + | ||
`running tasks: ${this.runCount}, waiting for previous tasks to finish` | ||
); | ||
} | ||
@@ -85,3 +84,6 @@ } | ||
if (this.debug) { | ||
console.log(`[TaskQueue] task interval is less than allowed (${this.interval}) reached, queue size: ${this.taskQueue.length}, running tasks: ${this.runCount}, waiting for ${this.interval - diffMs}ms`); | ||
console.log( | ||
`[TaskQueue] task interval is less than allowed (${this.interval}) reached, queue size: ` + | ||
`${this.taskQueue.length}, running tasks: ${this.runCount}, waiting for ${this.interval - diffMs}ms` | ||
); | ||
} | ||
@@ -112,3 +114,2 @@ } | ||
} | ||
} | ||
}; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
No tests
QualityPackage does not have any tests. This is a strong signal of a poorly maintained or low quality package.
Found 1 instance in 1 package
74909
32
1448
1
7
1
+ Addedargparse@2.0.1(transitive)
+ Addedjs-yaml@4.1.0(transitive)
- Removedargparse@1.0.10(transitive)
- Removedesprima@4.0.1(transitive)
- Removedjs-yaml@3.14.1(transitive)
- Removedsprintf-js@1.0.3(transitive)
Updatedfs-extra@^9.1.0
Updatedjs-yaml@^4.0.0
Updatedlodash@^4.17.21