diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index d921e1c..0000000 --- a/.editorconfig +++ /dev/null @@ -1,26 +0,0 @@ -; This file is for unifying the coding style for different editors and IDEs. -; More information at http://editorconfig.org - -; Refer to the README for setup instructions - -root = true - -[*] -indent_style = space -indent_size = 4 -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -[*.go] -indent_style = tab - -[*.md] -trim_trailing_whitespace = false - -[bower.json] -indent_size = 2 - -[package.json] -indent_size = 2 diff --git a/.gitignore b/.gitignore index 3c3629e..c1d9fa4 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,3 @@ node_modules +package-lock.json +vendor diff --git a/.nvmrc b/.nvmrc index af8c8ec..64f5a0a 100644 --- a/.nvmrc +++ b/.nvmrc @@ -1 +1 @@ -4.2.2 +node diff --git a/CHANGELOG.md b/CHANGELOG.md index aba400e..01f7a60 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/README.md b/README.md index 9541231..a847b37 100644 --- a/README.md +++ b/README.md @@ -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 { @@ -36,7 +36,6 @@ installing it globally. Here is a basic contrived example: } ``` - ## Usage as a global cli tool ```shell @@ -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. diff --git a/jq-releases/jq b/jq-releases/jq deleted file mode 120000 index 5648d63..0000000 --- a/jq-releases/jq +++ /dev/null @@ -1 +0,0 @@ -jq-osx-amd64 \ No newline at end of file diff --git a/jq-releases/jq-linux32 b/jq-releases/jq-linux32 deleted file mode 100644 index 2fb9cca..0000000 Binary files a/jq-releases/jq-linux32 and /dev/null differ diff --git a/jq-releases/jq-linux64 b/jq-releases/jq-linux64 deleted file mode 100755 index 939227e..0000000 Binary files a/jq-releases/jq-linux64 and /dev/null differ diff --git a/jq-releases/jq-osx-amd64 b/jq-releases/jq-osx-amd64 deleted file mode 100755 index 70a2d28..0000000 Binary files a/jq-releases/jq-osx-amd64 and /dev/null differ diff --git a/package.json b/package.json index f78dc32..cde168a 100644 --- a/package.json +++ b/package.json @@ -5,11 +5,10 @@ "author": "James Young (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", @@ -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 + } + } + ] + } } diff --git a/scripts/link-binary.js b/scripts/link-binary.js new file mode 100644 index 0000000..42649fd --- /dev/null +++ b/scripts/link-binary.js @@ -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')); +}); diff --git a/scripts/link-proper-binary.sh b/scripts/link-proper-binary.sh deleted file mode 100755 index badf993..0000000 --- a/scripts/link-proper-binary.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/bash - -cd jq-releases - -if [[ $(uname) =~ ^Darwin ]]; then - ln -s jq-osx-amd64 jq -else - if [[ $(uname -m) =~ i686 ]]; then - ln -s jq-linux32 jq - else - ln -s jq-linux64 jq - fi -fi