{"version":3,"sources":["cli.ts"],"names":[],"mappings":"AAkCA,wBAA8B,GAAG,CAC/B,IAAI,GAAE,MAAM,EAAO,EACnB,IAAI,UAAQ,GACX,OAAO,CAAC,IAAI,CAAC,CAkDf","file":"cli.d.ts","sourcesContent":["import meow from 'meow';\nimport {\n  commandGetWorkspaces,\n  commandRunWorkspaces,\n  commandGetChangesFromLastTagByWorkspaces,\n  commandGetVersionsByWorkspaces,\n} from './commands';\nimport * as logger from './utils/logger';\n\n\nconst COMMANDS = {\n  workspaces: commandGetWorkspaces,\n  ws: commandGetWorkspaces,\n  run: commandRunWorkspaces,\n  changes: commandGetChangesFromLastTagByWorkspaces,\n  versions: commandGetVersionsByWorkspaces,\n};\n\nconst helpMessage = `\n  usage\n    $ mono-ci [command] <...args> <...opts>\n  commands\n    run                run a command inside all workspaces\n    workspaces         show projects\n    changes            show changes of files grouped by workspaces\n    versions           get new versions for release by workspaces\n      --no-git-tag-version      \n                       By default, versions will add and push tags.\n                       Pass --no-git-tag-version to disable the behavior.\n  options\n  --since=<branch|tag> Only include packages that have been updated since the specified ref. \n                       If no ref is passed, it defaults to the most-recent tag.\n`;\n\nexport default async function cli(\n  argv: string[] = [],\n  exit = false,\n): Promise<void> {\n  const flagOpts: any = {\n    '--': true,\n    changed: {\n      type: 'string',\n      alias: 'b',\n    },\n    push: {\n      type: 'boolean',\n      default: true,\n    },\n    'git-tag-version': {\n      type: 'boolean',\n      default: true,\n    },\n  };\n  const {\n    pkg,\n    input,\n    flags,\n    showHelp,\n  } = meow(helpMessage, {\n    argv,\n    help: helpMessage,\n    description: 'A tool for managing JavaScript projects with multiple packages based on Bolt.',\n    flags: flagOpts,\n  });\n\n  logger.title(\n    `mono-ci v${pkg.version}`,\n    `(node v${process.versions.node})`,\n    { emoji: '⌚' },\n  );\n  const [command, ...commandArgs] = input;\n\n  try {\n    if (COMMANDS[command]) {\n      await COMMANDS[command](commandArgs, flags);\n    } else {\n      showHelp(0);\n    }\n  } catch (err) {\n    logger.write(err.message, null, true);\n    if (exit) {\n      process.exit(1);\n    } else {\n      throw err;\n    }\n  }\n  return null;\n}\n"]}