zen-app-plugin 0.1.7 → 0.1.9

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"],f=require("fs"),{join:u,dirname:a,resolve:d,extname:p}=require("path"),l=require("cos-nodejs-sdk-v5");let g,x,y,S;function m(e){const t=u(e,"package.json"),n=f.readFileSync(t,"utf8");return JSON.parse(n)}function O(e,t){f.readdirSync(e).forEach((n=>{if(0===n.indexOf(".")||n.indexOf(".html")>-1)return;let i=u(e,n),c=f.statSync(i);if(c.isDirectory()&&O(i,u(t,n)),c.isFile()){let e=u(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(f.readFileSync(i,"utf8")))):c.Body=f.createReadStream(i),x.putObject(c,((e,t)=>{}))}}))}function j(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=f.readFileSync(e,"utf8").replace(c,(e=>e.indexOf("'")>-1||e.indexOf('"')>-1?e:function(e){const t=e.substr(e.indexOf(".vip")+4),s=u(g,t),i=p(s);if(!f.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)));f.writeFileSync(i,Buffer.from(s.gzip(d)),"utf8")}function h(e){const t=f.readdirSync(e);for(const n of t){if(n.startsWith("."))continue;const t=u(e,n),s=f.statSync(t);s.isDirectory()?h(t):s.isFile()&&j(t)}}exports.remote=function(t){S=t,y=JSON.parse(f.readFileSync(u(e.homedir(),".cos.json"))),x=new l({SecretId:y.id,SecretKey:y.key});const n=m(t);i.branchLocal(((e,s)=>{let i=n.name,c=s.current;const r=u(t,"dist"),o=u(t,"public");O(r,`${i}/${c}`),f.existsSync(o)&&O(o,`${i}/${c}`)}))},exports.locale=function(e){S=e;const t=m(e).name;g=d(e,"..",t,"src","main","resources","static");const s=u(e,"public"),i=u(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 > "${u(s,e)}"`;n.exec(t)})),h(i),f.existsSync(s)&&h(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: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)}}();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zen-app-plugin",
3
- "version": "0.1.7",
3
+ "version": "0.1.9",
4
4
  "description": "app代码生成器",
5
5
  "main": "index.js",
6
6
  "author": "zen",