js-utils-kit 0.5.4 → 0.5.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli/index.js CHANGED
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- import r from"ora";import{Command as e}from"commander";import o from"fs";import t from"path";import i from"archiver";var n="JS Utils Kit",s="0.5.3",c="Essential JavaScript helpers";const a=new e;a.name(n).description(c).version(s).enablePositionalOptions(),a.command("createArchive").description("Creates a archive from a specified directory").requiredOption("-f, --format <format>","Archive format (zip or tar)").requiredOption("-s, --source <source>","Source directory path").requiredOption("-d, --destination <destination>","Destination archive file").action(async e=>{const n=r("Creating archive...").start();try{await function({format:r,source:e,destination:n,options:s={},log:c=!0,onSuccess:a}){const d=t.resolve(e);if(!o.existsSync(d)||!o.statSync(d).isDirectory())throw new Error(`Source directory "${e}" does not exist or is not a directory.`);const m=o.createWriteStream(n);"zip"===r&&(s={...s,zlib:{level:9}});const p=i(r,s);return new Promise((r,o)=>{m.on("close",()=>{const e=p.pointer();c&&console.log(`${n} created: ${e} total bytes`),a&&a(e),r()}),p.on("error",r=>{o(r)}),p.pipe(m),p.directory(e,!1),p.finalize().catch(r=>o(r instanceof Error?r:new Error(String(r))))})}({format:e.format,source:e.source,destination:e.destination,log:!1,onSuccess:r=>{n.succeed(`Archive created successfully at ${e.destination} (${r} bytes).`)}})}catch(r){n.fail("Failed to create archive: "+(r instanceof Error?r.message:"Unknown error")),process.exit(1)}}),a.parse();
2
+ import r from"ora";import{Command as e}from"commander";import o from"fs";import t from"path";import i from"archiver";var n="JS Utils Kit",s="0.5.4",c="Essential JavaScript helpers";const a=new e;a.name(n).description(c).version(s).enablePositionalOptions(),a.command("createArchive").description("Creates a archive from a specified directory").requiredOption("-f, --format <format>","Archive format (zip or tar)").requiredOption("-s, --source <source>","Source directory path").requiredOption("-d, --destination <destination>","Destination archive file").action(async e=>{const n=r("Creating archive...").start();try{await function({format:r,source:e,destination:n,options:s={},log:c=!0,onSuccess:a}){const d=t.resolve(e);if(!o.existsSync(d)||!o.statSync(d).isDirectory())throw new Error(`Source directory "${e}" does not exist or is not a directory.`);const m=o.createWriteStream(n);"zip"===r&&(s={...s,zlib:{level:9}});const p=i(r,s);return new Promise((r,o)=>{m.on("close",()=>{const e=p.pointer();c&&console.log(`${n} created: ${e} total bytes`),a&&a(e),r()}),p.on("error",r=>{o(r)}),p.pipe(m),p.directory(e,!1),p.finalize().catch(r=>o(r instanceof Error?r:new Error(String(r))))})}({format:e.format,source:e.source,destination:e.destination,log:!1,onSuccess:r=>{n.succeed(`Archive created successfully at ${e.destination} (${r} bytes).`)}})}catch(r){n.fail("Failed to create archive: "+(r instanceof Error?r.message:"Unknown error")),process.exit(1)}}),a.parse();
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "js-utils-kit",
3
3
  "displayName": "JS Utils Kit",
4
- "version": "0.5.4",
4
+ "version": "0.5.5",
5
5
  "description": "Essential JavaScript helpers",
6
6
  "license": "MIT",
7
7
  "private": false,