npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

shipit-cli

v5.3.0

Published

Universal automation and deployment tool written in JavaScript.

Downloads

27,463

Readme

shipit-cli

Build Status version MIT License

Shipit command line interface.

npm install --save-dev shipit-cli

Usage

Usage: shipit <environment> <tasks...>

Options:

  -V, --version         output the version number
  --shipitfile <file>   Specify a custom shipitfile to use
  --require <files...>  Script required before launching Shipit
  --tasks               List available tasks
  --environments        List available environments
  -h, --help            output usage information

shipitfile.js

module.exports = shipit => {
  shipit.initConfig({
    staging: {
      servers: 'myproject.com',
    },
  })

  shipit.task('pwd', async () => {
    await shipit.remote('pwd')
  })
}

API

shipit.task(name, [deps], fn)

Create a new Shipit task. If a promise is returned task will wait for completion.

shipit.task('hello', async () => {
  await shipit.remote('echo "hello on remote"')
  await shipit.local('echo "hello from local"')
})

shipit.blTask(name, [deps], fn)

Create a new Shipit task that will block other tasks during its execution. If a promise is returned other task will wait before start.

shipit.blTask('hello', async () => {
  await shipit.remote('echo "hello on remote"')
  await shipit.local('echo "hello from local"')
})

shipit.start(tasks)

Run Shipit tasks.

shipit.start('task')
shipit.start('task1', 'task2')
shipit.start(['task1', 'task2'])

shipit.local(command, [options])

Run a command locally and streams the result. See ssh-pool#exec.

shipit
  .local('ls -lah', {
    cwd: '/tmp/deploy/workspace',
  })
  .then(({ stdout }) => console.log(stdout))
  .catch(({ stderr }) => console.error(stderr))

shipit.remote(command, [options])

Run a command remotely and streams the result. Run a command locally and streams the result. See ssh-pool#connection.run.

shipit
  .remote('ls -lah')
  .then(([server1Result, server2Result]) => {
    console.log(server1Result.stdout)
    console.log(server2Result.stdout)
  })
  .catch(error => {
    console.error(error.stderr)
  })

shipit.copyToRemote(src, dest, [options])

Make a remote copy from a local path to a remote path. See ssh-pool#connection.copyToRemote.

shipit.copyToRemote('/tmp/workspace', '/opt/web/myapp')

shipit.copyFromRemote(src, dest, [options])

Make a remote copy from a remote path to a local path. See ssh-pool#connection.copyFromRemote.

shipit.copyFromRemote('/opt/web/myapp', '/tmp/workspace')

shipit.log(...args)

Log using Shipit, same API as console.log.

shipit.log('hello %s', 'world')

Workflow tasks

When the system initializes it automatically emits events:

  • Emit event "init"
  • Emit event "init:after_ssh_pool"

Each shipit task also generates events:

  • Emit event "task_start"
  • Emit event "task_stop"
  • Emit event "task_err"
  • Emit event "task_not_found"

Inside the task events, you can test for the task name.

shipit.on('task_start', event => {
  if (event.task == 'first_task') {
    shipit.log("I'm the first task")
  }
})

License

MIT