@times-components/depend
Advanced tools
Comparing version 0.1.5 to 0.1.6
@@ -6,2 +6,10 @@ # Change Log | ||
<a name="0.1.6"></a> | ||
## [0.1.6](https://github.com/newsuk/times-components/compare/@times-components/depend@0.1.5...@times-components/depend@0.1.6) (2018-04-04) | ||
**Note:** Version bump only for package @times-components/depend | ||
<a name="0.1.5"></a> | ||
@@ -8,0 +16,0 @@ ## [0.1.5](https://github.com/newsuk/times-components/compare/@times-components/depend@0.1.4...@times-components/depend@0.1.5) (2018-04-04) |
@@ -50,2 +50,6 @@ /* eslint-disable no-console */ | ||
) | ||
.option( | ||
"-on --only", | ||
"glob expression that restricts dependencies to process" | ||
) | ||
.option("-f --fix", "fixed dependencies with wrong versions") | ||
@@ -52,0 +56,0 @@ .option("-sr --show-rules", "prints rules that will be applied") |
import "babel-polyfill"; | ||
import minimatch from "minimatch"; | ||
@@ -191,7 +192,19 @@ const { keys, values, entries } = Object; | ||
export default async function compute(packagesList, strategy, overrides = {}) { | ||
export function restrictRequirements(requirements, expr) { | ||
const filter = expr ? name => minimatch(name, expr) : () => true; | ||
return requirements.filter(requirement => filter(requirement.requires.name)); | ||
} | ||
export default async function compute( | ||
packagesList, | ||
strategy, | ||
filter, | ||
overrides = {} | ||
) { | ||
const packages = packagesList.map(p => p[1]); | ||
const requirements = getAllRequirements(packages); | ||
const targetRequirements = restrictRequirements(requirements, filter); | ||
const { versionSets, resolved } = applyStrategy(requirements, strategy); | ||
const { versionSets, resolved } = applyStrategy(targetRequirements, strategy); | ||
@@ -209,3 +222,3 @@ const wrong = findWrongVersions(packages); | ||
return { | ||
requirements, | ||
requirements: targetRequirements, | ||
versionSets, | ||
@@ -212,0 +225,0 @@ wrong, |
@@ -43,2 +43,2 @@ "use strict"; | ||
exports.default = _commander2.default.version(_package.version).usage("depend [...options]").description("tool to analyze, visualize and fix dependencies of a javascript monorepo").option("-l --lerna <path>", "path to project root. Uses packages field to find all packages").option("-e --expr <glob>", "glob expression that finds package.json files").option("-p --pick <dependency>", "sets all package dependencies to {package}@{version}", validatePick).option("-g --graph [filter]", "output the dependency graph for all matching requirements").option("-s --strategy <strategy>", "how to resolve conflicts. possible strategies: conservative, progressive, majority, majorityConservative, majorityProgressive", validateStrategies).option("-f --fix", "fixed dependencies with wrong versions").option("-sr --show-rules", "prints rules that will be applied").option("-l --list", "prints all dependencies in use").option("-b --bail", "returns 1 if packages need fixing").option("--hint", "print fix suggestions"); | ||
exports.default = _commander2.default.version(_package.version).usage("depend [...options]").description("tool to analyze, visualize and fix dependencies of a javascript monorepo").option("-l --lerna <path>", "path to project root. Uses packages field to find all packages").option("-e --expr <glob>", "glob expression that finds package.json files").option("-p --pick <dependency>", "sets all package dependencies to {package}@{version}", validatePick).option("-g --graph [filter]", "output the dependency graph for all matching requirements").option("-s --strategy <strategy>", "how to resolve conflicts. possible strategies: conservative, progressive, majority, majorityConservative, majorityProgressive", validateStrategies).option("-on --only", "glob expression that restricts dependencies to process").option("-f --fix", "fixed dependencies with wrong versions").option("-sr --show-rules", "prints rules that will be applied").option("-l --list", "prints all dependencies in use").option("-b --bail", "returns 1 if packages need fixing").option("--hint", "print fix suggestions"); |
@@ -59,5 +59,10 @@ "use strict"; | ||
exports.applyStrategy = applyStrategy; | ||
exports.restrictRequirements = restrictRequirements; | ||
require("babel-polyfill"); | ||
var _minimatch = require("minimatch"); | ||
var _minimatch2 = _interopRequireDefault(_minimatch); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
@@ -317,7 +322,19 @@ | ||
function restrictRequirements(requirements, expr) { | ||
var filter = expr ? function (name) { | ||
return (0, _minimatch2.default)(name, expr); | ||
} : function () { | ||
return true; | ||
}; | ||
return requirements.filter(function (requirement) { | ||
return filter(requirement.requires.name); | ||
}); | ||
} | ||
exports.default = function () { | ||
var _ref31 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee(packagesList, strategy) { | ||
var overrides = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; | ||
var _ref31 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee(packagesList, strategy, filter) { | ||
var overrides = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {}; | ||
var packages, requirements, _applyStrategy, versionSets, resolved, wrong, rules, todo, fixedPackages, suggestions; | ||
var packages, requirements, targetRequirements, _applyStrategy, versionSets, resolved, wrong, rules, todo, fixedPackages, suggestions; | ||
@@ -332,3 +349,4 @@ return _regenerator2.default.wrap(function _callee$(_context) { | ||
requirements = getAllRequirements(packages); | ||
_applyStrategy = applyStrategy(requirements, strategy), versionSets = _applyStrategy.versionSets, resolved = _applyStrategy.resolved; | ||
targetRequirements = restrictRequirements(requirements, filter); | ||
_applyStrategy = applyStrategy(targetRequirements, strategy), versionSets = _applyStrategy.versionSets, resolved = _applyStrategy.resolved; | ||
wrong = findWrongVersions(packages); | ||
@@ -340,3 +358,3 @@ rules = createRules(resolved, wrong); | ||
return _context.abrupt("return", { | ||
requirements: requirements, | ||
requirements: targetRequirements, | ||
versionSets: versionSets, | ||
@@ -349,3 +367,3 @@ wrong: wrong, | ||
case 9: | ||
case 10: | ||
case "end": | ||
@@ -358,3 +376,3 @@ return _context.stop(); | ||
function compute(_x4, _x5) { | ||
function compute(_x4, _x5, _x6) { | ||
return _ref31.apply(this, arguments); | ||
@@ -361,0 +379,0 @@ } |
@@ -136,3 +136,3 @@ "use strict"; | ||
packagesList = _context.sent; | ||
return _context.abrupt("return", (0, _depend2.default)(packagesList, argv.strategy ? strategies[argv.strategy] : null, pickOverride(argv.pick)).then(function (_ref7) { | ||
return _context.abrupt("return", (0, _depend2.default)(packagesList, argv.strategy ? strategies[argv.strategy] : null, argv.only, pickOverride(argv.pick)).then(function (_ref7) { | ||
var requirements = _ref7.requirements, | ||
@@ -139,0 +139,0 @@ rules = _ref7.rules, |
{ | ||
"name": "@times-components/depend", | ||
"version": "0.1.5", | ||
"version": "0.1.6", | ||
"description": "dependency analyzer and fixer", | ||
@@ -69,2 +69,3 @@ "main": "dist/depend", | ||
"glob": "7.1.2", | ||
"minimatch": "3.0.4", | ||
"semver": "5.5.0" | ||
@@ -71,0 +72,0 @@ }, |
@@ -52,2 +52,3 @@ /* eslint-disable no-console */ | ||
argv.strategy ? strategies[argv.strategy] : null, | ||
argv.only, | ||
pickOverride(argv.pick) | ||
@@ -54,0 +55,0 @@ ) |
{ | ||
"name": "@times-components/depend", | ||
"version": "0.1.5", | ||
"version": "0.1.6", | ||
"description": "dependency analyzer and fixer", | ||
@@ -69,2 +69,3 @@ "main": "dist/depend", | ||
"glob": "7.1.2", | ||
"minimatch": "3.0.4", | ||
"semver": "5.5.0" | ||
@@ -71,0 +72,0 @@ }, |
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
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
51775
1036
9
+ Addedminimatch@3.0.4
+ Addedminimatch@3.0.4(transitive)
- Removedminimatch@3.1.2(transitive)