replace-json-property
Advanced tools
Comparing version 1.4.0 to 1.4.1
@@ -20,3 +20,3 @@ #!/usr/bin/env node | ||
const options = optionsHelper.extractOptions( | ||
commander.space, | ||
commander.spaces, | ||
commander.eol | ||
@@ -23,0 +23,0 @@ ); |
@@ -0,1 +1,8 @@ | ||
## [1.4.1](https://github.com/kreuzerk/replace-json-property/compare/v1.4.0...v1.4.1) (2019-05-13) | ||
### Bug Fixes | ||
* **spaces:** keep correct number of spaces ([78bd810](https://github.com/kreuzerk/replace-json-property/commit/78bd810)) | ||
# [1.4.0](https://github.com/kreuzerk/replace-json-property/compare/v1.3.0...v1.4.0) (2018-12-25) | ||
@@ -2,0 +9,0 @@ |
{ | ||
"name": "replace-json-property", | ||
"version": "1.4.0", | ||
"version": "1.4.1", | ||
"description": "CLI tool to replace a property in a JSON file", | ||
@@ -8,3 +8,4 @@ "main": "index.js", | ||
"hooks": { | ||
"pre-commit": "lint-staged" | ||
"pre-commit": "lint-staged", | ||
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS" | ||
} | ||
@@ -27,5 +28,16 @@ }, | ||
}, | ||
"commitlint": { | ||
"extends": [ | ||
"@commitlint/config-conventional" | ||
] | ||
}, | ||
"config": { | ||
"commitizen": { | ||
"path": "@commitlint/prompt" | ||
} | ||
}, | ||
"scripts": { | ||
"format:check": "prettier --list-different '{src,__mocks__,bin}/**/*.js'", | ||
"format:write": "prettier --write '{src,__mocks__,bin}/**/*.js'", | ||
"commit": "npx git-cz", | ||
"test": "jest", | ||
@@ -61,5 +73,9 @@ "test:coverage": "jest --coverage", | ||
"devDependencies": { | ||
"@commitlint/cli": "^7.2.1", | ||
"@commitlint/config-conventional": "^7.1.2", | ||
"@commitlint/prompt": "^7.2.1", | ||
"@semantic-release/changelog": "^3.0.1", | ||
"@semantic-release/git": "^7.0.6", | ||
"codecov": "^3.1.0", | ||
"commitizen": "^3.0.5", | ||
"husky": "^1.2.1", | ||
@@ -66,0 +82,0 @@ "jest": "^23.6.0", |
[![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettier) | ||
[![codecov](https://codecov.io/gh/kreuzerk/replace-json-property/branch/master/graph/badge.svg)](https://codecov.io/gh/kreuzerk/replace-json-property) | ||
[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release) | ||
@@ -62,3 +63,3 @@ # replace-json-property | ||
| -s or --spaces | Add the spaces the file should be written with, for example (2, 4) | 2 | ||
| -e or --eol | Add the line ending the file should be written with, for example "\n" | "\r\n" | ||
| -e or --eol | Add the line ending the file should be written with, for example "\r\n" | "\n" | ||
@@ -65,0 +66,0 @@ |
const log = require('./log'); | ||
const DEFAULT_SPACE = 2; | ||
const DEFAULT_EOL = '\r\n'; | ||
const DEFAULT_EOL = '\n'; | ||
const extractOptions = (space, endOfLine) => { | ||
const extractOptions = (spaces, endOfLine) => { | ||
return { | ||
space: space || applyDefaultSpace(), | ||
spaces: spaces ? parseInt(spaces) : applyDefaultSpaces(), | ||
endOfLine: endOfLine || applyDefaultEOL() | ||
@@ -12,3 +12,3 @@ }; | ||
const applyDefaultSpace = () => { | ||
const applyDefaultSpaces = () => { | ||
log.info( | ||
@@ -15,0 +15,0 @@ 'No space provided, file will be writen with 2 spaces which is the default' |
@@ -5,5 +5,5 @@ const sut = require('./options-helper'); | ||
it('should apply the provided space option', () => { | ||
const space = 4; | ||
const options = sut.extractOptions(space); | ||
expect(options.space).toBe(space); | ||
const spaces = '4'; | ||
const options = sut.extractOptions(spaces); | ||
expect(options.spaces).toBe(4); | ||
}); | ||
@@ -13,3 +13,3 @@ | ||
const options = sut.extractOptions(); | ||
expect(options.space).toBe(2); | ||
expect(options.spaces).toBe(2); | ||
}); | ||
@@ -25,4 +25,4 @@ | ||
const options = sut.extractOptions(); | ||
expect(options.endOfLine).toBe('\r\n'); | ||
expect(options.endOfLine).toBe('\n'); | ||
}); | ||
}); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
15517
15
77
12