idn-area-extractor
Advanced tools
Comparing version 0.4.0 to 0.5.0
#!/usr/bin/env node | ||
import{a as r,b as o,c as l}from"./chunk-AWZUUL7L.js";import{confirm as n,input as s,select as c}from"@inquirer/prompts";import{existsSync as f,lstatSync as g}from"fs";import p from"meow";var d=p(` | ||
import{a as r,b as o,c as l}from"./chunk-BNGMSJYP.js";import{confirm as n,input as s,select as c}from"@inquirer/prompts";import{existsSync as f,lstatSync as g}from"fs";import p from"meow";var d=p(` | ||
USAGE | ||
@@ -8,3 +8,3 @@ $ idnxtr [regencies|districts|islands|villages] </path/to/file.[pdf|txt]> [OPTIONS] | ||
-c, --compare Compare the extracted data with the latest data | ||
-d, --destination=<path> Set the folder destination | ||
-d, --destination=<path> Set the folder destination. Default: current working directory | ||
-o, --output=<filename> Set a specific output file name without the file extension | ||
@@ -21,4 +21,4 @@ -r, --range=<range> Extract specific PDF pages (e.g. 1-2,5,7-10) | ||
$ idnxtr regencies ~/data/raw-regencies.txt | ||
`,{importMeta:import.meta,description:"Extract Indonesia area data from PDF",booleanDefault:void 0,flags:{compare:{shortFlag:"c",type:"boolean"},destination:{shortFlag:"d",type:"string"},output:{shortFlag:"o",type:"string"},range:{shortFlag:"r",type:"string"},saveRaw:{shortFlag:"R",type:"boolean"},silent:{type:"boolean"}}});async function m(){let[t,i]=d.input,{flags:e}=d;!t&&!i&&!Object.keys(e).length&&(t=await c({message:"Which kind of data to extract?",choices:r.map(a=>({value:a}))}),i=await s({message:"Enter the file path:",validate(a){return a.trim()?!f(a)||!g(a).isFile()?"The file path does not exists":!0:"The file path cannot be empty"}}),await o(i)&&(e.range=await s({message:"Set specific pages range to extract? (e.g. 1-2,5,7-10)"}),e.range===""&&(e.range=void 0),e.saveRaw=await n({message:"Save the extracted raw data?",default:!1})),e.destination=await s({message:"Enter the destination folder:",default:process.cwd()}),e.output=await s({message:"What the output file name would you like to use?",default:t}),e.compare=await n({message:"Compare for data changes?",default:!1}),e.silent=await n({message:"Disable all logs?",default:!1})),await l({data:t,filePath:i,...e}),e.silent||console.log(` | ||
`,{importMeta:import.meta,description:"Extract Indonesia area data from PDF",booleanDefault:void 0,flags:{compare:{shortFlag:"c",type:"boolean"},destination:{shortFlag:"d",type:"string"},output:{shortFlag:"o",type:"string"},range:{shortFlag:"r",type:"string"},saveRaw:{shortFlag:"R",type:"boolean"},silent:{type:"boolean"}}});async function m(){let[t,i]=d.input,{flags:e}=d;!t&&!i&&!Object.keys(e).length&&(t=await c({message:"Which kind of data to extract?",choices:r.map(a=>({value:a}))}),i=await s({message:"Enter the file path:",validate(a){return a.trim()?!f(a)||!g(a).isFile()?"The file path does not exists":!0:"The file path cannot be empty"}}),await o(i)&&(e.range=await s({message:"Set specific pages range to extract? (e.g. 1-2,5,7-10)"}),e.range===""&&(e.range=void 0),e.saveRaw=await n({message:"Save the extracted raw data?",default:!1})),e.destination=await s({message:"Set specific destination folder?"}),e.output=await s({message:"What the output file name would you like to use?",default:t}),e.compare=await n({message:"Compare for data changes?",default:!1}),e.silent=await n({message:"Disable all logs?",default:!1})),await l({data:t,filePath:i,...e}),e.silent||console.log(` | ||
Done!`)}m().catch(t=>{console.error(`${t.name}: ${t.message}`),process.exit(1)}); | ||
//# sourceMappingURL=cli.js.map |
type DataEntity = 'regencies' | 'districts' | 'islands' | 'villages'; | ||
declare const dataEntities: readonly DataEntity[]; | ||
declare function isFilePdf(path: string): Promise<boolean>; | ||
declare function isFilePdf(fpath: string): Promise<boolean>; | ||
interface ExtractorOptions { | ||
@@ -16,6 +16,3 @@ /** | ||
* | ||
* @default | ||
* ```js | ||
* process.cwd() | ||
* ``` | ||
* The default is the current working directory. | ||
*/ | ||
@@ -50,2 +47,2 @@ destination?: string; | ||
export { DataEntity, ExtractorOptions, dataEntities, idnxtr as default, isFilePdf }; | ||
export { type DataEntity, type ExtractorOptions, dataEntities, idnxtr as default, isFilePdf }; |
@@ -1,2 +0,2 @@ | ||
import{a,b,c}from"./chunk-AWZUUL7L.js";export{a as dataEntities,c as default,b as isFilePdf}; | ||
import{a,b,c}from"./chunk-BNGMSJYP.js";export{a as dataEntities,c as default,b as isFilePdf}; | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "idn-area-extractor", | ||
"version": "0.4.0", | ||
"version": "0.5.0", | ||
"description": "Extract Indonesia area data from the raw sources to CSV", | ||
@@ -45,19 +45,19 @@ "type": "module", | ||
"devDependencies": { | ||
"@types/node": "^20.5.9", | ||
"@types/papaparse": "^5.3.8", | ||
"@types/node": "^20.10.0", | ||
"@types/papaparse": "^5.3.13", | ||
"@typescript-eslint/eslint-plugin": "^6.6.0", | ||
"@typescript-eslint/parser": "^6.6.0", | ||
"@vitest/coverage-v8": "^0.34.3", | ||
"eslint": "^8.47.0", | ||
"@vitest/coverage-v8": "^0.34.6", | ||
"eslint": "^8.54.0", | ||
"eslint-config-airbnb-base": "^15.0.0", | ||
"eslint-config-airbnb-typescript": "^17.1.0", | ||
"eslint-plugin-import": "^2.28.1", | ||
"tsup": "^7.2.0", | ||
"typescript": "^5.2.2", | ||
"vitest": "^0.34.3" | ||
"tsup": "^8.0.1", | ||
"typescript": "^5.3.2", | ||
"vitest": "^0.34.6" | ||
}, | ||
"dependencies": { | ||
"@inquirer/prompts": "^3.0.4", | ||
"file-type": "^18.5.0", | ||
"idn-area-data": "^3.0.0", | ||
"file-type": "^18.7.0", | ||
"idn-area-data": "^3.0.1", | ||
"jest-diff": "^29.6.4", | ||
@@ -68,4 +68,5 @@ "meow": "^12.1.1", | ||
"papaparse": "^5.4.1", | ||
"pdfjs-dist": "^3.9.179" | ||
"pdfjs-dist": "^4.0.269", | ||
"super-regex": "^0.3.0" | ||
} | ||
} |
@@ -7,20 +7,2 @@ <h1>idn-area-extractor</h1> | ||
<h2>Table of Contents</h2> | ||
- [Prerequisite](#prerequisite) | ||
- [Installation](#installation) | ||
- [Usage](#usage) | ||
- [Interactive UI](#interactive-ui) | ||
- [API](#api) | ||
- [`idnxtr(options)`](#idnxtroptions) | ||
- [`options`](#options) | ||
- [Example](#example) | ||
- [ESM](#esm) | ||
- [CommonJS](#commonjs) | ||
- [Problem Reporting](#problem-reporting) | ||
- [Reporting a Bug](#reporting-a-bug) | ||
- [Requesting a New Feature](#requesting-a-new-feature) | ||
- [Asking a Question](#asking-a-question) | ||
- [Support This Project](#support-this-project) | ||
## Prerequisite | ||
@@ -57,3 +39,3 @@ | ||
-c, --compare Compare the extracted data with the latest data | ||
-d, --destination=<path> Set the folder destination | ||
-d, --destination=<path> Set the folder destination. Default: current working directory | ||
-o, --output=<filename> Set a specific output file name without the file extension | ||
@@ -157,4 +139,4 @@ -r, --range=<range> Extract specific PDF pages (e.g. 1-2,5,7-10) | ||
<a href="https://trakteer.id/fityannugroho/tip" target="_blank"><img id="wse-buttons-preview" src="https://cdn.trakteer.id/images/embed/trbtn-red-6.png" style="border: 0px none; height: 36px; --darkreader-inline-border-top: currentcolor; --darkreader-inline-border-right: currentcolor; --darkreader-inline-border-bottom: currentcolor; --darkreader-inline-border-left: currentcolor;" alt="Trakteer Saya" data-darkreader-inline-border-top="" data-darkreader-inline-border-right="" data-darkreader-inline-border-bottom="" data-darkreader-inline-border-left="" height="40"></a> | ||
Give a ⭐️ if this project helped you! | ||
You can support this project by donating via [GitHub Sponsor](https://github.com/sponsors/fityannugroho), [Trakteer](https://trakteer.id/fityannugroho/tip), or [Saweria](https://saweria.co/fityannugroho). |
Sorry, the diff of this file is not supported yet
57600
10
101
140
+ Addedsuper-regex@^0.3.0
+ Added@napi-rs/canvas@0.1.67(transitive)
+ Added@napi-rs/canvas-android-arm64@0.1.67(transitive)
+ Added@napi-rs/canvas-darwin-arm64@0.1.67(transitive)
+ Added@napi-rs/canvas-darwin-x64@0.1.67(transitive)
+ Added@napi-rs/canvas-linux-arm-gnueabihf@0.1.67(transitive)
+ Added@napi-rs/canvas-linux-arm64-gnu@0.1.67(transitive)
+ Added@napi-rs/canvas-linux-arm64-musl@0.1.67(transitive)
+ Added@napi-rs/canvas-linux-riscv64-gnu@0.1.67(transitive)
+ Added@napi-rs/canvas-linux-x64-gnu@0.1.67(transitive)
+ Added@napi-rs/canvas-linux-x64-musl@0.1.67(transitive)
+ Added@napi-rs/canvas-win32-x64-msvc@0.1.67(transitive)
+ Addedconvert-hrtime@5.0.0(transitive)
+ Addedfunction-timeout@1.0.2(transitive)
+ Addedpdfjs-dist@4.10.38(transitive)
+ Addedsuper-regex@0.3.0(transitive)
+ Addedtime-span@5.1.0(transitive)
- Removed@mapbox/node-pre-gyp@1.0.11(transitive)
- Removedabbrev@1.1.1(transitive)
- Removedagent-base@6.0.2(transitive)
- Removedaproba@2.0.0(transitive)
- Removedare-we-there-yet@2.0.0(transitive)
- Removedbalanced-match@1.0.2(transitive)
- Removedbrace-expansion@1.1.11(transitive)
- Removedcanvas@2.11.2(transitive)
- Removedchownr@2.0.0(transitive)
- Removedcolor-support@1.1.3(transitive)
- Removedconcat-map@0.0.1(transitive)
- Removedconsole-control-strings@1.1.0(transitive)
- Removeddebug@4.4.0(transitive)
- Removeddecompress-response@4.2.1(transitive)
- Removeddelegates@1.0.0(transitive)
- Removeddetect-libc@2.0.3(transitive)
- Removedfs-minipass@2.1.0(transitive)
- Removedfs.realpath@1.0.0(transitive)
- Removedgauge@3.0.2(transitive)
- Removedglob@7.2.3(transitive)
- Removedhas-unicode@2.0.1(transitive)
- Removedhttps-proxy-agent@5.0.1(transitive)
- Removedinflight@1.0.6(transitive)
- Removedmake-dir@3.1.0(transitive)
- Removedmimic-response@2.1.0(transitive)
- Removedminimatch@3.1.2(transitive)
- Removedminipass@3.3.65.0.0(transitive)
- Removedminizlib@2.1.2(transitive)
- Removedmkdirp@1.0.4(transitive)
- Removedms@2.1.3(transitive)
- Removednan@2.22.0(transitive)
- Removednode-fetch@2.7.0(transitive)
- Removednopt@5.0.0(transitive)
- Removednpmlog@5.0.1(transitive)
- Removedobject-assign@4.1.1(transitive)
- Removedonce@1.4.0(transitive)
- Removedpath-is-absolute@1.0.1(transitive)
- Removedpath2d@0.1.1(transitive)
- Removedpath2d-polyfill@2.1.1(transitive)
- Removedpdfjs-dist@3.11.174(transitive)
- Removedrimraf@3.0.2(transitive)
- Removedsemver@6.3.17.7.1(transitive)
- Removedset-blocking@2.0.0(transitive)
- Removedsimple-concat@1.0.1(transitive)
- Removedsimple-get@3.1.1(transitive)
- Removedtar@6.2.1(transitive)
- Removedtr46@0.0.3(transitive)
- Removedwebidl-conversions@3.0.1(transitive)
- Removedwhatwg-url@5.0.0(transitive)
- Removedwide-align@1.1.5(transitive)
- Removedwrappy@1.0.2(transitive)
- Removedyallist@4.0.0(transitive)
Updatedfile-type@^18.7.0
Updatedidn-area-data@^3.0.1
Updatedpdfjs-dist@^4.0.269