i18next-scanner
Advanced tools
Comparing version 2.2.1 to 2.3.0
@@ -11,2 +11,6 @@ 'use strict'; | ||
var _eol = require('eol'); | ||
var _eol2 = _interopRequireDefault(_eol); | ||
var _get = require('lodash/get'); | ||
@@ -66,4 +70,5 @@ | ||
}; | ||
}; | ||
}; /* eslint-disable no-buffer-constructor */ | ||
var flush = function flush(parser, customFlush) { | ||
@@ -84,3 +89,6 @@ return function _flush(done) { | ||
var resStore = parser.get({ sort: options.sort }); | ||
var jsonIndent = options.resource.jsonIndent; | ||
var lineEnding = String(options.resource.lineEnding).toLowerCase(); | ||
Object.keys(resStore).forEach(function (lng) { | ||
@@ -92,7 +100,20 @@ var namespaces = resStore[lng]; | ||
var resPath = parser.formatResourceSavePath(lng, ns); | ||
var str = JSON.stringify(obj, null, options.resource.jsonIndent); | ||
var text = JSON.stringify(obj, null, jsonIndent) + '\n'; | ||
if (lineEnding === 'auto') { | ||
text = _eol2.default.auto(text); | ||
} else if (lineEnding === '\r\n' || lineEnding === 'crlf') { | ||
text = _eol2.default.crlf(text); | ||
} else if (lineEnding === '\n' || lineEnding === 'lf') { | ||
text = _eol2.default.lf(text); | ||
} else if (lineEnding === '\r' || lineEnding === 'cr') { | ||
text = _eol2.default.cr(text); | ||
} else { | ||
// Defaults to LF | ||
text = _eol2.default.lf(text); | ||
} | ||
_this.push(new _vinyl2.default({ | ||
path: resPath, | ||
contents: new Buffer(str + '\n') | ||
contents: typeof Buffer.from === 'function' ? Buffer.from(text) : new Buffer(text) // new Buffer() is deprecated since Node.js v5 | ||
})); | ||
@@ -117,3 +138,3 @@ }); | ||
// Convinience API | ||
// Convenience API | ||
module.exports = function () { | ||
@@ -120,0 +141,0 @@ var _module$exports; |
@@ -80,5 +80,14 @@ 'use strict'; | ||
resource: { | ||
loadPath: 'i18n/{{lng}}/{{ns}}.json', // the source resource path (relative to current working directory) | ||
savePath: 'i18n/{{lng}}/{{ns}}.json', // the target resource path (relative to the path specified with `gulp.dest(path)`) | ||
jsonIndent: 2 | ||
// The path where resources get loaded from. Relative to current working directory. | ||
loadPath: 'i18n/{{lng}}/{{ns}}.json', | ||
// The path to store resources. Relative to the path specified by `gulp.dest(path)`. | ||
savePath: 'i18n/{{lng}}/{{ns}}.json', | ||
// Specify the number of space characters to use as white space to insert into the output JSON string for readability purpose. | ||
jsonIndent: 2, | ||
// Normalize line endings to '\r\n', '\r', '\n', or 'auto' for the current operating system. Defaults to '\n'. | ||
// Aliases: 'CRLF', 'CR', 'LF', 'crlf', 'cr', 'lf' | ||
lineEnding: '\n' | ||
}, | ||
@@ -187,2 +196,5 @@ | ||
} | ||
if (_lodash2.default.isUndefined(_lodash2.default.get(options, 'resource.lineEnding'))) { | ||
_lodash2.default.set(options, 'resource.lineEnding', defaults.resource.lineEnding); | ||
} | ||
@@ -189,0 +201,0 @@ // Accept both nsseparator or nsSeparator |
{ | ||
"name": "i18next-scanner", | ||
"version": "2.2.1", | ||
"version": "2.3.0", | ||
"description": "Scan your code, extract translation keys/values, and merge them into i18n resource files.", | ||
@@ -51,3 +51,4 @@ "homepage": "https://github.com/i18next/i18next-scanner", | ||
"chalk": "^2.3.0", | ||
"commander": "^2.11.0", | ||
"commander": "^2.13.0", | ||
"eol": "^0.9.1", | ||
"esprima": "^4.0.0", | ||
@@ -61,3 +62,3 @@ "gulp-sort": "^2.0.0", | ||
"vinyl": "^2.1.0", | ||
"vinyl-fs": "^2.4.4" | ||
"vinyl-fs": "^3.0.1" | ||
}, | ||
@@ -67,11 +68,11 @@ "devDependencies": { | ||
"babel-core": "^6.26.0", | ||
"babel-eslint": "^8.0.2", | ||
"babel-eslint": "^8.2.1", | ||
"babel-preset-es2015": "^6.24.1", | ||
"babel-preset-stage-0": "^6.24.1", | ||
"coveralls": "^2.13.1", | ||
"eslint": "^4.10.0", | ||
"eslint-config-trendmicro": "^1.1.0", | ||
"coveralls": "^3.0.0", | ||
"eslint": "^4.15.0", | ||
"eslint-config-trendmicro": "^1.3.0", | ||
"eslint-plugin-import": "^2.8.0", | ||
"eslint-plugin-jsx-a11y": "^5.1.1", | ||
"eslint-plugin-react": "^7.4.0", | ||
"eslint-plugin-jsx-a11y": "^6.0.3", | ||
"eslint-plugin-react": "^7.5.1", | ||
"gulp": "^3.9.1", | ||
@@ -81,5 +82,5 @@ "gulp-tap": "^1.0.1", | ||
"sha1": "^1.1.1", | ||
"tap": "^10.7.2", | ||
"tap": "^11.0.1", | ||
"text-table": "^0.2.0" | ||
} | ||
} |
@@ -490,2 +490,4 @@ # i18next-scanner [![build status](https://travis-ci.org/i18next/i18next-scanner.svg?branch=master)](https://travis-ci.org/i18next/i18next-scanner) [![Coverage Status](https://coveralls.io/repos/i18next/i18next-scanner/badge.svg?branch=master&service=github)](https://coveralls.io/github/i18next/i18next-scanner?branch=master) | ||
savePath: 'i18n/{{lng}}/{{ns}}.json', | ||
jsonIndent: 2, | ||
lineEnding: '\n' | ||
}, | ||
@@ -497,3 +499,3 @@ nsSeparator: ':', | ||
interpolation: { | ||
pefix: '{{', | ||
prefix: '{{', | ||
suffix: '}}' | ||
@@ -622,10 +624,14 @@ } | ||
resource: { | ||
// path where resources get loaded from | ||
// The path where resources get loaded from. Relative to current working directory. | ||
loadPath: 'i18n/{{lng}}/{{ns}}.json', | ||
// path to store resources | ||
// The path to store resources. Relative to the path specified by `gulp.dest(path)`. | ||
savePath: 'i18n/{{lng}}/{{ns}}.json', | ||
// jsonIndent to use when storing json files | ||
jsonIndent: 2 | ||
// Specify the number of space characters to use as white space to insert into the output JSON string for readability purpose. | ||
jsonIndent: 2, | ||
// Normalize line endings to '\r\n', '\r', '\n', or 'auto' for the current operating system. Defaults to '\n'. | ||
// Aliases: 'CRLF', 'CR', 'LF', 'crlf', 'cr', 'lf' | ||
lineEnding: '\n' | ||
} | ||
@@ -632,0 +638,0 @@ } |
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
103334
725
66977
12
9
920
+ Addedeol@^0.9.1
+ Addedappend-buffer@1.0.2(transitive)
+ Addedbuffer-equal@1.0.1(transitive)
+ Addedcall-bind@1.0.7(transitive)
+ Addeddefine-data-property@1.1.4(transitive)
+ Addeddefine-properties@1.2.1(transitive)
+ Addedeol@0.9.1(transitive)
+ Addedes-define-property@1.0.0(transitive)
+ Addedes-errors@1.3.0(transitive)
+ Addedflush-write-stream@1.1.1(transitive)
+ Addedfs-mkdirp-stream@1.0.0(transitive)
+ Addedfs.realpath@1.0.0(transitive)
+ Addedfunction-bind@1.1.2(transitive)
+ Addedget-intrinsic@1.2.4(transitive)
+ Addedglob@7.2.3(transitive)
+ Addedglob-stream@6.1.0(transitive)
+ Addedgopd@1.0.1(transitive)
+ Addedhas-property-descriptors@1.0.2(transitive)
+ Addedhas-proto@1.0.3(transitive)
+ Addedhas-symbols@1.0.3(transitive)
+ Addedhasown@2.0.2(transitive)
+ Addedis-absolute@1.0.0(transitive)
+ Addedis-negated-glob@1.0.0(transitive)
+ Addedis-relative@1.0.0(transitive)
+ Addedis-unc-path@1.0.0(transitive)
+ Addedis-valid-glob@1.0.0(transitive)
+ Addedis-windows@1.0.2(transitive)
+ Addedlead@1.0.0(transitive)
+ Addednow-and-later@2.0.1(transitive)
+ Addedobject-keys@1.1.1(transitive)
+ Addedobject.assign@4.1.5(transitive)
+ Addedordered-read-streams@1.0.1(transitive)
+ Addedpump@2.0.1(transitive)
+ Addedpumpify@1.5.1(transitive)
+ Addedremove-bom-buffer@3.0.0(transitive)
+ Addedremove-bom-stream@1.2.0(transitive)
+ Addedresolve-options@1.1.0(transitive)
+ Addedset-function-length@1.2.2(transitive)
+ Addedto-absolute-glob@2.0.2(transitive)
+ Addedto-through@2.0.0(transitive)
+ Addedunc-path-regex@0.1.2(transitive)
+ Addedvalue-or-function@3.0.0(transitive)
+ Addedvinyl-fs@3.0.3(transitive)
+ Addedvinyl-sourcemap@1.1.0(transitive)
- Removedarr-diff@2.0.0(transitive)
- Removedarr-flatten@1.1.0(transitive)
- Removedarray-unique@0.2.1(transitive)
- Removedbraces@1.8.5(transitive)
- Removedclone@1.0.4(transitive)
- Removedclone-stats@0.0.1(transitive)
- Removedexpand-brackets@0.1.5(transitive)
- Removedexpand-range@1.8.2(transitive)
- Removedextend-shallow@2.0.1(transitive)
- Removedextglob@0.3.2(transitive)
- Removedfilename-regex@2.0.1(transitive)
- Removedfill-range@2.2.4(transitive)
- Removedfirst-chunk-stream@1.0.0(transitive)
- Removedfor-in@1.0.2(transitive)
- Removedfor-own@0.1.5(transitive)
- Removedglob@5.0.15(transitive)
- Removedglob-base@0.3.0(transitive)
- Removedglob-parent@2.0.0(transitive)
- Removedglob-stream@5.3.5(transitive)
- Removedgulp-sourcemaps@1.6.0(transitive)
- Removedis-dotfile@1.0.3(transitive)
- Removedis-equal-shallow@0.1.3(transitive)
- Removedis-extendable@0.1.1(transitive)
- Removedis-extglob@1.0.0(transitive)
- Removedis-glob@2.0.1(transitive)
- Removedis-number@2.1.04.0.0(transitive)
- Removedis-posix-bracket@0.1.1(transitive)
- Removedis-primitive@2.0.0(transitive)
- Removedis-stream@1.1.0(transitive)
- Removedis-valid-glob@0.3.0(transitive)
- Removedisarray@0.0.1(transitive)
- Removedisobject@2.1.0(transitive)
- Removedkind-of@3.2.26.0.3(transitive)
- Removedlodash.isequal@4.5.0(transitive)
- Removedmath-random@1.0.4(transitive)
- Removedmerge-stream@1.0.1(transitive)
- Removedmicromatch@2.3.11(transitive)
- Removedminimist@1.2.8(transitive)
- Removedmkdirp@0.5.6(transitive)
- Removedobject-assign@4.1.1(transitive)
- Removedobject.omit@2.0.1(transitive)
- Removedordered-read-streams@0.3.0(transitive)
- Removedparse-glob@3.0.4(transitive)
- Removedpreserve@0.2.0(transitive)
- Removedrandomatic@3.1.1(transitive)
- Removedreadable-stream@1.0.34(transitive)
- Removedregex-cache@0.4.4(transitive)
- Removedrepeat-element@1.1.4(transitive)
- Removedrepeat-string@1.6.1(transitive)
- Removedreplace-ext@0.0.1(transitive)
- Removedstring_decoder@0.10.31(transitive)
- Removedstrip-bom@2.0.0(transitive)
- Removedstrip-bom-stream@1.0.0(transitive)
- Removedthrough2@0.6.5(transitive)
- Removedthrough2-filter@2.0.0(transitive)
- Removedto-absolute-glob@0.1.1(transitive)
- Removedvali-date@1.0.0(transitive)
- Removedvinyl@1.2.0(transitive)
- Removedvinyl-fs@2.4.4(transitive)
Updatedcommander@^2.13.0
Updatedvinyl-fs@^3.0.1