zen-app-plugin 0.1.9 → 0.2.0

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/compress.js +1 -1
  2. package/package.json +1 -1
package/compress.js CHANGED
@@ -1 +1 @@
1
- !function(){const e=require("os"),t=require("simple-git"),n=require("shelljs"),s=require("pako"),i=t("./"),c=new RegExp("(https?:)?//((b|a)\\.(ebus))\\.vip/.+?\\.(svg|js|png|gif|jpe?g|ttf|woff2?|eot|css)","gi"),r=[".js",".css",".svg"],o=[".js",".css",".xml"],u=require("fs"),{join:f,dirname:a,resolve:d,extname:p}=require("path"),l=require("cos-nodejs-sdk-v5");let g,x,y,S;function m(e){const t=f(e,"package.json"),n=u.readFileSync(t,"utf8");return JSON.parse(n)}function O(e,t){u.readdirSync(e).forEach((n=>{if(0===n.indexOf(".")||n.indexOf(".html")>-1)return;let i=f(e,n),c=u.statSync(i);if(c.isDirectory()&&O(i,f(t,n)),c.isFile()){let e=f(t,n).replace(/\\/gi,"/"),c={Bucket:y.bucket,Region:y.region,Key:e,StorageClass:"STANDARD"},r=e.indexOf(".js")>-1;r||e.indexOf(".css")>-1?(c.Headers={"Content-Encoding":"gzip","Content-Type":r?"application/javascript":"text/css"},c.Body=Buffer.from(s.gzip(u.readFileSync(i,"utf8")))):c.Body=u.createReadStream(i),x.putObject(c,((e,t)=>{}))}}))}function h(e){const t=p(e);if(0===e.indexOf(".")||".html"===t)return;let i;if(i=e.indexOf("dist")>-1?g+e.substr(S.length+5):g+e.substr(S.length+7),n.mkdir("-p",a(i)),!r.includes(t))return n.cp(e,i);const d=u.readFileSync(e,"utf8").replace(c,(e=>e.indexOf("'")>-1||e.indexOf('"')>-1?e:function(e){const t=e.substr(e.indexOf(".vip")+4),s=f(g,t),i=p(s);if(!u.existsSync(s)||o.includes(i)){n.mkdir("-p",a(s));const t=e.indexOf(":")>-1?e:`https:${e}`;let i=`wget --timeout=15 -O "${s}" "${t}"`;if((s.indexOf(".js")>-1||s.indexOf(".css")>-1)&&(i=`wget -qO- "${t}" | gzip > "${s}"`),0!==n.exec(i).code)return e}return t}(e)));u.writeFileSync(i,Buffer.from(s.gzip(d)),"utf8")}function j(e){const t=u.readdirSync(e);for(const n of t){if(n.startsWith("."))continue;const t=f(e,n),s=u.statSync(t);s.isDirectory()?j(t):s.isFile()&&h(t)}}exports.remote=function(t){S=t,y=JSON.parse(u.readFileSync(f(e.homedir(),".cc.json"))),x=new l({SecretId:y.id,SecretKey:y.key});const n=m(t);i.branchLocal(((e,s)=>{let i=n.name;const c=function(e,t){const n=f(e,"..",t,"src","main","resources","config","app");try{const e=u.readFileSync(n,"utf8");return JSON.parse(e).tag}catch(e){return""}}(t,i);let r=c||s.current;const o=f(t,"dist"),a=f(t,"public");O(o,`${i}/${r}`),u.existsSync(a)&&O(a,`${i}/${r}`)}))},exports.locale=function(e){S=e;const t=m(e).name;g=d(e,"..",t,"src","main","resources","static");const s=f(e,"public"),i=f(e,"dist");["zen.js","zen.css","zen.wap.js","zen.wap.css"].forEach((e=>{const t=`wget --timeout=15 "https://b.ebus.vip/zeto/latest/${e}" -O - | gunzip > "${f(s,e)}"`;n.exec(t)})),j(i),u.existsSync(s)&&j(s)}}();
1
+ !function(){const e=require("os"),t=require("simple-git"),n=require("shelljs"),s=require("pako"),i=t("./"),c=new RegExp("(https?:)?//((b|a)\\.(ebus))\\.vip/.+?\\.(svg|js|png|gif|jpe?g|ttf|woff2?|eot|css)","gi"),r=[".js",".css",".svg"],o=[".js",".css",".xml"],u=require("fs"),{join:a,dirname:f,resolve:p,extname:d}=require("path"),l=require("cos-nodejs-sdk-v5");let g,x,y,S;function m(e){const t=a(e,"package.json"),n=u.readFileSync(t,"utf8");return JSON.parse(n)}function O(e,t){u.readdirSync(e).forEach((n=>{if(0===n.indexOf(".")||n.indexOf(".html")>-1)return;let i=a(e,n),c=u.statSync(i);if(c.isDirectory()&&O(i,a(t,n)),c.isFile()){let e=a(t,n).replace(/\\/gi,"/"),c={Bucket:y.bucket,Region:y.region,Key:e,StorageClass:"STANDARD"},r=e.indexOf(".js")>-1;r||e.indexOf(".css")>-1?(c.Headers={"Content-Encoding":"gzip","Content-Type":r?"application/javascript":"text/css"},c.Body=Buffer.from(s.gzip(u.readFileSync(i,"utf8")))):c.Body=u.createReadStream(i),x.putObject(c,((e,t)=>{}))}}))}function h(e){const t=d(e);if(0===e.indexOf(".")||".html"===t)return;let i;if(i=e.indexOf("dist")>-1?g+e.substr(S.length+5):g+e.substr(S.length+7),n.mkdir("-p",f(i)),!r.includes(t))return n.cp(e,i);const p=u.readFileSync(e,"utf8").replace(c,(e=>e.indexOf("'")>-1||e.indexOf('"')>-1?e:function(e){const t=e.substr(e.indexOf(".vip")+4),s=a(g,t),i=d(s);if(!u.existsSync(s)||o.includes(i)){n.mkdir("-p",f(s));const t=e.indexOf(":")>-1?e:`https:${e}`;let i=`wget --timeout=15 -O "${s}" "${t}"`;if((s.indexOf(".js")>-1||s.indexOf(".css")>-1)&&(i=`wget -qO- "${t}" | gzip > "${s}"`),0!==n.exec(i).code)return e}return t}(e)));u.writeFileSync(i,Buffer.from(s.gzip(p)),"utf8")}function j(e){const t=u.readdirSync(e);for(const n of t){if(n.startsWith("."))continue;const t=a(e,n),s=u.statSync(t);s.isDirectory()?j(t):s.isFile()&&h(t)}}exports.remote=function(t){S=t,y=JSON.parse(u.readFileSync(a(e.homedir(),".cc.json"))),x=new l({SecretId:y.id,SecretKey:y.key});const s=m(t);i.branchLocal(((e,i)=>{let c=s.name;const r=function(e,t){const n=a(e,"..",t,"src","main","resources","config","app");try{const e=u.readFileSync(n,"utf8");return JSON.parse(e).tag}catch(e){return""}}(t,c);let o=r||i.current;const f=a(t,"dist"),p=a(t,"public");["zen.js","zen.css","zen.wap.js","zen.wap.css"].forEach((e=>{const t=`wget --timeout=15 "https://b.ebus.vip/zeto/latest/${e}" -O - | gunzip > "${a(p,e)}"`;n.exec(t)})),O(f,`${c}/${o}`),u.existsSync(p)&&O(p,`${c}/${o}`)}))},exports.locale=function(e){S=e;const t=m(e).name;g=p(e,"..",t,"src","main","resources","static");const s=a(e,"public"),i=a(e,"dist");["zen.js","zen.css","zen.wap.js","zen.wap.css"].forEach((e=>{const t=`wget --timeout=15 "https://b.ebus.vip/zeto/latest/${e}" -O - | gunzip > "${a(s,e)}"`;n.exec(t)})),j(i),u.existsSync(s)&&j(s)}}();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zen-app-plugin",
3
- "version": "0.1.9",
3
+ "version": "0.2.0",
4
4
  "description": "app代码生成器",
5
5
  "main": "index.js",
6
6
  "author": "zen",