license import { batchProcess , BatchProcessFn , BatchProcessResponse , fsConcurrencyPreset , githubConcurrencyPreset , npmPublishConcurrencyPreset } from './util/batch-process' ; import { ExecResult } from './util/exec' ; import { WorkspaceRepo } from './workspace' ; /**
 * Run some function of work over each workspace repo, returning a collection
 * of successes and failures for each run.
 */ export const run = batchProcess ; /**
 * Create a new branch on each repo.
 */ export async function startNewBranch ( workspaceRepos , newBranch ) { return batchProcess ( workspaceRepos , ( repo ) => { return repo . git . createBranch ( newBranch ) ; } , { concurrency : fsConcurrencyPreset } ) ; } /**
 * Commit changes on each repo with the given commit message.
 */ export async function commitChanges ( workspaceRepos , message ) { return batchProcess ( workspaceRepos , ( repo ) => { return repo . git . commit ( message ) ; } , { concurrency : fsConcurrencyPreset } ) ; } /**
 * Push the current repo HEAD to the given branch on GitHub. If no branch is
 * given, push to the current branch on each repo.
 */ export async function pushChangesToGithub ( workspaceRepos , pushToBranch ? , forcePush = false ) { return batchProcess ( workspaceRepos , ( repo ) => { return repo . git . pushCurrentBranchToOrigin ( pushToBranch , forcePush ) ; } , { concurrency : githubConcurrencyPreset } ) ; } /**
 * Publish a new version of each repo to NPM. A new package.json version
 * will need to be set in each package before running.
 */ export async function publishPackagesToNpm ( workspaceRepos , distTag = 'latest' ) { return batchProcess ( workspaceRepos , ( repo ) => { return repo . npm . publishToNpm ( distTag ) ; } , { concurrency : npmPublishConcurrencyPreset } ) ; }