neo-cmp-cli 1.13.16 → 1.13.18
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/README.md +2 -1
- package/dist/index2.js +1 -1
- package/dist/main2.js +1 -1
- package/dist/neo/env.js +1 -1
- package/dist/neo/neoLogin.js +1 -1
- package/dist/neo/pushCmp.js +1 -1
- package/dist/package.json.js +1 -1
- package/package.json +3 -2
- package/template/antd-custom-cmp-template/package.json +1 -1
- package/template/asset-manage-template/docs/README.md +1 -232
- package/template/asset-manage-template/package.json +2 -2
- package/template/echarts-custom-cmp-template/package.json +1 -1
- package/template/empty-custom-cmp-template/package.json +2 -2
- package/template/map-custom-cmp-template/package.json +1 -1
- package/template/neo-bi-cmps/neo.config.js +7 -1
- package/template/neo-bi-cmps/package.json +8 -7
- package/template/neo-bi-cmps/public/403.html +77 -0
- package/template/neo-bi-cmps/public/demo.html +2453 -0
- package/template/neo-bi-cmps/src/assets/icon/barChart.svg +1 -0
- package/template/neo-bi-cmps/src/assets/icon/card.svg +1 -0
- package/template/neo-bi-cmps/src/assets/icon/filter.svg +1 -0
- package/template/neo-bi-cmps/src/assets/icon/funnel.svg +1 -0
- package/template/neo-bi-cmps/src/assets/icon/tab.svg +1 -0
- package/template/neo-bi-cmps/src/components/filterBar__c/README.md +3 -14
- package/template/neo-bi-cmps/src/components/filterBar__c/common.scss +29 -0
- package/template/neo-bi-cmps/src/components/filterBar__c/index.tsx +668 -146
- package/template/neo-bi-cmps/src/components/filterBar__c/model.ts +26 -48
- package/template/neo-bi-cmps/src/components/filterBar__c/style.scss +46 -139
- package/template/neo-bi-cmps/src/components/targetNumber__c/customStyleConfig/index.tsx +11 -10
- package/template/neo-bi-cmps/src/components/targetNumber__c/index.tsx +9 -16
- package/template/neo-bi-cmps/src/components/targetNumber__c/model.ts +1 -1
- package/template/neo-bi-cmps/src/utils/common.ts +231 -0
- package/template/neo-bi-cmps/src/utils/filter2chartFilter.ts +268 -0
- package/template/neo-bi-cmps/src/utils/filterBar.ts +140 -0
- package/template/neo-bi-cmps/src/utils/pipelineFunnel.ts +341 -0
- package/template/{neo-h5-cmps/src/utils/queryObjectData.ts → neo-bi-cmps/src/utils/queryByCustomSQL.ts} +18 -13
- package/template/neo-bi-cmps/src/utils/requestDebounce.ts +22 -0
- package/template/neo-bi-cmps/src/utils/simpleTable.tsx +344 -0
- package/template/neo-bi-cmps/src/utils/stageSwitch.ts +15 -0
- package/template/neo-bi-cmps/src/utils/stageTimeChart.ts +90 -0
- package/template/neo-bi-cmps/src/utils/targetNumber.ts +12 -0
- package/template/neo-custom-cmp-template/docs/README.md +0 -231
- package/template/neo-custom-cmp-template/package.json +2 -2
- package/template/neo-h5-cmps/package.json +2 -2
- package/template/neo-h5-cmps/src/components/entityList__c/index.tsx +1 -2
- package/template/neo-h5-cmps/src/components/entityTabs__c/index.tsx +1 -1
- package/template/neo-h5-cmps/src/components/globalSearchInput__c/index.tsx +1 -1
- package/template/neo-h5-cmps/src/components/openChatPageBtn__c/index.tsx +1 -2
- package/template/neo-order-cmps/package.json +2 -2
- package/template/neo-pipeline-cmps/.prettierrc.js +12 -0
- package/template/neo-pipeline-cmps/@types/neo-ui-common.d.ts +36 -0
- package/template/neo-pipeline-cmps/README.md +99 -0
- package/template/neo-pipeline-cmps/commitlint.config.js +59 -0
- package/template/neo-pipeline-cmps/neo.config.js +135 -0
- package/template/neo-pipeline-cmps/package.json +66 -0
- package/template/neo-pipeline-cmps/public/403.html +77 -0
- package/template/neo-pipeline-cmps/public/css/base.css +283 -0
- package/template/neo-pipeline-cmps/public/demo.html +2453 -0
- package/template/neo-pipeline-cmps/public/scripts/app/bluebird.js +6679 -0
- package/template/neo-pipeline-cmps/public/template.html +13 -0
- package/template/neo-pipeline-cmps/src/assets/css/common.scss +127 -0
- package/template/neo-pipeline-cmps/src/assets/css/mixin.scss +47 -0
- package/template/neo-pipeline-cmps/src/assets/icon/barChart.svg +1 -0
- package/template/neo-pipeline-cmps/src/assets/icon/card.svg +1 -0
- package/template/neo-pipeline-cmps/src/assets/icon/filter.svg +1 -0
- package/template/neo-pipeline-cmps/src/assets/icon/funnel.svg +1 -0
- package/template/neo-pipeline-cmps/src/assets/icon/tab.svg +1 -0
- package/template/neo-pipeline-cmps/src/assets/img/AIBtn.gif +0 -0
- package/template/neo-pipeline-cmps/src/assets/img/NeoCRM.jpg +0 -0
- package/template/neo-pipeline-cmps/src/assets/img/aiLogo.png +0 -0
- package/template/neo-pipeline-cmps/src/assets/img/card-list.svg +1 -0
- package/template/neo-pipeline-cmps/src/assets/img/contact-form.svg +1 -0
- package/template/neo-pipeline-cmps/src/assets/img/custom-form.svg +1 -0
- package/template/neo-pipeline-cmps/src/assets/img/custom-widget.svg +1 -0
- package/template/neo-pipeline-cmps/src/assets/img/data-list.svg +1 -0
- package/template/neo-pipeline-cmps/src/assets/img/detail.svg +1 -0
- package/template/neo-pipeline-cmps/src/assets/img/favicon.png +0 -0
- package/template/neo-pipeline-cmps/src/assets/img/map.svg +1 -0
- package/template/neo-pipeline-cmps/src/assets/img/search.svg +1 -0
- package/template/neo-pipeline-cmps/src/assets/img/table.svg +1 -0
- package/template/neo-pipeline-cmps/src/components/filterBar__c/README.md +24 -0
- package/template/neo-pipeline-cmps/src/components/filterBar__c/common.scss +29 -0
- package/template/neo-pipeline-cmps/src/components/filterBar__c/index.tsx +731 -0
- package/template/neo-pipeline-cmps/src/components/filterBar__c/model.ts +52 -0
- package/template/neo-pipeline-cmps/src/components/filterBar__c/style.scss +119 -0
- package/template/neo-pipeline-cmps/src/components/pipelineFunnel__c/README.md +39 -0
- package/template/neo-pipeline-cmps/src/components/pipelineFunnel__c/index.tsx +416 -0
- package/template/neo-pipeline-cmps/src/components/pipelineFunnel__c/model.ts +80 -0
- package/template/neo-pipeline-cmps/src/components/pipelineFunnel__c/style.scss +83 -0
- package/template/neo-pipeline-cmps/src/components/showHealthResult__c/index.tsx +470 -0
- package/template/neo-pipeline-cmps/src/components/showHealthResult__c/model.ts +45 -0
- package/template/neo-pipeline-cmps/src/components/showHealthResult__c/style.scss +137 -0
- package/template/neo-pipeline-cmps/src/components/simpleTable__c/README.md +89 -0
- package/template/neo-pipeline-cmps/src/components/simpleTable__c/common.scss +195 -0
- package/template/neo-pipeline-cmps/src/components/simpleTable__c/index.tsx +667 -0
- package/template/neo-pipeline-cmps/src/components/simpleTable__c/model.ts +124 -0
- package/template/neo-pipeline-cmps/src/components/simpleTable__c/style.scss +192 -0
- package/template/neo-pipeline-cmps/src/components/stageSwitch__c/README.md +36 -0
- package/template/neo-pipeline-cmps/src/components/stageSwitch__c/index.tsx +513 -0
- package/template/neo-pipeline-cmps/src/components/stageSwitch__c/model.ts +71 -0
- package/template/{neo-bi-cmps → neo-pipeline-cmps}/src/components/stageSwitch__c/style.scss +4 -2
- package/template/neo-pipeline-cmps/src/components/stageTimeChart__c/README.md +37 -0
- package/template/neo-pipeline-cmps/src/components/stageTimeChart__c/index.tsx +455 -0
- package/template/neo-pipeline-cmps/src/components/stageTimeChart__c/model.ts +106 -0
- package/template/{neo-bi-cmps → neo-pipeline-cmps}/src/components/stageTimeChart__c/style.scss +3 -2
- package/template/neo-pipeline-cmps/src/utils/common.ts +229 -0
- package/template/neo-pipeline-cmps/src/utils/filter2chartFilter.ts +266 -0
- package/template/neo-pipeline-cmps/src/utils/filterBar.ts +140 -0
- package/template/neo-pipeline-cmps/src/utils/pipelineFunnel.ts +343 -0
- package/template/neo-pipeline-cmps/src/utils/queryByCustomSQL.ts +121 -0
- package/template/neo-pipeline-cmps/src/utils/requestDebounce.ts +22 -0
- package/template/neo-pipeline-cmps/src/utils/simpleTable.tsx +349 -0
- package/template/neo-pipeline-cmps/src/utils/stageSwitch.ts +15 -0
- package/template/neo-pipeline-cmps/src/utils/stageTimeChart.ts +90 -0
- package/template/neo-pipeline-cmps/src/utils/targetNumber.ts +12 -0
- package/template/neo-pipeline-cmps/tsconfig.json +40 -0
- package/template/neo-web-entity-grid/package.json +2 -2
- package/template/neo-web-form/package.json +2 -2
- package/template/neo-web-form/src/components/batchAddTable__c/index.tsx +161 -41
- package/template/neo-web-form/src/components/batchAddTable__c/model.ts +4 -2
- package/template/react-custom-cmp-template/package.json +1 -1
- package/template/react-ts-custom-cmp-template/package.json +1 -1
- package/template/vue2-custom-cmp-template/package.json +1 -1
- package/template/asset-manage-template/src/utils/axiosFetcher.ts +0 -37
- package/template/asset-manage-template/src/utils/queryObjectData.ts +0 -112
- package/template/asset-manage-template/src/utils/xobjects.ts +0 -162
- package/template/neo-bi-cmps/.npmrc copy +0 -1
- package/template/neo-bi-cmps/src/components/aiCommitDrawer__c/README.md +0 -52
- package/template/neo-bi-cmps/src/components/aiCommitDrawer__c/index.tsx +0 -183
- package/template/neo-bi-cmps/src/components/aiCommitDrawer__c/model.ts +0 -90
- package/template/neo-bi-cmps/src/components/aiCommitDrawer__c/style.scss +0 -218
- package/template/neo-bi-cmps/src/components/forecastChart__c/README.md +0 -31
- package/template/neo-bi-cmps/src/components/forecastChart__c/index.tsx +0 -158
- package/template/neo-bi-cmps/src/components/forecastChart__c/model.ts +0 -40
- package/template/neo-bi-cmps/src/components/forecastChart__c/style.scss +0 -154
- package/template/neo-bi-cmps/src/components/forecastGrid__c/README.md +0 -36
- package/template/neo-bi-cmps/src/components/forecastGrid__c/index.tsx +0 -86
- package/template/neo-bi-cmps/src/components/forecastGrid__c/model.ts +0 -62
- package/template/neo-bi-cmps/src/components/forecastGrid__c/style.scss +0 -48
- package/template/neo-bi-cmps/src/components/gapCloser__c/README.md +0 -24
- package/template/neo-bi-cmps/src/components/gapCloser__c/index.tsx +0 -100
- package/template/neo-bi-cmps/src/components/gapCloser__c/model.ts +0 -46
- package/template/neo-bi-cmps/src/components/gapCloser__c/style.scss +0 -60
- package/template/neo-bi-cmps/src/components/kpiCards__c/README.md +0 -35
- package/template/neo-bi-cmps/src/components/kpiCards__c/index.tsx +0 -70
- package/template/neo-bi-cmps/src/components/kpiCards__c/model.ts +0 -50
- package/template/neo-bi-cmps/src/components/kpiCards__c/style.scss +0 -33
- package/template/neo-bi-cmps/src/components/oppList__c/README.md +0 -52
- package/template/neo-bi-cmps/src/components/oppList__c/index.tsx +0 -285
- package/template/neo-bi-cmps/src/components/oppList__c/model.ts +0 -86
- package/template/neo-bi-cmps/src/components/oppList__c/style.scss +0 -133
- package/template/neo-bi-cmps/src/components/pipelineFunnel__c/README.md +0 -39
- package/template/neo-bi-cmps/src/components/pipelineFunnel__c/index.tsx +0 -130
- package/template/neo-bi-cmps/src/components/pipelineFunnel__c/model.ts +0 -66
- package/template/neo-bi-cmps/src/components/pipelineFunnel__c/style.scss +0 -133
- package/template/neo-bi-cmps/src/components/stageSwitch__c/README.md +0 -36
- package/template/neo-bi-cmps/src/components/stageSwitch__c/index.tsx +0 -118
- package/template/neo-bi-cmps/src/components/stageSwitch__c/model.ts +0 -92
- package/template/neo-bi-cmps/src/components/stageTimeChart__c/README.md +0 -37
- package/template/neo-bi-cmps/src/components/stageTimeChart__c/index.tsx +0 -126
- package/template/neo-bi-cmps/src/components/stageTimeChart__c/model.ts +0 -57
- package/template/neo-bi-cmps/src/components/tabSwitch__c/README.md +0 -37
- package/template/neo-bi-cmps/src/components/tabSwitch__c/index.tsx +0 -80
- package/template/neo-bi-cmps/src/components/tabSwitch__c/model.ts +0 -45
- package/template/neo-bi-cmps/src/components/tabSwitch__c/style.scss +0 -37
- package/template/neo-bi-cmps/src/utils/axiosFetcher.ts +0 -37
- package/template/neo-bi-cmps/src/utils/queryObjectData.ts +0 -76
- package/template/neo-bi-cmps/src/utils/xobjects.ts +0 -162
- package/template/neo-custom-cmp-template/src/utils/axiosFetcher.ts +0 -37
- package/template/neo-custom-cmp-template/src/utils/queryObjectData.ts +0 -112
- package/template/neo-custom-cmp-template/src/utils/xobjects.ts +0 -162
- package/template/neo-h5-cmps/src/utils/axiosFetcher.ts +0 -37
- package/template/neo-h5-cmps/src/utils/xobjects.ts +0 -167
- package/template/neo-order-cmps/src/utils/axiosFetcher.ts +0 -37
- package/template/neo-order-cmps/src/utils/queryObjectData.ts +0 -112
- package/template/neo-order-cmps/src/utils/xobjects.ts +0 -162
- package/template/neo-web-entity-grid/src/utils/axiosFetcher.ts +0 -37
- package/template/neo-web-entity-grid/src/utils/queryObjectData.ts +0 -112
- package/template/neo-web-entity-grid/src/utils/xobjects.ts +0 -167
- package/template/neo-web-form/src/utils/axiosFetcher.ts +0 -37
- package/template/neo-web-form/src/utils/queryObjectData.ts +0 -112
- package/template/neo-web-form/src/utils/xobjects.ts +0 -167
package/README.md
CHANGED
|
@@ -125,7 +125,7 @@ neo push cmp
|
|
|
125
125
|
|------|------|------|
|
|
126
126
|
| `neo init` | 根据模板创建自定义组件项目 | `-t` / `--type` 模板类型(见 [内置模板](#内置模板)),`-n` / `--name` 项目名称;两者同时传入时为非交互 |
|
|
127
127
|
| `neo create project` | 创建自定义组件空项目(不含任何自定义组件) | `--name` 指定项目名称 |
|
|
128
|
-
| `neo create cmp` | 在当前项目中创建一个自定义组件 | `--name`
|
|
128
|
+
| `neo create cmp` | 在当前项目中创建一个自定义组件 | `--name` 指定组件名称,`--targetDevice` / `-d` 指定项目类型 |
|
|
129
129
|
| `neo login` | 登录 NeoCRM 平台(OAuth2 授权模式) | `-e` / `--env` 环境类型 |
|
|
130
130
|
| `neo logout` | 登出 NeoCRM 平台 | - |
|
|
131
131
|
| `neo preview` | 本地预览自定义组件内容,默认支持热更新与接口代理。(备注:当自定义组件使用 neo-ui-common 或者 neo-ui-component-web 时则不支持本地预览。) | `--name` 指定组件名称 |
|
|
@@ -502,6 +502,7 @@ async loadData(page = 1, pageSize = 10) {
|
|
|
502
502
|
}
|
|
503
503
|
}
|
|
504
504
|
```
|
|
505
|
+
【备注】 如果组件方法中涉及 this 的使用,请在 constructor 构造函数中 将当前组件上下文绑定方法,确保组件方法在外部执行时this不丢失。(比如: this.loadData = this.loadData.bind(this))
|
|
505
506
|
|
|
506
507
|
> 示例中使用了 `xObject.query`,请确保已从 `neo-open-api` 引入 `xObject`,并与实际业务 props 一致。
|
|
507
508
|
|
package/dist/index2.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./_virtual/index.js"),o=require("figlet"),s=require("yargs"),a=require("chalk"),n=require("inquirer"),t=require("ora"),i=require("./main2.js"),p=require("./utils/common.js"),c=require("./neo/env.js"),m=require("./package.json.js");var l;exports.__require=function(){if(l)return e.__exports;l=1;const r=o,u=s,g=a,d=n,h=t,{neoInit:y,neoInitByCopy:v,inspect:b,neoConfigInit:f,validateProjectName:C,getCmpTypeByDir:$,NeoService:x,NeoLoginService:T,hasNeoProject:w,consoleTag:j}=i.__require(),{errorLog:U,successLog:D,warningLog:L}=p.__require(),_=i.__require(),{getNeoCrmAPI:q}=c.__require(),M=m.default,N=r.textSync("neo",{font:"Lean"}),A=_.projectConfig,S=function(e){return g.green(g.bold(e))},R={"config init":"初始化配置文件",config:"初始化配置文件",dev:"开启本地调试模式",build:"构建生产环境代码",build2lib:"构建 UMD 模块",build2esm:"构建 ESM 模块",publish2oss:"发布到 OSS",inspect:"输出配置文件",open:"打开项目"},P={...R,init:"初始化自定义组件项目",login:"登录 NeoCRM 平台",logout:"登出 NeoCRM 平台","create project":"创建自定义组件项目","create cmp":"创建自定义组件",linkDebug:"开启外链调试模式",preview:"预览自定义组件","pull cmp":"拉取线上自定义组件","push cmp":"发布自定义组件到平台","delete cmp":"删除线上自定义组件",pull:"拉取线上自定义组件",push:"发布自定义组件到平台",delete:"删除线上自定义组件"},k=[{name:"线上生产环境(crm.xiaoshouyi.com)",value:"production"},{name:"灰度环境(crm-gray.xiaoshouyi.com)",value:"gray"},{name:"沙盒环境(crm-sandbox.xiaoshouyi.com)",value:"sandbox"},{name:"开发环境(crm-cd.xiaoshouyi.com)",value:"cd"},{name:"tencentuat环境(crm-tencentuat.xiaoshouyi.com)",value:"tencentuat"},{name:"自定义环境(在neo.config.js / neoConfig 中自行配置)",value:"custom"}],B=k.map(e=>e.value);return u.middleware(function(e){if(e.help||e.version)return;const o=function(e){if(!e._||0===e._.length)return"";const o=e._.join(" ");if(P[o])return o;const s=e._[0];return P[s]?s:o||s}(e);if(!o)return;const s=P[o]||o;R[o]&&(console.log(g.green(N)),console.log(g.green(`当前版本:v${M.version}.\n`))),console.log(""),console.log(g.cyan(`执行命令: ${s}`)),console.log("")}).command("init [options]","根据模板创建一个自定义组件",e=>{e.usage(S("Usage")+": $0 init [options]").option("type",{alias:"t",describe:"自定义组件类型(react ts 技术栈/ vue2.0 技术栈/ react 技术栈)"}).option("name",{alias:"n",describe:"自定义组件项目名称"}).alias("h","help")},e=>{if(e.type&&e.name)w()&&(U(`${j}创建自定义组件失败,当前目录(${process.cwd()})已经是一个自定义组件项目,请勿重复创建。`),process.exit(1)),"github"===e.mode?y(e.type,e.name):v(e.type,e.name);else{const o=[],s=[{name:"模板1.Web端列表组件: 含基础大列表、Picker 列表等示例组件",value:"neo-web-entity-grid",short:"neo-web-entity-grid"},{name:"模板2.H5端业务组件: 含全局搜索、数据列表、数据Tabs、打开AI对话页等示例组件",value:"neo-h5-cmps",short:"neo-h5-cmps"},{name:"模板3.自定义业务组件: 含实体表单、实体数据详情、实体数据表格等示例组件",value:"neo",short:"neo"},{name:"模板4.数值指标组件: 可配置展示实体数据源中关键数值指标",value:"neo-bi-cmps",short:"neo-bi-cmps"},{name:"模板5.antd 组件: 含基于 Antd 实现的数据仪表板、搜索组件等示例组件",value:"antd",short:"antd"},{name:"模板6.echarts 组件: 含基于 ECharts 实现的图表示例组件",value:"echarts",short:"echarts"},{name:"模板7.地图组件: 含基于 高德地图API 实现的示例组件",value:"amap",short:"amap"},{name:"模板8.vue2 组件: 含基于 Vue2 实现的示例组件",value:"vue2",short:"vue2"}];e.type||o.push({name:"type",type:"list",message:"请选择您要创建的自定义组件类型: ",default:"react-ts",choices:s}),e.name||o.push({name:"name",type:"input",message:"请设置自定义组件项目名称(默认 neoCustomCmp):",default:"neoCustomCmp"}),d.prompt(o).then(o=>{const{isValid:s,errors:a}=C(o.name);s||(U(a.join("\n")),process.exit(1)),"github"===e.mode?y(o.type,o.name):v(o.type,o.name)})}}).command("config init","创建 neo.config.js 配置文件",e=>{e.usage(S("Usage")+": $0 config init").alias("h","help")},()=>{f("neo.config.js")}).command("login","登录 NeoCRM 平台(OAuth2 授权)",e=>{e.usage(S("Usage")+": $0 login [options]").option("env",{alias:"e",describe:"登录环境(可选,不指定则交互选择)。",type:"string",choices:B}).alias("h","help")},async e=>{const o=async e=>{const o=q(e,A.neoConfig);try{const e=new T(o);await e.login(),process.exit(0)}catch(e){U(`\n登录失败: ${e.message||e.msg}`),process.exit(1)}};if(e.env)return void await o(e.env);const s=[{name:"env",type:"list",message:"请选择您要登录的环境:",default:"cd",choices:k}],a=await d.prompt(s);await o(a.env)}).command("logout","登出 NeoCRM 平台",e=>{e.usage(S("Usage")+": $0 logout").alias("h","help")},async()=>{try{const e=new T;await e.logout(),process.exit(0)}catch(e){U(`\n登出失败: ${e.message||e.msg}`),process.exit(1)}}).command("create","创建项目或者组件",e=>e.command("project [options]","创建自定义组件项目(含工程代码)",e=>{e.usage(S("Usage")+": $0 project [options]").option("name",{alias:"n",describe:"自定义组件项目名称"}).alias("h","help")},e=>{if(e.name)_.createCmpProjectByTemplate(e.name);else{const e=[{name:"name",type:"input",message:"请设置自定义组件项目名称:"}];d.prompt(e).then(e=>{const{isValid:o,errors:s}=C(e.name);o||(U(s.join("\n")),process.exit(1)),e.name?_.createCmpProjectByTemplate(e.name):(U("自定义组件项目名称不能为空。"),process.exit(1))})}}).command("cmp [options]","创建自定义组件",e=>{e.usage(S("Usage")+": $0 cmp [options]").option("name",{alias:"n",describe:"自定义组件名称"}).option("targetDevice",{alias:"d",describe:"终端类型(all: 所有端, web: 网页端, mobile: 移动端),不指定则交互选择",choices:["all","web","mobile"]}).alias("h","help")},e=>{const o=[{name:"所有端(all)",value:"all"},{name:"网页端(web)",value:"web"},{name:"移动端(mobile)",value:"mobile"}];if(e.name&&void 0!==e.targetDevice)_.createCmpByTemplate(e.name,{targetDevice:e.targetDevice});else if(e.name){const s=[{name:"targetDevice",type:"list",message:"请选择终端类型:",default:"all",choices:o}];d.prompt(s).then(o=>{_.createCmpByTemplate(e.name,{targetDevice:o.targetDevice})})}else{const e=[{name:"name",type:"input",message:"请设置自定义组件名称:"},{name:"targetDevice",type:"list",message:"请选择终端类型:",default:"all",choices:o}];d.prompt(e).then(e=>{e.name?_.createCmpByTemplate(e.name,{targetDevice:e.targetDevice}):(U("自定义组件名称不能为空。"),process.exit(1))})}})).command("pull cmp [options]","拉取线上自定义组件",e=>{e.usage(S("Usage")+": $0 pull cmp [options]").option("name",{alias:"n",describe:"自定义组件名称"}).alias("h","help")},async e=>{if(e.name){L(`[neo pull cmp] 即将拉取自定义组件:${e.name},如本地已存在同名组件目录,将可能被覆盖,请提前备份本地修改。`);try{await _.pullCmp(e.name)}catch(e){U(e.message||e.msg||"拉取线上自定义组件失败"),process.exit(1)}}else{const e=new x,o=h("正在拉取线上自定义组件列表...").start(),s=await e.getCustomCmpList();0===s.length&&(U("当前租户暂无任何自定义组件。"),process.exit(1)),o.stop("线上自定义组件列表拉取成功。");const a=[{name:"cmpType",type:"list",message:"请选择要拉取的自定义组件:",choices:[{name:"拉取所有组件(ALL)",value:"ALL"},...s.map(e=>({name:`${e.label}(${e.cmpType})`,value:e.cmpType}))]}];try{const o=await d.prompt(a);if(o.cmpType)if("ALL"===o.cmpType){L(`[neo pull cmp] 即将拉取当前租户下的所有自定义组件(共 ${s.length} 个),如本地存在同名组件目录,将可能被覆盖,请提前备份本地修改。`);for(let o=0,a=s.length;o<a;o++){const n=s[o];console.log(g.gray(`[neo pull cmp] 正在拉取第 ${o+1}/${a} 个组件: ${n.cmpType}`)),await _.pullCmp(n.cmpType,e)}D("[neo pull cmp]拉取所有组件命令已执行完成。")}else L(`[neo pull cmp] 即将拉取自定义组件:${o.cmpType},如本地已存在同名组件目录,将可能被覆盖,请提前备份本地修改。`),await _.pullCmp(o.cmpType,e);else U("请选择要拉取的自定义组件。"),process.exit(1)}catch(e){U(e.message||e.msg||"拉取线上自定义组件失败"),process.exit(1)}}}).command("delete cmp [options]","删除线上自定义组件",e=>{e.usage(S("Usage")+": $0 delete cmp [options]").option("name",{alias:"n",describe:"自定义组件名称"}).alias("h","help")},async e=>{if(e.name)_.deleteCmp(e.name);else{const e=new x,o=h("正在获取线上自定义组件列表...").start(),s=await e.getCustomCmpList();0===s.length&&(U("当前租户暂无任何自定义组件。"),process.exit(1)),o.stop("线上自定义组件列表获取成功。");const a=[{name:"cmpType",type:"list",message:"请选择要删除的自定义组件:",choices:s.map(e=>({name:`${e.label}(${e.cmpType})`,value:e.cmpType}))}];d.prompt(a).then(o=>{o.cmpType?_.deleteCmp(o.cmpType,e):(U("自定义组件名称不能为空。"),process.exit(1))})}}).command("preview [options]","预览指定自定义组件(仅预览组件本身内容)",e=>{e.usage(S("Usage")+": $0 preview [options]").option("name",{alias:"n",describe:"自定义组件名称"}).alias("h","help")},e=>{if(e.name)_.previewCmp(e.name);else{const e=$(A.componentsDir);0===e.length&&(U("当前自定义组件目录中未找到自定义组件。(./src/components 目录下)"),process.exit(1));const o=[{name:"cmpType",type:"list",message:"请选择要预览的自定义组件:",choices:e.map(e=>({name:e,value:e}))}];d.prompt(o).then(e=>{e.cmpType||(U("未选择要预览的自定义组件。"),process.exit(1)),_.previewCmp(e.cmpType)})}}).command("dev","开启本地调试模式",e=>{e.usage(S("Usage")+": $0 dev").alias("h","help")},()=>{_.dev()}).command("linkDebug","开启外链调试模式(在线上页面设计器端调试)",e=>{e.usage(S("Usage")+": $0 linkDebug [options]").option("platform",{alias:"p",describe:"调试设备类型:pc(网页端)、h5(移动端),默认 pc",type:"string",choices:["pc","h5"]}).alias("h","help")},e=>{const o=e=>{_.linkDebug({platform:e})};e.platform?o(e.platform):d.prompt([{name:"platform",type:"list",message:"请选择调试设备类型:",default:"pc",choices:[{name:"网页端(PC)",value:"pc",short:"pc"},{name:"移动端(H5)",value:"h5",short:"h5"}]}]).then(e=>{e.platform||(U("未选择调试设备类型。"),process.exit(1)),o(e.platform)})}).command("build","构建生产环境代码",e=>{e.usage(S("Usage")+": $0 build").alias("h","help")},e=>{_.build()}).command("build2lib","构建 UMD 模块",e=>{e.usage(S("Usage")+": $0 build2lib").alias("h","help")},e=>{_.build2lib()}).command("publish2oss [options]","发布到oss",e=>{e.usage(S("Usage")+": $0 publish2oss [options]").option("name",{alias:"n",describe:"自定义组件名称"}).alias("h","help")},e=>{if(e.name)_.publish2oss(e.name);else{const e=$(A.componentsDir);0===e.length&&(U("当前自定义组件目录中未找到自定义组件。(./src/components 目录下)"),process.exit(1));const o=[{name:"cmpType",type:"list",message:"请选择要发布的自定义组件:",choices:e.map(e=>({name:e,value:e}))}];d.prompt(o).then(e=>{e.cmpType||(U("未选择要发布的自定义组件。"),process.exit(1)),_.publish2oss(e.cmpType)})}}).command("push cmp [options]","构建并发布自定义组件到 NeoCRM 平台",e=>{e.usage(S("Usage")+": $0 push cmp [options]").option("name",{alias:"n",describe:"自定义组件名称"}).alias("h","help")},async e=>{if(e.name){L(`[neo push cmp] 即将构建并发布自定义组件:${e.name} 到 NeoCRM 平台,请确保已经通过 neo login 登录到正确的环境。`);try{await _.pushCmp(e.name)}catch(e){U(e.message||e.msg||"发布自定义组件失败"),process.exit(1)}}else{const e=$(A.componentsDir);0===e.length&&(U("当前自定义组件目录中未找到自定义组件。(./src/components 目录下)"),process.exit(1));const o=[{name:"cmpType",type:"list",message:"请选择要发布的自定义组件:",choices:[{name:"发布所有组件(ALL)",value:"ALL"},...e.map(e=>({name:e,value:e}))]}];d.prompt(o).then(async o=>{o.cmpType||(U("请选择要发布的自定义组件。"),process.exit(1));try{if("ALL"===o.cmpType){L(`[neo push cmp] 即将构建并发布当前目录下的所有自定义组件(共 ${e.length} 个)到 NeoCRM 平台,请确保已经通过 neo login 登录到正确的环境。`);for(let o=0,s=e.length;o<s;o++){const a=e[o];console.log(g.gray(`[neo push cmp] 正在拉取第 ${o+1}/${s} 个组件: ${a}`)),await _.pushCmp(a,!0)}D("[neo push cmp]发布所有组件命令已执行完成。")}else L(`[neo push cmp] 即将构建并发布自定义组件:${o.cmpType} 到 NeoCRM 平台,请确保已经通过 neo login 登录到正确的环境。`),await _.pushCmp(o.cmpType)}catch(e){U(e.message||e.msg||"发布失败"),process.exit(1)}})}}).command("build2esm","构建 ESM 模块",e=>{e.usage(S("Usage")+": $0 build2esm").alias("h","help")},()=>{_.build2esm()}).command("inspect","输出当前配置文件",e=>{e.usage(S("Usage")+": $0 inspect").option("type",{alias:"t",describe:"环境类型(本地调试环境/生产环境/library构建环境)",default:"build"}).alias("h","help")},e=>{b(e.type)}).command("open [options]","使用 Cursor 或 VSCode 打开项目",e=>{e.usage(S("Usage")+": $0 open [options]").option("editor",{alias:"e",describe:"编辑器类型(cursor/vscode/auto),默认为 auto(自动检测)",default:"auto",choices:["cursor","vscode","code","auto"]}).option("name",{alias:"n",describe:"要打开的项目名称,默认为当前目录"}).alias("h","help")},e=>{_.openEditor(e.editor,e.name)}).alias("h","help").alias("v","version").strict().fail((e,o,s)=>{U(`\n运行命令时发生错误: ${e}。\n`),console.log(S("当前可用命令列表:")),console.log("");[{cmd:"init [options]",desc:"根据模板创建一个自定义组件"},{cmd:"create project [options]",desc:"创建自定义组件项目(含工程代码)"},{cmd:"create cmp [options]",desc:"创建自定义组件"},{cmd:"preview [options]",desc:"预览指定自定义组件(仅预览组件本身内容)"},{cmd:"linkDebug [options]",desc:"开启外链调试模式(在线上页面设计器端调试),支持 --platform pc|h5,默认网页端"},{cmd:"login [options]",desc:"登录 NeoCRM 平台(OAuth2 授权),支持 --env cd|uat|cd"},{cmd:"logout",desc:"登出 NeoCRM 平台"},{cmd:"pull cmp [options]",desc:"拉取线上自定义组件"},{cmd:"delete cmp [options]",desc:"删除线上自定义组件"},{cmd:"push cmp [options]",desc:"构建并发布自定义组件到 NeoCRM 平台"},{cmd:"open [options]",desc:"使用 Cursor 或 VSCode 打开项目"}].forEach(({cmd:e,desc:o})=>{console.log(` ${g.cyan(e.padEnd(25))} ${o}`)}),console.log(""),console.log(`使用 ${g.cyan("neo <command> --help")} 查看具体命令的帮助信息。`),console.log(""),process.exit(1)}).help().updateStrings({"Usage:":S("Usage:"),"Commands:":S("Commands:"),"Options:":S("Options:")}).parseAsync().catch(e=>{e&&(U(`\n运行命令时发生错误: ${e.message||e}。\n`),process.exit(1))}),e.__exports};
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./_virtual/index.js"),o=require("figlet"),s=require("yargs"),a=require("chalk"),n=require("inquirer"),t=require("ora"),i=require("./main2.js"),p=require("./utils/common.js"),c=require("./neo/env.js"),m=require("./package.json.js");var l;exports.__require=function(){if(l)return e.__exports;l=1;const r=o,u=s,g=a,d=n,h=t,{neoInit:y,neoInitByCopy:v,inspect:b,neoConfigInit:f,validateProjectName:C,getCmpTypeByDir:$,NeoService:x,NeoLoginService:T,hasNeoProject:w,consoleTag:j}=i.__require(),{errorLog:U,successLog:D,warningLog:L}=p.__require(),_=i.__require(),{getNeoCrmAPI:q}=c.__require(),M=m.default,N=r.textSync("neo",{font:"Lean"}),A=_.projectConfig,S=function(e){return g.green(g.bold(e))},R={"config init":"初始化配置文件",config:"初始化配置文件",dev:"开启本地调试模式",build:"构建生产环境代码",build2lib:"构建 UMD 模块",build2esm:"构建 ESM 模块",publish2oss:"发布到 OSS",inspect:"输出配置文件",open:"打开项目"},P={...R,init:"初始化自定义组件项目",login:"登录 NeoCRM 平台",logout:"登出 NeoCRM 平台","create project":"创建自定义组件项目","create cmp":"创建自定义组件",linkDebug:"开启外链调试模式",preview:"预览自定义组件","pull cmp":"拉取线上自定义组件","push cmp":"发布自定义组件到平台","delete cmp":"删除线上自定义组件",pull:"拉取线上自定义组件",push:"发布自定义组件到平台",delete:"删除线上自定义组件"},k=[{name:"线上生产环境(crm.xiaoshouyi.com)",value:"production"},{name:"P20环境(crm-p20.xiaoshouyi.com)",value:"p20"},{name:"沙盒环境(crm-sandbox.xiaoshouyi.com)",value:"sandbox"},{name:"开发环境(crm-cd.xiaoshouyi.com)",value:"cd"},{name:"tencentuat环境(crm-tencentuat.xiaoshouyi.com)",value:"tencentuat"},{name:"自定义环境(在neo.config.js / neoConfig 中自行配置)",value:"custom"}],B=k.map(e=>e.value);return u.middleware(function(e){if(e.help||e.version)return;const o=function(e){if(!e._||0===e._.length)return"";const o=e._.join(" ");if(P[o])return o;const s=e._[0];return P[s]?s:o||s}(e);if(!o)return;const s=P[o]||o;R[o]&&(console.log(g.green(N)),console.log(g.green(`当前版本:v${M.version}.\n`))),console.log(""),console.log(g.cyan(`执行命令: ${s}`)),console.log("")}).command("init [options]","根据模板创建一个自定义组件",e=>{e.usage(S("Usage")+": $0 init [options]").option("type",{alias:"t",describe:"自定义组件类型(react ts 技术栈/ vue2.0 技术栈/ react 技术栈)"}).option("name",{alias:"n",describe:"自定义组件项目名称"}).alias("h","help")},e=>{if(e.type&&e.name)w()&&(U(`${j}创建自定义组件失败,当前目录(${process.cwd()})已经是一个自定义组件项目,请勿重复创建。`),process.exit(1)),"github"===e.mode?y(e.type,e.name):v(e.type,e.name);else{const o=[],s=[{name:"模板1.Web端列表组件: 含基础大列表、Picker 列表等示例组件",value:"neo-web-entity-grid",short:"neo-web-entity-grid"},{name:"模板2.H5端业务组件: 含全局搜索、数据列表、数据Tabs、打开AI对话页等示例组件",value:"neo-h5-cmps",short:"neo-h5-cmps"},{name:"模板3.自定义业务组件: 含实体表单、实体数据详情、实体数据表格等示例组件",value:"neo",short:"neo"},{name:"模板4.数值指标组件: 可配置展示实体数据源中关键数值指标",value:"neo-bi-cmps",short:"neo-bi-cmps"},{name:"模板5.antd 组件: 含基于 Antd 实现的数据仪表板、搜索组件等示例组件",value:"antd",short:"antd"},{name:"模板6.echarts 组件: 含基于 ECharts 实现的图表示例组件",value:"echarts",short:"echarts"},{name:"模板7.地图组件: 含基于 高德地图API 实现的示例组件",value:"amap",short:"amap"},{name:"模板8.vue2 组件: 含基于 Vue2 实现的示例组件",value:"vue2",short:"vue2"}];e.type||o.push({name:"type",type:"list",message:"请选择您要创建的自定义组件类型: ",default:"react-ts",choices:s}),e.name||o.push({name:"name",type:"input",message:"请设置自定义组件项目名称(默认 neoCustomCmp):",default:"neoCustomCmp"}),d.prompt(o).then(o=>{const{isValid:s,errors:a}=C(o.name);s||(U(a.join("\n")),process.exit(1)),"github"===e.mode?y(o.type,o.name):v(o.type,o.name)})}}).command("config init","创建 neo.config.js 配置文件",e=>{e.usage(S("Usage")+": $0 config init").alias("h","help")},()=>{f("neo.config.js")}).command("login","登录 NeoCRM 平台(OAuth2 授权)",e=>{e.usage(S("Usage")+": $0 login [options]").option("env",{alias:"e",describe:"登录环境(可选,不指定则交互选择)。",type:"string",choices:B}).alias("h","help")},async e=>{const o=async e=>{const o=q(e,A.neoConfig);try{const e=new T(o);await e.login(),process.exit(0)}catch(e){U(`\n登录失败: ${e.message||e.msg}`),process.exit(1)}};if(e.env)return void await o(e.env);const s=[{name:"env",type:"list",message:"请选择您要登录的环境:",default:"cd",choices:k}],a=await d.prompt(s);await o(a.env)}).command("logout","登出 NeoCRM 平台",e=>{e.usage(S("Usage")+": $0 logout").alias("h","help")},async()=>{try{const e=new T;await e.logout(),process.exit(0)}catch(e){U(`\n登出失败: ${e.message||e.msg}`),process.exit(1)}}).command("create","创建项目或者组件",e=>e.command("project [options]","创建自定义组件项目(含工程代码)",e=>{e.usage(S("Usage")+": $0 project [options]").option("name",{alias:"n",describe:"自定义组件项目名称"}).alias("h","help")},e=>{if(e.name)_.createCmpProjectByTemplate(e.name);else{const e=[{name:"name",type:"input",message:"请设置自定义组件项目名称:"}];d.prompt(e).then(e=>{const{isValid:o,errors:s}=C(e.name);o||(U(s.join("\n")),process.exit(1)),e.name?_.createCmpProjectByTemplate(e.name):(U("自定义组件项目名称不能为空。"),process.exit(1))})}}).command("cmp [options]","创建自定义组件",e=>{e.usage(S("Usage")+": $0 cmp [options]").option("name",{alias:"n",describe:"自定义组件名称"}).option("targetDevice",{alias:"d",describe:"终端类型(all: 所有端, web: 网页端, mobile: 移动端),不指定则交互选择",choices:["all","web","mobile"]}).alias("h","help")},e=>{const o=[{name:"所有端(all)",value:"all"},{name:"网页端(web)",value:"web"},{name:"移动端(mobile)",value:"mobile"}];if(e.name&&void 0!==e.targetDevice)_.createCmpByTemplate(e.name,{targetDevice:e.targetDevice});else if(e.name){const s=[{name:"targetDevice",type:"list",message:"请选择终端类型:",default:"all",choices:o}];d.prompt(s).then(o=>{_.createCmpByTemplate(e.name,{targetDevice:o.targetDevice})})}else{const e=[{name:"name",type:"input",message:"请设置自定义组件名称:"},{name:"targetDevice",type:"list",message:"请选择终端类型:",default:"all",choices:o}];d.prompt(e).then(e=>{e.name?_.createCmpByTemplate(e.name,{targetDevice:e.targetDevice}):(U("自定义组件名称不能为空。"),process.exit(1))})}})).command("pull cmp [options]","拉取线上自定义组件",e=>{e.usage(S("Usage")+": $0 pull cmp [options]").option("name",{alias:"n",describe:"自定义组件名称"}).alias("h","help")},async e=>{if(e.name){L(`[neo pull cmp] 即将拉取自定义组件:${e.name},如本地已存在同名组件目录,将可能被覆盖,请提前备份本地修改。`);try{await _.pullCmp(e.name)}catch(e){U(e.message||e.msg||"拉取线上自定义组件失败"),process.exit(1)}}else{const e=new x,o=h("正在拉取线上自定义组件列表...").start(),s=await e.getCustomCmpList();0===s.length&&(U("当前租户暂无任何自定义组件。"),process.exit(1)),o.stop("线上自定义组件列表拉取成功。");const a=[{name:"cmpType",type:"list",message:"请选择要拉取的自定义组件:",choices:[{name:"拉取所有组件(ALL)",value:"ALL"},...s.map(e=>({name:`${e.label}(${e.cmpType})`,value:e.cmpType}))]}];try{const o=await d.prompt(a);if(o.cmpType)if("ALL"===o.cmpType){L(`[neo pull cmp] 即将拉取当前租户下的所有自定义组件(共 ${s.length} 个),如本地存在同名组件目录,将可能被覆盖,请提前备份本地修改。`);for(let o=0,a=s.length;o<a;o++){const n=s[o];console.log(g.gray(`[neo pull cmp] 正在拉取第 ${o+1}/${a} 个组件: ${n.cmpType}`)),await _.pullCmp(n.cmpType,e)}D("[neo pull cmp]拉取所有组件命令已执行完成。")}else L(`[neo pull cmp] 即将拉取自定义组件:${o.cmpType},如本地已存在同名组件目录,将可能被覆盖,请提前备份本地修改。`),await _.pullCmp(o.cmpType,e);else U("请选择要拉取的自定义组件。"),process.exit(1)}catch(e){U(e.message||e.msg||"拉取线上自定义组件失败"),process.exit(1)}}}).command("delete cmp [options]","删除线上自定义组件",e=>{e.usage(S("Usage")+": $0 delete cmp [options]").option("name",{alias:"n",describe:"自定义组件名称"}).alias("h","help")},async e=>{if(e.name)_.deleteCmp(e.name);else{const e=new x,o=h("正在获取线上自定义组件列表...").start(),s=await e.getCustomCmpList();0===s.length&&(U("当前租户暂无任何自定义组件。"),process.exit(1)),o.stop("线上自定义组件列表获取成功。");const a=[{name:"cmpType",type:"list",message:"请选择要删除的自定义组件:",choices:s.map(e=>({name:`${e.label}(${e.cmpType})`,value:e.cmpType}))}];d.prompt(a).then(o=>{o.cmpType?_.deleteCmp(o.cmpType,e):(U("自定义组件名称不能为空。"),process.exit(1))})}}).command("preview [options]","预览指定自定义组件(仅预览组件本身内容)",e=>{e.usage(S("Usage")+": $0 preview [options]").option("name",{alias:"n",describe:"自定义组件名称"}).alias("h","help")},e=>{if(e.name)_.previewCmp(e.name);else{const e=$(A.componentsDir);0===e.length&&(U("当前自定义组件目录中未找到自定义组件。(./src/components 目录下)"),process.exit(1));const o=[{name:"cmpType",type:"list",message:"请选择要预览的自定义组件:",choices:e.map(e=>({name:e,value:e}))}];d.prompt(o).then(e=>{e.cmpType||(U("未选择要预览的自定义组件。"),process.exit(1)),_.previewCmp(e.cmpType)})}}).command("dev","开启本地调试模式",e=>{e.usage(S("Usage")+": $0 dev").alias("h","help")},()=>{_.dev()}).command("linkDebug","开启外链调试模式(在线上页面设计器端调试)",e=>{e.usage(S("Usage")+": $0 linkDebug [options]").option("platform",{alias:"p",describe:"调试设备类型:pc(网页端)、h5(移动端),默认 pc",type:"string",choices:["pc","h5"]}).alias("h","help")},e=>{const o=e=>{_.linkDebug({platform:e})};e.platform?o(e.platform):d.prompt([{name:"platform",type:"list",message:"请选择调试设备类型:",default:"pc",choices:[{name:"网页端(PC)",value:"pc",short:"pc"},{name:"移动端(H5)",value:"h5",short:"h5"}]}]).then(e=>{e.platform||(U("未选择调试设备类型。"),process.exit(1)),o(e.platform)})}).command("build","构建生产环境代码",e=>{e.usage(S("Usage")+": $0 build").alias("h","help")},e=>{_.build()}).command("build2lib","构建 UMD 模块",e=>{e.usage(S("Usage")+": $0 build2lib").alias("h","help")},e=>{_.build2lib()}).command("publish2oss [options]","发布到oss",e=>{e.usage(S("Usage")+": $0 publish2oss [options]").option("name",{alias:"n",describe:"自定义组件名称"}).alias("h","help")},e=>{if(e.name)_.publish2oss(e.name);else{const e=$(A.componentsDir);0===e.length&&(U("当前自定义组件目录中未找到自定义组件。(./src/components 目录下)"),process.exit(1));const o=[{name:"cmpType",type:"list",message:"请选择要发布的自定义组件:",choices:e.map(e=>({name:e,value:e}))}];d.prompt(o).then(e=>{e.cmpType||(U("未选择要发布的自定义组件。"),process.exit(1)),_.publish2oss(e.cmpType)})}}).command("push cmp [options]","构建并发布自定义组件到 NeoCRM 平台",e=>{e.usage(S("Usage")+": $0 push cmp [options]").option("name",{alias:"n",describe:"自定义组件名称"}).alias("h","help")},async e=>{if(e.name){L(`[neo push cmp] 即将构建并发布自定义组件:${e.name} 到 NeoCRM 平台,请确保已经通过 neo login 登录到正确的环境。`);try{await _.pushCmp(e.name)}catch(e){U(e.message||e.msg||"发布自定义组件失败"),process.exit(1)}}else{const e=$(A.componentsDir);0===e.length&&(U("当前自定义组件目录中未找到自定义组件。(./src/components 目录下)"),process.exit(1));const o=[{name:"cmpType",type:"list",message:"请选择要发布的自定义组件:",choices:[{name:"发布所有组件(ALL)",value:"ALL"},...e.map(e=>({name:e,value:e}))]}];d.prompt(o).then(async o=>{o.cmpType||(U("请选择要发布的自定义组件。"),process.exit(1));try{if("ALL"===o.cmpType){L(`[neo push cmp] 即将构建并发布当前目录下的所有自定义组件(共 ${e.length} 个)到 NeoCRM 平台,请确保已经通过 neo login 登录到正确的环境。`);for(let o=0,s=e.length;o<s;o++){const a=e[o];console.log(g.gray(`[neo push cmp] 正在发布第 ${o+1}/${s} 个组件: ${a}`)),await _.pushCmp(a,!0)}D("[neo push cmp]发布所有组件命令已执行完成。")}else L(`[neo push cmp] 即将构建并发布自定义组件:${o.cmpType} 到 NeoCRM 平台,请确保已经通过 neo login 登录到正确的环境。`),await _.pushCmp(o.cmpType)}catch(e){U(e.message||e.msg||"发布失败"),process.exit(1)}})}}).command("build2esm","构建 ESM 模块",e=>{e.usage(S("Usage")+": $0 build2esm").alias("h","help")},()=>{_.build2esm()}).command("inspect","输出当前配置文件",e=>{e.usage(S("Usage")+": $0 inspect").option("type",{alias:"t",describe:"环境类型(本地调试环境/生产环境/library构建环境)",default:"build"}).alias("h","help")},e=>{b(e.type)}).command("open [options]","使用 Cursor 或 VSCode 打开项目",e=>{e.usage(S("Usage")+": $0 open [options]").option("editor",{alias:"e",describe:"编辑器类型(cursor/vscode/auto),默认为 auto(自动检测)",default:"auto",choices:["cursor","vscode","code","auto"]}).option("name",{alias:"n",describe:"要打开的项目名称,默认为当前目录"}).alias("h","help")},e=>{_.openEditor(e.editor,e.name)}).alias("h","help").alias("v","version").strict().fail((e,o,s)=>{U(`\n运行命令时发生错误: ${e}。\n`),console.log(S("当前可用命令列表:")),console.log("");[{cmd:"init [options]",desc:"根据模板创建一个自定义组件"},{cmd:"create project [options]",desc:"创建自定义组件项目(含工程代码)"},{cmd:"create cmp [options]",desc:"创建自定义组件"},{cmd:"preview [options]",desc:"预览指定自定义组件(仅预览组件本身内容)"},{cmd:"linkDebug [options]",desc:"开启外链调试模式(在线上页面设计器端调试),支持 --platform pc|h5,默认网页端"},{cmd:"login [options]",desc:"登录 NeoCRM 平台(OAuth2 授权),支持 --env cd|uat|cd"},{cmd:"logout",desc:"登出 NeoCRM 平台"},{cmd:"pull cmp [options]",desc:"拉取线上自定义组件"},{cmd:"delete cmp [options]",desc:"删除线上自定义组件"},{cmd:"push cmp [options]",desc:"构建并发布自定义组件到 NeoCRM 平台"},{cmd:"open [options]",desc:"使用 Cursor 或 VSCode 打开项目"}].forEach(({cmd:e,desc:o})=>{console.log(` ${g.cyan(e.padEnd(25))} ${o}`)}),console.log(""),console.log(`使用 ${g.cyan("neo <command> --help")} 查看具体命令的帮助信息。`),console.log(""),process.exit(1)}).help().updateStrings({"Usage:":S("Usage:"),"Commands:":S("Commands:"),"Options:":S("Options:")}).parseAsync().catch(e=>{e&&(U(`\n运行命令时发生错误: ${e.message||e}。\n`),process.exit(1))}),e.__exports};
|
package/dist/main2.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("akfun");require("lodash");const r=require("open"),i=require("./module/neoInit.js"),s=require("./module/neoInitByCopy.js"),t=require("./module/inspect.js"),o=require("./utils/neoConfigInit.js"),u=require("./utils/neoParams.js"),n=require("./config/index.js"),l=require("./oss/publish2oss.js"),p=require("./neo/pushCmp.js"),c=require("./neo/pullCmp.js"),d=require("./neo/deleteCmp.js"),b=require("./utils/cmpUtils/previewCmp.js"),m=require("./utils/generateEntries.js"),a=require("./utils/cmpUtils/createCmpByTemplate.js"),y=require("./utils/projectUtils/createCmpProjectByTemplate.js"),q=require("./utils/projectUtils/openProject.js"),_=require("./utils/configureNeoBuild.js"),g=require("./utils/common.js"),j=require("./utils/projectNameValidator.js"),v=require("./utils/cmpUtils/getCmpTypeByDir.js"),T=require("./neo/neoService.js"),f=require("./neo/neoLogin.js"),C=require("./neo/neoEnvManager.js"),x=require("./utils/projectUtils/hasNeoProject.js");var h,
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("akfun");require("lodash");const r=require("open"),i=require("./module/neoInit.js"),s=require("./module/neoInitByCopy.js"),t=require("./module/inspect.js"),o=require("./utils/neoConfigInit.js"),u=require("./utils/neoParams.js"),n=require("./config/index.js"),l=require("./oss/publish2oss.js"),p=require("./neo/pushCmp.js"),c=require("./neo/pullCmp.js"),d=require("./neo/deleteCmp.js"),b=require("./utils/cmpUtils/previewCmp.js"),m=require("./utils/generateEntries.js"),a=require("./utils/cmpUtils/createCmpByTemplate.js"),y=require("./utils/projectUtils/createCmpProjectByTemplate.js"),q=require("./utils/projectUtils/openProject.js"),_=require("./utils/configureNeoBuild.js"),g=require("./utils/common.js"),j=require("./utils/projectNameValidator.js"),v=require("./utils/cmpUtils/getCmpTypeByDir.js"),T=require("./neo/neoService.js"),f=require("./neo/neoLogin.js"),C=require("./neo/neoEnvManager.js"),x=require("./utils/projectUtils/hasNeoProject.js");var h,D;exports.__require=function(){if(D)return h;D=1;const E=e,w=r,N=i.__require(),P=s.__require(),B=t.__require(),k=o.__require(),{consoleTag:M}=u.__require(),U=n.__require(),L=l.__require(),I=p.__require(),$=c.__require(),O=d.__require(),R=b.__require(),S=m.__require(),A=a.__require(),H=y.__require(),K=q.__require(),{configureNeoBuild:V}=_.__require(),{errorLog:z,successLog:F}=g.__require(),{validateProjectName:G}=j.__require(),J=v.__require(),Q=T.__require(),W=f.__require(),X=C.__require(),Y=x.__require();function Z(e,r){const{entryType:i,cmpType:s}=r;let t=[],o={};try{const{entries:r,cmpTypes:u,defaultExports:n}=S({configEntry:e.entry,disableAutoRegister:e.disableAutoRegister,componentsDir:U.componentsDir,entryType:i,cmpType:s});r&&Object.keys(r).length>0&&(e.entry=r,t=u,console.info("已自动生成 entry 入口配置:",r)),o=n}catch(e){z(e.message||e.msg),process.exit(1)}return{cmpTypes:t,defaultExports:o}}function ee(e){return Object.assign(U.build2lib,e)}return h={neoInit:N,neoInitByCopy:P,inspect:B,neoConfigInit:k,projectConfig:U,consoleTag:M,validateProjectName:G,getCmpTypeByDir:J,NeoService:Q,NeoLoginService:W,hasNeoProject:Y,createCmpProjectByTemplate:H,createCmpByTemplate:A,dev:()=>{U.dev||(z("未找到 dev 相关配置。"),process.exit(1)),E.dev(U,M)},previewCmp:e=>{e||(z("请输入要预览的组件名称。"),process.exit(1)),U.dev=Object.assign(U.dev,U.preview),U.dev||(z("未找到预览相关配置。"),process.exit(1)),delete U.preview,R(U,e)},linkDebug:(e={})=>{const r="h5"===e.platform?"h5":"pc",i="pc"===r?"web":"h5";U.linkDebug||(z("未找到 debug 相关配置。"),process.exit(1)),U.dev=Object.assign(U.dev,U.linkDebug),delete U.linkDebug,delete U.dev.ignoreNodeModules,U.webpack.ignoreNodeModules=!1;const{cmpTypes:s,defaultExports:t}=Z(U.dev,{entryType:"linkDebug"});V(U,U.dev,{cmpTypes:s,defaultExports:t,verbose:!0,excludeModel:!1});const o=X.getLinKDebugURL(i),u="pc"===r?"网页端(PC)":"移动端(H5)";E.dev(U,M,e=>{if(e&&e.url){const r=`${o}&linkDebug=${e.url}`;console.info(`\n[外链调试] 当前调试设备:${u}\n可打开以下页面设计器地址进行调试:\n${r}\n`),(async e=>{try{await w(e)}catch(r){z(`无法自动打开浏览器: ${r.message||r.msg}`),console.log(`\n请手动访问以下 URL 进行调试:\n${e}\n`)}})(r)}})},build:()=>E.build("build",U,M),build2lib:()=>{Z(U.build2lib,{entryType:"widget"}),U.build2lib.removeNeoCommonModules&&V(U,U.build2lib,{cmpTypes:[],defaultExports:[],verbose:!1,excludeModel:!0}),E.build("lib",U,M)},publish2oss:e=>{const r=U.publish2oss;U.build2lib=ee(r);const{cmpTypes:i,defaultExports:s}=Z(U.build2lib,{entryType:"widget",cmpType:e});V(U,U.build2lib,{cmpTypes:i,defaultExports:s,verbose:!0,excludeModel:!0}),E.build("lib",U,M,()=>{L(r.ossType,r.ossConfig,r.assetsRoot)})},pushCmp:(e,r=!1)=>{const{pushCmp:i}=U;U.build2lib=ee(i),r&&(U.build2lib.entry={});const{cmpTypes:s,defaultExports:t}=Z(U.build2lib,{entryType:"widget",cmpType:e});return V(U,U.build2lib,{cmpTypes:s,defaultExports:t,verbose:!1,excludeModel:!0}),new Promise((r,s)=>{E.build("lib",U,M,async()=>{try{await I({...i,componentsDir:U.componentsDir},e),r()}catch(e){s(e)}})})},pullCmp:$,deleteCmp:(e,r)=>{O(e,r)},build2esm:()=>E.build2esm(U,M),openEditor:K},h};
|
package/dist/neo/env.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("lodash");var t,e;exports.__require=function(){if(e)return t;e=1;const a=o,u={production:{neoBaseURL:"https://crm.xiaoshouyi.com",loginURL:"https://login.xiaoshouyi.com/auc/oauth2/auth",tokenURL:"https://login.xiaoshouyi.com/auc/oauth2/token"},
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("lodash");var t,e;exports.__require=function(){if(e)return t;e=1;const a=o,u={production:{neoBaseURL:"https://crm.xiaoshouyi.com",loginURL:"https://login.xiaoshouyi.com/auc/oauth2/auth",tokenURL:"https://login.xiaoshouyi.com/auc/oauth2/token"},p20:{neoBaseURL:"https://crm-p20.xiaoshouyi.com",loginURL:"https://login-p20.xiaoshouyi.com/auc/oauth2/auth",tokenURL:"https://login-p20.xiaoshouyi.com/auc/oauth2/token"},sandbox:{neoBaseURL:"https://crm-sandbox.xiaoshouyi.com",loginURL:"https://login-sandbox.xiaoshouyi.com/auc/oauth2/auth",tokenURL:"https://login-sandbox.xiaoshouyi.com/auc/oauth2/token"},cd:{neoBaseURL:"https://crm-cd.xiaoshouyi.com",loginURL:"https://login-cd.xiaoshouyi.com/auc/oauth2/auth",tokenURL:"https://login-cd.xiaoshouyi.com/auc/oauth2/token"},tencentuat:{neoBaseURL:"https://crm-tencentuat.xiaoshouyi.com",loginURL:"https://login-tencentuat.xiaoshouyi.com/auc/oauth2/auth",tokenURL:"https://login-tencentuat.xiaoshouyi.com/auc/oauth2/token"}},n={neoBaseURL:"https://crm-cd.xiaoshouyi.com",loginURL:"https://login-cd.xiaoshouyi.com/auc/oauth2/auth",tokenURL:"https://login-cd.xiaoshouyi.com/auc/oauth2/token",delete:"/rest/metadata/v3.0/ui/customComponents",saveAPI:"/rest/metadata/v3.0/ui/customComponents/actions/saveOrUpdateComponent",queryAll_v1:"/rest/metadata/v3.0/ui/components/filter?custom=true",queryAll:"/rest/metadata/v3.0/ui/customComponents/actions/queryCustomComponents",getCodeLibAPI:o=>`/rest/metadata/v3.0/ui/customComponents/${o}/codeLib`,uploadAPI:"/rest/metadata/v3.0/ui/customComponents/actions/upload",getUserInfoAPI:"/rest/auc/v2.0/userInfo",pcLinkDebugUrl:"/bff/spa/neo.ui.designer.web/index#/neoPage/layoutEdit/customPage/emptyPage/default?debug=true",h5LinkDebugUrl:"/bff/spa/neo.ui.designer.h5/index#/neoPage/layoutEdit/customPage/emptyPage/default?debug=true"};return t={DefaultNeoCrmAPI:n,getNeoCrmAPI:(o="cd",t={})=>{let e,s=a.cloneDeep(n);return e="custom"===o?{...t,neoBaseURL:t.neoBaseURL,loginURL:t.loginURL||t.loginAPI,tokenURL:t.tokenURL||t.tokenAPI}:u[o]||u.cd,{...s,...e}}}};
|
package/dist/neo/neoLogin.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("axios"),t=require("node:fs"),n=require("node:path"),s=require("ora"),r=require("node:http"),o=require("node:url"),i=require("open"),a=require("node:net"),c=require("lodash"),l=require("../utils/common.js"),h=require("./neoEnvManager.js");var p,u;exports.__require=function(){if(u)return p;u=1;const d=e,g=t,m=n,y=s,k=r,
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("axios"),t=require("node:fs"),n=require("node:path"),s=require("ora"),r=require("node:http"),o=require("node:url"),i=require("open"),a=require("node:net"),c=require("lodash"),l=require("../utils/common.js"),h=require("./neoEnvManager.js");var p,u;exports.__require=function(){if(u)return p;u=1;const d=e,g=t,m=n,y=s,k=r,f=o,_=i,T=a,U=c,{errorLog:w,successLog:R}=l.__require(),x=h.__require();return p=class{constructor(e){if(this.tokenDir=m.join(process.cwd(),".neo-cli"),this.tokenFile=m.join(this.tokenDir,"token.json"),this.pageDir=m.join(__dirname,"../../template/pageHtml"),this.authErrorTemplate=m.join(this.pageDir,"auth-error.html"),this.authSuccessTemplate=m.join(this.pageDir,"auth-success.html"),this.tokenErrorTemplate=m.join(this.pageDir,"token-error.html"),this.authFailedTemplate=m.join(this.pageDir,"auth-failed.html"),!e)return;const{neoBaseURL:t,loginURL:n,tokenURL:s}=e,r=x.getAuthConfig(),{redirectUri:o,authType:i,auth:a}=r;if(!n||!s)throw new Error("neo.config.js 配置不完整,需要包含 loginURL、tokenURL");this.neoBaseURL=t,this.loginURL=n,this.tokenURL=s,this.NeoCrmAPI=r,this.redirectUri=o,this.authType=i||"oauth2",this.response_type=a.response_type||"code",this.client_id=a.client_id,this.client_secret=a.client_secret,this.scope=a.scope||"all",this.oauthType=a.oauthType||"standard",this.access_type=a.access_type||"offline",this.grant_type=a.grant_type||"authorization_code";try{x.setEnvConfig(U.pick(e,["neoBaseURL","loginURL","tokenURL"]))}catch(e){w(`保存环境配置失败: ${e.message||e.msg}`)}}ensureTokenDir(){g.existsSync(this.tokenDir)||g.mkdirSync(this.tokenDir,{recursive:!0})}saveToken(e){this.ensureTokenDir();const t={...e,savedAt:Date.now(),expiresAt:Date.now()+1e3*(e.expires_in||7200)};g.writeFileSync(this.tokenFile,JSON.stringify(t,null,2),"utf-8")}readToken(){if(!g.existsSync(this.tokenFile))return null;try{return JSON.parse(g.readFileSync(this.tokenFile,"utf-8"))}catch(e){return w(`读取 token 文件失败: ${e.message||e.msg}`),null}}isTokenExpired(e){return!e||!e.expiresAt||Date.now()>=e.expiresAt-3e5}clearToken(){g.existsSync(this.tokenFile)&&g.unlinkSync(this.tokenFile)}getRedirectURI(e){return`http://localhost:${e}`}buildAuthUrl(e){const t=new URLSearchParams({response_type:this.response_type,client_id:this.client_id,redirect_uri:e,scope:this.scope,oauthType:this.oauthType,access_type:this.access_type});return`${this.loginURL}?${t.toString()}`}async openBrowser(e){try{await _(e)}catch(t){w(`无法自动打开浏览器: ${t.message||t.msg}`),console.log(`\n请手动访问以下 URL 进行授权:\n${e}\n`)}}getHtmlTemplate(e,t={}){try{let n=g.readFileSync(e,"utf-8");return Object.keys(t).forEach(e=>{const s=`{{${e}}}`;n=n.replace(new RegExp(s,"g"),t[e])}),n}catch(e){return w(`读取 HTML 模板失败: ${e.message||e.msg}`),"<html><body><h1>页面加载失败</h1></body></html>"}}async isPortInUse(e){return new Promise(t=>{const n=T.createServer();n.once("error",e=>{"EADDRINUSE"===e.code?t(!0):t(!1)}),n.once("listening",()=>{n.once("close",()=>{t(!1)}),n.close()}),n.listen(e)})}async startCallbackServer(){let e=this.redirectUri,t=new URL(e),n=parseInt(t.port,10);await this.isPortInUse(n)&&(w(`\n警告: 端口 ${n} 已被占用,请调整 redirectUri 配置项,使其指向一个未被占用的端口。`),process.exit(1));const s=new Promise((s,r)=>{const o=k.createServer(async(n,i)=>{const a=f.parse(n.url,!0);if(a.pathname===t.pathname||"/"===a.pathname){const t=a.query.code,n=a.query.error;if(n){i.writeHead(400,{"Content-Type":"text/html; charset=utf-8"});const e=this.getHtmlTemplate(this.authErrorTemplate,{ERROR:n});return i.end(e),o.close(),void r(new Error(`授权失败: ${n}`))}if(t)try{const n=await this.getTokenByCode(t,e);this.saveToken(n);const r=n.userInfo.tenantName?`${n.userInfo.tenantName}(${n.tenant_id})`:n.tenant_id||"未返回",a=n.instance_uri||"未返回";i.writeHead(200,{"Content-Type":"text/html; charset=utf-8"});const c=this.getHtmlTemplate(this.authSuccessTemplate,{TENANT_ID:r,INSTANCE_URI:a});return i.end(c),o.close(),void s({code:t,tokenData:n})}catch(e){i.writeHead(500,{"Content-Type":"text/html; charset=utf-8"});const t=this.getHtmlTemplate(this.tokenErrorTemplate,{ERROR:e});return i.end(t),o.close(),void r(e)}i.writeHead(400,{"Content-Type":"text/html; charset=utf-8"});const c=this.getHtmlTemplate(this.authFailedTemplate);i.end(c),o.close(),r(new Error("未获取到授权码"))}else i.writeHead(404,{"Content-Type":"text/plain"}),i.end("Not Found")});o.on("error",e=>{"EADDRINUSE"===e.code?r(new Error(`端口 ${n} 已被占用,无法启动回调服务器`)):r(e)}),o.listen(n,()=>{console.log(`\n本地回调服务器已启动,监听端口: ${n}`),console.log(`回调地址: ${e}`)}),setTimeout(()=>{o.close(),r(new Error("授权超时,请重试"))},3e5)});return{redirectUri:e,getCodeAndTokenPromise:s}}async getTokenByCode(e,t){const n=y("正在获取 access token...").start();try{const s=new URLSearchParams;s.append("grant_type",this.grant_type),s.append("client_id",this.client_id),s.append("client_secret",this.client_secret),s.append("code",e),s.append("redirect_uri",t);const r=(await d.post(this.tokenURL,s.toString(),{headers:{"Content-Type":"application/x-www-form-urlencoded"}})).data;if(r&&r.access_token){if(r&&r.instance_uri){const e=this.extractRootUrlFromUrl(r.instance_uri);e&&e!==this.neoBaseURL&&(this.neoBaseURL=e,x.setEnvConfig({neoBaseURL:e}))}const e=await this.getUserInfo(r.access_token);e&&e.tenantName&&e.name?r.userInfo=e:w("获取用户信息失败:",e)}else w("获取 token 失败:响应中未包含 access_token",n),w(`响应数据: ${JSON.stringify(r)}`),process.exit(1);return R("成功获取 access token",n),r}catch(e){w("获取 token 失败",n),w(`\n获取 token 失败: ${e.message||e.msg}`),e.response&&w(`响应数据: ${JSON.stringify(e.response.data)}`),process.exit(1)}}async refreshToken(e){const t=y("正在刷新授权信息(token)...").start();try{const n=new URLSearchParams;n.append("grant_type","refresh_token"),n.append("client_id",this.client_id),n.append("client_secret",this.client_secret),n.append("refresh_token",e);const s=(await d.post(this.tokenURL,n.toString(),{headers:{"Content-Type":"application/x-www-form-urlencoded"}})).data;if(!s||!s.access_token)return w("刷新授权信息失败:响应中未包含 access_token",t),w(`响应数据: ${JSON.stringify(s)}`),null;{const e=await this.getUserInfo(s.access_token);s.userInfo=e}return R("刷新授权信息成功(token)。",t),s}catch(e){return w("刷新授权信息失败",t),w(`\n刷新授权信息失败: ${e.message||e.msg}`),e.response&&w(`响应数据: ${JSON.stringify(e.response.data)}`),null}}async getUserInfo(e){let t={};try{let n=this.buildFullUrl(this.NeoCrmAPI.getUserInfoAPI);const s=await d.get(n,{headers:{Authorization:`Bearer ${e}`,"xsy-inner-source":"bff","Content-Type":"application/json"}}),{code:r,message:o,msg:i}=s.data||{};r&&"200"!==r&&(w(`获取用户信息失败: ${o||i||"未知错误"}`),process.exit(1)),t=s.data.result||s.data.data||{}}catch(e){const t=e.message||e.msg;w(t?`获取用户信息失败: ${t}`:`响应数据: ${JSON.stringify(e)}`),process.exit(1)}return t}async login(){console.log("\n========== NeoCRM 登录授权 ==========\n");try{const{redirectUri:e,getCodeAndTokenPromise:t}=await this.startCallbackServer(),n=this.buildAuthUrl(e);console.log("授权 URL:",n),console.log("\n正在打开浏览器进行授权..."),await this.openBrowser(n);const{code:s,tokenData:r}=await t;return R("\n✓ 已获取授权码"),console.log("\n========== 登录成功 ==========\n"),console.log(`实例地址: ${r.instance_uri||"未返回"}`),console.log(`当前租户信息: ${r.userInfo.tenantName||"未返回租户名称"}(${r.tenant_id||"未返回租户 ID"})`),console.log(`当前登录用户: ${r.userInfo.name||"未返回用户名"}`),r}catch(e){w(`\n登录失败: ${e.message||e.msg}`),process.exit(1)}}async logout(){if(console.log("\n========== NeoCRM 登出 ==========\n"),g.existsSync(this.tokenFile))try{x.clearEnvConfig(),this.clearToken(),R("已清除授权信息,下次登录需要重新授权。"),console.log("\n登出成功!\n")}catch(e){w(`登出失败: ${e.message||e.msg}`),process.exit(1)}else console.log("当前未登录,无需登出。")}async getValidToken(){const e=this.readToken();if(e||(w("未找到授权信息,请先执行 neo login 进行登录。"),process.exit(1)),this.isTokenExpired(e)){console.log("授权信息已过期,正在尝试刷新..."),e.refresh_token||(w("自动刷新授权信息失败,请重新登录(neo login)。"),process.exit(1));const t=await this.refreshToken(e.refresh_token);return t||(w("刷新授权信息失败,请重新登录 (neo login)"),process.exit(1)),this.saveToken(t),t}return e}async getAccessToken(){return await this.getValidToken()}extractRootUrlFromUrl(e){if(!e||"string"!=typeof e)return"";const t=e.trim();if(!t)return"";try{return new URL(t).origin}catch{return t}}buildFullUrl(e){if(e.startsWith("http://")||e.startsWith("https://"))return e;let t=this.neoBaseURL;return t.endsWith("/")&&(t=t.substring(0,t.length-1)),`${t}${e}`}}};
|
package/dist/neo/pushCmp.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("node:fs"),t=require("node:path"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("node:fs"),t=require("node:path"),r=require("lodash"),o=require("akfun"),s=require("ora"),i=require("jsdom"),a=require("./neoService.js"),n=require("../utils/common.js"),l=require("../utils/pathUtils.js"),c=require("../utils/projectUtils/createCmpProjectZip.js"),p=require("../utils/projectUtils/updatePublishLog.js"),u=require("../utils/cmpTypeValidator.js");var g,m;exports.__require=function(){if(m)return g;m=1;const d=e,w=t,h=r,{getConfigObj:f}=o,y=s,{JSDOM:b}=i,T=a.__require(),{getFramework:C,errorLog:$,successLog:v}=n.__require(),{catchCurPackageJson:q}=l.__require(),j=c.__require(),P=p.__require(),{validateApiName:S}=u.__require(),O=f(q()),_=(e=[])=>e.map(e=>({label:e.label,description:e.description,propSchema:JSON.stringify(e)})),D=(e=[],t)=>e&&0!==e.length?e.map(e=>{let r=e.eventParams||"[]";return h.isArray(r)&&(r=JSON.stringify(r)),{...e,componentType:t,eventCategory:e.eventCategory||2,pageType:e.pageType||1,targetDevice:e.targetDevice||1,eventParams:r}}):[],E=(e=[],t)=>e&&0!==e.length?e.map(e=>{let r=e.funcInParams||"[]",o=e.funcOutParams||"[]";return h.isArray(r)&&(r=JSON.stringify(r)),h.isArray(o)&&(o=JSON.stringify(o)),{...e,componentType:t,funcScope:e.funcScope||1,pageType:e.pageType||1,targetDevice:e.targetDevice||1,custom:!0,funcInParams:r,funcOutParams:o}}):[];return g=async(e,t)=>{const r=y("正在发布组件...").start(),{isValid:o,errors:s}=S(t);if(!o)throw $(s.join("\n")),new Error(s.join("\n"));try{let o,s=new T;await s.ensureValidToken(),r.start("[1/4] 打包源码文件(含单个自定义组件源码)...");try{o=j(t,process.cwd(),e.assetsRoot),o?v(`[1/4] 源码文件打包完成: ${w.basename(o)}。`,r):$("[1/4] 源码文件打包失败,未返回 zip 文件路径。",r)}catch(e){$("[1/4] 源码文件打包失败。",r)}r.start("[2/4] 获取自定义组件构建产物...");const i=await s.getCmpAssets(t);let a;r.start("[3/4] 构建组件数据...");try{a=await(async(e,t)=>{if(!t||!t.cmpType)return $("自定义组件信息或组件名称不能为空"),null;const{cmpType:r}=t;if(!e||!d.existsSync(e))return $(`未找到自定义组件目录: ${e}`),null;const o=h.camelCase(r),s=w.join(e,`${o}Model.js`);if(!d.existsSync(s))throw $(`未找到自定义组件模型文件,请检查以下路径是否存在:${s}`),new Error(`未找到自定义组件模型文件,请检查以下路径是否存在:${s}`);const i=globalThis.window;if(!globalThis.window){const e=new b("<!DOCTYPE html><p>Hello world</p>",{url:"http://localhost",contentType:"text/html",includeNodeLocations:!0,storageQuota:1e5});globalThis.window={...e.window,console:console,neoRequire:()=>{},postMessage:()=>{}},globalThis.document=e.window.document,globalThis.this={}}const a=globalThis.self;globalThis.self||(globalThis.self=globalThis);try{if(!d.existsSync(s))throw $(`未找到自定义组件模型文件,请检查以下路径是否存在:${s}`),new Error(`未找到自定义组件模型文件,请检查以下路径是否存在:${s}`);if(require(s),!globalThis.window||!globalThis.window.NEOEditorCustomModels)throw $(`模型文件未导出有效模型方法(CatchCustomCmpModelClass),模型文件地址: ${s} `),new Error(`模型文件未导出有效模型方法(CatchCustomCmpModelClass),模型文件地址: ${s} `);const e=globalThis.window.NEOEditorCustomModels[r];if(!e)throw $(`未找到自定义组件模型类(${r}),模型文件地址: ${s} `),new Error(`未找到自定义组件模型类(${r}),模型文件地址: ${s} `);const o=new e;if(!o)throw $(`未找到自定义组件模型信息(${r}),模型文件地址: ${s} `),new Error(`未找到自定义组件模型信息(${r}),模型文件地址: ${s} `);return{...t,version:O.version||"1.0.0",framework:O.framework?C(O.framework):0,label:o.label||r,description:o.description||"",componentCategory:(o.tags||["自定义组件"]).join(","),targetPage:o.targetPage||["all"],targetObject:o.targetObject||["all"],targetApplication:o.targetApplication||["all"],targetDevice:o.targetDevice||"web",iconUrl:o.iconUrl||o.iconUrl,defaultProps:JSON.stringify(o.defaultComProps||{}),previewProps:JSON.stringify(o.previewComProps||{}),props:_(o.propsSchema||[]),events:D(o.events||[],r),functions:E(o.functions||o.actions||[],r),exposedToDesigner:void 0===o.exposedToDesigner||o.exposedToDesigner,namespace:o.namespace||"neo-cmp-cli",enableDuplicate:void 0===o.enableDuplicate||o.enableDuplicate}}catch(e){return $(`自定义组件模型文件解析失败 (${s||"未知路径"}): ${e.message||e.msg}`),$(e.stack),null}finally{void 0===i?delete globalThis.window:globalThis.window=i,void 0===a?delete globalThis.self:globalThis.self=a}})(e.assetsRoot,i),a?v("[3/4] 组件数据构建完成。",r):$(`[3/4] 未获取到自定义组件模型信息(${t})。`,r)}catch(e){$(`[3/4] 组件数据构建失败: ${e.message||e.msg}`,r)}r.start("[4/4] 保存组件信息到 NeoCRM 平台...");const n=["assetFile","modelAssetFile","cssAssetFile","codeLibFile"],l={...a};n.forEach(e=>{l[e]&&l[e].fileContent&&(l[e]=h.omit(l[e],["fileContent"]))}),P(l);try{await s.updateCustomComponent(a),v("[4/4] 组件信息保存成功",r)}catch(e){$("[4/4] 组件信息保存失败",r)}const{tenant_id:c,instance_uri:p}=s.tokenCache||{};console.log(`\n✅ 自定义组件发布成功!\n(当前租户 ID: ${c||"未返回"},所在租户的 API 域名: ${p||"未返回"}。)`)}catch(e){try{r&&r.isSpinning&&$(`❌ 自定义组件发布失败: ${e.message||e.msg}`,r)}catch{$(`\n❌ 自定义组件发布失败: ${e.message||e.msg}`)}throw e}},g};
|
package/dist/package.json.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});var e="1.13.
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});var e="1.13.18";const o={version:e};exports.default=o,exports.version=e;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "neo-cmp-cli",
|
|
3
|
-
"version": "1.13.
|
|
3
|
+
"version": "1.13.18",
|
|
4
4
|
"description": "Neo 自定义组件开发工具,支持react 和 vue2.0技术栈。",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"neo-cli",
|
|
@@ -58,7 +58,8 @@
|
|
|
58
58
|
"portfinder": "^1.0.38",
|
|
59
59
|
"webpack-sources": "^3.2.3",
|
|
60
60
|
"yargs": "^17.7.2",
|
|
61
|
-
"jsdom": "^28.0.0"
|
|
61
|
+
"jsdom": "^28.0.0",
|
|
62
|
+
"@cloudbase/js-sdk": "^1.7.1"
|
|
62
63
|
},
|
|
63
64
|
"devDependencies": {
|
|
64
65
|
"@commitlint/cli": "^18.0.0",
|
|
@@ -10,235 +10,4 @@
|
|
|
10
10
|
- [获取业务数据信息(单个数据)](https://doc.xiaoshouyi.com/#/proMan/workplaceDetailApi?url=%2F%2Fconcepts%2Fapi_paas_customObject_getBusinessDataInformation.html&id=1405&dir=output_1757929564205&time=1758781533725): /rest/data/v2.0/xobjects/{xObjectApiKey}/{id};
|
|
11
11
|
- [查询接口(通用查询接口)](https://doc.xiaoshouyi.com/#/proMan/workplaceDetailApi?url=%2F%2Fconcepts%2Fapi_queryInterfaceDescription.html&id=1405&dir=output_1757929564205&time=1758784491846): /rest/data/v2/query;
|
|
12
12
|
- [获取业务类型描述](https://doc.xiaoshouyi.com/?sso-domain=login-cd.xiaoshouyi.com#/proMan/workplaceDetailApi?url=%2F%2Fconcepts%2Fapi_paas_customObject_getBusinessTypeDescription.html&id=1405&dir=output_1757929564205&time=1758798530511): /rest/data/v2.0/xobjects/{xObjectApiKey}/busiType;
|
|
13
|
-
- 更多可用接口见[文档](https://doc.xiaoshouyi.com/#/proMan/workplaceDetailApi?url=%2F%2Fconcepts%2Fapi_apiIntroduction.html&id=1405&dir=output_1757929564205)。
|
|
14
|
-
|
|
15
|
-
## Open API 请求方法
|
|
16
|
-
|
|
17
|
-
### 基础请求工具
|
|
18
|
-
|
|
19
|
-
#### axiosFetcher
|
|
20
|
-
基于 axios 封装的通用请求工具,支持 GET、POST、PATCH、DELETE 等请求方法。
|
|
21
|
-
|
|
22
|
-
```typescript
|
|
23
|
-
import axiosFetcher from '@/utils/axiosFetcher';
|
|
24
|
-
|
|
25
|
-
// 基本用法
|
|
26
|
-
const result = await axiosFetcher({
|
|
27
|
-
url: '/api/endpoint',
|
|
28
|
-
method: 'GET',
|
|
29
|
-
data: { key: 'value' },
|
|
30
|
-
headers: { 'Custom-Header': 'value' },
|
|
31
|
-
timeout: 30000
|
|
32
|
-
});
|
|
33
|
-
```
|
|
34
|
-
|
|
35
|
-
**参数说明:**
|
|
36
|
-
- `url`: 请求地址
|
|
37
|
-
- `method`: 请求方法,默认为 'GET'
|
|
38
|
-
- `data`: 请求数据,GET 请求会转为 params
|
|
39
|
-
- `headers`: 请求头,默认包含 'Content-Type': 'application/json'
|
|
40
|
-
- `timeout`: 超时时间,默认 30000ms
|
|
41
|
-
|
|
42
|
-
### 业务对象相关接口
|
|
43
|
-
|
|
44
|
-
#### 1. 查询业务对象数据列表 (queryXObjectData)
|
|
45
|
-
使用通用查询接口获取业务对象数据,支持分页和排序。
|
|
46
|
-
|
|
47
|
-
```typescript
|
|
48
|
-
import { queryXObjectData } from '@/utils/queryObjectData';
|
|
49
|
-
|
|
50
|
-
// 基本查询
|
|
51
|
-
const result = await queryXObjectData({
|
|
52
|
-
xObjectApiKey: 'Contact', // 业务对象 API Key
|
|
53
|
-
fields: ['name', 'phone', 'email'], // 查询字段
|
|
54
|
-
page: 1, // 页码
|
|
55
|
-
pageSize: 10, // 每页数量
|
|
56
|
-
orderBy: 'name asc' // 排序条件(可选)
|
|
57
|
-
});
|
|
58
|
-
```
|
|
59
|
-
|
|
60
|
-
**参数说明:**
|
|
61
|
-
- `xObjectApiKey`: 业务对象的 API Key
|
|
62
|
-
- `fields`: 需要查询的字段数组,会自动添加 'id' 字段
|
|
63
|
-
- `page`: 页码,默认为 1
|
|
64
|
-
- `pageSize`: 每页数量,默认为 10
|
|
65
|
-
- `orderBy`: 排序条件,如 'name asc' 或 'createdTime desc'
|
|
66
|
-
|
|
67
|
-
**返回结果:**
|
|
68
|
-
```typescript
|
|
69
|
-
{
|
|
70
|
-
code: 200,
|
|
71
|
-
result: {
|
|
72
|
-
// 查询结果数据
|
|
73
|
-
records: any[],
|
|
74
|
-
// 分页信息
|
|
75
|
-
totalSize: number, // 总个数
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
```
|
|
79
|
-
|
|
80
|
-
#### 2. 获取业务类型列表 (getEntityTypeList)
|
|
81
|
-
获取指定业务对象的业务类型列表。
|
|
82
|
-
|
|
83
|
-
```typescript
|
|
84
|
-
import { getEntityTypeList } from '@/utils/xobjects';
|
|
85
|
-
|
|
86
|
-
const result = await getEntityTypeList('Contact', {
|
|
87
|
-
// 其他请求选项
|
|
88
|
-
});
|
|
89
|
-
```
|
|
90
|
-
|
|
91
|
-
**参数说明:**
|
|
92
|
-
- `xObjectApiKey`: 业务对象的 API Key
|
|
93
|
-
- `options`: 可选的请求配置
|
|
94
|
-
|
|
95
|
-
#### 3. 获取对象列表 (getEntityList)
|
|
96
|
-
获取系统中的对象列表,支持标准对象和自定义对象。
|
|
97
|
-
|
|
98
|
-
```typescript
|
|
99
|
-
import { getEntityList } from '@/utils/xobjects';
|
|
100
|
-
|
|
101
|
-
// 获取标准对象列表
|
|
102
|
-
const standardObjects = await getEntityList({
|
|
103
|
-
custom: false, // 获取标准对象
|
|
104
|
-
active: true // 仅获取有权限的对象
|
|
105
|
-
});
|
|
106
|
-
|
|
107
|
-
// 获取自定义对象列表
|
|
108
|
-
const customObjects = await getEntityList({
|
|
109
|
-
custom: true, // 获取自定义对象
|
|
110
|
-
active: true // 仅获取有权限的对象
|
|
111
|
-
});
|
|
112
|
-
```
|
|
113
|
-
|
|
114
|
-
**参数说明:**
|
|
115
|
-
- `custom`: 是否获取自定义对象,false 为标准对象,true 为自定义对象
|
|
116
|
-
- `active`: 是否仅获取有权限的对象,默认为 true
|
|
117
|
-
|
|
118
|
-
#### 4. 创建业务数据 (createXObject)
|
|
119
|
-
创建新的业务数据记录。
|
|
120
|
-
|
|
121
|
-
```typescript
|
|
122
|
-
import { createXObject } from '@/utils/xobjects';
|
|
123
|
-
|
|
124
|
-
const result = await createXObject('Contact', {
|
|
125
|
-
method: 'POST',
|
|
126
|
-
data: {
|
|
127
|
-
name: '张三',
|
|
128
|
-
phone: '13800138000',
|
|
129
|
-
email: 'zhangsan@example.com'
|
|
130
|
-
}
|
|
131
|
-
});
|
|
132
|
-
```
|
|
133
|
-
|
|
134
|
-
**参数说明:**
|
|
135
|
-
- `xObjectApiKey`: 业务对象的 API Key
|
|
136
|
-
- `options.data`: 要创建的数据对象
|
|
137
|
-
- `options.method`: 请求方法,默认为 'GET'(建议使用 'POST')
|
|
138
|
-
|
|
139
|
-
#### 5. 更新业务数据 (updateXObject)
|
|
140
|
-
更新指定的业务数据记录。
|
|
141
|
-
|
|
142
|
-
```typescript
|
|
143
|
-
import { updateXObject } from '@/utils/xobjects';
|
|
144
|
-
|
|
145
|
-
const result = await updateXObject('Contact', '12345', {
|
|
146
|
-
method: 'PATCH',
|
|
147
|
-
data: {
|
|
148
|
-
name: '李四',
|
|
149
|
-
phone: '13900139000'
|
|
150
|
-
}
|
|
151
|
-
});
|
|
152
|
-
```
|
|
153
|
-
|
|
154
|
-
**参数说明:**
|
|
155
|
-
- `xObjectApiKey`: 业务对象的 API Key
|
|
156
|
-
- `objectId`: 要更新的记录 ID
|
|
157
|
-
- `options.data`: 要更新的数据对象
|
|
158
|
-
- `options.method`: 请求方法,默认为 'PATCH'
|
|
159
|
-
|
|
160
|
-
#### 6. 获取业务数据信息 (getXObject)
|
|
161
|
-
获取指定业务数据记录的详细信息。
|
|
162
|
-
|
|
163
|
-
```typescript
|
|
164
|
-
import { getXObject } from '@/utils/xobjects';
|
|
165
|
-
|
|
166
|
-
const result = await getXObject('Contact', '12345', {
|
|
167
|
-
// 其他请求选项
|
|
168
|
-
});
|
|
169
|
-
```
|
|
170
|
-
|
|
171
|
-
**参数说明:**
|
|
172
|
-
- `xObjectApiKey`: 业务对象的 API Key
|
|
173
|
-
- `objectId`: 要获取的记录 ID
|
|
174
|
-
- `options`: 可选的请求配置
|
|
175
|
-
|
|
176
|
-
#### 7. 删除业务数据 (deleteXObject)
|
|
177
|
-
删除指定的业务数据记录。
|
|
178
|
-
|
|
179
|
-
```typescript
|
|
180
|
-
import { deleteXObject } from '@/utils/xobjects';
|
|
181
|
-
|
|
182
|
-
const result = await deleteXObject('Contact', '12345');
|
|
183
|
-
```
|
|
184
|
-
|
|
185
|
-
**参数说明:**
|
|
186
|
-
- `xObjectApiKey`: 业务对象的 API Key
|
|
187
|
-
- `objectId`: 要删除的记录 ID
|
|
188
|
-
|
|
189
|
-
#### 8. 获取业务对象描述 (getXObjectDesc)
|
|
190
|
-
获取业务对象的描述信息。
|
|
191
|
-
|
|
192
|
-
```typescript
|
|
193
|
-
import { getXObjectDesc } from '@/utils/xobjects';
|
|
194
|
-
|
|
195
|
-
const result = await getXObjectDesc('Contact');
|
|
196
|
-
```
|
|
197
|
-
|
|
198
|
-
**参数说明:**
|
|
199
|
-
- `xObjectApiKey`: 业务对象的 API Key
|
|
200
|
-
|
|
201
|
-
### 使用示例
|
|
202
|
-
|
|
203
|
-
```typescript
|
|
204
|
-
import {
|
|
205
|
-
queryXObjectData,
|
|
206
|
-
createXObject,
|
|
207
|
-
updateXObject,
|
|
208
|
-
getXObject,
|
|
209
|
-
deleteXObject
|
|
210
|
-
} from '@/utils/xobjects';
|
|
211
|
-
|
|
212
|
-
// 查询联系人列表
|
|
213
|
-
const contacts = await queryXObjectData({
|
|
214
|
-
xObjectApiKey: 'Contact',
|
|
215
|
-
fields: ['name', 'phone', 'email'],
|
|
216
|
-
page: 1,
|
|
217
|
-
pageSize: 20,
|
|
218
|
-
orderBy: 'createdTime desc'
|
|
219
|
-
});
|
|
220
|
-
|
|
221
|
-
// 创建新联系人
|
|
222
|
-
const newContact = await createXObject('Contact', {
|
|
223
|
-
method: 'POST',
|
|
224
|
-
data: {
|
|
225
|
-
name: '王五',
|
|
226
|
-
phone: '13700137000',
|
|
227
|
-
email: 'wangwu@example.com'
|
|
228
|
-
}
|
|
229
|
-
});
|
|
230
|
-
|
|
231
|
-
// 更新联系人
|
|
232
|
-
const updatedContact = await updateXObject('Contact', newContact.id, {
|
|
233
|
-
data: {
|
|
234
|
-
name: '王五(更新)'
|
|
235
|
-
}
|
|
236
|
-
});
|
|
237
|
-
|
|
238
|
-
// 获取联系人详情
|
|
239
|
-
const contactDetail = await getXObject('Contact', newContact.id);
|
|
240
|
-
|
|
241
|
-
// 删除联系人
|
|
242
|
-
await deleteXObject('Contact', newContact.id);
|
|
243
|
-
```
|
|
244
|
-
|
|
13
|
+
- 更多可用接口见[文档](https://doc.xiaoshouyi.com/#/proMan/workplaceDetailApi?url=%2F%2Fconcepts%2Fapi_apiIntroduction.html&id=1405&dir=output_1757929564205)。
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"axios": "^1.7.0",
|
|
42
42
|
"antd": "4.9.4",
|
|
43
43
|
"lodash": "^4.17.21",
|
|
44
|
-
"neo-open-api": "^1.2.
|
|
44
|
+
"neo-open-api": "^1.2.7",
|
|
45
45
|
"tslib": "2.3.0",
|
|
46
46
|
"echarts": "^5.5.1",
|
|
47
47
|
"moment": "^2.30.1"
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"@types/react": "^16.9.11",
|
|
53
53
|
"@types/react-dom": "^16.9.15",
|
|
54
54
|
"@types/axios": "^0.14.0",
|
|
55
|
-
"neo-cmp-cli": "^1.13.
|
|
55
|
+
"neo-cmp-cli": "^1.13.17",
|
|
56
56
|
"husky": "^4.2.5",
|
|
57
57
|
"lint-staged": "^10.2.9",
|
|
58
58
|
"prettier": "^2.0.5",
|
|
@@ -34,14 +34,14 @@
|
|
|
34
34
|
"react": "^16.9.0",
|
|
35
35
|
"react-dom": "^16.9.0",
|
|
36
36
|
"antd": "4.9.4",
|
|
37
|
-
"neo-open-api": "^1.2.
|
|
37
|
+
"neo-open-api": "^1.2.7"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
40
|
"@commitlint/cli": "^18.0.0",
|
|
41
41
|
"@commitlint/config-conventional": "^18.0.0",
|
|
42
42
|
"@types/react": "^16.9.11",
|
|
43
43
|
"@types/react-dom": "^16.9.15",
|
|
44
|
-
"neo-cmp-cli": "^1.13.
|
|
44
|
+
"neo-cmp-cli": "^1.13.17",
|
|
45
45
|
"husky": "^4.2.5",
|
|
46
46
|
"lint-staged": "^10.2.9",
|
|
47
47
|
"prettier": "^2.0.5"
|
|
@@ -78,12 +78,18 @@ module.exports = {
|
|
|
78
78
|
*/
|
|
79
79
|
},
|
|
80
80
|
// 选择「自定义环境」时需要添加 NeoCRM 平台配置,可自定义对接的任何环境
|
|
81
|
-
|
|
81
|
+
neoConfig1: {
|
|
82
82
|
// authType: 'oauth2', // 默认授权模式:OAuth2 授权码模式
|
|
83
83
|
neoBaseURL: 'https://crm-test.xiaoshouyi.com', // 平台根地址(默认:https://crm.xiaoshouyi.com)
|
|
84
84
|
loginURL: 'https://login-test.xiaoshouyi.com/auc/oauth2/auth', // 登录授权 URL(默认:https://login.xiaoshouyi.com/auc/oauth2/auth)
|
|
85
85
|
tokenURL: 'https://login-test.xiaoshouyi.com/auc/oauth2/token', // Token 获取接口地址(默认:https://login.xiaoshouyi.com/auc/oauth2/token)
|
|
86
86
|
},
|
|
87
|
+
neoConfig: {
|
|
88
|
+
// authType: 'oauth2', // 默认授权模式:OAuth2 授权码模式
|
|
89
|
+
neoBaseURL: 'https://crm-p20.xiaoshouyi.com', // 平台根地址(默认:https://crm.xiaoshouyi.com)
|
|
90
|
+
loginURL: 'https://login-p20.xiaoshouyi.com/auc/oauth2/auth', // 登录授权 URL(默认:https://login.xiaoshouyi.com/auc/oauth2/auth)
|
|
91
|
+
tokenURL: 'https://login-p20.xiaoshouyi.com/auc/oauth2/token', // Token 获取接口地址(默认:https://login.xiaoshouyi.com/auc/oauth2/token)
|
|
92
|
+
},
|
|
87
93
|
pushCmp: {
|
|
88
94
|
// 用于构建并发布至 NeoCRM 的相关配置
|
|
89
95
|
// 备注:pushCmp 会服用量 build2lib 中的配置,执行 neo push cmp 时最好注释掉 build2lib 中的配置。
|
|
@@ -33,26 +33,27 @@
|
|
|
33
33
|
]
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
+
"antd": "^4.9.4",
|
|
37
|
+
"axios": "^1.7.0",
|
|
38
|
+
"echarts": "^5.6.0",
|
|
39
|
+
"lodash": "^4.17.21",
|
|
40
|
+
"moment": "^2.30.1",
|
|
41
|
+
"neo-open-api": "^1.2.7",
|
|
36
42
|
"neo-register": "^1.1.3",
|
|
37
43
|
"react": "^16.9.0",
|
|
38
44
|
"react-dom": "^16.9.0",
|
|
39
|
-
"axios": "^1.7.0",
|
|
40
|
-
"antd": "^4.9.4",
|
|
41
|
-
"lodash": "^4.17.21",
|
|
42
|
-
"neo-open-api": "^1.1.9",
|
|
43
|
-
"@wibetter/json-editor": "^6.0.5",
|
|
44
45
|
"tslib": "2.3.0"
|
|
45
46
|
},
|
|
46
47
|
"devDependencies": {
|
|
47
48
|
"@babel/runtime": "^7.26.0",
|
|
48
49
|
"@commitlint/cli": "^8.3.5",
|
|
49
50
|
"@commitlint/config-conventional": "^9.1.1",
|
|
51
|
+
"@types/axios": "^0.14.0",
|
|
50
52
|
"@types/react": "^16.9.11",
|
|
51
53
|
"@types/react-dom": "^16.9.15",
|
|
52
|
-
"@types/axios": "^0.14.0",
|
|
53
|
-
"neo-cmp-cli": "^1.13.16",
|
|
54
54
|
"husky": "^4.2.5",
|
|
55
55
|
"lint-staged": "^10.2.9",
|
|
56
|
+
"neo-cmp-cli": "^1.13.18",
|
|
56
57
|
"prettier": "^2.0.5"
|
|
57
58
|
},
|
|
58
59
|
"overrides": {
|