How to use the bolt.projectAdd function in bolt

To help you get started, we’ve selected a few bolt examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github wwselleck / bolt-interactive / src / prompts / commands / add.ts View on Github external
const scope = await runScopeSelectPrompt();
  const packagesInput = await runPackagesInputPrompt({
    message: "What package(s) to install?"
  });
  const depType = (await inquirer.prompt([
    {
      name: "depType",
      type: "list",
      choices: TypeChoices
    }
  ])).depType;

  const packages = packagesInput.split(" ");

  if (scope.kind === ScopeType.PROJECT) {
    await projectAdd({
      deps: packages.map(toDependency),
      type: depType
    });
  } else if (scope.kind === ScopeType.ALL) {
    // bolt ws add isn't implemented yet, do bolt w for each workspace
    const workspaces = await getWorkspaces();
    for (const w of workspaces) {
      await workspaceAdd({
        pkgName: w.name,
        deps: packages.map(toDependency),
        type: depType
      });
    }
  } else if (scope.kind === ScopeType.SELECT) {
    for (const w of scope.workspaces) {
      await workspaceAdd({