@lingui/babel-plugin-extract-messages
Advanced tools
Comparing version 2.1.2 to 2.2.0-9
21
index.js
@@ -204,2 +204,6 @@ "use strict"; | ||
var _fsPath$basename$spli = _path2.default.basename(filename).split(".", 2), | ||
_fsPath$basename$spli2 = (0, _slicedToArray3.default)(_fsPath$basename$spli, 1), | ||
basename = _fsPath$basename$spli2[0]; | ||
var baseDir = _path2.default.dirname(_path2.default.relative(optsBaseDir, filename)); | ||
@@ -210,6 +214,14 @@ var targetDir = _path2.default.join(localeDir, "_build", baseDir); | ||
var catalog = {}; | ||
var catalogFilename = _path2.default.join(targetDir, basename + ".json"); | ||
// no messages, skip file | ||
if (!messages.size) return; | ||
if (!messages.size) { | ||
// clean any existing catalog | ||
if (_fs2.default.existsSync(catalogFilename)) { | ||
_fs2.default.writeFileSync(catalogFilename, (0, _stringify2.default)({})); | ||
} | ||
return; | ||
} | ||
messages.forEach(function (value, key) { | ||
@@ -220,8 +232,3 @@ catalog[key] = value; | ||
_mkdirp2.default.sync(targetDir); | ||
var _fsPath$basename$spli = _path2.default.basename(filename).split(".", 2), | ||
_fsPath$basename$spli2 = (0, _slicedToArray3.default)(_fsPath$basename$spli, 1), | ||
basename = _fsPath$basename$spli2[0]; | ||
_fs2.default.writeFileSync(_path2.default.join(targetDir, basename + ".json"), (0, _stringify2.default)(catalog, null, 2)); | ||
_fs2.default.writeFileSync(catalogFilename, (0, _stringify2.default)(catalog, null, 2)); | ||
} | ||
@@ -228,0 +235,0 @@ }; |
{ | ||
"name": "@lingui/babel-plugin-extract-messages", | ||
"version": "2.1.2", | ||
"version": "2.2.0-9", | ||
"description": "Extract messages for translation", | ||
@@ -31,9 +31,9 @@ "main": "index.js", | ||
"dependencies": { | ||
"@lingui/conf": "2.1.2", | ||
"@lingui/conf": "2.2.0-9", | ||
"babel-generator": "^6.26.1" | ||
}, | ||
"devDependencies": { | ||
"@lingui/babel-plugin-transform-js": "2.1.2", | ||
"@lingui/babel-plugin-transform-react": "2.1.2" | ||
"@lingui/babel-plugin-transform-js": "2.2.0-9", | ||
"@lingui/babel-plugin-transform-react": "2.2.0-9" | ||
} | ||
} |
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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
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
12213
210
2
+ Added@lingui/conf@2.2.0-9(transitive)
+ Addedargparse@1.0.10(transitive)
+ Addedcosmiconfig@4.0.0(transitive)
+ Addedesprima@4.0.1(transitive)
+ Addedis-directory@0.3.1(transitive)
+ Addedjs-yaml@3.14.1(transitive)
+ Addedrequire-from-string@2.0.2(transitive)
+ Addedsprintf-js@1.0.3(transitive)
- Removed@lingui/conf@2.1.2(transitive)
Updated@lingui/conf@2.2.0-9