@elcrm/deploy 0.0.31 → 0.0.32

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.
Files changed (2) hide show
  1. package/dist/bin/index.js +2 -2
  2. package/package.json +24 -24
package/dist/bin/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env bun
2
2
  // @bun
3
- var n={command:"",options:{},flags:[]},I=(t)=>{if(!t||typeof t!=="string")return{...n};switch(!0){case t.startsWith("--"):if(t.includes("=")){let[o,...i]=t.split("="),x=i.join("="),l=o.slice(2);if(l)n.options[l]=x||""}else{let o=t.slice(2);if(o&&!n.flags.includes(o))n.flags.push(o)}break;case t.startsWith("-"):let e=t.slice(1);if(e&&!n.flags.includes(e))n.flags.push(e);break;default:if(!n.command&&t.trim())n.command=t.trim();break}return{command:n.command,options:{...n.options},flags:[...n.flags]}},B=()=>{n={command:"",options:{},flags:[]};let t=process.argv.slice(2);if(t.length===0)return{...n};return t.forEach((e)=>{try{I(e)}catch(o){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: ${e}`)}}),{command:n.command,options:{...n.options},flags:[...n.flags]}};var m=async(t)=>{let o=JSON.parse(await Bun.file("./package.json").text()),i=o.version.split(".").map(Number);i[i.length-1]+=1,o.version=i.join("."),console.log("v",o.version),await Bun.write("./package.json",JSON.stringify(o,null,2))};var D=async(t,e)=>{await m();let o=t.dir||"./out",i=t.name||"api";if(e.includes("client")){let l=Bun.spawn(["bun","run","build"],{stdout:"pipe",stderr:"pipe"}),u=await new Response(l.stdout).text(),c=await new Response(l.stderr).text();await l.exited,console.log("stdout:",u),console.log("stderr:",c),console.log("\u2699\uFE0F Build completed"),await Bun.spawn(["tar","czf","build.tar","build"]).exited;let w=Bun.file("./build.tar"),b=new FormData;b.append("upload",w);let T=await(await fetch(t.url,{method:"POST",body:b})).text();console.log(T)}else{let l=await Bun.build({entrypoints:["./src/index.js"],outdir:o,minify:!0,target:"bun",naming:`${i}.js`});if(!l.success){console.error("Build failed");for(let u of l.logs)console.error(u)}else if(t.url){let u=Bun.file(`${o}/${i}.js`),c=new FormData;c.append("upload",u),c.append("name",i);let w=await(await fetch(t.url,{method:"POST",body:c})).text();console.log(w)}}};var f={build:D};function N(){console.log(`
3
+ var o={command:"",options:{},flags:[]},I=(t)=>{if(!t||typeof t!=="string")return{...o};switch(!0){case t.startsWith("--"):if(t.includes("=")){let[n,...i]=t.split("="),x=i.join("="),l=n.slice(2);if(l)o.options[l]=x||""}else{let n=t.slice(2);if(n&&!o.flags.includes(n))o.flags.push(n)}break;case t.startsWith("-"):let e=t.slice(1);if(e&&!o.flags.includes(e))o.flags.push(e);break;default:if(!o.command&&t.trim())o.command=t.trim();break}return{command:o.command,options:{...o.options},flags:[...o.flags]}},B=()=>{o={command:"",options:{},flags:[]};let t=process.argv.slice(2);if(t.length===0)return{...o};return t.forEach((e)=>{try{I(e)}catch(n){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: ${e}`)}}),{command:o.command,options:{...o.options},flags:[...o.flags]}};var m=async(t)=>{let n=JSON.parse(await Bun.file("./package.json").text()),i=n.version.split(".").map(Number);i[i.length-1]+=1,n.version=i.join("."),console.log("v",n.version),await Bun.write("./package.json",JSON.stringify(n,null,2))};var D=async(t,e)=>{await m();let n=t.dir||"./out",i=t.name||"api";if(e.includes("client")){let l=Bun.spawn(["bun","run","build"],{stdout:"pipe",stderr:"pipe"}),u=await new Response(l.stdout).text(),c=await new Response(l.stderr).text();await l.exited,console.log("stdout:",u),console.log("stderr:",c),console.log("\u2699\uFE0F Build completed"),await Bun.spawn(["tar","--warning=no-xattr","czf","build.tar","build"]).exited;let w=Bun.file("./build.tar"),b=new FormData;b.append("upload",w);let T=await(await fetch(t.url,{method:"POST",body:b})).text();console.log(T)}else{let l=await Bun.build({entrypoints:["./src/index.js"],outdir:n,minify:!0,target:"bun",naming:`${i}.js`});if(!l.success){console.error("Build failed");for(let u of l.logs)console.error(u)}else if(t.url){let u=Bun.file(`${n}/${i}.js`),c=new FormData;c.append("upload",u),c.append("name",i);let w=await(await fetch(t.url,{method:"POST",body:c})).text();console.log(w)}}};var f={build:D};function N(){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:
@@ -23,4 +23,4 @@ var n={command:"",options:{},flags:[]},I=(t)=>{if(!t||typeof t!=="string")return
23
23
  elcrm build --client --url=https://example.com/deploy
24
24
  elcrm build --name=my-api --dir=./dist --url=https://example.com/deploy
25
25
  elcrm build --dev
26
- `)}async function $(){try{let t=B(),e=t.flags.includes("dev"),o=t.flags.includes("help")||t.flags.includes("h");if(e)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(t,null,2));if(o||!t.command){N();return}if(f[t.command])await f[t.command](t.options,t.flags);else console.error(`\u274C \u041D\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u043D\u0430\u044F \u043A\u043E\u043C\u0430\u043D\u0434\u0430: ${t.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(t){console.error("\u274C \u041D\u0435\u043E\u0436\u0438\u0434\u0430\u043D\u043D\u0430\u044F \u043E\u0448\u0438\u0431\u043A\u0430:",t),process.exit(1)}}$();
26
+ `)}async function $(){try{let t=B(),e=t.flags.includes("dev"),n=t.flags.includes("help")||t.flags.includes("h");if(e)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(t,null,2));if(n||!t.command){N();return}if(f[t.command])await f[t.command](t.options,t.flags);else console.error(`\u274C \u041D\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u043D\u0430\u044F \u043A\u043E\u043C\u0430\u043D\u0434\u0430: ${t.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(t){console.error("\u274C \u041D\u0435\u043E\u0436\u0438\u0434\u0430\u043D\u043D\u0430\u044F \u043E\u0448\u0438\u0431\u043A\u0430:",t),process.exit(1)}}$();
package/package.json CHANGED
@@ -1,25 +1,25 @@
1
1
  {
2
- "name": "@elcrm/deploy",
3
- "version": "0.0.31",
4
- "description": "plugin for elCRM",
5
- "type": "module",
6
- "author": "MaSkal <dev@elcrm.online>",
7
- "license": "MIT",
8
- "main": "dist/lib/index.js",
9
- "module": "dist/lib/index.js",
10
- "types": "dist/lib/index.d.ts",
11
- "bin": {
12
- "el": "./dist/bin/index.js",
13
- "elcrm": "./dist/bin/index.js"
14
- },
15
- "files": [
16
- "dist"
17
- ],
18
- "keywords": [
19
- "elcrm",
20
- "deploy"
21
- ],
22
- "devDependencies": {
23
- "@types/bun": "^1.2.18"
24
- }
25
- }
2
+ "name": "@elcrm/deploy",
3
+ "version": "0.0.32",
4
+ "description": "plugin for elCRM",
5
+ "type": "module",
6
+ "author": "MaSkal <dev@elcrm.online>",
7
+ "license": "MIT",
8
+ "main": "dist/lib/index.js",
9
+ "module": "dist/lib/index.js",
10
+ "types": "dist/lib/index.d.ts",
11
+ "bin": {
12
+ "el": "./dist/bin/index.js",
13
+ "elcrm": "./dist/bin/index.js"
14
+ },
15
+ "files": [
16
+ "dist"
17
+ ],
18
+ "keywords": [
19
+ "elcrm",
20
+ "deploy"
21
+ ],
22
+ "devDependencies": {
23
+ "@types/bun": "^1.2.18"
24
+ }
25
+ }