mgexcli 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.
- package/LICENSE +8 -0
- package/README.md +35 -0
- package/dist/bin/index.js +2 -0
- package/dist/index.js +2 -0
- package/dist/utils.js +2 -0
- package/package.json +33 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
Copyright © 2026 a-drowned-fish
|
|
3
|
+
|
|
4
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
5
|
+
|
|
6
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
7
|
+
|
|
8
|
+
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# mgexcli
|
|
2
|
+
|
|
3
|
+
一个用于管理多语言词汇(i18n)的 CLI 工具, 支持登录。
|
|
4
|
+
|
|
5
|
+
## 安装
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
# 全局安装
|
|
9
|
+
npm install -g mgexcli
|
|
10
|
+
|
|
11
|
+
# 或使用 npx 直接运行(无需安装)
|
|
12
|
+
npx mgexcli <command>
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## 命令
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
# 登录
|
|
19
|
+
mgexcli login
|
|
20
|
+
|
|
21
|
+
# 发布应用
|
|
22
|
+
mgexcli deploy
|
|
23
|
+
|
|
24
|
+
mgexcli deploy --authToken xxx
|
|
25
|
+
|
|
26
|
+
# 下载应用
|
|
27
|
+
mgexcli download
|
|
28
|
+
|
|
29
|
+
mgexcli download --path ./xxx
|
|
30
|
+
mgexcli download --path /absolutepath
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## License
|
|
34
|
+
|
|
35
|
+
MIT
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";function r(){var t=["400YWeQhc","6MvwNdF","2345848jHtrtL","266346vTasOy","2817660jsYjmh","3178623EBgToL","393986uSFixk","14715120XhvqSK","10jEdnLP","3shMRKA","7259230aWRGLN"];return(r=function(){return t})()}function t(t,n){return t-=113,r()[t]}require("../index.js"),function(){for(var n=t,s=r();;)try{if(778483===parseInt(n(123))/1*(parseInt(n(117))/2)+-parseInt(n(120))/3*(parseInt(n(113))/4)+-parseInt(n(119))/5*(parseInt(n(115))/6)+parseInt(n(116))/7+parseInt(n(122))/8*(parseInt(n(114))/9)+-parseInt(n(118))/10+parseInt(n(121))/11)break;s.push(s.shift())}catch(r){s.push(s.shift())}}();
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";var e=require("tslib"),n=require("commander"),t=require("fs-extra"),o=require("node:path"),r=require("./utils.js");const i=s;function s(e,n){e-=134;return a()[e]}function a(){const e=["version","SIGTERM","6096870ULNvii","5036845giLHAv","13ETBGNg","224412NZBtOK","deploy","--authToken <authToken>","readJsonSync","command","authToken","exit","707xqGpzU","getAppList","1045fNEMHR","login","mgexcli","SIGINT","2510zCArDV","30330gTkoSy","2084148efJMhs","option","action","cleanupTmpDir","parse","../package.json","75448CEpAxU","description","4ZhBZPv","download","--path <path>","path","name","33074PzNghp"];return(a=function(){return e})()}!function(){const e=s,n=a();for(;;)try{if(510317===-parseInt(e(158))/1*(parseInt(e(153))/2)+parseInt(e(140))/3+-parseInt(e(148))/4*(parseInt(e(157))/5)+parseInt(e(156))/6+parseInt(e(166))/7*(parseInt(e(146))/8)+parseInt(e(139))/9*(parseInt(e(138))/10)+parseInt(e(134))/11*(-parseInt(e(159))/12))break;n.push(n.shift())}catch(e){n.push(n.shift())}}();const p=t[i(162)](o.resolve(__dirname,i(145))),c=new n.Command;c[i(152)](i(136)).description("Manage Words CLI")[i(154)](p[i(154)]),c[i(163)]("login")[i(147)](i(135))[i(142)](n=>e.__awaiter(void 0,void 0,void 0,function*(){const e=i;try{yield r.login(),process[e(165)](0)}catch(n){process[e(165)](1)}})),c.command(i(160))[i(147)](i(160)).option(i(161),i(164))[i(142)](n=>e.__awaiter(void 0,void 0,void 0,function*(){const e=i;yield r[e(167)](n)})),c[i(163)](i(149))[i(147)](i(149))[i(141)](i(150),i(151))[i(142)](n=>e.__awaiter(void 0,void 0,void 0,function*(){yield r.getAppList(n,!0)})),c[i(144)](),process.on(i(137),()=>{r.cleanupTmpDir(),process.exit(0)}),process.on(i(155),()=>{const e=i;r[e(143)](),process[e(165)](0)}),process.on(i(165),()=>{r[i(143)]()});
|
package/dist/utils.js
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";var e=require("tslib"),n=require("node:os"),t=require("node:path"),o=require("fs-extra"),r=require("ora"),s=require("node:http"),i=require("inquirer"),c=require("execa"),a=require("chalk"),l=require("semver");function u(e,n){e-=325;return b()[e]}const d=u;var p;!function(){const e=u,n=b();for(;;)try{if(232838===parseInt(e(401))/1+parseInt(e(374))/2*(parseInt(e(396))/3)+parseInt(e(451))/4*(parseInt(e(406))/5)+parseInt(e(426))/6+parseInt(e(378))/7*(-parseInt(e(428))/8)+parseInt(e(434))/9*(parseInt(e(433))/10)+-parseInt(e(392))/11)break;n.push(n.shift())}catch(e){n.push(n.shift())}}();const f={success:"✔",error:"✖",warning:"⚠",info:"ℹ"},y=d(407),g=t[d(468)](n[d(472)](),".mgexcli_tmp"),h=new a.Chalk,v=r(),m=d(367),w=t[d(468)](n.homedir(),".mgexcli"),x=t[d(468)](w,d(461)),k=null!==(p=process.env.MGEXCLI_COOKIE_NAME)&&void 0!==p?p:d(352);function _(){const e=d;g&&o[e(408)](g)&&o[e(452)](g)}function b(){const e=["valid","/token","session.json","export declare const ","address","/api/auth/get-session",", Record<I18nKey, string>>;","status","red","resolve"," option is missing and cannot be empty. please add --",'.json";',"session","tmpdir","registry=https://registry.npmjs.org/","i18n","words","bold","platform","GET","error","not found","writeFileSync","unknown","map","isAbsolute","$1 $2","README.md","readJsonSync","name","searchParams","HTTP ","join","\n\n> Auto generated i18n language package.\n\n## Installation\n\n```bash\nnpm install ","pkg","input","export type I18nKey = ","cyan","invalid version number","EMPTY","push","请选择一个应用","info","set","__Secure-ex-lang-auth.session_token","127.0.0.1","ensureFileSync","publish","win32","stop",'";\n```\n\n## TypeScript\n\nThis package contains complete TypeScript declarations.\n\n---\n\nGenerated automatically.\n',"toString","ensureDirSync","index.d.ts","trim","exit","the ","success","export { default as ","https://ex.roxmotor.top"," i18n language package","version",".npmrc","end","length","ignore","7214hbOBBm","登录成功","inherit","never","14zFNFPZ","start","current version: ","登录失败或超时",": Record<I18nKey, string>;","/callback",'";\n```\n\nOr use all languages.\n\n```ts\nimport { languages } from "'," value.","writeHead","*.js","cmd",'";\n\nconsole.log(zh.hello);\nconsole.log(en.hello);\n\nconsole.log(languages.zh.hello);\nconsole.log(languages.en.hello);\n```\n\n## Export\n\nEach language exports a JSON object.\n\n```ts\nimport { zh } from "',"toLowerCase","darwin","4536345iTyUuz","/api/auth/cli-export",'\n```\n\n## Usage\n\n```ts\nimport { zh, en, languages } from "',"--access","255cMelvb",".json","登录中...","/api/punish","list","278727vBLCIW","export declare const languages: Record<","deploy success.","http://localhost:","*.d.ts","1145hviLJx","1.0.0","pathExistsSync","您还没有创建应用,请先创建应用","toISOString","message","isArray","port","object","...","download success.","github","*.json","url","cookie","return","listen","application/json","inc","token","2127228QqtVaV",' } from "./',"1847392YPyhRN","stringify","xdg-open","open","languages.json","268440OFDKed","9hBkdVH","npm","./i18n","writeJsonSync","cwd","split","replace","public","view","data","translation","utf-8","prompt","green","publish version:","text/plain; charset=utf-8","json","2452RgdeeQ","removeSync","language","./index.d.ts","package name:","log",'export { default as languages } from "./languages.json";',"patch"];return(b=function(){return e})()}function I(e){const n=d;return e[n(440)](/([a-z])([A-Z])/g,n(334))[n(440)](/([A-Z]+)([A-Z][a-z])/g,n(334))[n(440)](/[-_]/g," ")[n(390)]()[n(440)](/\s+/g," ")[n(362)]()}function S(n){return e.__awaiter(this,arguments,void 0,function*({options:e,key:n,defaultValue:t}){const o=u;let r=(null==e?void 0:e[n])||"";if(!r){return r=(yield i[o(446)]([{type:"input",name:n,default:null!=t?t:".",message:f.info+" "+h[o(447)](I(n))+h.green(":"),validate:e=>{const t=o;return!(!(null==e?void 0:e.trim())||"."===e)||f.error+" "+h[t(467)](t(364)+n+t(469)+n+t(385))}}]))[n],null==r?void 0:r[o(362)]()}return null==r?void 0:r.trim()})}function j(){const e=d;try{if(!o[e(408)](x))return null;const n=o[e(336)](x);return"string"==typeof(null==n?void 0:n[e(420)])?n[e(420)]:null}catch(e){return null}}function T(n){return e.__awaiter(this,void 0,void 0,function*(){const e=u,t=j();if(!t)throw new Error("请先登录");const o=yield fetch(""+m+n,{method:e(327),headers:{cookie:t}});if(!o.ok)throw new Error("HTTP "+o.status);const r=yield o[e(450)]().catch(()=>({}));if(!(null==r?void 0:r[e(466)]))throw new Error((null==r?void 0:r[e(411)])||"请求失败");return null==r?void 0:r[e(443)]})}function E(e,n="",t=[]){const o=d;for(const[r,s]of Object.entries(e)){const e=n?n+"."+r:r;s&&typeof s===o(414)&&!Array[o(412)](s)?E(s,e,t):t.push(e)}return t}exports.chalk=h,exports.cleanupTmpDir=_,exports.defaultBaseUrl=m,exports.defaultPkgVersion=y,exports.getAppList=function(n,r){return e.__awaiter(this,void 0,void 0,function*(){const s=u;v[s(379)](h.bold[s(447)]("正在获取应用列表..."));try{const a=yield T(s(399));yield function(n,r,s){return e.__awaiter(this,void 0,void 0,function*(){const a=u;if(!n[a(372)])return void console[a(456)](f[a(328)],h.red(a(409)));v[a(357)]();const{id:p}=yield i[a(446)]([{type:a(400),name:"id",message:h.bold[a(447)]("请选择一个应用:"),choices:n[a(332)](e=>({name:e[a(337)],value:e.id}))}]);if(!p)return void console[a(456)](f.error,h[a(467)](a(349)));const m=yield function(n){return e.__awaiter(this,void 0,void 0,function*(){const e=u;v[e(379)](h[e(325)][e(447)](e(415)));try{return yield T("/api/punish/"+n)}catch(n){console.log(f[e(328)],h[e(467)](n[e(411)]))}finally{v[e(357)]()}})}(p);if(m){if(_(),s){const e=yield S({options:r,key:"path",defaultValue:a(436)});let n;n=t[a(333)](e)?t[a(468)](e):t[a(468)](process[a(438)](),e),o[a(360)](n);for(const e in m.words){const r=m.words[e];o[a(437)](t[a(468)](n,e+a(397)),r,{spaces:4})}console[a(456)](f[a(365)]+" "+h[a(447)](a(416)))}else try{const n=yield S({options:r,key:"authToken"});!function(e,n){const r=d,s=t.resolve(e,r(370));o[r(354)](s);const i=[r(473),"//registry.npmjs.org/:_authToken="+n][r(340)]("\n");o.writeFileSync(s,i,r(445))}(g,(null==n?void 0:n.trim())||"");const s=yield function(n){return e.__awaiter(this,void 0,void 0,function*(){const e=u;var t,o;let r="",s=y;v[e(379)]();try{const{stdout:o}=yield c.execa(e(435),[e(442),n,"version"],{cwd:g});r=o[e(362)](),s=null!==(t=l[e(424)](r,e(458)))&&void 0!==t?t:e(331)}catch(e){}v.stop(),console[e(456)](f[e(350)]+" "+h.gray(e(455))+" "+h[e(345)](n));let a=e(448);r&&(a="next version:",console.log(f.info+" "+h.green(e(380)+r)));return null===(o=(yield i[e(446)]([{type:e(343),name:"version",message:f[e(350)]+" "+h[e(447)](a),default:s,validate:n=>{const t=e;return!!l[t(459)](n)||f[t(328)]+" "+h[t(467)](t(346))}}]))[e(369)])||void 0===o?void 0:o[e(362)]()})}(m[a(342)]);(function(e,n,r){const s=d,i=t[s(468)](e,"package.json");o.ensureFileSync(i);const c={name:n,version:r,description:n+s(368),license:"MIT",keywords:[n,s(474),s(444),s(453)],main:"./index.js",types:s(454),files:[s(418),s(387),s(405),s(335)],publishConfig:{access:s(441)}};o.writeJsonSync(i,c,{spaces:4})})(g,m[a(342)],s),function(e,n){const r=d,s=t.resolve(e,r(335));o.ensureFileSync(s);const i="# "+n+r(341)+n+r(394)+n+r(389)+n+r(384)+n+r(358);o[r(330)](s,i,r(445))}(g,m[a(342)]),function(e,n){const r=d;o.writeJsonSync(t[r(468)](e,r(432)),n,{spaces:4});let s=r(377);const i=[],c=[],a=E(n),l=0===a[r(372)]?r(377):a[r(332)](e=>'"'+e+'"').join("|"),u=Object.keys(n),p=0===u[r(372)]?r(377):u[r(332)](e=>'"'+e+'"')[r(340)]("|");for(const c in n){const a=n[c];i.push(r(366)+c+r(427)+c+r(470)),o[r(437)](t[r(468)](e,c+r(397)),a,{spaces:4});const l=E(a);"never"===s&&(s=0===l[r(372)]?r(377):l[r(332)](e=>'"'+e+'"')[r(340)]("|"))}i.push(r(457)),c[r(348)](r(344)+s+";"),c[r(348)]("export type I18nAllLanguageKey = "+l+";"),u.forEach(e=>{const n=r;c[n(348)](n(462)+e+n(382))}),c[r(348)](r(402)+p+r(465)),c[r(348)]('declare module "vue-i18n" {\n interface DefineLocaleMessage extends Record<I18nKey, string> {}\n interface ComposerTranslation {\n (key: I18nKey, ...args: any[]): string;\n }\n interface VueI18n {\n t(key: I18nKey, ...args: any[]): string;\n }\n}'),o[r(330)](t.resolve(e,"index.js"),i[r(340)]("\n")),o[r(330)](t[r(468)](e,r(361)),c[r(340)]("\n"))}(g,m[a(475)]),yield function(){return e.__awaiter(this,void 0,void 0,function*(){const e=u;v[e(379)]();try{yield c.execa("npm",[e(355),e(395),e(441)],{cwd:g,stdio:e(376)}),console.log(f.success+" "+h[e(447)](e(403)))}catch(n){throw v[e(357)](),n}v[e(357)]()})}()}finally{_()}process[a(363)](0)}})}(a,n,r)}catch(e){console[s(456)](f[s(328)],h[s(467)](e.message))}finally{v.stop()}})},exports.logSymbols=f,exports.login=function(){return e.__awaiter(this,void 0,void 0,function*(){const t=u,r=yield function(){return e.__awaiter(this,void 0,void 0,function*(){const e=u;var n;try{const t=j();if(!t)return!1;const o=yield fetch(m+e(464),{headers:{cookie:t},credentials:"include"});if(!o.ok)return!1;const r=yield o.json();return!!(null===(n=null==r?void 0:r[e(471)])||void 0===n?void 0:n[e(425)])&&t}catch(e){return!1}})}();if(r)return r;const i=s.createServer(),a=yield new Promise(e=>{const n=u;i[n(422)](0,n(353),()=>{const t=n,o=i[t(463)]();e(typeof o===t(414)&&o?o[t(413)]:0)})}),l=t(404)+a+"/callback";try{v[t(379)](t(398));const r=yield fetch(m+"/api/auth/sign-in/social",{method:"POST",headers:{"Content-Type":t(423)},body:JSON[t(429)]({provider:t(417),callbackURL:l,disableRedirect:!0})}),s=yield r[t(450)]().catch(()=>({}));if(!r.ok||!(null==s?void 0:s[t(419)]))throw new Error((null==s?void 0:s[t(411)])||t(339)+r[t(466)]);yield function(t){return e.__awaiter(this,void 0,void 0,function*(){const e=u,o=n[e(326)]();try{o===e(391)?yield c.execa(e(431),[t],{stdio:e(373)}):o===e(356)?yield c.execa(e(388),["/c","start","",t],{stdio:"ignore"}):yield c.execa(e(430),[t],{stdio:e(373)})}catch(e){}})}(s.url);const _=yield(p=i,y=a,g=3e5,new Promise(e=>{let n,t=!1;const o=o=>{t||(t=!0,n&&clearTimeout(n),e(o))};n=setTimeout(()=>o(null),g),p.on("request",(e,n)=>{const t=u;var r;const s=(null!==(r=e[t(419)])&&void 0!==r?r:"/")[t(439)]("?")[0];if(s===t(383)){const e=new URL(t(393),m);return e[t(338)][t(351)](t(421),t(404)+y+t(460)),n[t(386)](302,{Location:e[t(359)]()}),void n.end()}if(s===t(460)){v[t(357)]();let r="";return e.on(t(443),e=>r+=e),void e.on(t(371),()=>{const e=t,s=r.trim()||null;n[e(386)](200,{"Content-Type":e(449),"Access-Control-Allow-Origin":"*"}),n[e(371)](s?"OK":e(347)),o(s)})}n[t(386)](404)[t(371)](t(329))})}));if(!_)throw new Error(t(381));const b=function(e){const n=d,t=k+"="+e;return o[n(360)](w),o[n(437)](x,{cookie:t,createdAt:(new Date)[n(410)]()},{spaces:4}),t}(_);return console[t(456)](f[t(365)],h[t(447)](t(375))),b}catch(e){throw v[t(357)](),console[t(456)](f[t(328)],h.red(e[t(411)])),e}finally{i.listening&&i.close()}var p,y,g})},exports.sessionDir=w,exports.sessionFile=x,exports.spinner=v,exports.tmpDir=g;
|
package/package.json
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "mgexcli",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Manage Words",
|
|
5
|
+
"main": "./dist/index.js",
|
|
6
|
+
"exports": {
|
|
7
|
+
".": "./dist/index.js"
|
|
8
|
+
},
|
|
9
|
+
"bin": {
|
|
10
|
+
"mgexcli": "./dist/bin/index.js"
|
|
11
|
+
},
|
|
12
|
+
"files": [
|
|
13
|
+
"dist",
|
|
14
|
+
"LICENSE",
|
|
15
|
+
"README.md"
|
|
16
|
+
],
|
|
17
|
+
"keywords": [
|
|
18
|
+
"mgexcli"
|
|
19
|
+
],
|
|
20
|
+
"author": "a-drowned-fish",
|
|
21
|
+
"license": "MIT",
|
|
22
|
+
"dependencies": {
|
|
23
|
+
"chalk": "^6.0.0",
|
|
24
|
+
"commander": "^15.0.0",
|
|
25
|
+
"execa": "^10.0.1",
|
|
26
|
+
"fs-extra": "^11.4.0",
|
|
27
|
+
"inquirer": "^8.2.7",
|
|
28
|
+
"ora": "^5.4.1",
|
|
29
|
+
"semver": "^7.8.5",
|
|
30
|
+
"tslib": "^2.8.1"
|
|
31
|
+
},
|
|
32
|
+
"scripts": {}
|
|
33
|
+
}
|