Skip to content

Commit

Permalink
feat(run-topologically): Remove figgy-pudding
Browse files Browse the repository at this point in the history
  • Loading branch information
evocateur committed Nov 24, 2020
1 parent 1093f87 commit f3a73db
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 22 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/run-topologically/package.json
Expand Up @@ -32,7 +32,6 @@
},
"dependencies": {
"@lerna/query-graph": "file:../query-graph",
"figgy-pudding": "^3.5.1",
"p-queue": "^6.6.2"
}
}
27 changes: 8 additions & 19 deletions utils/run-topologically/run-topologically.js
@@ -1,34 +1,23 @@
"use strict";

const PQueue = require("p-queue").default;
const figgyPudding = require("figgy-pudding");
const QueryGraph = require("@lerna/query-graph");

module.exports = runTopologically;

const TopologicalConfig = figgyPudding({
// p-queue options
concurrency: {},
// query-graph options
"graph-type": {},
graphType: "graph-type",
"reject-cycles": {},
rejectCycles: "reject-cycles",
});
/**
* @typedef {import("@lerna/query-graph").QueryGraphConfig & { concurrency: number }} TopologicalConfig
*/

/**
* Run callback in maximally-saturated topological order.
*
* @param {Array<Package>} packages List of `Package` instances
* @param {Function} runner Callback to map each `Package` with
* @param {Number} [opts.concurrency] Concurrency of execution
* @param {String} [opts.graphType] "allDependencies" or "dependencies"
* @param {Boolean} [opts.rejectCycles] Whether or not to reject cycles
* @returns {Promise<Array<*>>} when all executions complete
* @param {import("@lerna/package")[]} packages List of `Package` instances
* @param {(pkg: import("@lerna/package")) => Promise<unknown>} runner Callback to map each `Package` with
* @param {TopologicalConfig} [options]
* @returns {Promise<unknown[]>} when all executions complete
*/
function runTopologically(packages, runner, opts) {
const { concurrency, graphType, rejectCycles } = TopologicalConfig(opts);

function runTopologically(packages, runner, { concurrency, graphType, rejectCycles } = {}) {
const queue = new PQueue({ concurrency });
const graph = new QueryGraph(packages, { graphType, rejectCycles });

Expand Down

0 comments on commit f3a73db

Please sign in to comment.