From 69d47041e83138869404c131adda3fc3122bf2d9 Mon Sep 17 00:00:00 2001 From: Daniel Stockman <5605+evocateur@users.noreply.github.com> Date: Mon, 23 Nov 2020 10:52:46 -0800 Subject: [PATCH] feat(profiler): Remove figgy-pudding --- package-lock.json | 2 -- utils/profiler/package.json | 1 - utils/profiler/profiler.js | 22 +++++++++++++--------- 3 files changed, 13 insertions(+), 12 deletions(-) diff --git a/package-lock.json b/package-lock.json index dcd888e526..b9e2753d75 100644 --- a/package-lock.json +++ b/package-lock.json @@ -14009,7 +14009,6 @@ "version": "3.20.0", "license": "MIT", "dependencies": { - "figgy-pudding": "^3.5.1", "fs-extra": "^9.0.1", "npmlog": "^4.1.2", "upath": "^2.0.1" @@ -15479,7 +15478,6 @@ "@lerna/profiler": { "version": "file:utils/profiler", "requires": { - "figgy-pudding": "^3.5.1", "fs-extra": "^9.0.1", "npmlog": "^4.1.2", "upath": "^2.0.1" diff --git a/utils/profiler/package.json b/utils/profiler/package.json index a38bcf364c..a7965305b3 100644 --- a/utils/profiler/package.json +++ b/utils/profiler/package.json @@ -31,7 +31,6 @@ "test": "echo \"Run tests from root\" && exit 1" }, "dependencies": { - "figgy-pudding": "^3.5.1", "fs-extra": "^9.0.1", "npmlog": "^4.1.2", "upath": "^2.0.1" diff --git a/utils/profiler/profiler.js b/utils/profiler/profiler.js index 968977968b..8b42265227 100644 --- a/utils/profiler/profiler.js +++ b/utils/profiler/profiler.js @@ -1,6 +1,5 @@ "use strict"; -const figgyPudding = require("figgy-pudding"); const fs = require("fs-extra"); const npmlog = require("npmlog"); const upath = require("upath"); @@ -22,16 +21,21 @@ const getTimeBasedFilename = () => { return `Lerna-Profile-${datetimeNormalized}.json`; }; -const ProfilerConfig = figgyPudding({ - concurrency: {}, - log: { default: npmlog }, - outputDirectory: {}, -}); +/** + * @typedef {object} ProfilerConfig + * @property {number} concurrency + * @property {typeof npmlog} [log] + * @property {string} [outputDirectory] + */ +/** + * A profiler to trace execution times across multiple concurrent calls. + */ class Profiler { - constructor(opts) { - const { concurrency, log, outputDirectory } = ProfilerConfig(opts); - + /** + * @param {ProfilerConfig} options + */ + constructor({ concurrency, log = npmlog, outputDirectory }) { this.events = []; this.logger = log; this.outputPath = upath.join(upath.resolve(outputDirectory || "."), getTimeBasedFilename());