i18n-patch
Advanced tools
Comparing version 0.0.1 to 0.0.2
@@ -13,3 +13,3 @@ #!/usr/bin/env node | ||
var _ = require('.'); | ||
var _ = require('./'); | ||
@@ -33,2 +33,2 @@ var _2 = _interopRequireDefault(_); | ||
}); | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9jbGkuanMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUNBOzs7Ozs7QUFNQTs7OztBQUNBOzs7Ozs7QUFFQSxJQUFNLE1BQU0sK2tCQUFOOztBQWtCTixJQUFNLFNBQVMsSUFBSSxLQUFKLENBQVUsQ0FBVixDQUFUO0FBQ04sSUFBTSxPQUFPLElBQUksS0FBSjs7QUFFYixJQUFJLENBQUMsTUFBRCxFQUFTO0FBQ1gsTUFBSSxRQUFKLEdBRFc7QUFFWCxVQUFRLElBQVIsQ0FBYSxDQUFiLEVBRlc7Q0FBYjs7QUFLQSxlQUFjLE1BQWQsRUFBc0IsSUFBdEIsRUFDQyxRQURELEdBRUMsS0FGRCxDQUVPLFVBQUMsR0FBRCxFQUFTO0FBQ2QsVUFBUSxHQUFSLENBQVksR0FBWixFQURjO0NBQVQsQ0FGUCIsImZpbGUiOiJjbGkuanMiLCJzb3VyY2VzQ29udGVudCI6WyJcbid1c2Ugc3RyaWN0JztcblxuLy8gTm90ZSBmb3IgZGV2ZWxvcG1lbnQ6XG4vLyAkIG5wbSBydW4gd2F0Y2hcbi8vICQgbm9kZSBsaWIvY2xpLmpzIC0tY29uZmlnIGV4YW1wbGUgLS1zcmMgZXhhbXBsZS9zcmMgLS1vdXQgZXhhbXBsZS9vdXQgamFcblxuaW1wb3J0IG1lb3cgZnJvbSAnbWVvdyc7XG5pbXBvcnQgSTE4blBhdGNoIGZyb20gJy4nO1xuXG5jb25zdCBjbGkgPSBtZW93KGBcbiAgICBVc2FnZVxuICAgICAgJCBpMThuLXBhdGNoIDxsb2NhbGU+XG5cbiAg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ZWZhdWx0LlxuICAgICAgLS1vdXQgICAgIEJhc2UgcGF0aCBmb3Igb3V0cHV0IGZpbGVzLiAnb3V0JyBieSBkZWZhdWx0LlxuICAgICAgICAgICAgICAgIFRoaXMgZGlyZWN0b3J5IHNob3VsZCBiZSBjbGVhbixcbiAgICAgICAgICAgICAgICBidXQgdGhpcyB0b29sIGRvZXMgbm90IGNsZWFuIGl0LlxuICAgICAgICAgICAgICAgIFlvdSBtdXN0IHJlbW92ZSB0aGUgZGlyZWN0b3J5IGJ5IHlvdXJzZWxmLlxuXG4gICAgRXhhbXBsZXNcbiAgICAgICQgaTE4bi1wYXRjaCAtLWNvbmZpZyBleGFtcGxlIC0tc3JjIGV4YW1wbGUvc3JjIC0tb3V0IGV4YW1wbGUvb3V0IGphXG5gKTtcblxuY29uc3QgbG9jYWxlID0gY2xpLmlucHV0WzBdO1xuY29uc3Qgb3B0cyA9IGNsaS5mbGFncztcblxuaWYgKCFsb2NhbGUpIHtcbiAgY2xpLnNob3dIZWxwKCk7XG4gIHByb2Nlc3MuZXhpdCgwKTtcbn1cblxubmV3IEkxOG5QYXRjaChsb2NhbGUsIG9wdHMpXG4uZ2VuZXJhdGUoKVxuLmNhdGNoKChlcnIpID0+IHtcbiAgY29uc29sZS5sb2coZXJyKTtcbn0pO1xuIl19 |
@@ -114,2 +114,3 @@ 'use strict'; | ||
var matched = false; | ||
var error = void 0; | ||
var dest = _path2.default.join(_this4.options.out || 'out', _path2.default.relative(_this4.options.src, file)); | ||
@@ -120,3 +121,18 @@ _fsExtra2.default.mkdirsSync(_path2.default.dirname(dest)); | ||
}); | ||
var out = temp.createWriteStream(); | ||
var out = temp.createWriteStream().on('error', function (err) { | ||
reject(err); | ||
}).on('close', function () { | ||
if (error) { | ||
// This can be set in 'error' callback of lr | ||
return; | ||
} | ||
if (matched) { | ||
// TODO Preserve original file stats | ||
_fsExtra2.default.copySync(out.path, dest); | ||
} else { | ||
// Just copy original file | ||
_fsExtra2.default.copySync(file, dest); | ||
} | ||
resolve(file); | ||
}); | ||
lr.on('line', function (line) { | ||
@@ -134,14 +150,7 @@ var result = line; | ||
}).on('error', function (err) { | ||
error = err; | ||
out.end(); | ||
reject(err); | ||
}).on('close', function () { | ||
if (matched) { | ||
// TODO Preserve original file stats | ||
_fsExtra2.default.copySync(out.path, dest); | ||
} else { | ||
// Just copy original file | ||
_fsExtra2.default.copySync(file, dest); | ||
} | ||
out.end(); | ||
resolve(file); | ||
}); | ||
@@ -156,2 +165,2 @@ }); | ||
exports.default = I18nPatch; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9pbmRleC5qcyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQTs7Ozs7Ozs7QUFFQTs7OztBQUNBOzs7O0FBQ0E7Ozs7QUFDQTs7Ozs7Ozs7QUFDQSxJQUFNLE9BQU8sUUFBUSxNQUFSLEVBQWdCLEtBQWhCLEVBQVA7O0lBRWU7QUFDbkIsV0FEbUIsU0FDbkIsQ0FBWSxNQUFaLEVBQW9CLE9BQXBCLEVBQTZCOzBCQURWLFdBQ1U7O0FBQzNCLFNBQUssTUFBTCxHQUFjLE1BQWQsQ0FEMkI7QUFFM0IsU0FBSyxPQUFMLEdBQWUsV0FBVyxFQUFYLENBRlk7R0FBN0I7O2VBRG1COzsrQkFNUjs7O0FBQ1QsV0FBSyxNQUFMLEdBQWMsS0FBSyxjQUFMLENBQW9CLFdBQXBCLENBQWQsQ0FEUztBQUVULFdBQUssWUFBTCxHQUFvQixLQUFLLGNBQUwsQ0FBdUIsS0FBSyxNQUFMLFVBQXZCLENBQXBCLENBRlM7QUFHVCxXQUFLLGFBQUwsR0FIUztBQUlULGFBQU8sSUFBSSxPQUFKLENBQVksVUFBQyxPQUFELEVBQVUsTUFBVixFQUFxQjtBQUN0QyxnQkFBUSxHQUFSLENBQVksTUFBSyxNQUFMLENBQVksWUFBWixDQUF5QixHQUF6QixDQUE2Q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xldCBvdXQgPSB0ZW1wLmNyZWF0ZVdyaXRlU3RyZWFtKCk7XG4gICAgICBsci5vbignbGluZScsIChsaW5lKSA9PiB7XG4gICAgICAgIGxldCByZXN1bHQgPSBsaW5lO1xuICAgICAgICB0LnBhdHRlcm5zLmZvckVhY2goKHApID0+IHtcbiAgICAgICAgICBsZXQgYmVmb3JlID0gcmVzdWx0O1xuICAgICAgICAgIHJlc3VsdCA9IHJlc3VsdC5yZXBsYWNlKHAucGF0dGVybiwgcC5yZXNvbHZlZCk7XG4gICAgICAgICAgaWYgKGJlZm9yZSAhPT0gcmVzdWx0KSB7XG4gICAgICAgICAgICBtYXRjaGVkID0gdHJ1ZTtcbiAgICAgICAgICB9XG4gICAgICAgIH0pO1xuICAgICAgICAvLyBUT0RPIFByZXNlcnZlIG9yaWdpbmFsIG5ld2xpbmUgaWYgcG9zc2libGVcbiAgICAgICAgb3V0LndyaXRlKGAke3Jlc3VsdH1cXG5gKTtcbiAgICAgIH0pXG4gICAgICAub24oJ2Vycm9yJywgKGVycikgPT4ge1xuICAgICAgICBvdXQuZW5kKCk7XG4gICAgICAgIHJlamVjdChlcnIpO1xuICAgICAgfSlcbiAgICAgIC5vbignY2xvc2UnLCAoKSA9PiB7XG4gICAgICAgIGlmIChtYXRjaGVkKSB7XG4gICAgICAgICAgLy8gVE9ETyBQcmVzZXJ2ZSBvcmlnaW5hbCBmaWxlIHN0YXRzXG4gICAgICAgICAgZnMuY29weVN5bmMob3V0LnBhdGgsIGRlc3QpO1xuICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgIC8vIEp1c3QgY29weSBvcmlnaW5hbCBmaWxlXG4gICAgICAgICAgZnMuY29weVN5bmMoZmlsZSwgZGVzdCk7XG4gICAgICAgIH1cbiAgICAgICAgb3V0LmVuZCgpO1xuICAgICAgICByZXNvbHZlKGZpbGUpO1xuICAgICAgfSk7XG4gICAgfSk7XG4gIH1cbn1cbiJdfQ== | ||
//# sourceMappingURL=data:application/json;base64,eyJ2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KVxuICAgICAgLm9uKCdlcnJvcicsIChlcnIpID0+IHtcbiAgICAgICAgZXJyb3IgPSBlcnI7XG4gICAgICAgIG91dC5lbmQoKTtcbiAgICAgICAgcmVqZWN0KGVycik7XG4gICAgICB9KVxuICAgICAgLm9uKCdjbG9zZScsICgpID0+IHtcbiAgICAgICAgb3V0LmVuZCgpO1xuICAgICAgfSk7XG4gICAgfSk7XG4gIH1cbn1cbiJdfQ== |
{ | ||
"name": "i18n-patch", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"description": "Replacing codes for i18n with patterns.", | ||
@@ -24,3 +24,10 @@ "license": "MIT", | ||
"keywords": [ | ||
"cli" | ||
"cli", | ||
"i18n", | ||
"internationalization", | ||
"l10n", | ||
"localization", | ||
"translation", | ||
"replace", | ||
"pattern" | ||
], | ||
@@ -53,3 +60,3 @@ "dependencies": { | ||
"watch": "babel src -d lib -s inline -w", | ||
"test": "eslint src" | ||
"test": "eslint src && ava" | ||
}, | ||
@@ -56,0 +63,0 @@ "eslintConfig": { |
@@ -1,2 +0,2 @@ | ||
# i18n-replace | ||
# i18n-patch | ||
@@ -10,3 +10,3 @@ > Replacing codes for i18n with patterns. | ||
```console | ||
$ npm install -g i18n-replace | ||
$ npm install -g i18n-patch | ||
``` | ||
@@ -13,0 +13,0 @@ |
@@ -9,3 +9,3 @@ #!/usr/bin/env node | ||
import meow from 'meow'; | ||
import I18nPatch from '.'; | ||
import I18nPatch from './'; | ||
@@ -12,0 +12,0 @@ const cli = meow(` |
@@ -80,2 +80,3 @@ 'use strict'; | ||
let matched = false; | ||
let error; | ||
let dest = path.join(this.options.out || 'out', | ||
@@ -87,3 +88,20 @@ path.relative(this.options.src, file)); | ||
}); | ||
let out = temp.createWriteStream(); | ||
let out = temp.createWriteStream() | ||
.on('error', (err) => { | ||
reject(err); | ||
}) | ||
.on('close', () => { | ||
if (error) { | ||
// This can be set in 'error' callback of lr | ||
return; | ||
} | ||
if (matched) { | ||
// TODO Preserve original file stats | ||
fs.copySync(out.path, dest); | ||
} else { | ||
// Just copy original file | ||
fs.copySync(file, dest); | ||
} | ||
resolve(file); | ||
}); | ||
lr.on('line', (line) => { | ||
@@ -102,2 +120,3 @@ let result = line; | ||
.on('error', (err) => { | ||
error = err; | ||
out.end(); | ||
@@ -107,11 +126,3 @@ reject(err); | ||
.on('close', () => { | ||
if (matched) { | ||
// TODO Preserve original file stats | ||
fs.copySync(out.path, dest); | ||
} else { | ||
// Just copy original file | ||
fs.copySync(file, dest); | ||
} | ||
out.end(); | ||
resolve(file); | ||
}); | ||
@@ -118,0 +129,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
26939
314