New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@balancy/cli

Package Overview
Dependencies
Maintainers
0
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@balancy/cli - npm Package Compare versions

Comparing version 1.0.7 to 1.0.8

dist/file-helper-node.class.d.ts

2

dist/index.d.ts

@@ -1,2 +0,2 @@

export {};
export * from './file-helper-node.class';
//# sourceMappingURL=index.d.ts.map

@@ -1,5 +0,5 @@

"use strict";const w=require("commander"),v=require("@balancy/core"),s=require("node:path"),n=require("node:fs");require("node:util");const d=require("mkdirp"),S=require("fs"),C=require("rimraf"),k="1.0.0-rc.24",P="todo";class O{constructor(e){this.cacheDir=s.resolve(e.cachePath),this.cacheBinaryDir=s.resolve(e.cachePath),!n.existsSync(this.cacheDir)&&d.mkdirpSync(this.cacheDir),!n.existsSync(this.cacheBinaryDir)&&d.mkdirpSync(this.cacheBinaryDir),e.codePath?(this.codeDir=s.resolve(e.codePath),!n.existsSync(this.codeDir)&&d.mkdirpSync(this.codeDir)):this.codeDir="",e.resourcesPath?(this.resourcesDir=s.resolve(e.resourcesPath),!n.existsSync(this.resourcesDir)&&d.mkdirpSync(this.resourcesDir)):this.resourcesDir=""}saveFileToDir(e,c,i){const t=s.resolve(e,c),{dir:h}=s.parse(t);d.mkdirpSync(h),n.writeFileSync(t,i)}clearDir(e){n.readdirSync(e).forEach(c=>{n.lstatSync(s.resolve(e,c)).isDirectory()?C.rimrafSync(s.resolve(e,c)):n.unlinkSync(s.resolve(e,c))})}readFileFromDir(e,c){try{return S.readFileSync(s.resolve(e,c)).toString("utf-8")}catch{return""}}getFilesInFolderCallback(e){return n.readdirSync(s.resolve(this.cacheDir,e))}createSubDirectoryInCacheCallback(e){d.mkdirpSync(s.resolve(this.cacheDir,e))}saveFileInCacheCallback(e,c){this.saveFileToDir(this.cacheDir,e,c)}saveFileInCacheBinaryCallback(e,c){this.saveFileToDir(this.cacheBinaryDir,e,c)}saveFileInResourcesCallback(e,c){this.saveFileToDir(this.resourcesDir,e,c)}cleanUpResourcesFolderCallback(){this.clearDir(this.resourcesDir)}cleanGeneratedCodeFolderCallback(){this.clearDir(this.codeDir)}saveGeneratedCodeCallback(e,c){this.saveFileToDir(this.codeDir,e,c)}loadFileFromCacheCallback(e){return this.readFileFromDir(this.cacheDir,e)}loadFileFromResourcesCallback(e){return this.readFileFromDir(this.resourcesDir,e)}deleteFolderCallback(e){}deleteCachedFolderCallback(e){C.rimrafSync(s.resolve(this.cacheDir,e))}deleteCachedFileCallback(e){n.unlinkSync(s.resolve(this.cacheDir,e))}getFilesInCachedFolderCallback(e){let c=s.resolve(this.cacheDir,e);return n.readdirSync(c)}applyTempFolderCallback(e){const c=s.resolve(this.cacheDir,e);if(!n.existsSync(this.cacheDir)||!n.existsSync(c)){console.error("Either the Cache or Temp directory does not exist.");return}const i=(t,h)=>{n.readdirSync(t).forEach(f=>{const p=s.resolve(t,f),u=s.resolve(h,f),D=n.lstatSync(p);D.isFile()?S.copyFileSync(p,u):D.isDirectory()&&(n.existsSync(u)||d.mkdirpSync(u),i(p,u))}),C.rimrafSync(t)};i(c,this.cacheDir)}}const F=s.resolve(__dirname,"..",".cache"),q={locateFile:a=>s.resolve(__dirname,"..","..","wasm","dist",a)};n.existsSync(F)||n.mkdirSync(F);const l=new w.Command;let r,y;const B=4;function o(a,e){a&&(y==="json"?process.stderr.write(JSON.stringify(a)):(process.stderr.write(a.title),process.stderr.write(`
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const k=require("commander"),F=require("@balancy/core"),s=require("node:path"),n=require("node:fs");require("node:util");const d=require("mkdirp"),S=require("fs"),C=require("rimraf"),P="1.0.0-rc.24",O="todo";class b{constructor(e){this.cacheDir=s.resolve(e.cachePath),this.cacheBinaryDir=s.resolve(e.cachePath),!n.existsSync(this.cacheDir)&&d.mkdirpSync(this.cacheDir),!n.existsSync(this.cacheBinaryDir)&&d.mkdirpSync(this.cacheBinaryDir),e.codePath?(this.codeDir=s.resolve(e.codePath),!n.existsSync(this.codeDir)&&d.mkdirpSync(this.codeDir)):this.codeDir="",e.resourcesPath?(this.resourcesDir=s.resolve(e.resourcesPath),!n.existsSync(this.resourcesDir)&&d.mkdirpSync(this.resourcesDir)):this.resourcesDir=""}saveFileToDir(e,c,i){const t=s.resolve(e,c),{dir:h}=s.parse(t);d.mkdirpSync(h),n.writeFileSync(t,i)}clearDir(e){n.readdirSync(e).forEach(c=>{n.lstatSync(s.resolve(e,c)).isDirectory()?C.rimrafSync(s.resolve(e,c)):n.unlinkSync(s.resolve(e,c))})}readFileFromDir(e,c){try{return S.readFileSync(s.resolve(e,c)).toString("utf-8")}catch{return""}}createSubDirectoryInCacheCallback(e){d.mkdirpSync(s.resolve(this.cacheDir,e))}saveFileInCacheCallback(e,c){this.saveFileToDir(this.cacheDir,e,c)}saveFileInCacheBinaryCallback(e,c){this.saveFileToDir(this.cacheBinaryDir,e,c)}saveFileInResourcesCallback(e,c){this.saveFileToDir(this.resourcesDir,e,c)}cleanUpResourcesFolderCallback(){this.clearDir(this.resourcesDir)}cleanGeneratedCodeFolderCallback(){this.clearDir(this.codeDir)}saveGeneratedCodeCallback(e,c){this.saveFileToDir(this.codeDir,e,c)}loadFileFromCacheCallback(e){return this.readFileFromDir(this.cacheDir,e)}loadFileFromResourcesCallback(e){return this.readFileFromDir(this.resourcesDir,e)}deleteCachedFolderCallback(e){C.rimrafSync(s.resolve(this.cacheDir,e))}deleteCachedFileCallback(e){n.unlinkSync(s.resolve(this.cacheDir,e))}getFilesInCachedFolderCallback(e){let c=s.resolve(this.cacheDir,e);return n.readdirSync(c)}applyTempFolderCallback(e){const c=s.resolve(this.cacheDir,e);if(!n.existsSync(this.cacheDir)||!n.existsSync(c)){console.error("Either the Cache or Temp directory does not exist.");return}const i=(t,h)=>{n.readdirSync(t).forEach(f=>{const p=s.resolve(t,f),u=s.resolve(h,f),D=n.lstatSync(p);D.isFile()?S.copyFileSync(p,u):D.isDirectory()&&(n.existsSync(u)||d.mkdirpSync(u),i(p,u))}),C.rimrafSync(t)};i(c,this.cacheDir)}}const v=s.resolve(__dirname,"..",".cache"),q={locateFile:a=>s.resolve(__dirname,"..","..","wasm","dist",a)};n.existsSync(v)||n.mkdirSync(v);const l=new k.Command;let r,y;const B=4;function o(a,e){a&&(y==="json"?process.stderr.write(JSON.stringify(a)):(process.stderr.write(a.title),process.stderr.write(`
`+a.message)),process.exit(a.code||1)),e&&(y==="json"?process.stdout.write(JSON.stringify(e)):(process.stdout.write(e.title),e.message&&process.stdout.write(`
`+e.message),e.list&&e.list.forEach(({id:c,name:i})=>{process.stdout.write(`
${c}: ${i}`)})))}l.name("Balancy CLI").description(P).version(k).option("-h, --help","Show help info",!1).option("-f, --format <format>","Output format","raw").hook("preAction",async(a,e)=>{switch(a.optsWithGlobals().format){case"json":y="json";break;default:y="raw"}r=await v.instanceWasm(q)});l.command("config-launch").action(async()=>{});function m(a){v.Balancy.initFileHelper(r,new O(a)),r.balancyConfigLaunch(B)}l.command("config-select-game").requiredOption("-g, --game <game>","Game ID").requiredOption("-c, --cache <cache>","location to save the config file").action(async a=>{try{const{game:e,cache:c}=a;m({cachePath:c}),r.balancyConfigSetSelectedGame(e),o(null,{title:"Init Ok"})}catch(e){const c=e;o({title:"Init Failed",message:c==null?void 0:c.message,code:403})}});l.command("config-select-branch").requiredOption("-b, --branch <branch>","Branch ID").requiredOption("-c, --cache <cache>","location to save the config file").action(async a=>{try{const{branch:e,cache:c}=a;m({cachePath:c}),r.balancyConfigSetSelectedBranch(Number(e)),o(null,{title:"Init Ok"})}catch(e){const c=e;o({title:"Init Failed",message:c==null?void 0:c.message,code:403})}});async function I(a,e){return new Promise((c,i)=>{r.balancyConfigAuth(a,e,(t,h)=>{const g=!!t,f=String(h);g?c({isAuthorized:g,message:f}):i(new Error(f||"Authorization failed"))})})}l.command("config-login").requiredOption("-e, --email <email>","Balancy user's email").requiredOption("-p, --password <password>","Balancy user's password").requiredOption("-c, --cache <cache>","location to save the config file").action(async a=>{const{email:e,password:c,cache:i}=a;m({cachePath:i});try{const t=await I(e,c);o(null,{title:"Auth Success"})}catch(t){const h=t;o({title:"Login Failed",message:h==null?void 0:h.message,code:403})}r.balancyConfigClose()});async function G(){return new Promise((a,e)=>{r.balancyConfigGenerateCode((c,i)=>{a({success:c,message:i})})})}l.command("config-generate").requiredOption("-c, --cache <cache>","location to save the config file").requiredOption("-p, --path <path>","Path generate to").action(async a=>{const{cache:e,path:c}=a;m({cachePath:e,codePath:c});const i=await G();i.success?o(null,{title:"Success"}):o({title:"Generation Failed",message:i.message}),r.balancyConfigClose()});async function x(){return new Promise((a,e)=>{r.balancyConfigDownloadContentToResources((c,i)=>{a({success:c,message:i})},(c,i)=>{console.log(`Downloading ${c}: ${i}%`)})})}l.command("config-download").requiredOption("-c, --cache <cache>","location to save the config file").requiredOption("-p, --path <path>","Path download to").action(async a=>{const{cache:e,path:c}=a;m({cachePath:e,resourcesPath:c}),await b();const i=await x();i.success?o(null,{title:"Success"}):o({title:"Generation Failed",message:i.message}),r.balancyConfigClose()});async function L(){return new Promise((a,e)=>{r.balancyConfigLoadListOfGames(c=>{let i=[];for(let t=0;t<c.size();t+=3)i.push({name:c.get(t),id:c.get(t+1)});a({games:i})})})}l.command("config-list-games").requiredOption("-c, --cache <cache>","location to save the config file").action(async a=>{const{cache:e}=a;m({cachePath:e});const c=await L();o(null,{title:"Games list",list:c.games}),r.balancyConfigClose()});async function b(){return new Promise((a,e)=>{r.balancyConfigLoadBranches(c=>{let i=[];for(let t=0;t<c.size();t+=2)i.push({name:c.get(t),id:c.get(t+1)});a({branches:i})})})}l.command("config-list-branches").requiredOption("-c, --cache <cache>","location to save the config file").action(async a=>{const{cache:e}=a;m({cachePath:e});const c=await b();o(null,{title:"Branches list",list:c.branches}),r.balancyConfigClose()});l.parse(process.argv);
${c}: ${i}`)})))}l.name("Balancy CLI").description(O).version(P).option("-h, --help","Show help info",!1).option("-f, --format <format>","Output format","raw").hook("preAction",async(a,e)=>{switch(a.optsWithGlobals().format){case"json":y="json";break;default:y="raw"}r=await F.instanceWasm(q)});l.command("config-launch").action(async()=>{});function m(a){F.Balancy.initFileHelper(r,new b(a)),r.balancyConfigLaunch(B)}l.command("config-select-game").requiredOption("-g, --game <game>","Game ID").requiredOption("-c, --cache <cache>","location to save the config file").action(async a=>{try{const{game:e,cache:c}=a;m({cachePath:c}),r.balancyConfigSetSelectedGame(e),o(null,{title:"Init Ok"})}catch(e){const c=e;o({title:"Init Failed",message:c==null?void 0:c.message,code:403})}});l.command("config-select-branch").requiredOption("-b, --branch <branch>","Branch ID").requiredOption("-c, --cache <cache>","location to save the config file").action(async a=>{try{const{branch:e,cache:c}=a;m({cachePath:c}),r.balancyConfigSetSelectedBranch(Number(e)),o(null,{title:"Init Ok"})}catch(e){const c=e;o({title:"Init Failed",message:c==null?void 0:c.message,code:403})}});async function I(a,e){return new Promise((c,i)=>{r.balancyConfigAuth(a,e,(t,h)=>{const g=!!t,f=String(h);g?c({isAuthorized:g,message:f}):i(new Error(f||"Authorization failed"))})})}l.command("config-login").requiredOption("-e, --email <email>","Balancy user's email").requiredOption("-p, --password <password>","Balancy user's password").requiredOption("-c, --cache <cache>","location to save the config file").action(async a=>{const{email:e,password:c,cache:i}=a;m({cachePath:i});try{const t=await I(e,c);o(null,{title:"Auth Success"})}catch(t){const h=t;o({title:"Login Failed",message:h==null?void 0:h.message,code:403})}r.balancyConfigClose()});async function G(){return new Promise((a,e)=>{r.balancyConfigGenerateCode((c,i)=>{a({success:c,message:i})})})}l.command("config-generate").requiredOption("-c, --cache <cache>","location to save the config file").requiredOption("-p, --path <path>","Path generate to").action(async a=>{const{cache:e,path:c}=a;m({cachePath:e,codePath:c});const i=await G();i.success?o(null,{title:"Success"}):o({title:"Generation Failed",message:i.message}),r.balancyConfigClose()});async function x(){return new Promise((a,e)=>{r.balancyConfigDownloadContentToResources((c,i)=>{a({success:c,message:i})},(c,i)=>{console.log(`Downloading ${c}: ${i}%`)})})}l.command("config-download").requiredOption("-c, --cache <cache>","location to save the config file").requiredOption("-p, --path <path>","Path download to").action(async a=>{const{cache:e,path:c}=a;m({cachePath:e,resourcesPath:c}),await w();const i=await x();i.success?o(null,{title:"Success"}):o({title:"Generation Failed",message:i.message}),r.balancyConfigClose()});async function T(){return new Promise((a,e)=>{r.balancyConfigLoadListOfGames(c=>{let i=[];for(let t=0;t<c.size();t+=3)i.push({name:c.get(t),id:c.get(t+1)});a({games:i})})})}l.command("config-list-games").requiredOption("-c, --cache <cache>","location to save the config file").action(async a=>{const{cache:e}=a;m({cachePath:e});const c=await T();o(null,{title:"Games list",list:c.games}),r.balancyConfigClose()});async function w(){return new Promise((a,e)=>{r.balancyConfigLoadBranches(c=>{let i=[];for(let t=0;t<c.size();t+=2)i.push({name:c.get(t),id:c.get(t+1)});a({branches:i})})})}l.command("config-list-branches").requiredOption("-c, --cache <cache>","location to save the config file").action(async a=>{const{cache:e}=a;m({cachePath:e});const c=await w();o(null,{title:"Branches list",list:c.branches}),r.balancyConfigClose()});l.parse(process.argv);exports.FileHelperNode=b;
//# sourceMappingURL=index.js.map
{
"name": "@balancy/cli",
"version": "1.0.7",
"version": "1.0.8",
"homepage": "https://balancy.co",

@@ -42,3 +42,3 @@ "repository": {

"dependencies": {
"@balancy/core": "~1.0.7",
"@balancy/core": "~1.0.8",
"commander": "^12.1.0",

@@ -45,0 +45,0 @@ "mkdirp": "^3.0.1",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc