@lovrabet/cli 1.3.2 → 1.3.4-beta.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 (89) hide show
  1. package/lib/ai-setup/AISetupUI.js +1 -1
  2. package/lib/ai-setup/config.js +1 -1
  3. package/lib/api/api-doc-ui.js +1 -1
  4. package/lib/api/api-doc.js +1 -1
  5. package/lib/api/api-pull-ui.js +1 -1
  6. package/lib/api/fetch-model-list.js +1 -1
  7. package/lib/api/generate-api-file.js +1 -1
  8. package/lib/api/main.js +1 -1
  9. package/lib/api/pull-silent.js +1 -1
  10. package/lib/app-menu/app-menu-sync-ui.js +1 -1
  11. package/lib/app-menu/create-menu.js +1 -1
  12. package/lib/app-menu/get-local-pages.js +1 -1
  13. package/lib/app-menu/get-online-menu-list.js +1 -1
  14. package/lib/app-menu/use-get-online-menu-list.js +1 -1
  15. package/lib/app-menu/utils.js +1 -1
  16. package/lib/app-menu/valid-url.js +1 -1
  17. package/lib/app-menu-update-cdn/current-content.js +1 -1
  18. package/lib/app-menu-update-cdn/input-cdn-asset.js +1 -1
  19. package/lib/app-menu-update-cdn/main.js +1 -1
  20. package/lib/app-menu-update-cdn/update-menu-cdn-url.js +1 -1
  21. package/lib/auth/auth-server-ui.js +1 -1
  22. package/lib/auth/auth-server.js +1 -1
  23. package/lib/auth/constant.js +1 -1
  24. package/lib/auth/get-cookie.js +1 -1
  25. package/lib/auth/is-session-valid.js +1 -1
  26. package/lib/auth/logout.js +1 -1
  27. package/lib/cli-flags.js +1 -1
  28. package/lib/cli.js +1 -1
  29. package/lib/cmd/build-watch.js +1 -1
  30. package/lib/cmd/build.js +1 -1
  31. package/lib/cmd/logs.js +1 -1
  32. package/lib/cmd/preview.js +1 -1
  33. package/lib/cmd/start-execa.js +1 -0
  34. package/lib/cmd/start.js +1 -1
  35. package/lib/config/config-help.js +1 -1
  36. package/lib/config/main.js +1 -1
  37. package/lib/constant/domain.js +1 -1
  38. package/lib/constant/env.js +1 -1
  39. package/lib/create-app/enhanced-guided-create.js +1 -1
  40. package/lib/create-app/format-elapsed.js +1 -1
  41. package/lib/create-app/main.js +1 -1
  42. package/lib/create-app/non-interactive.js +1 -1
  43. package/lib/create-app/task-finished.js +1 -1
  44. package/lib/create-app/task-loading.js +1 -1
  45. package/lib/create-app/task-running.js +1 -1
  46. package/lib/create-app/task-time.js +1 -1
  47. package/lib/create-app/use-copy-project-template.js +1 -1
  48. package/lib/create-app/use-format-code.js +1 -1
  49. package/lib/create-app/use-install-dependencies.js +1 -1
  50. package/lib/help.js +1 -1
  51. package/lib/i18n/I18nProvider.js +1 -0
  52. package/lib/i18n/hooks.js +1 -0
  53. package/lib/i18n/index.js +1 -0
  54. package/lib/i18n/locales/en-US.js +1 -0
  55. package/lib/i18n/locales/zh-CN.js +1 -0
  56. package/lib/init/main.js +1 -1
  57. package/lib/mcp/McpInstallUI.js +1 -1
  58. package/lib/mcp/claude.js +1 -1
  59. package/lib/mcp/cursor.js +1 -1
  60. package/lib/mcp/main.js +1 -1
  61. package/lib/mcp/mcp-install-non-interactive.js +1 -1
  62. package/lib/mcp/mcp-installer.js +1 -1
  63. package/lib/skills/SkillInstallUI.js +1 -1
  64. package/lib/skills/main.js +1 -1
  65. package/lib/skills/skill-install-non-interactive.js +1 -1
  66. package/lib/skills/skill-installer.js +1 -1
  67. package/lib/ui/IDESelector.js +1 -1
  68. package/lib/ui/useIDESelection.js +1 -1
  69. package/lib/utils/ai_config.js +1 -1
  70. package/lib/utils/cdn-config.js +1 -1
  71. package/lib/utils/check-sdk-version.js +1 -1
  72. package/lib/utils/cli-version-check.js +1 -1
  73. package/lib/utils/config.js +1 -1
  74. package/lib/utils/copy-directory.js +1 -1
  75. package/lib/utils/file-utils.js +1 -1
  76. package/lib/utils/guides-cdn.js +1 -1
  77. package/lib/utils/http-client.js +1 -1
  78. package/lib/utils/logger.js +1 -1
  79. package/lib/utils/rules-cdn.js +1 -1
  80. package/lib/utils/sleep.js +1 -1
  81. package/lib/utils/template-replacer.js +1 -1
  82. package/package.json +6 -1
  83. package/templates/README.md +10 -55
  84. package/lib/add-page/input-page-router.js +0 -1
  85. package/lib/add-page/main.js +0 -1
  86. package/lib/add-page/select-page-template.js +0 -1
  87. package/lib/utils/router-updater.js +0 -1
  88. package/templates/pages/blank/index.tsx.tpl +0 -13
  89. package/templates/pages/sdk-fetch/index.tsx.tpl +0 -80
