-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of https://github.com/danielsinai/jq-node-bindings
- Loading branch information
Showing
10 changed files
with
184 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created | ||
# For more information see: https://help.github.com/actions/language-and-framework-guides/publishing-nodejs-packages | ||
|
||
name: Publish node-rdkafka | ||
|
||
on: | ||
release: | ||
types: [created] | ||
|
||
jobs: | ||
publish-npm: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Install node-gyp deps | ||
run: sudo apt-get install -y autoconf make libtool automake | ||
- uses: actions/checkout@v3 | ||
with: | ||
submodules: recursive | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: 16 | ||
registry-url: https://registry.npmjs.org/ | ||
cache: "npm" | ||
- run: npm ci | ||
- run: npm publish --access=public | ||
env: | ||
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
name: Node.js CI | ||
|
||
on: | ||
push: | ||
branches: [ main ] | ||
pull_request: | ||
branches: [ main ] | ||
|
||
jobs: | ||
build: | ||
strategy: | ||
matrix: | ||
node: [16] | ||
os: [ubuntu-22.04] | ||
include: | ||
- node: 16 | ||
os: macos-12 | ||
runs-on: ${{ matrix.os }} | ||
steps: | ||
- name: Install node-gyp deps | ||
run: | | ||
if [ "${{ matrix.os }}" == "ubuntu-22.04" ]; then | ||
sudo apt-get install -y autoconf make libtool automake | ||
else | ||
brew install autoconf automake libtool | ||
fi | ||
- uses: actions/checkout@v3 | ||
with: | ||
submodules: recursive | ||
- name: Use Node.js ${{ matrix.node-version }} | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
- run: npm ci | ||
- run: npm run build --if-present | ||
- run: npm test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2023-present, Port IO, Inc. | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
# jq-node-bindings | ||
|
||
This is a library for Node.js that provides C bindings to the [jq](https://stedolan.github.io/jq/) library. It allows you to use jq to extract and manipulate data from JSON objects in Node.js. | ||
|
||
## Installation | ||
|
||
``` | ||
npm install @port-labs/jq-node-bindings | ||
``` | ||
|
||
## Requirements | ||
|
||
To use this library, you must have `node-gyp` installed on your system. and the following libraries | ||
|
||
1. `node-gyp` | ||
``` | ||
npm install -g node-gyp | ||
``` | ||
2. XCode on Mac, gcc on unix | ||
Mac | ||
``` | ||
xcode-select --install | ||
``` | ||
Yum | ||
``` | ||
sudo yum install gcc g++ | ||
``` | ||
apt-get | ||
``` | ||
sudo apt-get gcc g++ | ||
``` | ||
3. The following C\C++ toolchains autoconf make libtool automake | ||
Homebrew | ||
``` | ||
brew install autoconf make automake libtool | ||
``` | ||
Yum | ||
``` | ||
sudo apt-get install -y autoconf make libtool automake | ||
``` | ||
apt-get | ||
``` | ||
sudo apt-get install -y autoconf make libtool automake | ||
``` | ||
## Usage | ||
Here's an example of how to use the library: | ||
```typescript | ||
import { exec } from 'jq-node-bindings'; | ||
const json = { foo: 'bar' }; | ||
const input = '.foo'; | ||
const result = exec(json, input); | ||
console.log(result); // outputs "bar" | ||
``` | ||
|
||
The exec function takes two arguments: a JSON object and a jq input string. It returns the result of running the jq program on the JSON object. The result can be of any type supported by jq: object, array, string, number, boolean, or null. | ||
|
||
## Contributing | ||
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change. | ||
|
||
Please make sure to update tests as appropriate. | ||
|
||
## License | ||
[MIT](https://choosealicense.com/licenses/mit/) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters