How to use bolt - 10 common examples

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
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({
        pkgName: w.name,
        deps: packages.map(toDependency),
        type: depType
      });
    }
  }
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({
github wwselleck / bolt-interactive / src / prompts / commands / run.ts View on Github external
let choices = scripts.map(k => ({
    name: k,
    value: k
  }));

  const script = (await inquirer.prompt([
    {
      name: "script",
      type: "list",
      message: "Select script to run",
      choices
    }
  ])).script;

  if (scope.kind === ScopeType.PROJECT) {
    projectRun({
      script,
      scriptArgs: []
    });
  } else if (scope.kind === ScopeType.ALL || scope.kind === ScopeType.SELECT) {
    // the trailing comma in the glob is important for some reason
    let glob = `{${scope.workspaces.map(w => w.name).join(",")},}`;
    workspacesRun({
      script,
      scriptArgs: [],
      filterOpts: {
        only: glob
      }
    });
  }
}
github wwselleck / bolt-interactive / src / prompts / commands / add.ts View on Github external
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({
        pkgName: w.name,
        deps: packages.map(toDependency),
        type: depType
      });
    }
  }
}
github wwselleck / bolt-interactive / src / prompts / commands / run.ts View on Github external
name: "script",
      type: "list",
      message: "Select script to run",
      choices
    }
  ])).script;

  if (scope.kind === ScopeType.PROJECT) {
    projectRun({
      script,
      scriptArgs: []
    });
  } else if (scope.kind === ScopeType.ALL || scope.kind === ScopeType.SELECT) {
    // the trailing comma in the glob is important for some reason
    let glob = `{${scope.workspaces.map(w => w.name).join(",")},}`;
    workspacesRun({
      script,
      scriptArgs: [],
      filterOpts: {
        only: glob
      }
    });
  }
}
github skatejs / skatejs / projector.js View on Github external
async function changed() {
  for (const w of await getWorkspaces()) {
    const changes = await getChangesInWorkspace(w);
    if (changes.length) {
      console.log(
        outdent`

          ${w.config.name} ${chalk`{green ${
          w.config.version
        }}`} -> ${chalk`{yellow ${calculateNextVersion(
          w.config.version,
          changes
        )}}`}
            ${changes
              .map(
                d =>
                  `${d.hash} ${chalk`{yellow ${inferReleaseType(
                    d.message
github skatejs / skatejs / projector.js View on Github external
async function clean() {
  parallel(() => require('fs-extra').remove('./site/public'));
  for (const w of await getWorkspaces()) {
    parallel(w.dir, async dir => {
      const fs = require('fs-extra');
      const path = require('path');
      const toRemove = path.relative(process.cwd(), path.join(dir, 'dist'));
      await fs.remove(toRemove);
      return toRemove;
    }).then(console.log);
  }
}
github skatejs / skatejs / projector.js View on Github external
async function release({ packages, type }) {
  need(packages, 'Please specify at least one package.');
  need(type, 'Please specify a release type (or version number).');
  await exec('bolt', ['build']);
  const ws = await getWorkspaces();
  for (const pkg of packages.split(',')) {
    const name = pkg.trim();
    const w = ws.filter(w => w.name === name)[0];
    if (!w) continue;
    const cwd = w.dir;
    await exec('npm', ['--no-git-tag-version', 'version', type], { cwd });
    const ver = require(path.join(cwd, 'package.json')).version;
    const tag = `${name}-${ver}`;
    await exec('git', ['commit', '-am', tag], { cwd });
    await exec('git', ['tag', '-a', tag, '-m', tag], { cwd });
    await exec('npm', ['publish'], { cwd });
  }
  await exec('git', ['push', '--follow-tags']);
}
github nodester / watcher / examples / master.js View on Github external
var bolt = require('bolt');

var mesh = new bolt.Node({
  delimiter:'::',
  host: 'localhost',
  port:  6379,
  silent:true
});
mesh.start()
mesh.on('nodester::dieing',function(app){
 console.log('')
 console.log(app.PID)  
 console.log(app.code)
})
github wwselleck / bolt-interactive / src / prompts / commands / remove.ts View on Github external
export default async function runRemovePrompt() {
  const scope = await runScopeSelectPrompt();
  const packagesInput = await runPackagesInputPrompt({
    message: 'What package(s) to remove?'
  });

  const packages: string[] = packagesInput.split(" ");

  if (scope.type === ScopeType.PROJECT) {
    await projectRemove({
      deps: packages
    });
  } else if (scope.type === ScopeType.ALL) {
    await workspacesRemove({
      deps: packages,
      filterOpts: {}
    });
  } else if (scope.type === ScopeType.SELECT) {
    for (const w of scope.workspaces) {
      await workspaceRemove({
        pkgName: w.name,
        deps: packages
      });
    }
  }
}