Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

lerna

Package Overview
Dependencies
Maintainers
3
Versions
276
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

lerna - npm Package Compare versions

Comparing version 2.0.0-beta.16 to 2.0.0-beta.17

lib/commands/ExecCommand.js

2

bin/lerna.js

@@ -18,2 +18,3 @@ #!/usr/bin/env node

" run Run npm script in each package",
" exec Run a command in each package",
" ls List all public packages",

@@ -26,2 +27,3 @@ "",

" --npm-tag [tagname] Publish packages with the specified npm dist-tag",
" --scope [glob] Restricts the scope to package names matching the given glob (Works only in combination with the 'run' and the 'exec' command).",
" --force-publish Force publish for the specified packages (comma-separated) or all packages using * (skips the git diff check for changed packages)",

@@ -28,0 +30,0 @@ " --yes Skip all confirmation prompts",

@@ -14,2 +14,6 @@ "use strict";

var _objectAssign = require("object-assign");
var _objectAssign2 = _interopRequireDefault(_objectAssign);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

@@ -29,2 +33,10 @@

if (err != null) {
// If the error from `child.exec` is just that the child process
// emitted too much on stderr, then that stderr output is likely to
// be useful.
if (/^stderr maxBuffer exceeded/.test(err.message)) {
err = "Error: " + err.message + ". Partial output follows:\n\n" + stderr;
}
callback(err || stderr);

@@ -45,6 +57,8 @@ } else {

key: "spawn",
value: function spawn(command, args, callback) {
_child_process2.default.spawn(command, args, {
value: function spawn(command, args, opts, callback) {
_child_process2.default.spawn(command, args, (0, _objectAssign2.default)({
stdio: "inherit"
}).on("close", callback);
}, opts)).on("close", callback).on("error", function () {
return null;
});
}

@@ -51,0 +65,0 @@ }]);

2

lib/Command.js

@@ -48,5 +48,5 @@ "use strict";

this.lernaVersion = require("../package.json").version;
this.logger = _logger2.default;
this.repository = new _Repository2.default();
this.progressBar = _progressBar2.default;
this.logger = _logger2.default;
this.concurrency = !flags || flags.concurrency === undefined ? DEFAULT_CONCURRENCY : Math.max(1, +flags.concurrency || DEFAULT_CONCURRENCY);

@@ -53,0 +53,0 @@ }

@@ -75,3 +75,3 @@ "use strict";

