How to use the gluegun.build function in gluegun

To help you get started, we’ve selected a few gluegun 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 infinitered / solidarity / __tests__ / index.ts View on Github external
test('ensure build', async () => {
  const result = await baseRuntimeConfiguration()
  expect(result).toMatchSnapshot()
  expect(build.mock.calls.length).toBe(1)
  expect(build().brand.mock.calls.length).toBe(1)
  expect(build().brand.mock.calls[0][0]).toBe('solidarity')
  expect(build().src.mock.calls.length).toBe(1)
  // Check local and globals for Windows/Darwin + Yarn === 4 checks
  expect(build().plugins.mock.calls.length).toBe(4)
  expect(build().create.mock.calls.length).toBe(1)
  expect(build().run.mock.calls.length).toBe(1)
})
github infinitered / solidarity / __tests__ / index.ts View on Github external
test('ensure build', async () => {
  const result = await baseRuntimeConfiguration()
  expect(result).toMatchSnapshot()
  expect(build.mock.calls.length).toBe(1)
  expect(build().brand.mock.calls.length).toBe(1)
  expect(build().brand.mock.calls[0][0]).toBe('solidarity')
  expect(build().src.mock.calls.length).toBe(1)
  // Check local and globals for Windows/Darwin + Yarn === 4 checks
  expect(build().plugins.mock.calls.length).toBe(4)
  expect(build().create.mock.calls.length).toBe(1)
  expect(build().run.mock.calls.length).toBe(1)
})
github infinitered / solidarity / __tests__ / index.ts View on Github external
test('ensure build', async () => {
  const result = await baseRuntimeConfiguration()
  expect(result).toMatchSnapshot()
  expect(build.mock.calls.length).toBe(1)
  expect(build().brand.mock.calls.length).toBe(1)
  expect(build().brand.mock.calls[0][0]).toBe('solidarity')
  expect(build().src.mock.calls.length).toBe(1)
  // Check local and globals for Windows/Darwin + Yarn === 4 checks
  expect(build().plugins.mock.calls.length).toBe(4)
  expect(build().create.mock.calls.length).toBe(1)
  expect(build().run.mock.calls.length).toBe(1)
})
github aws-amplify / amplify-cli / packages / amplify-cli / src / cli.js View on Github external
async function run(argv) {
  const nodeModulesDirPath = path.join(__dirname, '../node_modules');
  const globalNodeModulesDirPath = path.join(globalPrefix, 'lib/node_modules');

  const cli = build()
    .brand('amplify')
    .src(__dirname)
    .plugins(nodeModulesDirPath, { matching: 'amplify-*', hidden: false })
    .plugins(globalNodeModulesDirPath, { matching: 'amplify-*', hidden: false })
    .version() // provides default for version, v, --version, -v
    .create();

  // and run it
  const context = await cli.run(argv);

  // send it back (for testing, mostly)
  return context;
}
github infinitered / gluegun / packages / ignite / src / cli / cli.js View on Github external
module.exports = async function run (argv) {
  // create a runtime
  const runtime = build()
    .brand('ignite')
    .loadAll(`${__dirname}/../plugins`)
    .token('commandName', 'cliCommand')
    .token('commandDescription', 'cliDescription')
    .token('extensionName', 'contextExtension')
    .createRuntime()

  // run the command
  const context = await runtime.run()

  // print the commands (TODO: but not if we just ran i guess)
  if (isNil(context.plugin) || isNil(context.command)) {
    header()
    printCommands(context)
  }
github goldcaddy77 / warthog / src / cli / cli.ts View on Github external
export async function run(argv: string[]) {
  // create a CLI runtime
  const cli = build()
    .brand('warthog')
    .src(__dirname)
    // .plugins('./node_modules', { matching: 'warthog-*', hidden: true })
    .help() // provides default for help, h, --help, -h
    .version() // provides default for version, v, --version, -v
    .create();

  // and run it
  const toolbox = await cli.run(argv);

  // send it back (for testing, mostly)
  return toolbox;
}
github zce / zce-cli / src / index.ts View on Github external
export default async (argv?: string[]): Promise => {
  // create a CLI runtime
  const cli = build()
    .brand('zce')
    .exclude(['config', 'semver', 'http', 'strings', 'system', 'patching'])
    .src(__dirname)
    .defaultCommand(zce)
    .version(version)
    .help(help)
    .create()

  // and run the CLI
  const toolbox = await cli.run(argv)

  // send it back (for testing, mostly)
  return toolbox
}
github SaraVieira / fiddly / src / cli.js View on Github external
async function run(argv) {
  // create a CLI runtime
  const cli = build()
    .brand('fiddly')
    .src(__dirname)
    .help() // provides default for help, h, --help, -h
    .version() // provides default for version, v, --version, -v
    .create()

  // and run it
  const toolbox = await cli.run(argv)

  // send it back (for testing, mostly)
  return toolbox
}
github infinitered / solidarity / src / runtime.js View on Github external
function configureRuntime () {
  return (
    build()
      // Brand is used for default config files (if any).
      .brand(BRAND)
      // The default plugin is the directory we're in right now, so
      // the commands sub-directory will contain the first right of
      // refusal to handle user's requests.
      .src(__dirname)
      // TODO: maybe there's other places you'd like to load plugins from?
      // .load(`~/.${BRAND}`)

      // These are the magic tokens found inside command js sources
      // which plugin authors use to specify the command users can type
      // as well as the help they see.
      // .token('commandName', `${BRAND}Command`)
      // .token('commandDescription', `${BRAND}Description`)
      // let's build it
      .create()
github graphprotocol / graph-cli / src / cli.js View on Github external
const run = async argv => {
  const cli = build()
    .brand('graph')
    .src(__dirname)
    .plugins('./node_modules', { matching: 'graph-cli-*', hidden: true })
    .help()
    .version()
    .defaultCommand()
    .create()

  return await cli.run(argv)
}