@@ -1 +0,0 @@
1
- function a1_0x575e(){const _0x1d31ef=['finally','14260455PpcxNp','cwd','join','column','pages','1563464ZHNJwd','\x20Step2:\x20','\x20*\x20页面创建成功!','6zcUCWf','\x20Step1:\x20','开始添加页面:\x20','success','cyan','info','error','\x20*\x20页面文件已创建,可直接通过路由访问','add-page','页面添加成功:\x20','56DGftBm','gray','已输入的页面路由\x20','src','页面添加失败:\x20','97592vqCsiO','processTemplate','4121192lnSkqE','catch','5155220VFivoJ','正在创建页面,请稍候…','now','1570934dxFvBF','green','\x20*\x20路由地址:\x20','\x20*\x20页面路径:\x20','resolve','2002884OvIHrE','message'];a1_0x575e=function(){return _0x1d31ef;};return a1_0x575e();}const a1_0x264e6f=a1_0x365e;(function(_0x2930fe,_0x385d52){const _0x222370=a1_0x365e,_0x5b19ea=_0x2930fe();while(!![]){try{const _0x534af8=parseInt(_0x222370(0x95))/0x1+-parseInt(_0x222370(0x8e))/0x2+-parseInt(_0x222370(0x9a))/0x3+-parseInt(_0x222370(0x90))/0x4+-parseInt(_0x222370(0x92))/0x5*(-parseInt(_0x222370(0x7f))/0x6)+parseInt(_0x222370(0x89))/0x7*(parseInt(_0x222370(0x7c))/0x8)+-parseInt(_0x222370(0x9d))/0x9;if(_0x534af8===_0x385d52)break;else _0x5b19ea['push'](_0x5b19ea['shift']());}catch(_0xc1bf9a){_0x5b19ea['push'](_0x5b19ea['shift']());}}}(a1_0x575e,0xcbab1));function a1_0x365e(_0x46f717,_0xd0dbbb){_0x46f717=_0x46f717-0x7c;const _0x575ee9=a1_0x575e();let _0x365ef8=_0x575ee9[_0x46f717];return _0x365ef8;}import{jsx as a1_0x4ef507,jsxs as a1_0x3fcd87,Fragment as a1_0xb81f6f}from'react/jsx-runtime';import{fileURLToPath}from'node:url';import a1_0x36fc57 from'node:path';import{useEffect,useState}from'react';import{Box,Text,useApp}from'ink';import{SelectPageTemplate}from'./select-page-template.js';import{InputProjectCode}from'./input-page-router.js';import{logger}from'../utils/logger.js';import{TemplateReplacer}from'../utils/template-replacer.js';const __dirname=a1_0x36fc57['dirname'](fileURLToPath(import.meta.url)),pageTemplateDir=a1_0x36fc57[a1_0x264e6f(0x99)](__dirname,'../../templates/pages'),projectDir=process[a1_0x264e6f(0x9e)]();export const AddPage=()=>{const _0x39d04e=a1_0x264e6f,{exit:_0x56af32}=useApp(),[_0x5054ea,_0xe91f68]=useState(''),[_0x565eb6,_0x16f62e]=useState(''),[_0x28af0c,_0x33a7ad]=useState(![]),[_0xe06162,_0x3c65a5]=useState(![]),_0x214a16=a1_0x36fc57[_0x39d04e(0x9f)](projectDir,_0x39d04e(0x8c),_0x39d04e(0xa1)),_0x4694d8=a1_0x36fc57[_0x39d04e(0x9f)](_0x214a16,_0x565eb6),_0x3e4303=a1_0x36fc57['join'](_0x39d04e(0x8c),_0x39d04e(0xa1),_0x565eb6);useEffect(()=>{const _0x521b87=_0x39d04e,_0x4b5e73=a1_0x36fc57[_0x521b87(0x99)](pageTemplateDir,_0x5054ea);if(_0x5054ea&&_0x565eb6){_0x33a7ad(!![]),logger['setLogPath'](process[_0x521b87(0x9e)]());const _0x342e15=Date[_0x521b87(0x94)]();logger[_0x521b87(0x84)]('add-page',_0x521b87(0x81)+_0x565eb6,{'template':_0x5054ea,'targetPath':_0x3e4303}),TemplateReplacer[_0x521b87(0x8f)](_0x4b5e73,a1_0x36fc57['join'](_0x214a16,_0x565eb6),_0x565eb6,_0x5054ea)['then'](()=>{const _0x443c00=_0x521b87,_0x29abac=Date[_0x443c00(0x94)]()-_0x342e15;logger[_0x443c00(0x82)](_0x443c00(0x87),_0x443c00(0x88)+_0x565eb6,_0x29abac,{'template':_0x5054ea,'targetPath':_0x3e4303,'routePath':_0x565eb6}),_0x3c65a5(!![]);})[_0x521b87(0x91)](_0x3eef11=>{const _0x20c19e=_0x521b87,_0x1b9107=Date[_0x20c19e(0x94)]()-_0x342e15;logger[_0x20c19e(0x85)](_0x20c19e(0x87),_0x20c19e(0x8d)+_0x565eb6,{'template':_0x5054ea,'targetPath':_0x3e4303,'error':_0x3eef11 instanceof Error?_0x3eef11[_0x20c19e(0x9b)]:String(_0x3eef11),'duration':_0x1b9107});})[_0x521b87(0x9c)](()=>{_0x33a7ad(![]);});}},[_0x5054ea,_0x565eb6]),useEffect(()=>{_0xe06162&&setTimeout(()=>{_0x56af32();});},[_0xe06162]);if(_0x5054ea)return a1_0x3fcd87(Box,{'flexDirection':_0x39d04e(0xa0),'paddingY':0x1,'children':[a1_0x3fcd87(Box,{'children':[a1_0x4ef507(Text,{'color':'gray','children':_0x39d04e(0x80)}),a1_0x4ef507(Text,{'children':'已选择页面模板\x20'}),a1_0x4ef507(Text,{'color':'green','children':_0x5054ea})]}),_0x565eb6?a1_0x3fcd87(Box,{'children':[a1_0x4ef507(Text,{'color':_0x39d04e(0x8a),'children':_0x39d04e(0x7d)}),a1_0x4ef507(Text,{'children':_0x39d04e(0x8b)}),a1_0x4ef507(Text,{'color':_0x39d04e(0x96),'children':_0x565eb6})]}):a1_0x4ef507(InputProjectCode,{'pagePath':_0x4694d8,'onSubmit':_0x16f62e}),_0x565eb6&&_0x28af0c?a1_0x3fcd87(Box,{'marginTop':0x1,'children':[a1_0x4ef507(Box,{'width':'4'}),a1_0x4ef507(Text,{'children':_0x39d04e(0x93)})]}):null,_0xe06162?a1_0x3fcd87(a1_0xb81f6f,{'children':[a1_0x4ef507(Box,{'marginTop':0x1,'children':a1_0x4ef507(Text,{'color':'gray','children':_0x39d04e(0x7e)})}),a1_0x3fcd87(Box,{'children':[a1_0x4ef507(Text,{'color':_0x39d04e(0x8a),'children':_0x39d04e(0x98)}),a1_0x4ef507(Text,{'color':_0x39d04e(0x96),'children':_0x3e4303})]}),a1_0x3fcd87(Box,{'children':[a1_0x4ef507(Text,{'color':_0x39d04e(0x8a),'children':_0x39d04e(0x97)}),a1_0x3fcd87(Text,{'color':_0x39d04e(0x96),'children':['/',_0x565eb6]})]}),a1_0x4ef507(Box,{'marginTop':0x1,'children':a1_0x4ef507(Text,{'color':_0x39d04e(0x83),'children':_0x39d04e(0x86)})})]}):null]});return a1_0x4ef507(SelectPageTemplate,{'onSelect':_0xe91f68});};
@@ -1 +0,0 @@
1
- (function(_0x18c943,_0x3c0714){const _0x5cc29f=a2_0x51ec,_0x58a938=_0x18c943();while(!![]){try{const _0x5948dd=parseInt(_0x5cc29f(0xfb))/0x1+-parseInt(_0x5cc29f(0x10b))/0x2*(-parseInt(_0x5cc29f(0xfd))/0x3)+parseInt(_0x5cc29f(0x103))/0x4+parseInt(_0x5cc29f(0x11c))/0x5+-parseInt(_0x5cc29f(0x101))/0x6*(parseInt(_0x5cc29f(0x115))/0x7)+parseInt(_0x5cc29f(0x108))/0x8*(-parseInt(_0x5cc29f(0xfe))/0x9)+parseInt(_0x5cc29f(0x102))/0xa*(-parseInt(_0x5cc29f(0x114))/0xb);if(_0x5948dd===_0x3c0714)break;else _0x58a938['push'](_0x58a938['shift']());}catch(_0x271f81){_0x58a938['push'](_0x58a938['shift']());}}}(a2_0x49ff,0x7f15f));import{jsx as a2_0x117de4,jsxs as a2_0x24deb8}from'react/jsx-runtime';import{useState,useEffect}from'react';import{Text,Box,useInput}from'ink';import{readdir}from'node:fs/promises';import a2_0x24a3e1 from'node:path';function a2_0x51ec(_0x4d78f1,_0x2993ea){_0x4d78f1=_0x4d78f1-0xfa;const _0x49fff2=a2_0x49ff();let _0x51ec02=_0x49fff2[_0x4d78f1];return _0x51ec02;}import{fileURLToPath}from'node:url';async function getTemplateList(){const _0x518f3a=a2_0x51ec;try{const _0x513463=fileURLToPath(import.meta.url),_0x5d27bb=a2_0x24a3e1[_0x518f3a(0xfa)](a2_0x24a3e1[_0x518f3a(0x118)](_0x513463),_0x518f3a(0x113)),_0x3b86f3=a2_0x24a3e1[_0x518f3a(0x11b)](_0x5d27bb,'templates/pages'),_0x3b019e=await readdir(_0x3b86f3,{'withFileTypes':!![]}),_0x202f7a=_0x3b019e[_0x518f3a(0x10a)](_0x18bd46=>_0x18bd46[_0x518f3a(0x10c)]())['map'](_0x4e1fcb=>({'label':_0x4e1fcb[_0x518f3a(0x11d)]}))[_0x518f3a(0x11a)]((_0x1e33e5,_0x25bbb9)=>_0x1e33e5[_0x518f3a(0x100)]['localeCompare'](_0x25bbb9[_0x518f3a(0x100)]));return _0x202f7a;}catch(_0x5e8210){return console[_0x518f3a(0x119)](_0x518f3a(0xfc),_0x5e8210),[{'label':_0x518f3a(0xff)},{'label':_0x518f3a(0x10d)}];}}function a2_0x49ff(){const _0x254b3d=['join','2503055osqaIk','name','resolve','307091riNuyf','获取模板列表失败:','3QzyTDQ','45QoVOjw','blank','label','42318wzNsaC','3175450mOQTTc','4039220RazMLP','\x20Step1:\x20','map','column','请选择您要创建的页面模板','1379080XmzIyD','downArrow','filter','1824488sgDyNN','isDirectory','sdk-fetch','正在加载页面模板...','return','gray','\x20\x20\x20\x20\x20\x20\x20\x20','\x20\x20\x20\x20\x20\x20>\x20','../..','11OBTnNW','1022hcAQeD','green','length','dirname','error','sort'];a2_0x49ff=function(){return _0x254b3d;};return a2_0x49ff();}export function SelectPageTemplate(_0x44c7cf){const _0x607d1=a2_0x51ec,[_0x4cd8c6,_0x53278a]=useState(0x0),[_0x34959f,_0x1b93e0]=useState([]),[_0x2bbcaa,_0x45f5c3]=useState(!![]);useEffect(()=>{async function _0x12a8f6(){const _0x5e51d8=await getTemplateList();_0x1b93e0(_0x5e51d8),_0x45f5c3(![]);}_0x12a8f6();},[]),useInput((_0x2aac27,_0xbe7bfb)=>{const _0xba6153=a2_0x51ec;if(_0x2bbcaa)return;if(_0xbe7bfb[_0xba6153(0x10f)]){const _0x5a0c3c=_0x34959f[_0x4cd8c6];_0x5a0c3c&&_0x44c7cf['onSelect'](_0x5a0c3c[_0xba6153(0x100)]);}_0xbe7bfb['upArrow']&&_0x53278a(_0x424b69=>_0x424b69===0x0?_0x34959f[_0xba6153(0x117)]-0x1:_0x424b69-0x1),_0xbe7bfb[_0xba6153(0x109)]&&_0x53278a(_0x375bf0=>_0x375bf0===_0x34959f[_0xba6153(0x117)]-0x1?0x0:_0x375bf0+0x1);});if(_0x2bbcaa)return a2_0x117de4(Box,{'flexDirection':_0x607d1(0x106),'paddingY':0x1,'children':a2_0x24deb8(Box,{'children':[a2_0x117de4(Text,{'color':_0x607d1(0x110),'children':_0x607d1(0x104)}),a2_0x117de4(Text,{'children':_0x607d1(0x10e)})]})});return a2_0x24deb8(Box,{'flexDirection':'column','paddingY':0x1,'children':[a2_0x24deb8(Box,{'children':[a2_0x117de4(Text,{'color':_0x607d1(0x110),'children':_0x607d1(0x104)}),a2_0x117de4(Text,{'children':_0x607d1(0x107)})]}),_0x34959f[_0x607d1(0x105)]((_0x487521,_0xba342b)=>{const _0x2b994f=_0x607d1,_0x13807e=_0xba342b===_0x4cd8c6,_0x77ab61=_0x13807e?_0x2b994f(0x112)+_0x487521[_0x2b994f(0x100)]:_0x2b994f(0x111)+_0x487521['label'];return a2_0x117de4(Box,{'children':a2_0x117de4(Text,{'color':_0x13807e?_0x2b994f(0x116):undefined,'children':_0x77ab61})},_0x77ab61);})]});}
@@ -1 +0,0 @@
1
- const a78_0x49247f=a78_0x2f29;function a78_0x2f29(_0x274327,_0x16bbf0){_0x274327=_0x274327-0xe4;const _0x52a82d=a78_0x52a8();let _0x2f297e=_0x52a82d[_0x274327];return _0x2f297e;}(function(_0x81de78,_0x5e6492){const _0x271d4d=a78_0x2f29,_0x52d919=_0x81de78();while(!![]){try{const _0xd93e49=parseInt(_0x271d4d(0xf9))/0x1+parseInt(_0x271d4d(0xee))/0x2*(-parseInt(_0x271d4d(0xf6))/0x3)+parseInt(_0x271d4d(0x112))/0x4*(-parseInt(_0x271d4d(0xfa))/0x5)+parseInt(_0x271d4d(0xea))/0x6*(-parseInt(_0x271d4d(0xf2))/0x7)+-parseInt(_0x271d4d(0xfb))/0x8+-parseInt(_0x271d4d(0xfd))/0x9*(parseInt(_0x271d4d(0x114))/0xa)+parseInt(_0x271d4d(0x10e))/0xb;if(_0xd93e49===_0x5e6492)break;else _0x52d919['push'](_0x52d919['shift']());}catch(_0x455699){_0x52d919['push'](_0x52d919['shift']());}}}(a78_0x52a8,0x67d5e));function a78_0x52a8(){const _0x5c0bac=['import\x20','indexOf','charAt','toLowerCase','6qKkgar','now','success','addPageRoute','148opUOKU','index','路由配置更新失败','\x20/>,\x0a\x20\x20\x20\x20\x20\x20\x20\x20},','5846638Dcxqcy','\x22,\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20element:\x20<','未找到路由配置的\x20children\x20数组','join','16941jQkslf','\x20\x20\x20\x20\x20\x20\x20\x20{\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20path:\x20\x22','promises','665597RxBWdV','43115uNVIVk','970048WwsZNQ','slice','1705203DxwAaX','路由配置更新完成','match','router','src','utf8','开始更新路由配置','路由文件不存在:\x20','error','map','toUpperCase','index.tsx','routerFilePath','previewChanges','info','toComponentName','lastIndexOf','22524051KyKuRC','path:\x20\x22','includes','existsSync','248ZAtjfk','message','20WYLGlw','addRoute','length','addImport'];a78_0x52a8=function(){return _0x5c0bac;};return a78_0x52a8();}import a78_0x4679d3 from'node:fs';import a78_0x293b14 from'node:path';import{logger}from'./logger.js';export class RouterUpdater{[a78_0x49247f(0x109)];constructor(_0x35b1a7){const _0x4479a5=a78_0x49247f;this[_0x4479a5(0x109)]=a78_0x293b14[_0x4479a5(0xf5)](_0x35b1a7,_0x4479a5(0x101),_0x4479a5(0x100),_0x4479a5(0x108));}async[a78_0x49247f(0xed)](_0x21e173,_0x333ba8){const _0x441ee1=a78_0x49247f;if(!a78_0x4679d3[_0x441ee1(0x111)](this[_0x441ee1(0x109)]))throw new Error(_0x441ee1(0x104)+this[_0x441ee1(0x109)]);const _0x4c893b=Date[_0x441ee1(0xeb)]();logger[_0x441ee1(0x10b)](_0x441ee1(0x100),_0x441ee1(0x103),{'pageName':_0x21e173,'routePath':_0x333ba8,'file':this[_0x441ee1(0x109)]});try{const _0x32c54e=await a78_0x4679d3[_0x441ee1(0xf8)]['readFile'](this[_0x441ee1(0x109)],_0x441ee1(0x102)),_0x3337de=this[_0x441ee1(0x10c)](_0x21e173),_0x3e1a40=this[_0x441ee1(0xe5)](_0x32c54e,_0x3337de,_0x21e173),_0x2df407=this[_0x441ee1(0x115)](_0x3e1a40,_0x333ba8,_0x3337de);await a78_0x4679d3[_0x441ee1(0xf8)]['writeFile'](this['routerFilePath'],_0x2df407,_0x441ee1(0x102));const _0x5764e1=Date[_0x441ee1(0xeb)]()-_0x4c893b;logger[_0x441ee1(0xec)]('router',_0x441ee1(0xfe),_0x5764e1,{'pageName':_0x21e173,'routePath':_0x333ba8,'componentName':_0x3337de});}catch(_0x25d50c){const _0x219aeb=Date[_0x441ee1(0xeb)]()-_0x4c893b;logger[_0x441ee1(0x105)]('router',_0x441ee1(0xf0),{'pageName':_0x21e173,'routePath':_0x333ba8,'error':_0x25d50c instanceof Error?_0x25d50c[_0x441ee1(0x113)]:String(_0x25d50c),'duration':_0x219aeb});throw _0x25d50c;}}[a78_0x49247f(0x10c)](_0x27ec99){const _0x225019=a78_0x49247f;return _0x27ec99['split']('-')[_0x225019(0x106)](_0x32d3cf=>_0x32d3cf[_0x225019(0xe8)](0x0)[_0x225019(0x107)]()+_0x32d3cf[_0x225019(0xfc)](0x1)[_0x225019(0xe9)]())[_0x225019(0xf5)]('');}[a78_0x49247f(0xe5)](_0x22c575,_0x35ddaa,_0x5841ba){const _0x3cf9fa=a78_0x49247f,_0x5f30ab=/import\s+\w+\s+from\s+["']\.\.\/pages\/\w+["'];?\n/g,_0x2e6d11=_0x22c575[_0x3cf9fa(0xff)](_0x5f30ab)||[],_0x416d76=_0x3cf9fa(0xe6)+_0x35ddaa+'\x20from\x20\x22../pages/'+_0x5841ba+'\x22;';if(_0x22c575[_0x3cf9fa(0x110)](_0x416d76))return _0x22c575;if(_0x2e6d11[_0x3cf9fa(0xe4)]>0x0){const _0x366c4c=_0x2e6d11[_0x2e6d11[_0x3cf9fa(0xe4)]-0x1];if(_0x366c4c){const _0x2395e8=_0x22c575[_0x3cf9fa(0x10d)](_0x366c4c),_0x1ce756=_0x2395e8+_0x366c4c[_0x3cf9fa(0xe4)];return _0x22c575[_0x3cf9fa(0xfc)](0x0,_0x1ce756)+_0x416d76+'\x0a'+_0x22c575[_0x3cf9fa(0xfc)](_0x1ce756);}}const _0x2f739a=_0x22c575[_0x3cf9fa(0xff)](/import\s+\w+\s+from\s+["']\.\.\/layouts\/\w+["'];?\n/);if(_0x2f739a&&_0x2f739a['index']!==undefined){const _0x532067=_0x2f739a[_0x3cf9fa(0xef)]+_0x2f739a[0x0][_0x3cf9fa(0xe4)];return _0x22c575[_0x3cf9fa(0xfc)](0x0,_0x532067)+_0x416d76+'\x0a'+_0x22c575[_0x3cf9fa(0xfc)](_0x532067);}return _0x22c575;}['addRoute'](_0x453b47,_0x5e51bf,_0x2b3f89){const _0x5e66c5=a78_0x49247f,_0x5adb56=_0x5e66c5(0xf7)+_0x5e51bf+_0x5e66c5(0xf3)+_0x2b3f89+_0x5e66c5(0xf1);if(_0x453b47[_0x5e66c5(0x110)](_0x5e66c5(0x10f)+_0x5e51bf+'\x22'))return _0x453b47;const _0x4c539f=/children:\s*\[([\s\S]*?)\]/,_0x509cfc=_0x453b47[_0x5e66c5(0xff)](_0x4c539f);if(!_0x509cfc||_0x509cfc[_0x5e66c5(0xef)]===undefined)throw new Error(_0x5e66c5(0xf4));const _0xef63ca=_0x509cfc[0x1],_0x42dfac=_0x509cfc[_0x5e66c5(0xef)]+_0x509cfc[0x0][_0x5e66c5(0xe7)]('[')+0x1,_0x57f1f9=_0xef63ca?.[_0x5e66c5(0xff)](/\{[\s\S]*?\},/g)||[];if(_0x57f1f9['length']>0x0){const _0x268fc6=_0x57f1f9[_0x57f1f9[_0x5e66c5(0xe4)]-0x1];if(_0x268fc6){const _0x26a3ed=_0x453b47[_0x5e66c5(0x10d)](_0x268fc6),_0x33cc81=_0x26a3ed+_0x268fc6[_0x5e66c5(0xe4)];return _0x453b47[_0x5e66c5(0xfc)](0x0,_0x33cc81)+'\x0a'+_0x5adb56+_0x453b47[_0x5e66c5(0xfc)](_0x33cc81);}}return _0x453b47['slice'](0x0,_0x42dfac)+'\x0a'+_0x5adb56+_0x453b47[_0x5e66c5(0xfc)](_0x42dfac);}async[a78_0x49247f(0x10a)](_0x3fab62,_0x48ceab){const _0x527618=a78_0x49247f;if(!a78_0x4679d3[_0x527618(0x111)](this[_0x527618(0x109)]))throw new Error('路由文件不存在:\x20'+this[_0x527618(0x109)]);const _0x3e08ed=await a78_0x4679d3['promises']['readFile'](this[_0x527618(0x109)],'utf8'),_0x1799ec=this['toComponentName'](_0x3fab62);let _0x48800b=this[_0x527618(0xe5)](_0x3e08ed,_0x1799ec,_0x3fab62);return _0x48800b=this[_0x527618(0x115)](_0x48800b,_0x48ceab,_0x1799ec),_0x48800b;}}
@@ -1,13 +0,0 @@
1
- /**
2
- * Generated by Lovrabet CLI v{CliVersion}
3
- * Created: {CreatedAt}
4
- * Page: {PageName}
5
- * Title: {ComponentName}
6
- */
7
- import React from "react";
8
-
9
- function {ComponentName}() {
10
- return <div style={{ padding: "24px" }}>{DisplayTitle} 页面</div>;
11
- }
12
-
13
- export default {ComponentName};
@@ -1,80 +0,0 @@
1
- /**
2
- * Generated by Lovrabet CLI v{CliVersion}
3
- * Created: {CreatedAt}
4
- * Page: {PageName}
5
- * Title: {ComponentName}
6
- */
7
- import React, { useState } from "react";
8
- import { Button, Typography, Table, message } from "antd";
9
- import { ApiOutlined } from "@ant-design/icons";
10
- import { lovrabetClient } from "../../api/client";
11
- import { SortOrder } from "@lovrabet/sdk";
12
-
13
- const { Title, Paragraph, Text } = Typography;
14
-
15
- function {ComponentName}() {
16
- const [loading, setLoading] = useState(false);
17
- const [data, setData] = useState<any>({});
18
- const [columns, setColumns] = useState<any[]>([]);
19
-
20
- // SDK 调用示例
21
- const fetchData = async () => {
22
- setLoading(true);
23
- try {
24
- // 动态获取第一个模型,请以实际业务诉求自行修改
25
- const firstModel = lovrabetClient.getModel(0);
26
- const data = await firstModel.getList(
27
- {
28
- currentPage: 1,
29
- pageSize: 10,
30
- },
31
- // 排序,请以实际业务字段自行修改
32
- [{ id: SortOrder.ASC }],
33
- );
34
- processResponse(data, "获取数据成功");
35
- } catch (error) {
36
- console.error("获取数据失败:", error);
37
- } finally {
38
- setLoading(false);
39
- }
40
- };
41
- /**
42
- * 处理响应数据
43
- */
44
- const processResponse = (response: any, successMessage: string) => {
45
- // 处理返回的数据
46
- setData(response.tableData || []);
47
-
48
- // 动态生成表格列
49
- if (response.tableColumns) {
50
- const tableColumns = response.tableColumns.map((column: any) => ({
51
- title: column.title || column.dataIndex,
52
- dataIndex: column.dataIndex,
53
- key: column.dataIndex,
54
- }));
55
- setColumns(tableColumns);
56
- }
57
-
58
- message.success(successMessage);
59
- };
60
-
61
- return (
62
- <div style={{ padding: "24px" }}>
63
- <Title level={2}>
64
- <ApiOutlined /> Fetch Data - {PageName}
65
- </Title>
66
- <Paragraph style={{ color: "#666", marginBottom: 24 }}>
67
- 使用 lovrabetClient 调用 SDK 的示例页面
68
- </Paragraph>
69
-
70
- <p>
71
- <Button onClick={fetchData} type="primary">
72
- Fetch Data
73
- </Button>
74
- </p>
75
- {data.length > 0 && <Table dataSource={data} columns={columns} />}
76
- </div>
77
- );
78
- }
79
-
80
- export default {ComponentName};