value: function execute(callback) {
_ChildProcessUtilities2.default.spawn("git", ["diff", this.lastCommit, "--color=auto", this.filePath], function (code) {
_ChildProcessUtilities2.default.spawn("git", ["diff", this.lastCommit, "--color=auto", this.filePath], {}, function (code) {
if (code !== 0) {

@@ -78,0 +78,0 @@ callback(new Error("Errored while spawning `git diff`."));

@@ -18,2 +18,6 @@ "use strict";

var _PackageUtilities = require("../PackageUtilities");
var _PackageUtilities2 = _interopRequireDefault(_PackageUtilities);
var _async = require("async");

@@ -62,2 +66,12 @@

if (this.flags.scope) {
this.logger.info("Scoping to packages that match '" + this.flags.scope + "'");
try {
this.packagesWithScript = _PackageUtilities2.default.filterPackages(this.packagesWithScript, this.flags.scope);
} catch (err) {
callback(err);
return;
}
}
callback(null, true);

@@ -64,0 +78,0 @@ }

@@ -10,3 +10,3 @@ "use strict";

var _dec, _dec2, _dec3, _dec4, _dec5, _dec6, _dec7, _dec8, _dec9, _dec10, _dec11, _dec12, _dec13, _dec14, _dec15, _desc, _value, _class;
var _dec, _dec2, _dec3, _dec4, _dec5, _dec6, _dec7, _dec8, _dec9, _dec10, _dec11, _dec12, _dec13, _dec14, _dec15, _dec16, _dec17, _desc, _value, _class;

@@ -54,3 +54,3 @@ var _ChildProcessUtilities = require("./ChildProcessUtilities");

var GitUtilities = (_dec = _logger2.default.logifySync, _dec2 = _logger2.default.logifySync, _dec3 = _logger2.default.logifySync, _dec4 = _logger2.default.logifySync, _dec5 = _logger2.default.logifySync, _dec6 = _logger2.default.logifySync, _dec7 = _logger2.default.logifySync, _dec8 = _logger2.default.logifySync, _dec9 = _logger2.default.logifySync, _dec10 = _logger2.default.logifySync, _dec11 = _logger2.default.logifySync, _dec12 = _logger2.default.logifySync, _dec13 = _logger2.default.logifySync, _dec14 = _logger2.default.logifySync, _dec15 = _logger2.default.logifySync, (_class = function () {
var GitUtilities = (_dec = _logger2.default.logifySync, _dec2 = _logger2.default.logifySync, _dec3 = _logger2.default.logifySync, _dec4 = _logger2.default.logifySync, _dec5 = _logger2.default.logifySync, _dec6 = _logger2.default.logifySync, _dec7 = _logger2.default.logifySync, _dec8 = _logger2.default.logifySync, _dec9 = _logger2.default.logifySync, _dec10 = _logger2.default.logifySync, _dec11 = _logger2.default.logifySync, _dec12 = _logger2.default.logifySync, _dec13 = _logger2.default.logifySync, _dec14 = _logger2.default.logifySync, _dec15 = _logger2.default.logifySync, _dec16 = _logger2.default.logifySync, _dec17 = _logger2.default.logifySync, (_class = function () {
function GitUtilities() {

@@ -61,2 +61,12 @@ _classCallCheck(this, GitUtilities);

_createClass(GitUtilities, null, [{
key: "isInitialized",
value: function isInitialized() {
try {
_ChildProcessUtilities2.default.execSync("git rev-parse");
return true;
} catch (err) {
return false;
}
}
}, {
key: "addFile",

@@ -134,2 +144,7 @@ value: function addFile(file) {

}, {
key: "init",
value: function init() {
return _ChildProcessUtilities2.default.execSync("git init");
}
}, {
key: "hasCommit",

@@ -147,3 +162,3 @@ value: function hasCommit() {

return GitUtilities;
}(), (_applyDecoratedDescriptor(_class, "addFile", [_dec], Object.getOwnPropertyDescriptor(_class, "addFile"), _class), _applyDecoratedDescriptor(_class, "commit", [_dec2], Object.getOwnPropertyDescriptor(_class, "commit"), _class), _applyDecoratedDescriptor(_class, "addTag", [_dec3], Object.getOwnPropertyDescriptor(_class, "addTag"), _class), _applyDecoratedDescriptor(_class, "removeTag", [_dec4], Object.getOwnPropertyDescriptor(_class, "removeTag"), _class), _applyDecoratedDescriptor(_class, "hasTags", [_dec5], Object.getOwnPropertyDescriptor(_class, "hasTags"), _class), _applyDecoratedDescriptor(_class, "getLastTaggedCommit", [_dec6], Object.getOwnPropertyDescriptor(_class, "getLastTaggedCommit"), _class), _applyDecoratedDescriptor(_class, "getFirstCommit", [_dec7], Object.getOwnPropertyDescriptor(_class, "getFirstCommit"), _class), _applyDecoratedDescriptor(_class, "pushWithTags", [_dec8], Object.getOwnPropertyDescriptor(_class, "pushWithTags"), _class), _applyDecoratedDescriptor(_class, "describeTag", [_dec9], Object.getOwnPropertyDescriptor(_class, "describeTag"), _class), _applyDecoratedDescriptor(_class, "diffSinceIn", [_dec10], Object.getOwnPropertyDescriptor(_class, "diffSinceIn"), _class), _applyDecoratedDescriptor(_class, "getCurrentSHA", [_dec11], Object.getOwnPropertyDescriptor(_class, "getCurrentSHA"), _class), _applyDecoratedDescriptor(_class, "getTopLevelDirectory", [_dec12], Object.getOwnPropertyDescriptor(_class, "getTopLevelDirectory"), _class), _applyDecoratedDescriptor(_class, "checkoutChanges", [_dec13], Object.getOwnPropertyDescriptor(_class, "checkoutChanges"), _class), _applyDecoratedDescriptor(_class, "getCurrentBranch", [_dec14], Object.getOwnPropertyDescriptor(_class, "getCurrentBranch"), _class), _applyDecoratedDescriptor(_class, "hasCommit", [_dec15], Object.getOwnPropertyDescriptor(_class, "hasCommit"), _class)), _class));
}(), (_applyDecoratedDescriptor(_class, "isInitialized", [_dec], Object.getOwnPropertyDescriptor(_class, "isInitialized"), _class), _applyDecoratedDescriptor(_class, "addFile", [_dec2], Object.getOwnPropertyDescriptor(_class, "addFile"), _class), _applyDecoratedDescriptor(_class, "commit", [_dec3], Object.getOwnPropertyDescriptor(_class, "commit"), _class), _applyDecoratedDescriptor(_class, "addTag", [_dec4], Object.getOwnPropertyDescriptor(_class, "addTag"), _class), _applyDecoratedDescriptor(_class, "removeTag", [_dec5], Object.getOwnPropertyDescriptor(_class, "removeTag"), _class), _applyDecoratedDescriptor(_class, "hasTags", [_dec6], Object.getOwnPropertyDescriptor(_class, "hasTags"), _class), _applyDecoratedDescriptor(_class, "getLastTaggedCommit", [_dec7], Object.getOwnPropertyDescriptor(_class, "getLastTaggedCommit"), _class), _applyDecoratedDescriptor(_class, "getFirstCommit", [_dec8], Object.getOwnPropertyDescriptor(_class, "getFirstCommit"), _class), _applyDecoratedDescriptor(_class, "pushWithTags", [_dec9], Object.getOwnPropertyDescriptor(_class, "pushWithTags"), _class), _applyDecoratedDescriptor(_class, "describeTag", [_dec10], Object.getOwnPropertyDescriptor(_class, "describeTag"), _class), _applyDecoratedDescriptor(_class, "diffSinceIn", [_dec11], Object.getOwnPropertyDescriptor(_class, "diffSinceIn"), _class), _applyDecoratedDescriptor(_class, "getCurrentSHA", [_dec12], Object.getOwnPropertyDescriptor(_class, "getCurrentSHA"), _class), _applyDecoratedDescriptor(_class, "getTopLevelDirectory", [_dec13], Object.getOwnPropertyDescriptor(_class, "getTopLevelDirectory"), _class), _applyDecoratedDescriptor(_class, "checkoutChanges", [_dec14], Object.getOwnPropertyDescriptor(_class, "checkoutChanges"), _class), _applyDecoratedDescriptor(_class, "getCurrentBranch", [_dec15], Object.getOwnPropertyDescriptor(_class, "getCurrentBranch"), _class), _applyDecoratedDescriptor(_class, "init", [_dec16], Object.getOwnPropertyDescriptor(_class, "init"), _class), _applyDecoratedDescriptor(_class, "hasCommit", [_dec17], Object.getOwnPropertyDescriptor(_class, "hasCommit"), _class)), _class));
exports.default = GitUtilities;

@@ -32,2 +32,6 @@ "use strict";

var _ExecCommand = require("./commands/ExecCommand");
var _ExecCommand2 = _interopRequireDefault(_ExecCommand);
var _LsCommand = require("./commands/LsCommand");

@@ -50,2 +54,3 @@

run: _RunCommand2.default,
exec: _ExecCommand2.default,
ls: _LsCommand2.default

@@ -52,0 +57,0 @@ };

@@ -10,3 +10,3 @@ "use strict";

var _dec, _dec2, _dec3, _dec4, _dec5, _dec6, _desc, _value, _class;
var _dec, _dec2, _dec3, _dec4, _dec5, _dec6, _dec7, _desc, _value, _class;

@@ -54,3 +54,3 @@ var _ChildProcessUtilities = require("./ChildProcessUtilities");

var NpmUtilities = (_dec = _logger2.default.logifyAsync, _dec2 = _logger2.default.logifySync, _dec3 = _logger2.default.logifySync, _dec4 = _logger2.default.logifySync, _dec5 = _logger2.default.logifyAsync, _dec6 = _logger2.default.logifyAsync, (_class = function () {
var NpmUtilities = (_dec = _logger2.default.logifyAsync, _dec2 = _logger2.default.logifySync, _dec3 = _logger2.default.logifySync, _dec4 = _logger2.default.logifySync, _dec5 = _logger2.default.logifySync, _dec6 = _logger2.default.logifyAsync, _dec7 = _logger2.default.logifyAsync, (_class = function () {
function NpmUtilities() {

@@ -87,5 +87,10 @@ _classCallCheck(this, NpmUtilities);

}, {
key: "execInDir",
value: function execInDir(command, args, directory, callback) {
_ChildProcessUtilities2.default.exec("npm " + command + " " + args.join(" "), { cwd: directory }, callback);
}
}, {
key: "runScriptInDir",
value: function runScriptInDir(script, args, directory, callback) {
_ChildProcessUtilities2.default.exec("npm run " + script + " " + args.join(" "), { cwd: directory }, callback);
NpmUtilities.execInDir("run " + script, args, directory, callback);
}

@@ -100,3 +105,3 @@ }, {

return NpmUtilities;
}(), (_applyDecoratedDescriptor(_class, "installInDir", [_dec], Object.getOwnPropertyDescriptor(_class, "installInDir"), _class), _applyDecoratedDescriptor(_class, "addDistTag", [_dec2], Object.getOwnPropertyDescriptor(_class, "addDistTag"), _class), _applyDecoratedDescriptor(_class, "removeDistTag", [_dec3], Object.getOwnPropertyDescriptor(_class, "removeDistTag"), _class), _applyDecoratedDescriptor(_class, "checkDistTag", [_dec4], Object.getOwnPropertyDescriptor(_class, "checkDistTag"), _class), _applyDecoratedDescriptor(_class, "runScriptInDir", [_dec5], Object.getOwnPropertyDescriptor(_class, "runScriptInDir"), _class), _applyDecoratedDescriptor(_class, "publishTaggedInDir", [_dec6], Object.getOwnPropertyDescriptor(_class, "publishTaggedInDir"), _class)), _class));
}(), (_applyDecoratedDescriptor(_class, "installInDir", [_dec], Object.getOwnPropertyDescriptor(_class, "installInDir"), _class), _applyDecoratedDescriptor(_class, "addDistTag", [_dec2], Object.getOwnPropertyDescriptor(_class, "addDistTag"), _class), _applyDecoratedDescriptor(_class, "removeDistTag", [_dec3], Object.getOwnPropertyDescriptor(_class, "removeDistTag"), _class), _applyDecoratedDescriptor(_class, "checkDistTag", [_dec4], Object.getOwnPropertyDescriptor(_class, "checkDistTag"), _class), _applyDecoratedDescriptor(_class, "execInDir", [_dec5], Object.getOwnPropertyDescriptor(_class, "execInDir"), _class), _applyDecoratedDescriptor(_class, "runScriptInDir", [_dec6], Object.getOwnPropertyDescriptor(_class, "runScriptInDir"), _class), _applyDecoratedDescriptor(_class, "publishTaggedInDir", [_dec7], Object.getOwnPropertyDescriptor(_class, "publishTaggedInDir"), _class)), _class));
exports.default = NpmUtilities;

@@ -26,2 +26,6 @@ "use strict";

var _minimatch = require("minimatch");
var _minimatch2 = _interopRequireDefault(_minimatch);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

@@ -93,2 +97,26 @@

}
/**
* Filters a given set of packages and returns the one matching the given glob
*
* @param {!Array.<Package>} packages The packages to filter
* @param {String} glob The glob to match the package name against
* @return {Array.<Package>} The packages with a name matching the glob
* @throws in case a given glob would produce an empty list of packages
*/
}, {
key: "filterPackages",
value: function filterPackages(packages, glob) {
if (typeof glob !== "undefined") {
packages = packages.filter(function (pkg) {
return (0, _minimatch2.default)(pkg.name, glob);
});
if (!packages.length) {
throw new Error("No packages found that match '" + glob + "'");
}
}
return packages;
}
}]);

@@ -95,0 +123,0 @@

@@ -22,2 +22,6 @@ "use strict";

var _logger = require("./logger");
var _logger2 = _interopRequireDefault(_logger);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

@@ -31,4 +35,8 @@

if (!_GitUtilities2.default.isInitialized()) {
_logger2.default.info("Initializing Git repository.");
_GitUtilities2.default.init();
}
this.rootPath = _GitUtilities2.default.getTopLevelDirectory();
this.lernaJsonLocation = _path2.default.join(this.rootPath, "lerna.json");

@@ -35,0 +43,0 @@ this.packageJsonLocation = _path2.default.join(this.rootPath, "package.json");

{
"name": "lerna",
"version": "2.0.0-beta.16",
"version": "2.0.0-beta.17",
"description": "Tool for managing JavaScript projects with multiple packages",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -90,3 +90,3 @@ <p align="center">

Lerna allows you to manage your project using one of two modes: Fixed or Indepedent.
Lerna allows you to manage your project using one of two modes: Fixed or Independent.

@@ -315,3 +315,3 @@ ### Fixed/Locked mode (default)

```sh
$ lerna run [script] // runs npm run my-script in all packages that have it
$ lerna run [script] # runs npm run my-script in all packages that have it
$ lerna run test

@@ -323,2 +323,36 @@ $ lerna run build

`lerna run` respects the `--concurrency` flag (see below).
`lerna run` respects the `--scope` flag (see below).
```sh
$ lerna run --scope my-component test
```
### exec
```sh
$ lerna exec -- [command] # runs the command in all packages
$ lerna exec -- rm -rf ./node_modules
$ lerna exec -- protractor conf.js
```
Run an arbitrary command in each package.
`lerna exec` respects the `--concurrency` flag (see below).
`lerna exec` respects the `--scope` flag (see below).
```sh
$ lerna exec --scope my-component -- ls -la
```
> Hint: The commands are spawned in parallel, using the concurrency given.
> The output is piped through, so not deterministic.
> If you want to run the command in one package after another, use it like this:
```sh
$ lerna exec --concurrency 1 -- ls -la
```
## Misc

@@ -347,4 +381,29 @@

- `lerna`: the current version of `lerna` being used.
- `lerna`: the current version of Lerna being used.
- `version`: the current version of the repository.
- `publishConfig.ignore`: an array of globs that won't be included in `lerna updated/publish`. Use this to prevent publishing a new version unnecessarily for changes, such as fixing a `README.md` typo.
### Flags
#### --concurrency
How many threads to use when Lerna parallelizes the tasks (defaults to `4`)
```sh
$ lerna publish --concurrency 1
```
#### --scope [glob]
Allows to scope an command only affect a subset of packages.
```sh
$ lerna exec --scope my-component -- ls -la
```
```sh
$ lerna run --scope toolbar-* -- ls -la
```
> Hint: The glob is matched against the package name defined in `package.json`,
> not the directory name the package lives in.

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc