UNPKG

lerna

Version:

Lerna is a fast, modern build system for managing and publishing multiple JavaScript/TypeScript packages from the same repository

56 lines (54 loc) 1.6 kB
import { Command, ValidationError, filterProjects } from "../../chunk-WC2B4V4E.js"; import "../../chunk-MLKGABMK.js"; // packages/lerna/src/commands/watch/index.ts import { watch } from "nx/src/command-line/watch/watch"; function factory(argv) { return new WatchCommand(argv); } var WatchCommand = class extends Command { filteredProjects = []; count = 0; packagePlural = "packages"; get requiresGit() { return false; } async initialize() { if (!this.options.command) { throw new ValidationError("ENOCOMMAND", "A command to execute is required"); } this.filteredProjects = filterProjects(this.projectGraph, this.execOpts, this.options); this.count = this.filteredProjects.length; this.packagePlural = this.count === 1 ? "package" : "packages"; } async execute() { this.logger.info( "watch", "Executing command %j on changes in %d %s.", this.options.command, this.count, this.packagePlural ); const projectNames = this.filteredProjects.map((p) => p.name); await watch({ command: this.options.command, projectNameEnvName: "LERNA_PACKAGE_NAME", fileChangesEnvName: "LERNA_FILE_CHANGES", includeDependentProjects: false, // dependent projects are accounted for via lerna filter options projects: projectNames, verbose: this.options.verbose }); } }; var commonJsExport = Object.assign(factory, { WatchCommand }); var watch_default = commonJsExport; export { WatchCommand, watch_default as default, factory, commonJsExport as "module.exports" };