qqjs
useful functions for writing node scripts
Last updated 5 months ago by dickeyxxx .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install qqjs 
SYNC missed versions from official npm registry.

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

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

Current Tags

  • 0.3.10                                ...           latest (5 months ago)

16 Versions

  • 0.3.10                                ...           5 months ago
  • 0.3.9                                ...           5 months ago
  • 0.3.8                                ...           6 months ago
  • 0.3.7                                ...           6 months ago
  • 0.3.6                                ...           6 months ago
  • 0.3.5                                ...           6 months ago
  • 0.3.4                                ...           6 months ago
  • 0.3.3                                ...           6 months ago
  • 0.3.2                                ...           6 months ago
  • 0.3.0                                ...           6 months ago
  • 0.2.1                                ...           6 months ago
  • 0.2.0                                ...           6 months ago
  • 0.1.0                                ...           6 months ago
  • 0.0.2                                ...           8 months ago
  • 0.0.1                                ...           9 months ago
  • 0.0.0                                ...           9 months ago
Maintainers (1)
Downloads
Today 0
This Week 51
This Month 405
Last Day 0
Last Week 352
Last Month 19
Dependencies (13)
Dev Dependencies (19)

Copyright 2014 - 2016 © taobao.org |