Comparing version 3.5.0 to 3.6.1
@@ -41,3 +41,3 @@ #!/usr/bin/env node | ||
alias: 'p', | ||
describe: 'Run only for this package. Can be used multiple times.', | ||
describe: 'Run only for packages matching this glob. Can be used multiple times.', | ||
type: 'array' | ||
@@ -106,2 +106,6 @@ }, | ||
describe: 'Show an execution report once the command has finished in each package' | ||
}, | ||
concurrency: { | ||
type: 'number', | ||
describe: 'Maximum number of commands to be executed at once' | ||
} | ||
@@ -140,2 +144,3 @@ }); | ||
const showReport = argv.report || false; | ||
const concurrency = typeof argv.concurrency === 'number' ? argv.concurrency : null; | ||
const cmd = argv._; | ||
@@ -165,3 +170,4 @@ if (!cmd.length) { | ||
ifDependency: argv.ifDependency || false, | ||
workspacePath: process.cwd() | ||
workspacePath: process.cwd(), | ||
concurrency | ||
}, pkgPaths); | ||
@@ -168,0 +174,0 @@ let cycle = runner.detectCycles(); |
@@ -11,2 +11,3 @@ "use strict"; | ||
const cmd_process_1 = require("./cmd-process"); | ||
const minimatch = require("minimatch"); | ||
let mkThroat = require('throat')(Bromise); | ||
@@ -61,6 +62,10 @@ let passThrough = f => f(); | ||
this.children = []; | ||
// serial always has a concurrency of 1 | ||
if (this.opts.mode === 'serial') | ||
this.throat = mkThroat(1); | ||
if (this.opts.mode === 'stages') | ||
this.throat = mkThroat(16); // max 16 proc | ||
// max 16 proc unless otherwise specified | ||
else if (this.opts.mode === 'stages') | ||
this.throat = mkThroat(opts.concurrency || 16); | ||
else if (opts.concurrency) | ||
this.throat = mkThroat(opts.concurrency); | ||
process.on('SIGINT', this.closeAll); // close all children on ctrl+c | ||
@@ -228,3 +233,7 @@ } | ||
} | ||
run(cmd, pkgs = this.pkgJsons.map(p => p.name)) { | ||
expandGlobs(globs) { | ||
return this.pkgJsons.map(p => p.name).filter(name => globs.some(glob => minimatch(name, glob))); | ||
} | ||
run(cmd, globs = ['*']) { | ||
let pkgs = this.expandGlobs(globs); | ||
this.runList = new Set(pkgs); | ||
@@ -239,3 +248,3 @@ return (Bromise.all(pkgs.map(pkg => this.lookupOrRun(cmd, pkg))) | ||
// Generate report | ||
.then(() => this.checkResultsAndReport(cmd, pkgs))); | ||
.then(() => this.checkResultsAndReport(cmd, globs))); | ||
} | ||
@@ -242,0 +251,0 @@ } |
{ | ||
"name": "wsrun", | ||
"version": "3.5.0", | ||
"version": "3.6.1", | ||
"description": "executes commands on packages in parallel, but is aware of the dependencies between them", | ||
"main": "./build/index.js", | ||
"author": "Andrej T.", | ||
"author": "hfour", | ||
"license": "MIT", | ||
@@ -44,2 +44,3 @@ "repository": "github:whoeverest/wsrun", | ||
"@types/lodash": "^4.14.85", | ||
"@types/minimatch": "^3.0.3", | ||
"@types/mkdirp": "^0.5.2", | ||
@@ -72,2 +73,3 @@ "@types/mz": "^0.0.32", | ||
"lodash": "^4.17.4", | ||
"minimatch": "^3.0.4", | ||
"split": "^1.0.1", | ||
@@ -74,0 +76,0 @@ "throat": "^4.1.0", |
@@ -17,5 +17,4 @@ # Workspace script runner | ||
--recursive, -r Execute the same script on all of its dependencies, too [boolean] | ||
--package, -p Run only for this package. Can be used multiple times. [array] | ||
-c Denotes the end of the package list and the beginning of the command. Can be | ||
used instead of "--" | ||
--package, -p Run only for packages matching this glob. Can be used multiple times. [array] | ||
Misc Options: | ||
@@ -36,4 +35,8 @@ --fast-exit If at least one script exits with code > 0, abort [boolean] | ||
Other Options: | ||
--help Show help [boolean] | ||
--version Show version number [boolean] | ||
--help Show help [boolean] | ||
--version Show version number [boolean] | ||
-c Denotes the end of the package list and the beginning of the command. Can be used | ||
instead of "--" [boolean] | ||
--concurrency Maximum number of commands to be executed at once [number] | ||
``` | ||
@@ -55,2 +58,6 @@ | ||
`yarn wsrun -p 'app-*-frontend' -r watch` will watch all packages matching the glob | ||
`'app-*-frontend'` and their dependencies. Globstar and extglobs are supported. Make sure to pass | ||
the option quoted to prevent bash from trying to expand it! | ||
`yarn wsrun -p h4zip planc -c test` - run tests for both `h4zip` and `planc | ||
@@ -57,0 +64,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
83631
1083
92
8
18
+ Addedminimatch@^3.0.4