Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

qqjs

jdxcode314.7kMIT0.3.11TypeScript support: included

useful functions for writing node scripts

anycli

readme

qqjs

A bunch of wrappers for various utilites. Ideal for writing shell scripts in node.

Version CircleCI Appveyor CI Codecov Greenkeeper Known Vulnerabilities Downloads/week License

Usage

It's best to look at the code to see what all is available, but here is an example of using it:

const qq = require('qqjs')

// qq.run(fn) is just fn().catch(qq.handleError)
// this helps skip a couple of steps when running async functions in scripts
qq.run(async () => {
  // turn silent mode to log all commands
  // can also see output with DEBUG=qq
  // qq.config.silent = false

  // run a command with qq.x this runs synchronously using execa
  // by default it will echo out to the screen the commmand, stdout/stderr and connect to stdin
  // can send either a string
  await qq.x('git --version')

  // or specify the arguments
  await qq.x('git' ['--version'])

  await qq.cd('newdir')

  await qq.cp('from', 'to')

  const pjson = await qq.readJSON('package.json')
  await qq.writeJSON('package.json', {})

  // for almost any command, if it takes a string you can also pass an array and it will automatically path.join()
  await qq.writeJSON(['mydir', 'package.json'], {})
})

Status

  • <input checked="" disabled="" type="checkbox"> x (exec)
  • <input checked="" disabled="" type="checkbox"> readJSON
  • <input checked="" disabled="" type="checkbox"> writeJSON
  • <input checked="" disabled="" type="checkbox"> path
  • <input checked="" disabled="" type="checkbox"> mkdirp
  • <input checked="" disabled="" type="checkbox"> env
  • <input checked="" disabled="" type="checkbox"> globby
  • <input checked="" disabled="" type="checkbox"> read file
  • <input checked="" disabled="" type="checkbox"> write file
  • <input checked="" disabled="" type="checkbox"> cd
  • <input checked="" disabled="" type="checkbox"> ls
  • <input checked="" disabled="" type="checkbox"> cp (use cpy)
  • <input checked="" disabled="" type="checkbox"> mv
  • <input checked="" disabled="" type="checkbox"> rm
  • <input checked="" disabled="" type="checkbox"> cwd
  • <input checked="" disabled="" type="checkbox"> file exists
  • <input checked="" disabled="" type="checkbox"> homedir
  • <input checked="" disabled="" type="checkbox"> chmod
  • <input checked="" disabled="" type="checkbox"> download files
  • <input checked="" disabled="" type="checkbox"> emptyDir
  • <input disabled="" type="checkbox"> ln
  • <input disabled="" type="checkbox"> is file/directory/symlink/etc
  • <input disabled="" type="checkbox"> batch rename
  • <input disabled="" type="checkbox"> sed
  • <input disabled="" type="checkbox"> upload files
  • <input disabled="" type="checkbox"> aws s3
  • <input disabled="" type="checkbox"> resolve-from
  • <input disabled="" type="checkbox"> open-editor
  • <input disabled="" type="checkbox"> hasha
  • <input checked="" disabled="" type="checkbox"> temp dirs
  • <input disabled="" type="checkbox"> temp files
  • <input disabled="" type="checkbox"> git stuff?
  • <input disabled="" type="checkbox"> find-up
  • <input disabled="" type="checkbox"> read-pkg
  • <input disabled="" type="checkbox"> which
  • <input checked="" disabled="" type="checkbox"> pushd/popd