Skip to content

Commit

Permalink
fix: jd cli was not working
Browse files Browse the repository at this point in the history
  • Loading branch information
lukascivil committed Aug 7, 2023
1 parent 6fc5502 commit ae7165e
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 3 deletions.
4 changes: 2 additions & 2 deletions libs/json-difference-cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"homepage": "https://github.com/lukascivil/json-difference#readme",
"description": "json-difference cli lib",
"license": "MIT",
"main": "bin/src/index.js",
"main": "bin/index.js",
"repository": {
"type": "git",
"url": "git+https://github.com/lukascivil/json-difference.git"
Expand All @@ -16,7 +16,7 @@
"cli"
],
"bin": {
"json-difference": "./bin/index.js"
"jd": "./bin/index.js"
},
"dependencies": {
"json-difference": "^1.9.1",
Expand Down
21 changes: 21 additions & 0 deletions libs/json-difference-cli/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,27 @@
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"targets": {
"build": {
"executor": "nx:run-commands",
"options": {
"commands": ["nx run json-difference-cli:pre-build", "nx run json-difference-cli:pos-build"],
"parallel": false
}
},
"pre-build": {
"executor": "@nx/js:tsc",
"options": {
"outputPath": "libs/json-difference-cli/bin",
"main": "libs/json-difference-cli/src/index.ts",
"tsConfig": "libs/json-difference-cli/tsconfig.lib.json"
}
},
"pos-build": {
"executor": "nx:run-commands",
"options": {
"commands": ["mv libs/json-difference-cli/bin/src/* libs/json-difference-cli/bin/", "rm -R libs/json-difference-cli/bin/src"],
"parallel": false
}
},
"version": {
"executor": "@jscutlery/semver:version",
"options": {
Expand All @@ -30,6 +44,13 @@
"access": "public",
"distFolderPath": "libs/json-difference-cli",
"buildTarget": "json-difference-cli:build"
},
"install-local": {
"executor": "nx:run-commands",
"options": {
"commands": ["nx run json-difference-cli:build", "sudo npm install -g libs/json-difference-cli/."],
"parallel": false
}
}
}
}
5 changes: 5 additions & 0 deletions libs/json-difference-cli/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
import yargs from 'yargs'
import { getDiff } from 'json-difference'

/**
* @description This is a cli tool to get the difference between two json files
* @example
* jd -o "{}" -m "[]"
*/
const options = yargs
.usage('Usage: -o <original> -m <modified>')
.option('o', { alias: 'original', describe: 'Json 1', type: 'string', demandOption: true })
Expand Down
2 changes: 1 addition & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -9859,7 +9859,7 @@ __metadata:
json-difference: ^1.9.1
yargs: ^17.7.2
bin:
json-difference: ./bin/index.js
jd: ./bin/index.js
languageName: unknown
linkType: soft

Expand Down

0 comments on commit ae7165e

Please sign in to comment.