Skip to content

Commit

Permalink
use bin-wrapper(#8)
Browse files Browse the repository at this point in the history
- Uses bin-wrapper to download the needed binary
- Removed .editorconfig in favor of prettier
- Re-saved all files w/ the prettier changes

Fixes: #3 
PR-URL: #8 
Reviewed-By: Jamie Young @jamsyoung <jmeyoung@gmail.com>
  • Loading branch information
jamsyoung authored and yungjames committed Apr 19, 2018
1 parent c2d0cc7 commit 528c753
Show file tree
Hide file tree
Showing 12 changed files with 96 additions and 83 deletions.
26 changes: 0 additions & 26 deletions .editorconfig

This file was deleted.

2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
node_modules
package-lock.json
vendor
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
4.2.2
node
39 changes: 22 additions & 17 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,41 +4,46 @@

### Notable changes

- Does not pin node engine anymore, updated to require 6.9.1+ (current LTS)
* Does not pin node engine anymore, updated to require 6.9.1+ (current LTS)

### Known issues

See https://github.com/jamsyoung/jq-cli-wrapper/labels/defect for complete and
current list of known issues.
See https://github.com/jamsyoung/jq-cli-wrapper/labels/defect for complete and current list of known
issues.

### Commits

* [[`019bc3c047`](https://github.com/jamsyoung/jq-cli-wrapper/commit/019bc3c047)] - **deps**: update node engine (#5) (Jamie Young) [#5](https://github.com/jamsyoung/jq-cli-wrapper/pull/5)
* [[`4e99169d3f`](https://github.com/jamsyoung/jq-cli-wrapper/commit/4e99169d3f)] - **deps**: update node version to most current LTS (james young)
* [[`b0c44497ae`](https://github.com/jamsyoung/jq-cli-wrapper/commit/b0c44497ae)] - **deps**: set node engine to be >=, not exact (James Young



* [[`019bc3c047`](https://github.com/jamsyoung/jq-cli-wrapper/commit/019bc3c047)] - **deps**: update
node engine (#5) (Jamie Young) [#5](https://github.com/jamsyoung/jq-cli-wrapper/pull/5)
* [[`4e99169d3f`](https://github.com/jamsyoung/jq-cli-wrapper/commit/4e99169d3f)] - **deps**: update
node version to most current LTS (james young)
* [[`b0c44497ae`](https://github.com/jamsyoung/jq-cli-wrapper/commit/b0c44497ae)] - **deps**: set
node engine to be >=, not exact (James Young

## 2015-12-08, Version 0.3.0, @jamsyoung

### Notable changes
- Support for Linux 32-bit

* Support for Linux 32-bit

### Known issues
See https://github.com/jamsyoung/jq-cli-wrapper/labels/defect for complete and
current list of known issues.

### Commits
* [[`d27aedab20`](https://github.com/jamsyoung/jq-cli-wrapper/commit/d27aedab20)] - **linux**: add support for linux 32-bit (James Young)
See https://github.com/jamsyoung/jq-cli-wrapper/labels/defect for complete and current list of known
issues.

### Commits

* [[`d27aedab20`](https://github.com/jamsyoung/jq-cli-wrapper/commit/d27aedab20)] - **linux**: add
support for linux 32-bit (James Young)

## 2015-12-07, Version 0.2.0, @jamsyoung
### Notable changes
- Support for Linux 64-bit

### Notable changes

* Support for Linux 64-bit

## 2015-12-07, Version 0.1.0, @jamsyoung

### Notable changes
- Initial release - only support for OS X 64-bit

* Initial release - only support for OS X 64-bit
33 changes: 16 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
# JQ CLI Wrapper

This is a simple npm wrapper around [jq](https://stedolan.github.io/jq/) so it
can be pulled in as a node dependency and used for script commands in the
package.json file without the requirement to be globally installed. While that
was my original reason for creating this wrapper, you could install this
globally as another easy way to get jq installed on your system.
This is a simple npm wrapper around [jq](https://stedolan.github.io/jq/) so it can be pulled in as a
node dependency and used for script commands in the package.json file without the requirement to be
globally installed. While that was my original reason for creating this wrapper, you could install
this globally as another easy way to get jq installed on your system.

This wrapper currently only supports the following jq binaries:
**2018 UPDATE!** I rarely use this as a dependency and always install it globally now. Go figure!

- OS X 64-bit
- Linux 32-bit
- Linux 64-bit
This wrapper currently only supports the following jq binaries:

More OS support will be added if needed. Please submit an issue requesting it
or feel free to add it yourself and submit a pull request.
* OS X 64-bit
* Linux 32-bit
* Linux 64-bit

More OS support will be added if needed. Please submit an issue requesting it or feel free to add it
yourself and submit a pull request.

## Usage as package dependency

Just include this as a dependency in your package.json. Once installed you can
reference `jq` directly in the package.json and not need to worry about
installing it globally. Here is a basic contrived example:
Just include this as a dependency in your package.json. Once installed you can reference `jq`
directly in the package.json and not need to worry about installing it globally. Here is a basic
contrived example:

```json
{
Expand All @@ -36,7 +36,6 @@ installing it globally. Here is a basic contrived example:
}
```


## Usage as a global cli tool

```shell
Expand All @@ -45,5 +44,5 @@ $ jq --version
jq-1.5
```

NOTE: You may need to open a new Terminal window or tab for `jq` to be in your
PATH after it is installed.
NOTE: You may need to open a new Terminal window or tab for `jq` to be in your PATH after it is
installed.
1 change: 0 additions & 1 deletion jq-releases/jq

This file was deleted.

Binary file removed jq-releases/jq-linux32
Binary file not shown.
Binary file removed jq-releases/jq-linux64
Binary file not shown.
Binary file removed jq-releases/jq-osx-amd64
Binary file not shown.
39 changes: 31 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,10 @@
"author": "James Young <jmeyoung@gmail.com> (http://jamsyoung.com/)",
"main": "",
"bin": {
"jq": "./jq-releases/jq"
"jq": "./vendor/jq"
},
"scripts": {
"generate-changelog": "changelog-maker --group",
"preinstall": "scripts/link-proper-binary.sh"
"postinstall": "rm -rf vendor; node scripts/link-binary.js"
},
"repository": {
"type": "git",
Expand All @@ -20,16 +19,40 @@
},
"homepage": "https://github.com/jamsyoung/jq-cli-wrapper",
"engines": {
"node": ">=6.9.1"
"node": ">=8.11.1"
},
"dependencies": {},
"devDependencies": {
"changelog-maker": "2.0.0"
"os": [
"darwin",
"linux"
],
"dependencies": {
"bin-wrapper": "3.0.2"
},
"devDependencies": {},
"keywords": [
"cli-wrapper",
"jq",
"json"
],
"license": "MIT"
"license": "MIT",
"prettier": {
"printWidth": 120,
"tabWidth": 2,
"useTabs": false,
"semi": true,
"singleQuote": true,
"trailingComma": "none",
"bracketSpacing": false,
"jsxBracketSameLine": true,
"arrowParens": "avoid",
"proseWrap": "always",
"overrides": [
{
"files": "*.md",
"options": {
"printWidth": 100
}
}
]
}
}
24 changes: 24 additions & 0 deletions scripts/link-binary.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
'use strict';

// only supports macos and linux
// assumption is the package.json's os property is limiting the package to these oses
// i am sure if this is installed on some other os fire will rain from the sky

const path = require('path');
const fs = require('fs');
const BinWrapper = require('bin-wrapper');
const base = 'https://github.com/stedolan/jq/releases/download/jq-1.5';
const platform = process.platform === 'darwin' ? 'osx' : 'linux';
const arch = process.platform === 'darwin' ? 'amd64' : process.arch();
const jqExecutableName = `jq-${platform}-${arch}`;
const bin = new BinWrapper()
.src(`${base}/jq-osx-amd64`, 'darwin')
.src(`${base}/jq-linux64`, 'linux', 'x64')
.src(`${base}/jq-linux32`, 'linux', 'x32')
.dest(path.join('vendor'))
.use(jqExecutableName)
.version('>=1.5');

bin.run(['--version'], err => {
fs.symlinkSync(jqExecutableName, path.join('vendor', 'jq'));
});
13 changes: 0 additions & 13 deletions scripts/link-proper-binary.sh

This file was deleted.

0 comments on commit 528c753

Please sign in to comment.