@airiot/cli 1.0.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.
@@ -0,0 +1,25 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+
4
+ <head>
5
+ <meta charset="utf-8">
6
+ <meta http-equiv="X-UA-Compatible" content="IE=edge">
7
+ <meta name="renderer" content="webkit" />
8
+ <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no">
9
+ <title>数据采集与监控系统</title>
10
+ </head>
11
+
12
+ <body>
13
+ <div id="loader-wrapper">
14
+ <div id="loader"></div>
15
+ </div>
16
+ <script>
17
+ if(localStorage.getItem('airIotTheme') == 'antdDarkTheme') {
18
+ document.body.setAttribute('class', 'antdDarkTheme');
19
+ }
20
+ </script>
21
+ <div id="app"></div>
22
+ <script src="{{entry}}" type="module"></script>
23
+ </body>
24
+
25
+ </html>
@@ -0,0 +1 @@
1
+ #loader-wrapper{position:fixed;top:0;left:0;width:100%;height:100%;z-index:1000;background-color:#fff;opacity:1;transition:opacity 2s ease}#loader{display:block;position:relative;left:50%;top:50%;width:150px;height:150px;margin:-75px 0 0 -75px;border-radius:50%;border:3px solid transparent;border-top-color:#3498db;-webkit-animation:spin 2s linear infinite;animation:spin 2s linear infinite}#loader:before{content:"";position:absolute;top:5px;left:5px;right:5px;bottom:5px;border-radius:50%;border:3px solid transparent;border-top-color:#e74c3c;-webkit-animation:spin 3s linear infinite;animation:spin 3s linear infinite}#loader:after{content:"";position:absolute;top:15px;left:15px;right:15px;bottom:15px;border-radius:50%;border:3px solid transparent;border-top-color:#f9c922;-webkit-animation:spin 1.5s linear infinite;animation:spin 1.5s linear infinite}@-webkit-keyframes spin{0%{-webkit-transform:rotate(0deg);-ms-transform:rotate(0deg);transform:rotate(0deg)}100%{-webkit-transform:rotate(360deg);-ms-transform:rotate(360deg);transform:rotate(360deg)}}@keyframes spin{0%{-webkit-transform:rotate(0deg);-ms-transform:rotate(0deg);transform:rotate(0deg)}100%{-webkit-transform:rotate(360deg);-ms-transform:rotate(360deg);transform:rotate(360deg)}}
@@ -0,0 +1,3 @@
1
+ //(c)2017, MIT Style License <browser-update.org/LICENSE.txt>
2
+ //it is recommended to directly link to this file because we update the detection code
3
+ function $bu_getBrowser(ua_str){var n,t,ua=ua_str||navigator.userAgent,donotnotify=false;var names={i:'Internet Explorer',e:"Edge",f:'Firefox',o:'Opera',s:'Safari',n:'Netscape',c:"Chrome",a:"Android Browser",y:"Yandex Browser",v:"Vivaldi",x:"Other"};function ignore(reason,pattern){if(RegExp(pattern,"i").test(ua))return reason;}var ig=ignore("bot","bot|spider|archiver|transcoder|crawl|checker|monitoring|screenshot|python-|php|uptime|validator|fetcher|facebook|slurp|google|yahoo|microsoft|node|mail.ru|github|cloudflare|addthis|thumb|proxy|feed|fetch|favicon|link|http|scrape|seo|page|search console|AOLBuild|Teoma|Gecko Expeditor")||ignore("discontinued browser","camino|flot|k-meleon|fennec|galeon|chromeframe|coolnovo")||ignore("complicated device browser","SMART-TV|SmartTV")||ignore("niche browser","Dorado|Whale|SamsungBrowser|MIDP|wii|UCBrowser|Chromium|Puffin|Opera Mini|maxthon|maxton|dolfin|dolphin|seamonkey|opera mini|netfront|moblin|maemo|arora|kazehakase|epiphany|konqueror|rekonq|symbian|webos|PaleMoon|QupZilla|Otter|Midori|qutebrowser")||ignore("mobile without upgrade path or landing page","kindle|silk|blackberry|bb10|RIM|PlayBook|meego|nokia|ZuneWP7")||ignore("android(chrome) web view","; wv");var mobile=(/iphone|ipod|ipad|android|mobile|phone|ios|iemobile/i.test(ua));if(ig)return{n:"x",v:0,t:"other browser",donotnotify:ig};var pats=[["CriOS.VV","c"],["FxiOS.VV","f"],["Trident.*rv:VV","i"],["Trident.VV","io"],["MSIE.VV","i"],["Edge.VV","e"],["Vivaldi.VV","v"],["OPR.VV","o"],["YaBrowser.VV","y"],["Chrome.VV","c"],["Firefox.VV","f"],["Version.VV.*Safari","s"],["Safari.VV","so"],["Opera.*Version.VV","o"],["Opera.VV","o"],["Netscape.VV","n"]];for(var i=0;i<pats.length;i++)if(ua.match(new RegExp(pats[i][0].replace("VV","(\\d+\\.?\\d?)")),"i")){n=pats[i][1];break;}var v=parseFloat(RegExp.$1);if(!n)return{n:"x",v:0,t:names[n],mobile:mobile};if(/windows.nt.5.0|windows.nt.4.0|windows.95|windows.98|os x 10.2|os x 10.3|os x 10.4|os x 10.5|os x 10.6|os x 10.7/i.test(ua))donotnotify="oldOS";if(/iphone|ipod|ipad|ios/i.test(ua)){ua.replace("_",".").match(new RegExp("OS.(\\d+\\.?\\d?)"),"i");n="iOS";v=parseFloat(RegExp.$1);var h=Math.max(window.screen.height,window.screen.width);if(h<=480||window.devicePixelRatio<2)return{n:"s",v:v,t:"iOS "+v,donotnotify:"iOS without upgrade path",mobile:mobile};return{n:"s",v:v,t:"iOS "+v,donotnotify:false,mobile:mobile};}if(ua.indexOf('Android')>-1&&n==="s"){var ver=parseInt((/WebKit\/([0-9]+)/i.exec(ua)||0)[1],10)||2000;if(ver<=534)return{n:"a",v:ver,t:names.a,mob:true,donotnotify:donotnotify,mobile:mobile};}if(n=="f"&&(Math.round(v)==45||Math.round(v)==52))donotnotify="ESR";if(n=="so"){v=4.0;n="s";}if(n=="i"&&v==7&&window.XDomainRequest)v=8;if(n=="io"){n="i";if(v>6)v=11;else if(v>5)v=10;else if(v>4)v=9;else if(v>3.1)v=8;else if(v>3)v=7;else v=9;}if(n=="e")return{n:"i",v:v,t:names[n]+" "+v,donotnotify:donotnotify,mobile:mobile};return{n:n,v:v,t:names[n]+" "+v,donotnotify:donotnotify,mobile:mobile};}var $buo=function(op,test){var jsv=24;var n=window.navigator,b;window._buorgres=this.op=op||{};var ll=op.l||(n.languages?n.languages[0]:null)||n.language||n.browserLanguage||n.userLanguage||document.documentElement.getAttribute("lang")||"en";this.op.ll=ll=ll.replace("_","-").toLowerCase().substr(0,2);this.op.apiver=this.op.api||this.op.c||-1;var vsakt={i:12,f:52,o:43,s:10,n:20,c:56,y:17.3,v:1.8};var vsdefault={i:-2,f:-4,o:-4,s:-1.7,n:12,c:-4,a:534,y:-1,v:-0.2};if(this.op.apiver<4)var vsmin={i:9,f:10,o:20,s:7,n:12};else var vsmin={i:8,f:5,o:12.5,s:6.2,n:12};var myvs=op.vs||{};var vs=op.vs||vsdefault;for(b in vsdefault){if(!vs[b])vs[b]=vsdefault[b];if(vsakt[b]&&vs[b]>=vsakt[b])vs[b]=vsakt[b]-0.2;if(vsakt[b]&&vs[b]<0)vs[b]=vsakt[b]+vs[b];if(vsmin[b]&&vs[b]<vsmin[b])vs[b]=vsmin[b];}op.vsf=vs;if(op.reminder<0.1||op.reminder===0)op.reminder=0;else op.reminder=op.reminder||24;op.reminderClosed=op.reminderClosed||(24*7);op.onshow=op.onshow||function(o){};op.onclick=op.onclick||function(o){};op.onclose=op.onclose||function(o){};op.pageurl=op.pageurl||location.hostname||"x";op.newwindow=(op.newwindow!==false);op.test=test||op.test||(location.hash=="#test-bu")||(location.hash=="#test-bu-beta")||false;var bb=$bu_getBrowser();if(!this.op.test&&(!bb||!bb.n||bb.n=="x"||bb.donotnotify!==false||(document.cookie.indexOf("browserupdateorg=pause")>-1&&this.op.reminder>0)||bb.v>vs[bb.n]||(bb.mobile&&op.mobile===false)))return;this.op.setCookie=function(hours){document.cookie='browserupdateorg=pause; expires='+new Date(new Date().getTime()+3600000*hours).toGMTString()+'; path=/';};if(this.op.reminder>0)this.op.setCookie(this.op.reminder);if(this.op.nomessage){op.onshow(this.op);return;}var e=document.createElement("script");e.src=op.jsshowurl||(/file:/.test(location.href)&&"./static/update.show.min.js")||"./static/update.show.min.js";document.body.appendChild(e);};var $buoop=window.$buoop||{};$buo($buoop);
@@ -0,0 +1 @@
1
+ var $buo_show=function(){var op=this.op=window._buorgres;var jsv=24;var tv=jsv;var ll=op.ll;var bb=$bu_getBrowser();var burl=op.burl||"https://browser-update.org/";if(!op.url)if(op.l)op.url=burl+ll+"/update-browser.html#"+tv+":"+op.pageurl;else op.url=burl+"update-browser.html#"+tv+":"+op.pageurl;var frac=1000;if(Math.random()*frac<1&&!this.op.test&&!this.op.betatest){var i=new Image();var txt=op["text_"+ll]||op.text||"";var extra=encodeURIComponent("frac="+frac+"&txt="+txt+"&apiver="+op.apiver);i.src=burl+"count.php?what=noti&from="+bb.n+"&fromv="+bb.v+"&ref="+escape(op.pageurl)+"&jsv="+jsv+"&tv="+tv+"&extra="+extra;}function busprintf(){var args=arguments;var data=args[0];for(var k=1;k<args.length;++k)data=data.replace(/%s/,args[k]);return data;}var t={};t.en='<b>Your web browser ({brow_name}) is out of date.</b> For more security, comfort and the best experience on this site: <a{up_but}>Update your browser</a> <a{ignore_but}>Ignore</a>';t.ar='<b> متصفح الويب ({brow_name}) الخاص بك قديم.</b> قُم بتحديث متصفحك للحصول على مزيدٍ من الحماية والراحة وتجربة أفضل على هذا الموقع. <a{up_but}> تحديث المتصفح</a> <a{ignore_but}> تجاهل</a>';t.bg='<b>Вашият браузър ({brow_name}) не е актуализиран.</b> Актуализирайте го за повече сигурност, удобство и най-добро изживяване на сайта. <a{up_but}>Актуализирайте браузъра</a> <a{ignore_but}>Игнорирайте</a>';t.ca='El teu navegador (%s) està <b>desactualitzat.</b> Té <b>vulnerabilitats</b> conegudes i pot <b>no mostrar totes les característiques</b> d\'aquest i altres llocs web. <a%s>Aprèn a actualitzar el navegador</a>';t.cs='<b>Váš webový prohlížeč ({brow_name}) je zastaralý .</b> Pro větší bezpečnost, pohodlí a optimální zobrazení této stránky si prosím svůj prohlížeč aktualizujte. <a{up_but}>Aktualizovat prohlížeč</a> <a{ignore_but}>Ignorovat</a>';t.da='<b>Din netbrowser ({brow_name}) er forældet.</b> Opdater din browser for mere sikkerhed, komfort og den bedste oplevelse på denne side. <a{up_but}>Opdater browser</a> <a{ignore_but}>Ignorer</a>';t.de='<b>Ihr Browser ({brow_name}) ist veraltet.</b> <span>Aktualisieren Sie Ihren Browser für mehr Sicherheit, Komfort und die einwandfreie Nutzung dieser Webseite.</span> <a{up_but}>Browser aktualisieren</a> <a{ignore_but}>Ignorieren</a>';t.el='<b>Η έκδοση του προγράμματος περιήγησής σας ({brow_name}) είναι παλιά.</b> Ενημερώστε τον περιηγητή σας για περισσότερη ασφάλεια, άνεση και την βέλτιστη εμπειρία σε αυτή την ιστοσελίδα. <a{up_but}>Αναβάθμιση περιηγητή</a> <a{ignore_but}>Παράβλεψη</a>';t.es='<b>Tu navegador web ({brow_name}) no está actualizado.</b> Actualiza tu navegador para tener más seguridad y comodidad y tener la mejor experiencia en este sitio. <a{up_but}>Actualizar navegador</a> <a{ignore_but}>Ignorar</a>';t.fa='مرورگر شما (%s) <b>از رده خارج شده</b> می باشد. این مرورگر دارای <b>مشکلات امنیتی شناخته شده</b> می باشد و <b>نمی تواند تمامی ویژگی های این</b> وب سایت و دیگر وب سایت ها را به خوبی نمایش دهد. <a%s>در خصوص گرفتن راهنمایی درخصوص نحوه ی به روز رسانی مرورگر خود اینجا کلیک کنید.</a>';t.fi='<b>Selaimesi ({brow_name}) on vanhentunut.</b> Päivitä selaimesi parantaaksesi turvallisuutta, mukavuutta ja käyttökokemusta tällä sivustolla. <a{up_but}>Päivitä selain</a> <a{ignore_but}>Ohita</a>';t.fr='<b>Votre navigateur web ({brow_name}) n\'est pas à jour.</b> Mettez votre navigateur à jour pour plus de sécurité, de confort et une expérience optimale sur ce site. <a{up_but}>Mettre le navigateur à jour</a> <a{ignore_but}>Ignorer</a>';t.ga='Tá an líonléitheoir agat (%s) <b>as dáta.</b> Tá <b>laigeachtaí slándála</b> a bhfuil ar eolas ann agus b\'fhéidir <b>nach taispeánfaidh sé gach gné</b> den suíomh gréasáin seo ná cinn eile. <a%s>Foghlaim conas do líonléitheoir a nuashonrú</a>';t.gl='O seu navegador (%s) está <b>desactualizado.</b> Ten coñecidos <b>fallos de seguranza</b> e podería <b>non mostrar tódalas características</b> deste e outros sitios web. <a%s>Aprenda como pode actualizar o seu navegador</a>';t.he='הדפדפן שלך (%s) <b>אינו מעודכן.</b> יש לו <b>בעיות אבטחה ידועות</b> ועשוי <b>לא להציג את כל התכונות</b> של אתר זה ואתרים אחרים. <a%s>למד כיצד לעדכן את הדפדפן שלך</a>';t.hi='यह वेबसाइट आपको याद दिलाना चाहती हैं: आपका ब्राउज़र (%s) <b> आउट ऑफ़ डेट </ b> हैं। <a%s> और अधिक सुरक्षा, आराम और इस साइट पर सबसे अच्छा अनुभव करने लिए आपके ब्राउज़र को अपडेट करें</a>।';t.hu='<b>Az ön ({brow_name}) böngészője elavult.</b> Frissítse a böngészőjét több biztonság, kényelem és a legjobb felhasználói élmény érdekében ezen az oldalon. <a{up_but}>Böngésző frissítése</a> <a{ignore_but}>Mellőzés</a>';t.id='<b>Peramban web Anda ({brow_name}) sudah lawas.</b> Perbarui peramban Anda untuk pengalaman terbaik yang lebih aman dan nyaman di situs ini. <a{up_but}>Perbarui peramban</a> <a{ignore_but}>Abaikan</a>';t.it='<b>Il suo browser web ({brow_name}) non è aggiornato.</b> Aggiorni il suo browser per ottenere maggiore sicurezza, comfort, e la migliore esperienza possibile su questo sito. <a{up_but}>Aggiorna il browser</a> <a{ignore_but}>Ignora</a>';t.ja='<b>お使いのウェブブラウザ ({brow_name}) は古すぎます。</b>安全性と快適さを向上させ、このサイトで最高の体験が出来るよう、お使いのブラウザをアップデートしましょう。<a{up_but}>ブラウザをアップデートする</a> <a{ignore_but}>無視する</a>';t.ko='<b>현재 귀하의 웹브라우저 ({brow_name})은(는) 구버전입니다.</b> 본 사이트의 향상된 보안 및 최고 품질의 편안한 서비스를 사용하기 위해서 브라우저를 업데이트해 주십시오. <a{up_but}>브라우저 업데이트</a> <a{ignore_but}>무시하기</a>';t.lv='Jūsu pārlūkprogramma (%s) ir <b>novecojusi.</b> Tai ir zināmas <b>drošības problēmas</b>, un tā var attēlot šo un citas tīmekļa lapas <b>nekorekti.</b> <a%s>Uzzini, kā atjaunot savu pārlūkprogrammu</a>';t.ms='<b>Pelayar web ({brow_name}) anda sudah usang.</b> Kemas kini pelayar anda untuk memperoleh lebih keselamatan, keselesaan dan pengalaman terbaik di tapak ini. <a{up_but}>Kemas kini pelayar</a> <a{ignore_but}>Abaikan</a>';t.nl='<b>Uw webbrowser ({brow_name}) is verouderd.</b> Update uw browser voor meer veiligheid, comfort en de beste ervaring op deze site. <a{up_but}>Update browser</a> <a{ignore_but}>Negeer</a>';t.no='<b>Nettleseren din,({brow_name}), er utdatert.</b> Oppdater nettleseren din for mer sikkerhet, komfort og den beste opplevelsen på denne siden. <a{up_but}>Oppdater nettleser</a> <a{ignore_but}>Ignorer</a>';t.pl='<b>Państwa przeglądarka ({brow_name}) jest nieaktualna.</b> Aby zapewnić większe bezpieczeństwo, wygodę i komfort użytkowania w tej witrynie, proszę zaktualizować swoją przeglądarkę. <a{up_but}>Zaktualizuj przeglądarkę</a> <a{ignore_but}>Zignoruj</a>';t.pt='<b>Seu navegador de internet ({brow_name}) está desatualizado.</b> Atualize seu navegador para obter mais segurança, conforto e a melhor experiência neste site. <a{up_but}>Atualizar navegador</a> <a{ignore_but}>Ignorar</a>';t.ro='<b>Browserul dumneavoastră ({brow_name}) nu este actualizat.</b> Actualizați-vă browserul pentru securitate sporită, confort și cea mai bună experiență pe site. <a{up_but}>Actualizează browser</a><a{ignore_but}>Ignoră</a>';t.ru='<b>Ваш веб-браузер ({brow_name}) устарел.</b> Обновите свой браузер, чтобы сделать пребывание на этом сайте более безопасным, комфортным и продуктивным. <a{up_but}>Обновить браузер</a> <a{ignore_but}>Игнорировать</a>';t.sk='<b> Váš internetový prehliadač ({brow_name}) je zastaraný.</b> Aktualizujte váš prehliadač pre vyššiu bezpečnosť, komfort a najlepší zážitok na tejto stránke. <a{up_but}>Aktualizovať prehliadač</a><a{ignore_but}>Ignorovať</a>';t.sl='Vaš brskalnik (%s) je <b>zastarel.</b> Ima več <b>varnostnih pomankljivosti</b> in morda <b>ne bo pravilno prikazal</b> te ali drugih strani. <a%s>Poglejte kako lahko posodobite svoj brskalnik</a>';t.sq='Shfletuesi juaj (%s) është <b>ca i vjetër.</b> Ai ka <b>të meta sigurie</b> të njohura dhe mundet të <b>mos i shfaqë të gjitha karakteristikat</b> e kësaj dhe shumë faqeve web të tjera. <a%s>Mësoni se si të përditësoni shfletuesin tuaj</a>';t.sr='Vaš pretraživač (%s) je <b>zastareo.</b> Ima poznate <b>sigurnosne probleme</b> i najverovatnije <b>neće prikazati sve funkcionalnisti</b> ovog i drugih sajtova. <a%s>Nauči više o nadogradnji svog pretraživača</a>';t.sv='<b>Din webbläsare ({brow_name}) är föråldrad.</b> Uppdatera din webbläsare för bättre säkerhet, bekvämlighet och den bästa upplevelsen på den här sidan. <a{up_but}>Uppdatera webbläsare</a> <a{ignore_but}>Avstå</a>';t.th='เว็บไซต์นี้อยากจะเตือนคุณ: เบราว์เซอร์ (%s) ของคุณนั้น <b>ล้าสมัยแล้ว</b> <a%s>ปรับปรุงเบราว์เซอร์ของคุณ</a> เพื่อเพิ่ม ความปลอดภัย ความสะดวกสบายและประสบการณ์ที่ดีที่สุดในเว็บไซต์นี้';t.tr='<b>({brow_name}) internet tarayıcınız güncel değil.</b> Bu sitede daha fazla güvenlik, konfor ve en iyi deneyim için tarayıcınızı güncelleyin. <a{up_but}>Tarayıcıyı güncelle</a> <a{ignore_but}>Yoksay</a>';t.uk='<b>Ваш браузер ({brow_name}) є застарілим.</b> Оновіть його заради безпечнішого, зручнішого та приємнішого перегляду цього та інших сайтів. <a{up_but}>Оновити</a> <a{ignore_but}>Скасувати</a>';t.vi='<b>Trình duyệt web của bạn ({brow_name}) đã cũ.</b> Hãy nâng cấp trình duyệt của bạn để được an toàn và thuận lợi hơn đồng thời có được trải nghiệm tốt nhất với trang này. <a{up_but}>Nâng cấp trình duyệt</a> <a{ignore_but}>Bỏ qua</a>';t.zh='<b>您的网页浏览器 ({brow_name}) 已过期。</b>更新您的浏览器,以提高安全性和舒适性,并获得访问本网站的最佳体验。<a{up_but}>更新浏览器</a> <a{ignore_but}>忽略</a>';t["zh-tw"]='<b>您的網頁瀏覽器 ({brow_name}) 已經過時。</b> 請更新您的瀏覽器,以在此網站取得更安全、舒適的最佳瀏覽體驗。<a{up_but}>更新瀏覽器</a><a{ignore_but}>忽略</a>';t=op["text_"+ll]||op.text||t[ll]||t.en;var tar="";if(op.newwindow)tar=' target="_blank" rel="noopener"';var div=this.op.div=document.createElement("div");div.id="buorg";div.className="buorg";var style='<style>.buorg {background: #FDF2AB no-repeat 14px center url('+burl+'img/small/'+bb.n+'.png);}</style>';if(t.indexOf("{brow_name}")===-1){t=busprintf(t,bb.t,' id="buorgul" href="'+op.url+'"'+tar);style+="<style>.buorg {position:absolute;position:fixed;z-index:111111; width:100%; top:0px; left:0px; border-bottom:1px solid #A29330; text-align:left; cursor:pointer; font: 13px Arial,sans-serif;color:#000;} .buorg div { padding:5px 36px 5px 40px; } .buorg>div>a,.buorg>div>a:visited{color:#E25600; text-decoration: underline;} #buorgclose{position:absolute;right:6px;top:0px;height:20px;width:12px;font:18px bold;padding:0;} #buorga{display:block;} @media only screen and (max-width: 700px){.buorg div { padding:5px 15px 5px 9px; }}</style>";div.innerHTML='<div>'+t+'<div id="buorgclose"><a id="buorga">&times;</a></div></div>'+style;op.addmargin=true;}else if(op.position&&op.position==="bottom"){style+="<style>.buorg {background-position: 8px 17px; position:absolute;position:fixed;z-index:111111; width:100%; bottom:0px; left:0px; border-bottom:1px solid #A29330; text-align:left; cursor:pointer; background-color: #fff8ea; font: 17px Calibri,Helvetica,Arial,sans-serif; box-shadow: 0 0 5px rgba(0,0,0,0.2);} .buorg div { padding: 11px 12px 11px 30px; line-height: 1.7em; } .buorg div a,.buorg div a:visited{ text-indent: 0; color: #fff; text-decoration: none; box-shadow: 0 0 2px rgba(0,0,0,0.4); padding: 1px 10px; border-radius: 4px; font-weight: normal; background: #5ab400; white-space: nowrap; margin: 0 2px; display: inline-block;} #buorgig{ background-color: #edbc68;} @media only screen and (max-width: 700px){.buorg div { padding:5px 12px 5px 9px; text-indent: 22px;line-height: 1.3em;}.buorg {background-position: 9px 8px;}}</style>";t=t.replace("{brow_name}",bb.t).replace("{up_but}",' id="buorgul" href="'+op.url+'"'+tar).replace("{ignore_but}",' id="buorgig" href=""');div.innerHTML='<div>'+t+'</div>'+style;}else if(op.position&&op.position==="corner"){style+="<style>.buorg {background-position: 8px 17px; position:absolute;position:fixed;z-index:111111; text-align:left; cursor:pointer; background-color: #fff8ea; font: 17px Calibri,Helvetica,Arial,sans-serif; box-shadow: 0 0 5px rgba(0,0,0,0.2);} .buorg div { padding: 11px 12px 11px 30px; line-height: 1.7em; } .buorg div a,.buorg div a:visited{ text-indent: 0; color: #fff; text-decoration: none; box-shadow: 0 0 2px rgba(0,0,0,0.4); padding: 1px 10px; border-radius: 4px; font-weight: normal; background: #5ab400; white-space: nowrap; margin: 0 2px; display: inline-block;} #buorgig{ background-color: #edbc68;} @media only screen and (max-width: 700px){.buorg div { padding:5px 12px 5px 9px; text-indent: 22px;line-height: 1.3em;} body .buorg { top:0px; left:0px; width:100%;}} .buorg { width:300px; top:50px; right:50px; border:1px solid #A29330; } .buorg div b {display:block;} .buorg div span { display: block; } .buorg div a {margin: 4px 2px;} @keyframes buorgfly { from {opacity:0;transform:translateY(-50px)} to {opacity:1;transform:translateY(0px)}} .buorg { animation-name: buorgfly; animation-duration: 1s; animation-timing-function: ease-out;}</style>";t=t.replace("{brow_name}",bb.t).replace("{up_but}",' id="buorgul" href="'+op.url+'"'+tar).replace("{ignore_but}",' id="buorgig" href=""');div.innerHTML='<div>'+t+'</div>'+style;}else{style+="<style>.buorg {background-position: 8px 17px; position:absolute;position:fixed;z-index:111111; width:100%; top:0px; left:0px; border-bottom:1px solid #A29330; text-align:left; cursor:pointer; background-color: #fff8ea; font: 17px Calibri,Helvetica,Arial,sans-serif; box-shadow: 0 0 5px rgba(0,0,0,0.2);} .buorg div { padding: 11px 12px 11px 30px; line-height: 1.7em; } .buorg div a,.buorg div a:visited{ text-indent: 0; color: #fff; text-decoration: none; box-shadow: 0 0 2px rgba(0,0,0,0.4); padding: 1px 10px; border-radius: 4px; font-weight: normal; background: #5ab400; white-space: nowrap; margin: 0 2px; display: inline-block;} #buorgig{ background-color: #edbc68;} @media only screen and (max-width: 700px){.buorg div { padding:5px 12px 5px 9px; text-indent: 22px;line-height: 1.3em;}.buorg {background-position: 9px 8px;}} @keyframes buorgfly { from {transform:translateY(-50px)} to {transform:translateY(0px)}} .buorg { animation-name: buorgfly; animation-duration: .5s; animation-timing-function: ease-out;}</style>";t=t.replace("{brow_name}",bb.t).replace("{up_but}",' id="buorgul" href="'+op.url+'"'+tar).replace("{ignore_but}",' id="buorgig" href=""');div.innerHTML='<div>'+t+'</div>'+style;op.addmargin=true;}op.text=t;if(op.container){op.container.appendChild(div);op.addmargin=false;}else document.body.insertBefore(div,document.body.firstChild);var me=this;div.onclick=function(){if(me.op.newwindow)window.open(me.op.url,"_blank");else window.location.href=me.op.url;me.op.setCookie(me.op.reminderClosed);me.op.onclick(me.op);return false;};try{document.getElementById("buorgul").onclick=function(e){e=e||window.event;if(e.stopPropagation)e.stopPropagation();else e.cancelBubble=true;me.op.div.style.display="none";hm.style.marginTop=me.op.bodymt;me.op.onclick(me.op);return true;};}catch(e){}if(op.addmargin){var hm=document.getElementsByTagName("html")[0]||document.body;this.op.bodymt=hm.style.marginTop;hm.style.marginTop=(div.clientHeight)+"px";}(function(me){(document.getElementById("buorga")||document.getElementById("buorgig")).onclick=function(e){e=e||window.event;if(e.stopPropagation)e.stopPropagation();else e.cancelBubble=true;me.op.div.style.display="none";if(me.op.addmargin)hm.style.marginTop=me.op.bodymt;me.op.onclose(me.op);me.op.setCookie(me.op.reminderClosed);return false;};})(me);if(this.op.noclose){var el=(document.getElementById("buorga")||document.getElementById("buorgig"));el.parentNode.removeChild(el);}this.op.onshow(this.op);};$buo_show();
package/dist/tpl.html ADDED
@@ -0,0 +1,80 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <link rel="icon" type="image/svg+xml" href="/vite.svg" />
6
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
+ <title>Vite + React</title>
8
+ <script type="module" crossorigin src="/assets/index-jFq3DTxj.js"></script>
9
+ <link rel="stylesheet" crossorigin href="/assets/index-Kw75SrGy.css" />
10
+
11
+ <script type="module">
12
+ import.meta.url;
13
+ import("_").catch(() => 1);
14
+ (async function* () {})().next();
15
+ if (location.protocol != "file:") {
16
+ window.__vite_is_modern_browser = true;
17
+ }
18
+ </script>
19
+ <script type="module">
20
+ !(function () {
21
+ if (window.__vite_is_modern_browser) return;
22
+ console.warn(
23
+ "vite: loading legacy chunks, syntax error above and the same error below should be ignored"
24
+ );
25
+ var e = document.getElementById("vite-legacy-polyfill"),
26
+ n = document.createElement("script");
27
+ (n.src = e.src),
28
+ (n.onload = function () {
29
+ System.import(
30
+ document
31
+ .getElementById("vite-legacy-entry")
32
+ .getAttribute("data-src")
33
+ );
34
+ }),
35
+ document.body.appendChild(n);
36
+ })();
37
+ </script>
38
+ </head>
39
+ <body>
40
+ <div id="root"></div>
41
+ <script nomodule>
42
+ !(function () {
43
+ var e = document,
44
+ t = e.createElement("script");
45
+ if (!("noModule" in t) && "onbeforeload" in t) {
46
+ var n = !1;
47
+ e.addEventListener(
48
+ "beforeload",
49
+ function (e) {
50
+ if (e.target === t) n = !0;
51
+ else if (!e.target.hasAttribute("nomodule") || !n) return;
52
+ e.preventDefault();
53
+ },
54
+ !0
55
+ ),
56
+ (t.type = "module"),
57
+ (t.src = "."),
58
+ e.head.appendChild(t),
59
+ t.remove();
60
+ }
61
+ })();
62
+ </script>
63
+ <script
64
+ nomodule
65
+ crossorigin
66
+ id="vite-legacy-polyfill"
67
+ src="/assets/polyfills-legacy-d7_WCmBg.js"
68
+ ></script>
69
+ <script
70
+ nomodule
71
+ crossorigin
72
+ id="vite-legacy-entry"
73
+ data-src="/assets/index-legacy-BWaH16PN.js"
74
+ >
75
+ System.import(
76
+ document.getElementById("vite-legacy-entry").getAttribute("data-src")
77
+ );
78
+ </script>
79
+ </body>
80
+ </html>
package/package.json ADDED
@@ -0,0 +1,61 @@
1
+ {
2
+ "name": "@airiot/cli",
3
+ "version": "1.0.0",
4
+ "description": "AIRIOT平台前端包管理工具",
5
+ "type": "module",
6
+ "scripts": {},
7
+ "keywords": [
8
+ "iot",
9
+ "airiot"
10
+ ],
11
+ "files": [
12
+ "bin",
13
+ "config",
14
+ "dist",
15
+ "scripts",
16
+ "vite-plugin",
17
+ "package.json"
18
+ ],
19
+ "bin": {
20
+ "airiot": "bin/iot-scripts.js"
21
+ },
22
+ "publishConfig": {
23
+ "access": "public"
24
+ },
25
+ "author": "",
26
+ "license": "ISC",
27
+ "dependencies": {
28
+ "@eslint/js": "^9.38.0",
29
+ "@vitejs/plugin-legacy": "^5.2.0",
30
+ "@vitejs/plugin-react": "^4.2.0",
31
+ "archiver": "^5.0.2",
32
+ "axios": "^1.6.2",
33
+ "chalk": "^4.1.0",
34
+ "commander": "^6.2.0",
35
+ "connect-history-api-fallback": "^2.0.0",
36
+ "cross-spawn": "^7.0.3",
37
+ "eslint": "^9.38.0",
38
+ "eslint-plugin-import": "^2.32.0",
39
+ "eslint-plugin-react": "^7.37.5",
40
+ "form-data": "^3.0.0",
41
+ "globals": "^16.4.0",
42
+ "i18next-scanner": "^4.4.0",
43
+ "inquirer": "^7.3.3",
44
+ "less": "^4.0.0",
45
+ "md5": "^2.3.0",
46
+ "node-fetch": "^2.6.1",
47
+ "npm-packlist": "^2.1.4",
48
+ "pacote": "^11.3.0",
49
+ "path-browserify": "^1.0.1",
50
+ "portfinder": "^1.0.28",
51
+ "scp2": "^0.5.0",
52
+ "svg-inline-loader": "^0.8.2",
53
+ "terser": "^5.25.0",
54
+ "vinyl-fs": "^4.0.0",
55
+ "vite": "^5.0.0",
56
+ "vite-plugin-commonjs": "^0.10.1",
57
+ "vite-plugin-css-injected-by-js": "^3.3.0",
58
+ "vite-plugin-external": "^4.0.1",
59
+ "vite-plugin-require-transform": "^1.0.21"
60
+ }
61
+ }
@@ -0,0 +1,34 @@
1
+ import fs from 'fs';
2
+ import { build } from 'vite'
3
+ import paths from '../config/paths.js';
4
+ import plugins from '../vite-plugin/index.js';
5
+
6
+ ;(async () => {
7
+
8
+ const input = { index: paths.appIndexJs }
9
+ if( fs.existsSync(paths.appFrontJs) ) {
10
+ input['front'] = paths.appFrontJs
11
+ }
12
+
13
+ await build({
14
+ configFile: false,
15
+ root: paths.appPath,
16
+ base: '',
17
+ build: {
18
+ assetsDir: '',
19
+ assetsInlineLimit: 0,
20
+ cssCodeSplit: true,
21
+ rollupOptions: {
22
+ input,
23
+ output: {
24
+ assetFileNames: 'assets/[name][extname]',
25
+ entryFileNames: '[name].js',
26
+ chunkFileNames(chunkInfo) {
27
+ return `chunks/${chunkInfo.name}.js`;
28
+ }
29
+ }
30
+ }
31
+ },
32
+ plugins: await plugins('build')
33
+ })
34
+ })()
@@ -0,0 +1,35 @@
1
+ import { ESLint } from 'eslint';
2
+
3
+ import overrideConfig from '../config/eslint.config.js';
4
+
5
+ const args = process.argv.slice(2);
6
+ let fix = false;
7
+ for (const arg of args) {
8
+ if (arg === '--fix') {
9
+ fix = true;
10
+ break;
11
+ }
12
+ if (arg.startsWith('--fix=')) {
13
+ const val = arg.split('=')[1].toLowerCase();
14
+ fix = !(val === 'false' || val === '0');
15
+ break;
16
+ }
17
+ }
18
+
19
+ const eslint = new ESLint({
20
+ overrideConfigFile: true,
21
+ overrideConfig,
22
+ fix,
23
+ // 启用缓存以提升性能[6](@ref)
24
+ // cache: true
25
+ });
26
+
27
+ (async () => {
28
+ const results = await eslint.lintFiles(['src/**/*.js']);
29
+ if (fix) {
30
+ await ESLint.outputFixes(results);
31
+ }
32
+ const formatter = await eslint.loadFormatter('stylish');
33
+ const resultText = formatter.format(results);
34
+ console.log(resultText);
35
+ })();
@@ -0,0 +1,74 @@
1
+ import scanner from 'i18next-scanner';
2
+ import vfs from 'vinyl-fs';
3
+ import fs from 'fs';
4
+ import path from 'path';
5
+ import paths from '../config/paths.js';
6
+
7
+ const input = [
8
+ 'src/**/*.{js,jsx}',
9
+ // Use ! to filter out files or directories
10
+ '!src/**/*.spec.{js,jsx}',
11
+ '!src/i18n/**',
12
+ '!**/node_modules/**',
13
+ ].map(p => path.resolve(paths.appPath, p));
14
+
15
+ const options = {
16
+ debug: false,
17
+ func: {
18
+ list: ['_t1', '_t2', '_r'],
19
+ extensions: ['.js', '.jsx']
20
+ },
21
+ trans: {
22
+ component: 'Trans',
23
+ i18nKey: 'i18nKey',
24
+ defaultsKey: 'defaults',
25
+ extensions: ['.js', '.jsx'],
26
+ fallbackKey: function (ns, value) {
27
+ return value;
28
+ },
29
+ acorn: {
30
+ ecmaVersion: 2020,
31
+ sourceType: 'module', // defaults to 'module'
32
+ // Check out https://github.com/acornjs/acorn/tree/master/acorn#interface for additional options
33
+ }
34
+ },
35
+ lngs: ['en', 'zh_Hans'],
36
+ ns: ['translation'],
37
+ defaultLng: 'en',
38
+ defaultNs: 'translation',
39
+ defaultValue: '__STRING_NOT_TRANSLATED__',
40
+ resource: {
41
+ loadPath: 'locales/{{lng}}/{{ns}}.json',
42
+ savePath: 'locales/{{lng}}/{{ns}}.json',
43
+ jsonIndent: 2,
44
+ lineEnding: '\n'
45
+ },
46
+ nsSeparator: false, // namespace separator
47
+ keySeparator: false, // key separator
48
+ interpolation: {
49
+ prefix: '{{',
50
+ suffix: '}}'
51
+ }
52
+ };
53
+
54
+ const transform = function customTransform(file, enc, done) {
55
+ "use strict";
56
+ const parser = this.parser;
57
+ const content = fs.readFileSync(file.path, enc);
58
+ let count = 0;
59
+
60
+ parser.parseFuncFromString(content, { list: ['_t1', '_r'] }, (key, options) => {
61
+ parser.set(key);
62
+ ++count;
63
+ });
64
+
65
+ if (count > 0) {
66
+ // console.log(`i18next-scanner: count=${chalk.cyan(count)}, file=${chalk.yellow(JSON.stringify(file.relative))}`);
67
+ }
68
+
69
+ done();
70
+ };
71
+
72
+ vfs.src(input)
73
+ .pipe(scanner(options, transform))
74
+ .pipe(vfs.dest(paths.appPath));
@@ -0,0 +1,81 @@
1
+ import md5 from 'md5';
2
+ import axios from 'axios';
3
+ import fs from 'fs';
4
+ import paths from '../config/paths.js';
5
+ import { translateKeys } from '../config/envs.js';
6
+
7
+ const apiUrl = 'http://api.fanyi.baidu.com/api/trans/vip/translate';
8
+ const { appid = '20230216001563735', secret = 'HU997LakH_PwTX0UmXUr' } = translateKeys();
9
+
10
+ const defaultLng = 'zh'
11
+
12
+ const readDirPath = paths.appPath + '/locales'
13
+
14
+ const upperCase = str => str.trim().slice(0, 1).toUpperCase() + str.slice(1)
15
+
16
+ const base = (from, to, q) => {
17
+ const salt = Math.random();
18
+ const sign = md5(appid + q + salt + secret);
19
+ const params = { q, from, to, salt, appid, sign };
20
+ return axios.get(apiUrl, { params });
21
+ }
22
+
23
+ const requestTranslate = (from, lngs) => {
24
+ const list = lngs.map(lng => base(from, lng.to, lng.q))
25
+ return Promise.all(list).then(res => {
26
+ return res.map(r => {
27
+ const data = r.data
28
+ return {
29
+ lng: data.to,
30
+ data: data.trans_result.reduce((p, c) => {
31
+ return { ...p, [c.src]: upperCase(c.dst) }
32
+ }, {})
33
+ }
34
+ })
35
+ }).catch(err => {
36
+ console.log(err)
37
+ })
38
+ }
39
+
40
+ const lngsQuery = []
41
+
42
+ const lngs = fs.readdirSync(readDirPath)
43
+ const cache = {}
44
+
45
+ lngs.forEach(lng => {
46
+ if(lng != 'index.js'){
47
+ const lngPath = readDirPath + `/${lng}/translation.json`
48
+ const fileData = fs.readFileSync(lngPath)
49
+ const current = JSON.parse(fileData)
50
+ if (lng == 'zh_Hans') {
51
+ const zn = { ...current }
52
+ Object.keys(current).forEach(k => {
53
+ if (current[k] == '__STRING_NOT_TRANSLATED__') {
54
+ zn[k] = k
55
+ }
56
+ })
57
+ fs.writeFile(lngPath, JSON.stringify(zn, null, 2), () => { })
58
+ } else {
59
+ let q = ''
60
+ Object.keys(current).forEach(k => {
61
+ if (current[k] == '__STRING_NOT_TRANSLATED__') {
62
+ q += `${k}\n`
63
+ } else {
64
+ cache[lng] = { ...(cache[lng] || {}), [k]: current[k] }
65
+ }
66
+ })
67
+ q != '' && lngsQuery.push({ to: lng, q })
68
+ }
69
+ }
70
+
71
+ })
72
+
73
+ lngsQuery.length > 0 && requestTranslate(defaultLng, lngsQuery).then(res => {
74
+ res?.forEach(r => {
75
+ const lngPath = readDirPath + `/${r.lng}/translation.json`
76
+ const prevData = cache[r.lng] || {}
77
+ fs.writeFile(lngPath, JSON.stringify(Object.assign(prevData, r.data),null,2), () => { })
78
+ })
79
+ })
80
+
81
+ console.log('\x1B[32m', lngsQuery.length > 0 ? '😊 translate success' : '😊 nothing need translate')
@@ -0,0 +1,116 @@
1
+ import chalk from "chalk";
2
+ import inquirer from "inquirer";
3
+ import pacote from "pacote";
4
+ import os from "os";
5
+ import fs from "fs";
6
+ import fetch from "node-fetch";
7
+ import FormData from "form-data";
8
+ import paths from "../config/paths.js";
9
+
10
+ const jsonData = fs.readFileSync(paths.appPackageJson, 'utf-8');
11
+ const packageJson = JSON.parse(jsonData);
12
+
13
+ const envs = process.env;
14
+ const args = process.argv;
15
+ let packageName = packageJson.name;
16
+
17
+ const getOption = (name, envName) => {
18
+ let value;
19
+ const optionArgs = args.filter((arg) => arg.startsWith(`--${name}=`));
20
+ if (optionArgs.length != 0) {
21
+ value = optionArgs[0].replace(`--${name}=`, "");
22
+ } else if (envs[envName]) {
23
+ value = envs[envName];
24
+ }
25
+
26
+ if (value && value.endsWith("/")) {
27
+ value = value.substring(0, value.length - 1);
28
+ }
29
+
30
+ return value;
31
+ };
32
+
33
+ const questions = [];
34
+ const forceQuestion = args.filter((arg) => arg.startsWith("-f")).length != 0;
35
+ const options = {
36
+ host: getOption("ophost", "IOT_OPURL"),
37
+ username: getOption("username", "IOT_OP_USER"),
38
+ password: getOption("password", "IOT_OP_PASSWORD"),
39
+ branch: getOption("branch", "IOT_BRANCH"),
40
+ };
41
+
42
+ if (forceQuestion || !options.host) {
43
+ questions.push({ name: "host", message: "[iot] 运维网址:" });
44
+ }
45
+ if (forceQuestion || !options.username) {
46
+ questions.push({ name: "username", message: "[iot] 管理员用户:" });
47
+ }
48
+ if (forceQuestion || !options.password) {
49
+ questions.push({ name: "password", message: "[iot] 管理员密码:", type: "password" });
50
+ }
51
+ if (forceQuestion || !options.branch) {
52
+ questions.push({ name: "branch", message: "[iot] 部署版本(可跳过):" });
53
+ }
54
+
55
+ inquirer
56
+ .prompt(questions)
57
+ .then(async (answers) => {
58
+ let host = answers.host || options.host;
59
+ let username = answers.username || options.username;
60
+ let password = answers.password || options.password;
61
+ let branch = answers.branch || options.branch;
62
+
63
+ host = host.endsWith("/") ? host : host + "/";
64
+
65
+ try {
66
+ // get user token from environment
67
+ const res = await fetch(host + "api/login", {
68
+ method: "POST",
69
+ body: JSON.stringify({ username, password }),
70
+ headers: { "Content-Type": "application/json", "Request-Type": "service" },
71
+ });
72
+
73
+ if (res.status != 200) {
74
+ throw new Error(await res.text());
75
+ }
76
+
77
+ const json = await res.json();
78
+ if (!json.accessToken) {
79
+ throw new Error(json);
80
+ }
81
+ const token = `Bearer ${json.accessToken}`;
82
+
83
+ const data = await pacote.tarball(paths.appPath);
84
+
85
+ const form = new FormData();
86
+
87
+ const fileKey = Math.ceil(Math.random() * 10000);
88
+ const fileName = os.tmpdir() + "/package_" + fileKey + ".tgz";
89
+ fs.writeFileSync(fileName, data);
90
+
91
+ form.append("file", fs.createReadStream(fileName));
92
+ if (branch) {
93
+ form.append("branch", branch);
94
+ }
95
+
96
+ console.log(chalk.yellow("[iot:install] 上传中 ...... "));
97
+
98
+ const installRes = await fetch(host + "api/front/install", {
99
+ method: "POST",
100
+ body: form,
101
+ headers: { ...form.getHeaders(), Authorization: token, "Request-Type": "service" },
102
+ });
103
+
104
+ if (installRes.status != 200) {
105
+ const text = await installRes.text();
106
+ console.log(chalk.red("[iot:install] 接口错误" + "\n" + text));
107
+ } else {
108
+ console.log(chalk.green("[iot:install] " + `成功安装 ${packageName} 到 ${host}`));
109
+ }
110
+ } catch (err) {
111
+ console.error(chalk.red("\n" + err.toString()));
112
+ }
113
+ })
114
+ .catch((err) => {
115
+ console.error(chalk.red("[iot:install] 用户验证失败" + "\n" + err.toString()));
116
+ });
@@ -0,0 +1,6 @@
1
+ import pacote from 'pacote';
2
+ import paths from "../config/paths.js";
3
+
4
+ pacote.tarball.file(paths.appPath, 'package.tgz').then(data => {
5
+ console.log('生成包文件成功')
6
+ })
@@ -0,0 +1,46 @@
1
+ import chalk from 'chalk';
2
+ import {preview} from 'vite';
3
+ import { getHost, getBaseUrl } from '../config/envs.js';
4
+ import paths from '../config/paths.js';
5
+ import plugins from '../vite-plugin/index.js';
6
+
7
+ const DEFAULT_PORT = parseInt(process.env.PORT, 10) || 3030;
8
+
9
+ const host = getHost();
10
+ const baseUrl = getBaseUrl();
11
+
12
+ console.log(chalk.green('[iot:envs] 请求 IOT_URL 为: ' + host));
13
+
14
+ (async () => {
15
+ const proxy = {
16
+ '/rest': {
17
+ target: host,
18
+ changeOrigin: true
19
+ },
20
+ '/ws': {
21
+ ws: true,
22
+ target: host,
23
+ changeOrigin: true
24
+ }
25
+ }
26
+ if (!(baseUrl.startsWith('http://') || baseUrl.startsWith('https://') || baseUrl.startsWith('//'))) {
27
+ proxy[baseUrl + '/node_modules/@airiot'] = {
28
+ target: host,
29
+ changeOrigin: true
30
+ }
31
+ }
32
+
33
+ const server = await preview({
34
+ configFile: false,
35
+ root: paths.appPath,
36
+ plugins: await plugins(),
37
+ preview: {
38
+ proxy,
39
+ port: DEFAULT_PORT,
40
+ open: true
41
+ },
42
+ });
43
+
44
+ server.printUrls()
45
+ server.bindCLIShortcuts({ print: true })
46
+ })();