Skip to content

Commit

Permalink
feat(profiler): Remove figgy-pudding
Browse files Browse the repository at this point in the history
  • Loading branch information
evocateur committed Nov 24, 2020
1 parent 640faa5 commit 69d4704
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 12 deletions.
2 changes: 0 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion utils/profiler/package.json
Expand Up @@ -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"
Expand Down
22 changes: 13 additions & 9 deletions 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");
Expand All @@ -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());
Expand Down

0 comments on commit 69d4704

Please sign in to comment.