Security News
RubyGems.org Adds New Maintainer Role
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
@lerna/run
Advanced tools
@lerna/run is a part of the Lerna monorepo management toolset. It allows you to run scripts or commands across multiple packages in a monorepo, making it easier to manage and automate tasks in a multi-package repository.
Run npm scripts in all packages
This command runs the 'test' script in all packages that contain it. It's useful for ensuring that all packages pass their tests before a release.
lerna run test
Run npm scripts in specific packages
This command runs the 'build' script only in the package named 'my-package'. This is useful for targeting specific packages for certain tasks.
lerna run build --scope my-package
Run npm scripts with parallel execution
This command runs the 'lint' script in all packages in parallel, which can speed up the process significantly compared to running them sequentially.
lerna run lint --parallel
Run npm scripts with a specific concurrency
This command runs the 'test' script in all packages but limits the number of concurrent executions to 4. This can help manage resource usage on your machine.
lerna run test --concurrency 4
Nx is a set of extensible dev tools for monorepos, which helps you develop like Google, Facebook, and Microsoft. It offers similar functionalities to Lerna, including running scripts across multiple packages, but also provides advanced features like dependency graph visualization and affected command execution.
Rush is a scalable monorepo manager for the web, which helps you manage large repositories with many projects. It offers similar script running capabilities as Lerna but focuses more on build orchestration and dependency management.
@lerna/run
Run an npm script in each package that contains that script
Install lerna for access to the lerna
CLI.
$ lerna run <script> -- [..args] # runs npm run my-script in all packages that have it
$ lerna run test
$ lerna run build
# watch all packages and transpile on change, streaming prefixed output
$ lerna run --parallel watch
Run an npm script in each package that contains that script. A double-dash (--
)
is necessary to pass dashed arguments to the script execution.
lerna run
accepts all filter flags.
$ lerna run --scope my-component test
--npm-client <client>
Must be an executable that knows how to run npm lifecycle scripts.
The default --npm-client
is npm
.
$ lerna run build --npm-client=yarn
May also be configured in lerna.json
:
{
"command": {
"run": {
"npmClient": "yarn"
}
}
}
--stream
Stream output from child processes immediately, prefixed with the originating package name. This allows output from different packages to be interleaved.
$ lerna run watch --stream
--parallel
Similar to --stream
, but completely disregards concurrency and topological sorting, running a given command or script
immediately in all matching packages with prefixed streaming output. This is the preferred flag for long-running
processes such as npm run watch
run over many packages.
$ lerna run watch --parallel
Note: It is advised to constrain the scope of this command when using the
--parallel
flag, as spawning dozens of subprocesses may be harmful to your shell's equanimity (or maximum file descriptor limit, for example). YMMV
--no-bail
# Run an npm script in all packages that contain it, ignoring non-zero (error) exit codes
$ lerna run --no-bail test
By default, lerna run
will exit with an error if any script run returns a non-zero exit code.
Pass --no-bail
to disable this behavior, running the script in all packages that contain it regardless of exit code.
--no-prefix
Disable package name prefixing when output is streaming (--stream
or --parallel
).
This option can be useful when piping results to other processes, such as editor plugins.
--profile
Profiles the script executions and produces a performance profile which can be analyzed using DevTools in a
Chromium-based browser (direct url: devtools://devtools/bundled/devtools_app.html
). The profile shows a timeline of
the script executions where each execution is assigned to an open slot. The number of slots is determined by the
--concurrency
option and the number of open slots is determined by --concurrency
minus the number of ongoing
operations. The end result is a visualization of the parallel execution of your scripts.
The default location of the performance profile output is at the root of your project.
$ lerna run build --profile
Note: Lerna will only profile when topological sorting is enabled (i.e. without
--parallel
and--no-sort
).
--profile-location <location>
You can provide a custom location for the performance profile output. The path provided will be resolved relative to the current working directory.
$ lerna run build --profile --profile-location=logs/profile/
useNx
(experimental)Enables integration with Nx. Setting "useNx": true
in lerna.json
will tell Lerna to delegate
running tasks to Nx instead of using p-map
and p-queue
. This only works if Nx is installed and nx.json
is present.
Example of nx.json
:
{
"extends": "nx/presets/npm.json",
"tasksRunnerOptions": {
"default": {
"runner": "nx/tasks-runners/default",
"options": {
"cacheableOperations": ["build"]
}
}
}
}
FAQs
Run an npm script in each package that contains that script
The npm package @lerna/run receives a total of 160,311 weekly downloads. As such, @lerna/run popularity was classified as popular.
We found that @lerna/run demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.
Security News
Research
Socket's threat research team has detected five malicious npm packages targeting Roblox developers, deploying malware to steal credentials and personal data.