1 | qqjs
|
2 | ====
|
3 |
|
4 | A bunch of wrappers for various utilites. Ideal for writing shell scripts in node.
|
5 |
|
6 | [![Version](https://img.shields.io/npm/v/qqjs.svg)](https://npmjs.org/package/qqjs)
|
7 | [![CircleCI](https://circleci.com/gh/jdxcode/qqjs/tree/master.svg?style=svg)](https://circleci.com/gh/jdxcode/qqjs/tree/master)
|
8 | [![Appveyor CI](https://ci.appveyor.com/api/projects/status/github/jdxcode/qqjs?branch=master&svg=true)](https://ci.appveyor.com/project/heroku/qqjs/branch/master)
|
9 | [![Codecov](https://codecov.io/gh/jdxcode/qqjs/branch/master/graph/badge.svg)](https://codecov.io/gh/jdxcode/qqjs)
|
10 | [![Greenkeeper](https://badges.greenkeeper.io/jdxcode/qqjs.svg)](https://greenkeeper.io/)
|
11 | [![Known Vulnerabilities](https://snyk.io/test/npm/qqjs/badge.svg)](https://snyk.io/test/npm/qqjs)
|
12 | [![Downloads/week](https://img.shields.io/npm/dw/qqjs.svg)](https://npmjs.org/package/qqjs)
|
13 | [![License](https://img.shields.io/npm/l/qqjs.svg)](https://github.com/jdxcode/qqjs/blob/master/package.json)
|
14 |
|
15 | Usage
|
16 | =====
|
17 |
|
18 | It's best to [look at the code](src/index.ts) to see what all is available, but here is an example of using it:
|
19 |
|
20 | ```js
|
21 | const qq = require('qqjs')
|
22 |
|
23 | // qq.run(fn) is just fn().catch(qq.handleError)
|
24 | // this helps skip a couple of steps when running async functions in scripts
|
25 | qq.run(async () => {
|
26 | // turn silent mode to log all commands
|
27 | // can also see output with DEBUG=qq
|
28 | // qq.config.silent = false
|
29 |
|
30 | // run a command with qq.x this runs synchronously using execa
|
31 | // by default it will echo out to the screen the commmand, stdout/stderr and connect to stdin
|
32 | // can send either a string
|
33 | await qq.x('git --version')
|
34 |
|
35 | // or specify the arguments
|
36 | await qq.x('git' ['--version'])
|
37 |
|
38 | await qq.cd('newdir')
|
39 |
|
40 | await qq.cp('from', 'to')
|
41 |
|
42 | const pjson = await qq.readJSON('package.json')
|
43 | await qq.writeJSON('package.json', {})
|
44 |
|
45 | // for almost any command, if it takes a string you can also pass an array and it will automatically path.join()
|
46 | await qq.writeJSON(['mydir', 'package.json'], {})
|
47 | })
|
48 | ```
|
49 |
|
50 | Status
|
51 | ======
|
52 |
|
53 | - [x] x (exec)
|
54 | - [x] readJSON
|
55 | - [x] writeJSON
|
56 | - [x] path
|
57 | - [x] mkdirp
|
58 | - [x] env
|
59 | - [x] globby
|
60 | - [x] read file
|
61 | - [x] write file
|
62 | - [x] cd
|
63 | - [x] ls
|
64 | - [x] cp (use cpy)
|
65 | - [x] mv
|
66 | - [x] rm
|
67 | - [x] cwd
|
68 | - [x] file exists
|
69 | - [x] homedir
|
70 | - [x] chmod
|
71 | - [x] download files
|
72 | - [x] emptyDir
|
73 | - [ ] ln
|
74 | - [ ] is file/directory/symlink/etc
|
75 | - [ ] batch rename
|
76 | - [ ] sed
|
77 | - [ ] upload files
|
78 | - [ ] aws s3
|
79 | - [ ] resolve-from
|
80 | - [ ] open-editor
|
81 | - [ ] hasha
|
82 | - [x] temp dirs
|
83 | - [ ] temp files
|
84 | - [ ] git stuff?
|
85 | - [ ] find-up
|
86 | - [ ] read-pkg
|
87 | - [ ] which
|
88 | - [x] pushd/popd
|