@elcrm/deploy 0.0.47 → 0.0.48

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/bin/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env bun
2
2
  // @bun
3
- var q={command:"",options:{},flags:[]},H=(U)=>{if(!U||typeof U!=="string")return{...q};switch(!0){case U.startsWith("--"):if(U.includes("=")){let[B,...Q]=U.split("="),X=Q.join("="),G=B.slice(2);if(G)q.options[G]=X||""}else{let B=U.slice(2);if(B&&!q.flags.includes(B))q.flags.push(B)}break;case U.startsWith("-"):let z=U.slice(1);if(z&&!q.flags.includes(z))q.flags.push(z);break;default:if(!q.command&&U.trim())q.command=U.trim();break}return{command:q.command,options:{...q.options},flags:[...q.flags]}},W=()=>{q={command:"",options:{},flags:[]};let U=process.argv.slice(2);if(U.length===0)return{...q};return U.forEach((z)=>{try{H(z)}catch(B){console.warn(`\u26A0\uFE0F \u041D\u0435 \u0443\u0434\u0430\u043B\u043E\u0441\u044C \u0440\u0430\u0441\u043F\u0430\u0440\u0441\u0438\u0442\u044C \u0430\u0440\u0433\u0443\u043C\u0435\u043D\u0442: ${z}`)}}),{command:q.command,options:{...q.options},flags:[...q.flags]}};var y=async(U)=>{let B=JSON.parse(await Bun.file("./package.json").text()),Q=B.version.split(".").map(Number);Q[Q.length-1]+=1,B.version=Q.join("."),console.log("v",B.version),await Bun.write("./package.json",JSON.stringify(B,null,2))};var K=async(U,z)=>{await y();let B=z.includes("client"),Q=U.dir||"./out",X=U.name?U.name:B?"build":"api";if(B){let G=Bun.spawn(["bun","run","build"],{stdout:"pipe",stderr:"pipe"}),Y=await new Response(G.stdout).text(),Z=await new Response(G.stderr).text();await G.exited,console.log("stdout:",Y),console.log("stderr:",Z),console.log("\u2699\uFE0F Build completed");let j=Bun.spawn(["tar","czf","build.tar","build"],{stderr:"pipe"});await j.exited;let $=await new Response(j.stderr).text();if($&&!$.includes("LIBARCHIVE.xattr")&&$.trim()!=="");let C=Bun.file("./build.tar"),w=new FormData;w.append("upload",C),w.append("name",X);let F=await(await fetch(U.url,{method:"POST",body:w})).text();console.log(F)}else{let G=await Bun.build({entrypoints:["./src/index.js"],outdir:Q,minify:!0,target:"bun",naming:`${X}.js`});if(!G.success){console.error("Build failed");for(let Y of G.logs)console.error(Y)}else if(U.url){let Y=Bun.file(`${Q}/${X}.js`),Z=new FormData;Z.append("upload",Y),Z.append("name",X);let $=await(await fetch(U.url,{method:"POST",body:Z})).text();console.log($)}}};var R=async()=>{console.log(Bun.randomUUIDv7())};var O={build:K,uuid:R};function V(){console.log(`
3
+ var z={command:"",options:{},flags:[]},H=(U)=>{if(!U||typeof U!=="string")return{...z};switch(!0){case U.startsWith("--"):if(U.includes("=")){let[q,...Q]=U.split("="),X=Q.join("="),G=q.slice(2);if(G)z.options[G]=X||""}else{let q=U.slice(2);if(q&&!z.flags.includes(q))z.flags.push(q)}break;case U.startsWith("-"):let B=U.slice(1);if(B&&!z.flags.includes(B))z.flags.push(B);break;default:if(!z.command&&U.trim())z.command=U.trim();break}return{command:z.command,options:{...z.options},flags:[...z.flags]}},O=()=>{z={command:"",options:{},flags:[]};let U=process.argv.slice(2);if(U.length===0)return{...z};return U.forEach((B)=>{try{H(B)}catch(q){console.warn(`\u26A0\uFE0F \u041D\u0435 \u0443\u0434\u0430\u043B\u043E\u0441\u044C \u0440\u0430\u0441\u043F\u0430\u0440\u0441\u0438\u0442\u044C \u0430\u0440\u0433\u0443\u043C\u0435\u043D\u0442: ${B}`)}}),{command:z.command,options:{...z.options},flags:[...z.flags]}};var W=async(U)=>{let q=JSON.parse(await Bun.file("./package.json").text()),Q=q.version.split(".").map(Number);Q[Q.length-1]+=1,q.version=Q.join("."),console.log("v",q.version),await Bun.write("./package.json",JSON.stringify(q,null,2))};var K=async(U,B)=>{await W();let q=B.includes("client"),Q=U.dir||"./out",X=U.name?U.name:q?"build":"api";if(q){let G=Bun.spawn(["bun","run","build"],{stdout:"pipe",stderr:"pipe"}),Y=await new Response(G.stdout).text(),Z=await new Response(G.stderr).text();await G.exited,console.log("stdout:",Y),console.log("stderr:",Z),console.log("\u2699\uFE0F Build completed");let j=Bun.spawn(["tar","czf","build.tar","build"],{stderr:"pipe"});await j.exited;let $=await new Response(j.stderr).text();if($&&!$.includes("LIBARCHIVE.xattr")&&$.trim()!=="");let C=Bun.file("./build.tar"),w=new FormData;w.append("upload",C),w.append("name",X);let F=await(await fetch(U.url,{method:"POST",body:w})).text();console.log(F)}else{let G=await Bun.build({entrypoints:["./src/index.js"],outdir:Q,minify:!0,target:"bun",naming:`${X}.js`});if(!G.success){console.error("Build failed");for(let Y of G.logs)console.error(Y)}else if(U.url){let Y=Bun.file(`${Q}/${X}.js`),Z=new FormData;Z.append("upload",Y),Z.append("name",X);let $=await(await fetch(U.url,{method:"POST",body:Z})).text();console.log($)}}};var R=async()=>{console.log(crypto.randomUUID())};var y={build:K,uuid:R};function V(){console.log(`
4
4
  \uD83D\uDE80 elCRM Deploy Tool
5
5
 
6
6
  \u0418\u0441\u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u043D\u0438\u0435:
@@ -24,4 +24,4 @@ var q={command:"",options:{},flags:[]},H=(U)=>{if(!U||typeof U!=="string")return
24
24
  elcrm build --client --url=https://example.com/deploy
25
25
  elcrm build --name=my-api --dir=./dist --url=https://example.com/deploy
26
26
  elcrm build --dev
27
- `)}async function h(){try{let U=W(),z=U.flags.includes("dev"),B=U.flags.includes("help")||U.flags.includes("h");if(z)console.log("\uD83D\uDD0D \u041E\u0442\u043B\u0430\u0434\u043E\u0447\u043D\u0430\u044F \u0438\u043D\u0444\u043E\u0440\u043C\u0430\u0446\u0438\u044F:"),console.log(JSON.stringify(U,null,2));if(B||!U.command){V();return}if(O[U.command])await O[U.command](U.options,U.flags);else console.error(`\u274C \u041D\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u043D\u0430\u044F \u043A\u043E\u043C\u0430\u043D\u0434\u0430: ${U.command}`),console.log("\uD83D\uDCA1 \u0418\u0441\u043F\u043E\u043B\u044C\u0437\u0443\u0439\u0442\u0435 'elcrm --help' \u0434\u043B\u044F \u043F\u043E\u043B\u0443\u0447\u0435\u043D\u0438\u044F \u0441\u043F\u0440\u0430\u0432\u043A\u0438"),process.exit(1)}catch(U){console.error("\u274C \u041D\u0435\u043E\u0436\u0438\u0434\u0430\u043D\u043D\u0430\u044F \u043E\u0448\u0438\u0431\u043A\u0430:",U),process.exit(1)}}h();
27
+ `)}async function h(){try{let U=O(),B=U.flags.includes("dev"),q=U.flags.includes("help")||U.flags.includes("h");if(B)console.log("\uD83D\uDD0D \u041E\u0442\u043B\u0430\u0434\u043E\u0447\u043D\u0430\u044F \u0438\u043D\u0444\u043E\u0440\u043C\u0430\u0446\u0438\u044F:"),console.log(JSON.stringify(U,null,2));if(q||!U.command){V();return}if(y[U.command])await y[U.command](U.options,U.flags);else console.error(`\u274C \u041D\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u043D\u0430\u044F \u043A\u043E\u043C\u0430\u043D\u0434\u0430: ${U.command}`),console.log("\uD83D\uDCA1 \u0418\u0441\u043F\u043E\u043B\u044C\u0437\u0443\u0439\u0442\u0435 'elcrm --help' \u0434\u043B\u044F \u043F\u043E\u043B\u0443\u0447\u0435\u043D\u0438\u044F \u0441\u043F\u0440\u0430\u0432\u043A\u0438"),process.exit(1)}catch(U){console.error("\u274C \u041D\u0435\u043E\u0436\u0438\u0434\u0430\u043D\u043D\u0430\u044F \u043E\u0448\u0438\u0431\u043A\u0430:",U),process.exit(1)}}h();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elcrm/deploy",
3
- "version": "0.0.47",
3
+ "version": "0.0.48",
4
4
  "description": "plugin for elCRM",
5
5
  "type": "module",
6
6
  "author": "MaSkal <dev@elcrm.online>",