@jp-postal-code/address-data-generator
Advanced tools
Comparing version 0.1.2 to 0.1.3
@@ -6,5 +6,5 @@ #!/usr/bin/env node | ||
}); | ||
const _createProgram = require("../lib/commands/create-program"); | ||
(0, _createProgram.createProgram)().parse(); | ||
const _createprogram = require("../lib/commands/create-program"); | ||
(0, _createprogram.createProgram)().parse(); | ||
//# sourceMappingURL=adg.js.map |
@@ -12,11 +12,15 @@ "use strict"; | ||
_export(exports, { | ||
defaultOptions: ()=>defaultOptions, | ||
apiAction: ()=>apiAction | ||
defaultOptions: function() { | ||
return defaultOptions; | ||
}, | ||
apiAction: function() { | ||
return apiAction; | ||
} | ||
}); | ||
const _constants = require("../../constants"); | ||
const _createPostalCodeAddressesMap = require("../../generate/create-postal-code-addresses-map"); | ||
const _downloadKenAllZip = require("../../generate/download-ken-all-zip"); | ||
const _readKenAllRecord = require("../../generate/read-ken-all-record"); | ||
const _writeAddressesJson = require("../../generate/write-addresses-json"); | ||
const _makeTempDir = require("../../utils/make-temp-dir"); | ||
const _createpostalcodeaddressesmap = require("../../generate/create-postal-code-addresses-map"); | ||
const _downloadkenallzip = require("../../generate/download-ken-all-zip"); | ||
const _readkenallrecord = require("../../generate/read-ken-all-record"); | ||
const _writeaddressesjson = require("../../generate/write-addresses-json"); | ||
const _maketempdir = require("../../utils/make-temp-dir"); | ||
const _unzip = require("../../utils/unzip"); | ||
@@ -32,3 +36,3 @@ const _promises = require("fs/promises"); | ||
const apiAction = async (distPath, { pretty })=>{ | ||
const tempDir = await (0, _makeTempDir.makeTempDir)(); | ||
const tempDir = await (0, _maketempdir.makeTempDir)(); | ||
const kenAllZipPath = (0, _path.join)(tempDir, 'ken_all.zip'); | ||
@@ -57,3 +61,3 @@ const kenAllCsvPath = (0, _path.join)(tempDir, _constants.KEN_ALL_CSV_FILENAME); | ||
async task ({ kenAllZipPath }) { | ||
await (0, _downloadKenAllZip.downloadKenAllZip)(kenAllZipPath); | ||
await (0, _downloadkenallzip.downloadKenAllZip)(kenAllZipPath); | ||
} | ||
@@ -71,3 +75,3 @@ }, | ||
const { kenAllCsvPath } = context; | ||
const postalCodeAddressesMap = await (0, _createPostalCodeAddressesMap.createPostalCodeAddressesMap)((0, _readKenAllRecord.readKenAllRecord)(kenAllCsvPath)); | ||
const postalCodeAddressesMap = await (0, _createpostalcodeaddressesmap.createPostalCodeAddressesMap)((0, _readkenallrecord.readKenAllRecord)(kenAllCsvPath)); | ||
context.postalCodeAddressesMap = postalCodeAddressesMap; | ||
@@ -86,3 +90,3 @@ } | ||
try { | ||
await (0, _writeAddressesJson.writeAddressesJson)({ | ||
await (0, _writeaddressesjson.writeAddressesJson)({ | ||
postalCodeAddressesMap, | ||
@@ -105,3 +109,3 @@ distPath, | ||
} | ||
}, | ||
} | ||
], { | ||
@@ -108,0 +112,0 @@ ctx: context, |
@@ -7,10 +7,12 @@ "use strict"; | ||
enumerable: true, | ||
get: ()=>minifyAction | ||
get: function() { | ||
return minifyAction; | ||
} | ||
}); | ||
const _listr2 = require("listr2"); | ||
const _fastGlob = /*#__PURE__*/ _interopRequireDefault(require("fast-glob")); | ||
const _fastglob = /*#__PURE__*/ _interop_require_default(require("fast-glob")); | ||
const _minify = require("../minify/minify"); | ||
const _rxjs = require("rxjs"); | ||
const _operators = require("rxjs/operators"); | ||
function _interopRequireDefault(obj) { | ||
function _interop_require_default(obj) { | ||
return obj && obj.__esModule ? obj : { | ||
@@ -31,3 +33,3 @@ default: obj | ||
async task (ctx) { | ||
ctx.paths = await (0, _fastGlob.default)(ctx.glob, { | ||
ctx.paths = await (0, _fastglob.default)(ctx.glob, { | ||
dot: true, | ||
@@ -64,3 +66,3 @@ onlyFiles: true | ||
} | ||
}, | ||
} | ||
], { | ||
@@ -67,0 +69,0 @@ ctx: context, |
@@ -7,9 +7,11 @@ "use strict"; | ||
enumerable: true, | ||
get: ()=>createGenerateCommand | ||
get: function() { | ||
return createGenerateCommand; | ||
} | ||
}); | ||
const _commander = require("commander"); | ||
const _createApiCommand = require("./generate/create-api-command"); | ||
const _createapicommand = require("./generate/create-api-command"); | ||
function createGenerateCommand() { | ||
const command = new _commander.Command('generate'); | ||
command.addCommand((0, _createApiCommand.createApiCommand)()); | ||
command.addCommand((0, _createapicommand.createApiCommand)()); | ||
return command; | ||
@@ -16,0 +18,0 @@ } |
@@ -7,9 +7,11 @@ "use strict"; | ||
enumerable: true, | ||
get: ()=>createMinifyCommand | ||
get: function() { | ||
return createMinifyCommand; | ||
} | ||
}); | ||
const _minifyAction = require("../actions/minify-action"); | ||
const _minifyaction = require("../actions/minify-action"); | ||
const _commander = require("commander"); | ||
function createMinifyCommand() { | ||
const command = new _commander.Command('minify'); | ||
command.addArgument(new _commander.Argument('glob')).action(_minifyAction.minifyAction); | ||
command.addArgument(new _commander.Argument('glob')).action(_minifyaction.minifyAction); | ||
return command; | ||
@@ -16,0 +18,0 @@ } |
@@ -7,11 +7,13 @@ "use strict"; | ||
enumerable: true, | ||
get: ()=>createProgram | ||
get: function() { | ||
return createProgram; | ||
} | ||
}); | ||
const _commander = require("commander"); | ||
const _createGenerateCommand = require("./create-generate-command"); | ||
const _createMinifyCommand = require("./create-minify-command"); | ||
const _creategeneratecommand = require("./create-generate-command"); | ||
const _createminifycommand = require("./create-minify-command"); | ||
function createProgram() { | ||
const program = new _commander.Command('adg'); | ||
program.addCommand((0, _createGenerateCommand.createGenerateCommand)()); | ||
program.addCommand((0, _createMinifyCommand.createMinifyCommand)()); | ||
program.addCommand((0, _creategeneratecommand.createGenerateCommand)()); | ||
program.addCommand((0, _createminifycommand.createMinifyCommand)()); | ||
return program; | ||
@@ -18,0 +20,0 @@ } |
@@ -7,9 +7,11 @@ "use strict"; | ||
enumerable: true, | ||
get: ()=>createApiCommand | ||
get: function() { | ||
return createApiCommand; | ||
} | ||
}); | ||
const _apiAction = require("../../actions/generate/api-action"); | ||
const _apiaction = require("../../actions/generate/api-action"); | ||
const _commander = require("commander"); | ||
function createApiCommand() { | ||
const command = new _commander.Command('api'); | ||
command.addArgument(new _commander.Argument('output dir', 'output directory')).addOption(new _commander.Option('--pretty', 'pretty output')).action(_apiAction.apiAction); | ||
command.addArgument(new _commander.Argument('output dir', 'output directory')).addOption(new _commander.Option('--pretty', 'pretty output')).action(_apiaction.apiAction); | ||
return command; | ||
@@ -16,0 +18,0 @@ } |
@@ -12,6 +12,14 @@ "use strict"; | ||
_export(exports, { | ||
KEN_ALL_ZIP_URL: ()=>KEN_ALL_ZIP_URL, | ||
KEN_ALL_CSV_FILENAME: ()=>KEN_ALL_CSV_FILENAME, | ||
CHECKSUM_FILENAME: ()=>CHECKSUM_FILENAME, | ||
REGION_ID_MAP: ()=>REGION_ID_MAP | ||
KEN_ALL_ZIP_URL: function() { | ||
return KEN_ALL_ZIP_URL; | ||
}, | ||
KEN_ALL_CSV_FILENAME: function() { | ||
return KEN_ALL_CSV_FILENAME; | ||
}, | ||
CHECKSUM_FILENAME: function() { | ||
return CHECKSUM_FILENAME; | ||
}, | ||
REGION_ID_MAP: function() { | ||
return REGION_ID_MAP; | ||
} | ||
}); | ||
@@ -209,5 +217,5 @@ const KEN_ALL_ZIP_URL = 'https://www.post.japanpost.jp/zipcode/dl/kogaki/zip/ken_all.zip'; | ||
47 | ||
], | ||
] | ||
]); | ||
//# sourceMappingURL=constants.js.map |
@@ -7,6 +7,8 @@ "use strict"; | ||
enumerable: true, | ||
get: ()=>createPostalCodeAddressesMap | ||
get: function() { | ||
return createPostalCodeAddressesMap; | ||
} | ||
}); | ||
const _isUnique = require("../utils/is-unique"); | ||
const _kenAllRecordToAddresses = require("./ken-all-record-to-addresses"); | ||
const _isunique = require("../utils/is-unique"); | ||
const _kenallrecordtoaddresses = require("./ken-all-record-to-addresses"); | ||
async function createPostalCodeAddressesMap(kenAllRecordGenerator) { | ||
@@ -16,3 +18,3 @@ const result = new Map(); | ||
for await (const record of kenAllRecordGenerator){ | ||
const addresses = (0, _kenAllRecordToAddresses.kenAllRecordToAddresses)(record); | ||
const addresses = (0, _kenallrecordtoaddresses.kenAllRecordToAddresses)(record); | ||
for (const address of addresses){ | ||
@@ -30,3 +32,3 @@ if (!isUnique(address)) { | ||
function isUniqueAddressFactory() { | ||
const isUnique = (0, _isUnique.isUniqueFactory)(); | ||
const isUnique = (0, _isunique.isUniqueFactory)(); | ||
return (address)=>isUnique(Object.values(address).join('_')); | ||
@@ -33,0 +35,0 @@ } |
@@ -7,3 +7,5 @@ "use strict"; | ||
enumerable: true, | ||
get: ()=>downloadKenAllZip | ||
get: function() { | ||
return downloadKenAllZip; | ||
} | ||
}); | ||
@@ -10,0 +12,0 @@ const _promises = require("fs/promises"); |
@@ -7,3 +7,5 @@ "use strict"; | ||
enumerable: true, | ||
get: ()=>kenAllRecordToAddresses | ||
get: function() { | ||
return kenAllRecordToAddresses; | ||
} | ||
}); | ||
@@ -10,0 +12,0 @@ const _constants = require("../constants"); |
@@ -7,9 +7,11 @@ "use strict"; | ||
enumerable: true, | ||
get: ()=>readKenAllRecord | ||
get: function() { | ||
return readKenAllRecord; | ||
} | ||
}); | ||
const _parseCsv = require("../utils/parse-csv"); | ||
const _parsecsv = require("../utils/parse-csv"); | ||
async function* readKenAllRecord(csvPath) { | ||
let address1Fragment = ''; | ||
let address1KanaFragment = ''; | ||
for await (const record of (0, _parseCsv.parseCsv)(csvPath)){ | ||
for await (const record of (0, _parsecsv.parseCsv)(csvPath)){ | ||
const address1 = record[8]; | ||
@@ -16,0 +18,0 @@ const address1Kana = record[5]; |
@@ -7,10 +7,12 @@ "use strict"; | ||
enumerable: true, | ||
get: ()=>writeAddressesJson | ||
get: function() { | ||
return writeAddressesJson; | ||
} | ||
}); | ||
const _promisePool = require("@supercharge/promise-pool"); | ||
const _writeJsonFile = require("../utils/write-json-file"); | ||
const _promisepool = require("@supercharge/promise-pool"); | ||
const _writejsonfile = require("../utils/write-json-file"); | ||
const _path = require("path"); | ||
const _promises = require("fs/promises"); | ||
async function writeAddressesJson({ postalCodeAddressesMap , distPath , pretty , onOutput }) { | ||
await _promisePool.PromisePool.for([ | ||
await _promisepool.PromisePool.for([ | ||
...postalCodeAddressesMap.entries() | ||
@@ -24,3 +26,3 @@ ]).withConcurrency(50).handleError((error)=>{ | ||
}); | ||
await (0, _writeJsonFile.writeJsonFile)(outputPath, addresses, pretty); | ||
await (0, _writejsonfile.writeJsonFile)(outputPath, addresses, pretty); | ||
onOutput?.(outputPath); | ||
@@ -27,0 +29,0 @@ }); |
@@ -7,13 +7,15 @@ "use strict"; | ||
enumerable: true, | ||
get: ()=>minify | ||
get: function() { | ||
return minify; | ||
} | ||
}); | ||
const _promisePool = require("@supercharge/promise-pool/dist/promise-pool"); | ||
const _promisepool = require("@supercharge/promise-pool/dist/promise-pool"); | ||
const _promises = require("fs/promises"); | ||
const _minifyJson = require("../utils/minify-json"); | ||
const _minifyjson = require("../utils/minify-json"); | ||
async function minify({ paths , onMinified }) { | ||
await _promisePool.PromisePool.for(paths).withConcurrency(50).handleError((error)=>{ | ||
await _promisepool.PromisePool.for(paths).withConcurrency(50).handleError((error)=>{ | ||
throw error; | ||
}).process(async (path)=>{ | ||
const content = await (0, _promises.readFile)(path, 'utf-8'); | ||
await (0, _promises.writeFile)(path, (0, _minifyJson.minifyJson)(content), 'utf-8'); | ||
await (0, _promises.writeFile)(path, (0, _minifyjson.minifyJson)(content), 'utf-8'); | ||
onMinified?.(path); | ||
@@ -20,0 +22,0 @@ }); |
@@ -7,3 +7,5 @@ "use strict"; | ||
enumerable: true, | ||
get: ()=>fetch | ||
get: function() { | ||
return fetch; | ||
} | ||
}); | ||
@@ -10,0 +12,0 @@ const _https = require("https"); |
@@ -7,3 +7,5 @@ "use strict"; | ||
enumerable: true, | ||
get: ()=>isUniqueFactory | ||
get: function() { | ||
return isUniqueFactory; | ||
} | ||
}); | ||
@@ -10,0 +12,0 @@ function isUniqueFactory() { |
@@ -7,3 +7,5 @@ "use strict"; | ||
enumerable: true, | ||
get: ()=>makeTempDir | ||
get: function() { | ||
return makeTempDir; | ||
} | ||
}); | ||
@@ -10,0 +12,0 @@ const _promises = require("fs/promises"); |
@@ -7,3 +7,5 @@ "use strict"; | ||
enumerable: true, | ||
get: ()=>minifyJson | ||
get: function() { | ||
return minifyJson; | ||
} | ||
}); | ||
@@ -10,0 +12,0 @@ function minifyJson(content) { |
@@ -9,9 +9,11 @@ // eslint-disable-next-line @typescript-eslint/ban-ts-comment | ||
enumerable: true, | ||
get: ()=>parseCsv | ||
get: function() { | ||
return parseCsv; | ||
} | ||
}); | ||
const _csvParse = require("csv-parse"); | ||
const _csvparse = require("csv-parse"); | ||
const _fs = require("fs"); | ||
const _iconvLite = require("iconv-lite"); | ||
const _iconvlite = require("iconv-lite"); | ||
async function* parseCsv(csvPath) { | ||
const stream = (0, _fs.createReadStream)(csvPath).pipe((0, _iconvLite.decodeStream)('Shift_JIS')).pipe((0, _csvParse.parse)()); | ||
const stream = (0, _fs.createReadStream)(csvPath).pipe((0, _iconvlite.decodeStream)('Shift_JIS')).pipe((0, _csvparse.parse)()); | ||
for await (const record of stream){ | ||
@@ -18,0 +20,0 @@ yield record; |
@@ -7,8 +7,10 @@ "use strict"; | ||
enumerable: true, | ||
get: ()=>unzip | ||
get: function() { | ||
return unzip; | ||
} | ||
}); | ||
const _promises = require("fs/promises"); | ||
const _jszip = /*#__PURE__*/ _interopRequireDefault(require("jszip")); | ||
const _jszip = /*#__PURE__*/ _interop_require_default(require("jszip")); | ||
const _path = require("path"); | ||
function _interopRequireDefault(obj) { | ||
function _interop_require_default(obj) { | ||
return obj && obj.__esModule ? obj : { | ||
@@ -15,0 +17,0 @@ default: obj |
@@ -7,3 +7,5 @@ "use strict"; | ||
enumerable: true, | ||
get: ()=>writeJsonFile | ||
get: function() { | ||
return writeJsonFile; | ||
} | ||
}); | ||
@@ -10,0 +12,0 @@ const _promises = require("fs/promises"); |
{ | ||
"name": "@jp-postal-code/address-data-generator", | ||
"description": "Generate japan address data", | ||
"version": "0.1.2", | ||
"version": "0.1.3", | ||
"repository": "git@github.com:jp-postal-code/address-data-generator.git", | ||
@@ -17,12 +17,12 @@ "publishConfig": { | ||
"dependencies": { | ||
"@supercharge/promise-pool": "2.3.2", | ||
"commander": "9.4.0", | ||
"csv-parse": "5.3.0", | ||
"@supercharge/promise-pool": "2.4.0", | ||
"commander": "10.0.1", | ||
"csv-parse": "5.4.0", | ||
"fast-glob": "3.2.12", | ||
"iconv-lite": "0.6.3", | ||
"jszip": "3.10.1", | ||
"listr2": "5.0.5", | ||
"listr2": "5.0.8", | ||
"progress": "2.0.3", | ||
"rxjs": "7.5.6" | ||
"rxjs": "7.8.1" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
820
57257
+ Added@supercharge/promise-pool@2.4.0(transitive)
+ Addedcommander@10.0.1(transitive)
+ Addedcsv-parse@5.4.0(transitive)
+ Addedlistr2@5.0.8(transitive)
+ Addedrxjs@7.8.1(transitive)
- Removed@supercharge/promise-pool@2.3.2(transitive)
- Removedcommander@9.4.0(transitive)
- Removedcsv-parse@5.3.0(transitive)
- Removedlistr2@5.0.5(transitive)
- Removedrxjs@7.5.6(transitive)
Updatedcommander@10.0.1
Updatedcsv-parse@5.4.0
Updatedlistr2@5.0.8
Updatedrxjs@7.8.1