@jp-postal-code/address-data-generator
Advanced tools
Comparing version 0.1.0 to 0.1.1
@@ -25,2 +25,4 @@ "use strict"; | ||
const _path = require("path"); | ||
const _rxjs = require("rxjs"); | ||
const _operators = require("rxjs/operators"); | ||
const defaultOptions = { | ||
@@ -73,3 +75,3 @@ pretty: false | ||
title: 'Write addresses json', | ||
async task ({ postalCodeAddressesMap , distPath , pretty }, task) { | ||
task ({ postalCodeAddressesMap , distPath , pretty }, task) { | ||
if (postalCodeAddressesMap == null) { | ||
@@ -79,12 +81,22 @@ task.skip(); | ||
} | ||
let completedCount = 0; | ||
await (0, _writeAddressesJson.writeAddressesJson)({ | ||
postalCodeAddressesMap, | ||
distPath, | ||
pretty, | ||
onOutput () { | ||
++completedCount; | ||
task.output = `${completedCount}/${postalCodeAddressesMap.size}`; | ||
} | ||
}); | ||
return new _rxjs.Observable((observer)=>{ | ||
(async ()=>{ | ||
try { | ||
await (0, _writeAddressesJson.writeAddressesJson)({ | ||
postalCodeAddressesMap, | ||
distPath, | ||
pretty, | ||
onOutput () { | ||
observer.next(); | ||
} | ||
}); | ||
observer.complete(); | ||
} catch (error) { | ||
observer.error(error); | ||
} | ||
})(); | ||
}).pipe((0, _operators.map)((_, i)=>{ | ||
const percent = i / postalCodeAddressesMap.size * 100; | ||
return `${i}/${postalCodeAddressesMap.size} ${percent.toFixed(1)}%`; | ||
}), (0, _operators.throttleTime)(1000)); | ||
} | ||
@@ -91,0 +103,0 @@ }, |
@@ -12,2 +12,4 @@ "use strict"; | ||
const _minify = require("../minify/minify"); | ||
const _rxjs = require("rxjs"); | ||
const _operators = require("rxjs/operators"); | ||
function _interopRequireDefault(obj) { | ||
@@ -37,3 +39,3 @@ return obj && obj.__esModule ? obj : { | ||
title: 'Minify', | ||
async task ({ paths }, task) { | ||
task ({ paths }, task) { | ||
if (paths == null || paths.length === 0) { | ||
@@ -43,10 +45,20 @@ task.skip('Skip because file not found.'); | ||
} | ||
let completedCount = 0; | ||
await (0, _minify.minify)({ | ||
paths, | ||
onMinified () { | ||
++completedCount; | ||
task.output = `${completedCount}/${paths.length}`; | ||
} | ||
}); | ||
return new _rxjs.Observable((observer)=>{ | ||
(async ()=>{ | ||
try { | ||
await (0, _minify.minify)({ | ||
paths, | ||
onMinified () { | ||
observer.next(); | ||
} | ||
}); | ||
observer.complete(); | ||
} catch (error) { | ||
observer.error(error); | ||
} | ||
})(); | ||
}).pipe((0, _operators.map)((_, i)=>{ | ||
const percent = i / paths.length * 100; | ||
return `${i}/${paths.length} ${percent.toFixed(1)}%`; | ||
}), (0, _operators.throttleTime)(1000)); | ||
} | ||
@@ -53,0 +65,0 @@ }, |
{ | ||
"name": "@jp-postal-code/address-data-generator", | ||
"description": "Generate japan address data", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"repository": "git@github.com:jp-postal-code/address-data-generator.git", | ||
@@ -24,4 +24,5 @@ "publishConfig": { | ||
"listr2": "^5.0.5", | ||
"progress": "^2.0.3" | ||
"progress": "^2.0.3", | ||
"rxjs": "^7.5.6" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
63223
772
9
+ Addedrxjs@^7.5.6