/
githubmirror
/
lerna
Обзор
Документация
Войти
/
githubmirror
/
lerna
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
libs/commands/run/src/command.ts
105 строк
3 KB
AI-JamesHenry
feat!: support node ^22.13.0 || ^24.0.0 || ^26.0.0, ship lerna as ESM-only (#4390)
14 июл 2026, 11:38
Не верифицирован
14 июл 2026, 11:38
a148ba2
Код
Авторство
О чём код?
import { filterOptions } from "@lerna/core"; import type { CommandModule } from "yargs"; import { RunCommandConfigOptions, factory } from "."; /** * @see https://github.com/yargs/yargs/blob/main/docs/advanced.md#providing-a-command-module */ const command: CommandModule<object, RunCommandConfigOptions> = { command: "run <script>", describe: "Run an npm script in each package that contains that script", builder(yargs) { yargs .example("$0 run build -- --silent", "# `npm run build --silent` in all packages with a build script") .parserConfiguration({ "populate--": true, }) .positional("script", { describe: "The npm script to run. Pass flags to send to the npm client after --", type: "string", coerce: (script) => { // Allow passing multiple scripts to run concurrently by comma-separating them if (script.includes(",")) { return script .split(",") .filter(Boolean) .map((s: string) => s.trim()); } return script; }, }) .options({ "npm-client": { group: "Command Options:", describe: "Executable used to run scripts (npm, yarn, pnpm, ...).", defaultDescription: "npm", type: "string", requiresArg: true, }, stream: { group: "Command Options:", describe: "Stream output with lines prefixed by package.", type: "boolean", }, parallel: { group: "Command Options:", describe: "Run script with unlimited concurrency, streaming prefixed output.", type: "boolean", }, "no-bail": { group: "Command Options:", describe: "Continue running script despite non-zero exit in a given package.", type: "boolean", }, bail: { // proxy for --no-bail hidden: true, type: "boolean", }, // This option controls prefix for stream output so that it can be disabled to be friendly // to tools like Visual Studio Code to highlight the raw results "no-prefix": { group: "Command Options:", describe: "Do not prefix streaming output.", type: "boolean", }, prefix: { // proxy for --no-prefix hidden: true, type: "boolean", }, profile: { group: "Command Options:", describe: "Profile script executions and output performance profile to default location.", type: "boolean", }, "profile-location": { group: "Command Options:", describe: "Output performance profile to custom location instead of default project root.", type: "string", }, "skip-nx-cache": { hidden: true, type: "boolean", }, verbose: { group: "Command Options:", describe: "When useNx is not false, show verbose output from dependent tasks.", type: "boolean", }, "load-env-files": { group: "Command Options:", describe: "When useNx is not false, automatically load .env files", type: "boolean", }, }); return filterOptions<RunCommandConfigOptions>(yargs); }, async handler(argv) { return factory(argv); }, }; export default command; export { command as "module.exports" };