neo-cmp-cli 1.9.30 → 1.9.32

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.
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("axios"),t=require("form-data"),s=require("node:fs"),o=require("node:path"),i=require("ora"),r=require("lodash"),n=require("akfun"),a=require("./neoLogin.js"),c=require("../utils/projectUtils/updatePublishLog.js"),l=require("../utils/common.js"),h=require("./neoEnvManager.js"),u=require("../utils/tableLog.js");var d,p;exports.__require=function(){if(p)return d;p=1;const m=e,f=t,y=s,g=o,w=i,k=r,{resolve:A}=n,$=a.__require(),C=c.__require(),{getFramework:x,errorLog:T,successLog:F}=l.__require(),L=h.__require(),P=u.__require(),b=["cmpType","label","componentCategory","description","framework","icon","iconUrl","orderNo","version","propsSchema","defaultProps","previewProps","events","functions","asset","modelAsset","cssAsset","codeLib"];return d=class{constructor(){const e=L.getEnvConfig(),{assetsRoot:t,auth:s,authType:o}=e||{};this.authType=o||"oauth2",this.NeoCrmAPI=e,"password"!==this.authType||s||(T("密码授权模式时,neo.config.js / neoConfig / auth 配置不能为空"),process.exit(1)),"password"===this.authType?s.client_id&&s.client_secret&&s.username&&s.password||(T("neo.config.js / neoConfig / auth 配置不完整(password 模式),需要包含 client_id、client_secret、username、password"),process.exit(1)):"oauth2"!=this.authType&&(T(`不支持的授权类型: ${this.authType},可选值:oauth2、password`),process.exit(1)),this.assetsRoot=t||A("dist"),this.auth=s,this.cmpList=[],this.cmpInfoMap={},this.tokenCache={token:null,expiresAt:null}}buildFullUrl(e){return e.startsWith("http://")||e.startsWith("https://")?e:`${this.NeoCrmAPI.neoBaseURL}${e}`}uploadAPI(){return this.buildFullUrl(this.NeoCrmAPI.uploadAPI)}saveAPI(){return this.buildFullUrl(this.NeoCrmAPI.saveAPI)}isTokenExpired(){return!this.tokenCache.token||!this.tokenCache.expiresAt||Date.now()>=this.tokenCache.expiresAt}async getToken(){return this.isTokenExpired()?"oauth2"===this.authType?await this.getTokenByOAuth2():await this.getTokenByPassword():this.tokenCache.token}async getTokenByPassword(){const e=w("获取 token(密码模式)...").start();if(!this.isTokenExpired())return F("使用缓存的 token。",e),this.tokenCache.token;const t=new URLSearchParams;t.append("grant_type","password"),t.append("client_id",this.auth.client_id),t.append("client_secret",this.auth.client_secret),t.append("username",this.auth.username),t.append("password",this.auth.password);const s=this.buildFullUrl(this.NeoCrmAPI.tokenURL);try{const o=await m.post(s,t.toString(),{headers:{"Content-Type":"application/x-www-form-urlencoded"}}),i=o.data||{},{access_token:r,expires_in:n}=i;r||(T("获取 token 失败(授权配置错误):响应中未包含 access_token,"+JSON.stringify(o.data),e),process.exit(1));const a=parseInt(n)||3600;return this.tokenCache={...i,token:r,expiresAt:Date.now()+1e3*(a-60)},e.clear(),e.stop(),r}catch(o){T("获取 token 失败",e),T(`\n获取 token 失败: ${o.message||o.msg}`),T(`\ntoken 授权地址: ${s}`),T(`\ntoken 请求参数: ${t}`),o.response&&T(`响应数据: ${JSON.stringify(o.response.data)}`),process.exit(1)}}async getTokenByOAuth2(){const e=w("获取 token(OAuth2 模式)...").start();try{const t={loginURL:this.NeoCrmAPI.loginURL,tokenURL:this.NeoCrmAPI.tokenURL},s=new $(t),o=await s.getAccessToken(),i=o.access_token;return this.tokenCache={...o,token:i,expiresAt:Date.now()+72e5},e.clear(),e.stop(),i}catch(t){T("获取 token 失败(OAuth2 模式)",e),T(`\n获取 token 失败: ${t.message||t.msg}`),t.response&&T(`响应数据: ${JSON.stringify(t.response.data)}`),process.exit(1)}}async refreshToken(){return this.tokenCache={token:null,expiresAt:null},await this.getToken()}async ensureValidToken(){if(!this.tokenCache.token)return await this.getToken();if(this.isTokenExpired()){const e=w("token 已过期,正在刷新...").start();try{const t=await this.refreshToken();return F("token 刷新成功。",e),t}catch(t){throw T("token 刷新失败。",e),t}}return this.tokenCache.token}async uploadFile(e,t={}){const s=await this.ensureValidToken();if(!e||"string"!=typeof e)throw new Error(`文件路径无效: ${e}`);if(!y.existsSync(e))throw new Error(`文件不存在: ${e}`);const o=y.statSync(e);if(!o.isFile())throw new Error(`路径不是文件: ${e}`);const i=t.maxSize||5242880;if(o.size>i){const e=(o.size/1024/1024).toFixed(2),t=(i/1024/1024).toFixed(2);throw new Error(`文件大小超过限制: ${e}MB > ${t}MB`)}if(0===o.size)throw new Error(`文件为空: ${e}`);const r=g.basename(e),n=(o.size/1024).toFixed(2),a=w(`正在上传文件: ${r} (${n}KB)...`).start();try{const o=new f,i=t.fieldName||"customComponentCode",n=y.createReadStream(e);o.append(i,n,r);const c=this.uploadAPI(),l=t.timeout||6e4,h={headers:{Authorization:`Bearer ${s}`,"xsy-inner-source":"bff",...o.getHeaders()},timeout:l,maxContentLength:1/0,maxBodyLength:1/0},u=await m.post(c,o,h);let d;const p=u.data;if(200!==u.status&&201!==u.status)throw new Error(`上传失败: HTTP ${u.status}`);if("string"==typeof p)d=p.trim();else{if(!p||"object"!=typeof p)throw new Error("响应数据格式不正确: "+typeof p);if(void 0!==p.code&&200!==p.code&&0!==p.code){const e=p.message||p.msg||"未知错误";throw new Error(`上传失败: ${e} (code: ${p.code})`)}d=void 0!==p.data?p.data:void 0!==p.url?p.url:void 0!==p.fileUrl?p.fileUrl:p}if(!d)throw new Error("返回的文件地址为空");let g;return"string"==typeof d?g=d:d&&"object"==typeof d&&d.url&&(g=d.url),F(`文件上传成功: ${r} -> ${g}`,a),g}catch(t){if(T(`上传文件失败: ${t.message||t.msg}, 文件路径: ${e}`,a),t.response){const e=t.response.status,s=t.response.statusText,o=t.response.data,i=t.config?.url||this.uploadAPI();if(T("\n========== 上传请求详情 =========="),T(`请求 URL: ${i}`),T(`HTTP 状态码: ${e} ${s}`),T(`响应数据: ${JSON.stringify(o)}`),T("==================================\n"),404===e)throw new Error(`上传 API 不存在 (404): ${i}\n请检查 neo.config.js 中的 neoBaseURL 配置是否正确,或者 API 路径是否存在。\n当前配置的 API 路径: ${this.NeoCrmAPI.uploadAPI}`)}else t.request&&T("请求已发送但未收到响应,请检查网络连接或代理配置。");throw t}}async publish2oss(e,t=[".js",".css",".zip"]){if(!e)return void T(`自定义组件名称不能为空: ${e}`);if(!y.existsSync(this.assetsRoot))return void T(`未找到自定义组件资源目录: ${this.assetsRoot}`);const s={cmpType:e},o=y.readdirSync(this.assetsRoot).map(async o=>{const i=g.join(this.assetsRoot,o),r=y.statSync(i),n=g.parse(i);if(r.isFile()&&t.includes(n.ext)){let t=k.camelCase(e);if(o.indexOf(t)<0)return;try{const e=await this.uploadFile(i);o.indexOf("Model")>-1?s.modelAsset=e:o.endsWith(".css")?s.cssAsset=e:o.endsWith(".zip")?s.codeLib=e:s.asset=e}catch(e){T(`文件上传失败(${o}):\n`),process.exit(1)}}});return await Promise.all(o),s&&s.cmpType&&(console.info("上传至 OSS 的文件信息:\n",s),C(s)),s}async getCmpAssets(e,t=[".js",".css",".zip"]){if(!e)return void T(`自定义组件名称不能为空: ${e}`);if(!y.existsSync(this.assetsRoot))return void T(`未找到自定义组件资源目录: ${this.assetsRoot}`);const s={cmpType:e};return y.readdirSync(this.assetsRoot).forEach(o=>{const i=g.join(this.assetsRoot,o),r=y.statSync(i),n=g.parse(i);if(r.isFile()&&t.includes(n.ext)){let t=k.camelCase(e);if(o.indexOf(t)<0)return;const n=5242880;if(r.size>n){const e=(r.size/1024/1024).toFixed(2),t=(n/1024/1024).toFixed(2);throw new Error(`${o} 文件大小超过限制: ${e}MB > ${t}MB`)}const a={fileContent:y.createReadStream(i),fileName:o,fileSize:r.size};o.indexOf("Model")>-1?s.modelAssetFile=a:o.endsWith(".css")?s.cssAssetFile=a:o.endsWith(".zip")?s.codeLibFile=a:s.assetFile=a}}),s}async updateCustomComponent(e){const t=await this.ensureValidToken();if(!e)throw new Error("componentData 不能为空");const s=w("正在保存自定义组件信息...").start();try{const o=this.saveAPI(),i=new f;e.assetFile&&i.append("assetFile",e.assetFile.fileContent,e.assetFile.fileName),e.modelAssetFile&&i.append("modelAssetFile",e.modelAssetFile.fileContent,e.modelAssetFile.fileName),e.cssAssetFile&&i.append("cssAssetFile",e.cssAssetFile.fileContent,e.cssAssetFile.fileName),e.codeLibFile&&i.append("codeLibFile",e.codeLibFile.fileContent,e.codeLibFile.fileName),i.append("component",JSON.stringify(k.omit(e,["assetFile","modelAssetFile","cssAssetFile","codeLibFile"])));const r=await m.post(o,i,{headers:{Authorization:`Bearer ${t}`,"xsy-inner-source":"bff",...i.getHeaders()},timeout:12e4,maxContentLength:1/0,maxBodyLength:1/0}),{code:n,message:a,msg:c}=r.data||{};n&&200!==n&&(T(`保存自定义组件信息失败: ${a||c||"未知错误"}`),process.exit(1)),s.clear(),s.stop()}catch(e){const t=e.message||e.msg;T(t?`保存自定义组件信息失败: ${t}`:`保存自定义组件信息失败: ${JSON.stringify(e)}`,s),process.exit(1)}}async getCustomCmpList(){const e=await this.ensureValidToken();try{let t=this.buildFullUrl(this.NeoCrmAPI.queryAll);t+=`&fields=${b.join(",")}`;const s=await m.get(t,{headers:{Authorization:`Bearer ${e}`,"xsy-inner-source":"bff","Content-Type":"application/json"}}),{code:o,message:i,msg:r}=s.data||{};o&&200!==o&&(T(`获取自定义组件列表失败: ${i||r||"未知错误"}`),process.exit(1)),this.updateCustomCmpList(s.data.data||[])}catch(e){const t=e.message||e.msg;T(t?`获取自定义组件列表失败: ${t}`:`响应数据: ${JSON.stringify(e)}`),process.exit(1)}return this.cmpList||[]}getCodeLibByCmpType(e){return e?this.buildFullUrl(this.NeoCrmAPI.getCodeLibAPI(e)):null}async deleteCmp(e){const t=await this.ensureValidToken();e||(T("自定义组件名称不能为空。"),process.exit(1));let s=this.buildFullUrl(this.NeoCrmAPI.delete);s+=`/${e}`;const o=await m.delete(s,{headers:{Authorization:`Bearer ${t}`,"xsy-inner-source":"bff","Content-Type":"application/json"}}),{code:i,message:r,msg:n,errorInfo:a}=o.data||{};return i&&200!==i&&(a&&a.length>0?P(a,{title:"删除自定义组件失败",columns:["reason","instance"],headers:{name:"原因",age:"实例"},align:{name:"left",city:"center"},padding:2,showBorder:!0}):T(`删除自定义组件失败: ${r||n||"未知错误"}`),process.exit(1)),o.data}getCmpListByFramework(e){if(!e)return this.cmpList;const t=x(e);return this.cmpList.filter(e=>e.framework===t)}getCmpInfoByCmpType(e){return e&&this.cmpInfoMap[e]||null}updateCustomCmpList(e){e&&Array.isArray(e)&&(this.cmpList=e,e.forEach(e=>{this.cmpInfoMap[e.cmpType]=e}))}async request(e,t,s={}){const o=await this.ensureValidToken(),{data:i,headers:r={},params:n}=s,a=this.buildFullUrl(t);try{const t=await m({method:e,url:a,data:i,params:n,headers:{Authorization:`Bearer ${o}`,"xsy-inner-source":"bff",...r}});if(t.data&&t.data.code&&200!==t.data.code)throw new Error(`请求失败: ${t.data.message||t.data.msg||"未知错误"}`);return t.data}catch(s){throw T(`请求失败 [${e} ${t}]: ${s.message||s.msg}`),s.response&&T(`响应数据: ${JSON.stringify(s.response.data)}`),s}}async get(e,t={}){return await this.request("GET",e,t)}async post(e,t={}){return await this.request("POST",e,t)}async put(e,t={}){return await this.request("PUT",e,t)}async delete(e,t={}){return await this.request("DELETE",e,t)}}};
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("axios"),t=require("form-data"),s=require("node:fs"),o=require("node:path"),i=require("ora"),r=require("lodash"),n=require("akfun"),a=require("./neoLogin.js"),c=require("../utils/projectUtils/updatePublishLog.js"),l=require("../utils/common.js"),h=require("./neoEnvManager.js"),u=require("../utils/tableLog.js");var d,p;exports.__require=function(){if(p)return d;p=1;const m=e,f=t,y=s,g=o,w=i,k=r,{resolve:A}=n,$=a.__require(),C=c.__require(),{getFramework:x,errorLog:T,successLog:F}=l.__require(),L=h.__require(),{tableLog:P}=u.__require(),b=["cmpType","label","componentCategory","description","framework","icon","iconUrl","orderNo","version","propsSchema","defaultProps","previewProps","events","functions","asset","modelAsset","cssAsset","codeLib"];return d=class{constructor(){const e=L.getEnvConfig(),{assetsRoot:t,auth:s,authType:o}=e||{};this.authType=o||"oauth2",this.NeoCrmAPI=e,"password"!==this.authType||s||(T("密码授权模式时,neo.config.js / neoConfig / auth 配置不能为空"),process.exit(1)),"password"===this.authType?s.client_id&&s.client_secret&&s.username&&s.password||(T("neo.config.js / neoConfig / auth 配置不完整(password 模式),需要包含 client_id、client_secret、username、password"),process.exit(1)):"oauth2"!=this.authType&&(T(`不支持的授权类型: ${this.authType},可选值:oauth2、password`),process.exit(1)),this.assetsRoot=t||A("dist"),this.auth=s,this.cmpList=[],this.cmpInfoMap={},this.tokenCache={token:null,expiresAt:null}}buildFullUrl(e){return e.startsWith("http://")||e.startsWith("https://")?e:`${this.NeoCrmAPI.neoBaseURL}${e}`}uploadAPI(){return this.buildFullUrl(this.NeoCrmAPI.uploadAPI)}saveAPI(){return this.buildFullUrl(this.NeoCrmAPI.saveAPI)}isTokenExpired(){return!this.tokenCache.token||!this.tokenCache.expiresAt||Date.now()>=this.tokenCache.expiresAt}async getToken(){return this.isTokenExpired()?"oauth2"===this.authType?await this.getTokenByOAuth2():await this.getTokenByPassword():this.tokenCache.token}async getTokenByPassword(){const e=w("获取 token(密码模式)...").start();if(!this.isTokenExpired())return F("使用缓存的 token。",e),this.tokenCache.token;const t=new URLSearchParams;t.append("grant_type","password"),t.append("client_id",this.auth.client_id),t.append("client_secret",this.auth.client_secret),t.append("username",this.auth.username),t.append("password",this.auth.password);const s=this.buildFullUrl(this.NeoCrmAPI.tokenURL);try{const o=await m.post(s,t.toString(),{headers:{"Content-Type":"application/x-www-form-urlencoded"}}),i=o.data||{},{access_token:r,expires_in:n}=i;r||(T("获取 token 失败(授权配置错误):响应中未包含 access_token,"+JSON.stringify(o.data),e),process.exit(1));const a=parseInt(n)||3600;return this.tokenCache={...i,token:r,expiresAt:Date.now()+1e3*(a-60)},e.clear(),e.stop(),r}catch(o){T("获取 token 失败",e),T(`\n获取 token 失败: ${o.message||o.msg}`),T(`\ntoken 授权地址: ${s}`),T(`\ntoken 请求参数: ${t}`),o.response&&T(`响应数据: ${JSON.stringify(o.response.data)}`),process.exit(1)}}async getTokenByOAuth2(){const e=w("获取 token(OAuth2 模式)...").start();try{const t={loginURL:this.NeoCrmAPI.loginURL,tokenURL:this.NeoCrmAPI.tokenURL},s=new $(t),o=await s.getAccessToken(),i=o.access_token;return this.tokenCache={...o,token:i,expiresAt:Date.now()+72e5},e.clear(),e.stop(),i}catch(t){T("获取 token 失败(OAuth2 模式)",e),T(`\n获取 token 失败: ${t.message||t.msg}`),t.response&&T(`响应数据: ${JSON.stringify(t.response.data)}`),process.exit(1)}}async refreshToken(){return this.tokenCache={token:null,expiresAt:null},await this.getToken()}async ensureValidToken(){if(!this.tokenCache.token)return await this.getToken();if(this.isTokenExpired()){const e=w("token 已过期,正在刷新...").start();try{const t=await this.refreshToken();return F("token 刷新成功。",e),t}catch(t){throw T("token 刷新失败。",e),t}}return this.tokenCache.token}async uploadFile(e,t={}){const s=await this.ensureValidToken();if(!e||"string"!=typeof e)throw new Error(`文件路径无效: ${e}`);if(!y.existsSync(e))throw new Error(`文件不存在: ${e}`);const o=y.statSync(e);if(!o.isFile())throw new Error(`路径不是文件: ${e}`);const i=t.maxSize||5242880;if(o.size>i){const e=(o.size/1024/1024).toFixed(2),t=(i/1024/1024).toFixed(2);throw new Error(`文件大小超过限制: ${e}MB > ${t}MB`)}if(0===o.size)throw new Error(`文件为空: ${e}`);const r=g.basename(e),n=(o.size/1024).toFixed(2),a=w(`正在上传文件: ${r} (${n}KB)...`).start();try{const o=new f,i=t.fieldName||"customComponentCode",n=y.createReadStream(e);o.append(i,n,r);const c=this.uploadAPI(),l=t.timeout||6e4,h={headers:{Authorization:`Bearer ${s}`,"xsy-inner-source":"bff",...o.getHeaders()},timeout:l,maxContentLength:1/0,maxBodyLength:1/0},u=await m.post(c,o,h);let d;const p=u.data;if(200!==u.status&&201!==u.status)throw new Error(`上传失败: HTTP ${u.status}`);if("string"==typeof p)d=p.trim();else{if(!p||"object"!=typeof p)throw new Error("响应数据格式不正确: "+typeof p);if(void 0!==p.code&&200!==p.code&&0!==p.code){const e=p.message||p.msg||"未知错误";throw new Error(`上传失败: ${e} (code: ${p.code})`)}d=void 0!==p.data?p.data:void 0!==p.url?p.url:void 0!==p.fileUrl?p.fileUrl:p}if(!d)throw new Error("返回的文件地址为空");let g;return"string"==typeof d?g=d:d&&"object"==typeof d&&d.url&&(g=d.url),F(`文件上传成功: ${r} -> ${g}`,a),g}catch(t){if(T(`上传文件失败: ${t.message||t.msg}, 文件路径: ${e}`,a),t.response){const e=t.response.status,s=t.response.statusText,o=t.response.data,i=t.config?.url||this.uploadAPI();if(T("\n========== 上传请求详情 =========="),T(`请求 URL: ${i}`),T(`HTTP 状态码: ${e} ${s}`),T(`响应数据: ${JSON.stringify(o)}`),T("==================================\n"),404===e)throw new Error(`上传 API 不存在 (404): ${i}\n请检查 neo.config.js 中的 neoBaseURL 配置是否正确,或者 API 路径是否存在。\n当前配置的 API 路径: ${this.NeoCrmAPI.uploadAPI}`)}else t.request&&T("请求已发送但未收到响应,请检查网络连接或代理配置。");throw t}}async publish2oss(e,t=[".js",".css",".zip"]){if(!e)return void T(`自定义组件名称不能为空: ${e}`);if(!y.existsSync(this.assetsRoot))return void T(`未找到自定义组件资源目录: ${this.assetsRoot}`);const s={cmpType:e},o=y.readdirSync(this.assetsRoot).map(async o=>{const i=g.join(this.assetsRoot,o),r=y.statSync(i),n=g.parse(i);if(r.isFile()&&t.includes(n.ext)){let t=k.camelCase(e);if(o.indexOf(t)<0)return;try{const e=await this.uploadFile(i);o.indexOf("Model")>-1?s.modelAsset=e:o.endsWith(".css")?s.cssAsset=e:o.endsWith(".zip")?s.codeLib=e:s.asset=e}catch(e){T(`文件上传失败(${o}):\n`),process.exit(1)}}});return await Promise.all(o),s&&s.cmpType&&(console.info("上传至 OSS 的文件信息:\n",s),C(s)),s}async getCmpAssets(e,t=[".js",".css",".zip"]){if(!e)return void T(`自定义组件名称不能为空: ${e}`);if(!y.existsSync(this.assetsRoot))return void T(`未找到自定义组件资源目录: ${this.assetsRoot}`);const s={cmpType:e};return y.readdirSync(this.assetsRoot).forEach(o=>{const i=g.join(this.assetsRoot,o),r=y.statSync(i),n=g.parse(i);if(r.isFile()&&t.includes(n.ext)){let t=k.camelCase(e);if(o.indexOf(t)<0)return;const n=5242880;if(r.size>n){const e=(r.size/1024/1024).toFixed(2),t=(n/1024/1024).toFixed(2);throw new Error(`${o} 文件大小超过限制: ${e}MB > ${t}MB`)}const a={fileContent:y.createReadStream(i),fileName:o,fileSize:r.size};o.indexOf("Model")>-1?s.modelAssetFile=a:o.endsWith(".css")?s.cssAssetFile=a:o.endsWith(".zip")?s.codeLibFile=a:s.assetFile=a}}),s}async updateCustomComponent(e){const t=await this.ensureValidToken();if(!e)throw new Error("componentData 不能为空");const s=w("正在保存自定义组件信息...").start();try{const o=this.saveAPI(),i=new f;e.assetFile&&i.append("assetFile",e.assetFile.fileContent,e.assetFile.fileName),e.modelAssetFile&&i.append("modelAssetFile",e.modelAssetFile.fileContent,e.modelAssetFile.fileName),e.cssAssetFile&&i.append("cssAssetFile",e.cssAssetFile.fileContent,e.cssAssetFile.fileName),e.codeLibFile&&i.append("codeLibFile",e.codeLibFile.fileContent,e.codeLibFile.fileName),i.append("component",JSON.stringify(k.omit(e,["assetFile","modelAssetFile","cssAssetFile","codeLibFile"])));const r=await m.post(o,i,{headers:{Authorization:`Bearer ${t}`,"xsy-inner-source":"bff",...i.getHeaders()},timeout:12e4,maxContentLength:1/0,maxBodyLength:1/0}),{code:n,message:a,msg:c}=r.data||{};n&&200!==n&&(T(`保存自定义组件信息失败: ${a||c||"未知错误"}`),process.exit(1)),s.clear(),s.stop()}catch(e){const t=e.message||e.msg;T(t?`保存自定义组件信息失败: ${t}`:`保存自定义组件信息失败: ${JSON.stringify(e)}`,s),process.exit(1)}}async getCustomCmpList(){const e=await this.ensureValidToken();try{let t=this.buildFullUrl(this.NeoCrmAPI.queryAll);t+=`&fields=${b.join(",")}`;const s=await m.get(t,{headers:{Authorization:`Bearer ${e}`,"xsy-inner-source":"bff","Content-Type":"application/json"}}),{code:o,message:i,msg:r}=s.data||{};o&&200!==o&&(T(`获取自定义组件列表失败: ${i||r||"未知错误"}`),process.exit(1)),this.updateCustomCmpList(s.data.data||[])}catch(e){const t=e.message||e.msg;T(t?`获取自定义组件列表失败: ${t}`:`响应数据: ${JSON.stringify(e)}`),process.exit(1)}return this.cmpList||[]}getCodeLibByCmpType(e){return e?this.buildFullUrl(this.NeoCrmAPI.getCodeLibAPI(e)):null}async deleteCmp(e){const t=await this.ensureValidToken();e||(T("自定义组件名称不能为空。"),process.exit(1));let s=this.buildFullUrl(this.NeoCrmAPI.delete);s+=`/${e}`;const o=await m.delete(s,{headers:{Authorization:`Bearer ${t}`,"xsy-inner-source":"bff","Content-Type":"application/json"}}),{code:i,message:r,msg:n,errorInfo:a}=o.data||{};return i&&200!==i&&(a&&a.length>0?P(a,{title:"删除自定义组件失败",columns:["reason","instance"],headers:{name:"原因",age:"实例"},align:{name:"center",city:"center"},padding:2,showBorder:!0}):T(`删除自定义组件失败: ${r||n||"未知错误"}`),process.exit(1)),o.data}getCmpListByFramework(e){if(!e)return this.cmpList;const t=x(e);return this.cmpList.filter(e=>e.framework===t)}getCmpInfoByCmpType(e){return e&&this.cmpInfoMap[e]||null}updateCustomCmpList(e){e&&Array.isArray(e)&&(this.cmpList=e,e.forEach(e=>{this.cmpInfoMap[e.cmpType]=e}))}async request(e,t,s={}){const o=await this.ensureValidToken(),{data:i,headers:r={},params:n}=s,a=this.buildFullUrl(t);try{const t=await m({method:e,url:a,data:i,params:n,headers:{Authorization:`Bearer ${o}`,"xsy-inner-source":"bff",...r}});if(t.data&&t.data.code&&200!==t.data.code)throw new Error(`请求失败: ${t.data.message||t.data.msg||"未知错误"}`);return t.data}catch(s){throw T(`请求失败 [${e} ${t}]: ${s.message||s.msg}`),s.response&&T(`响应数据: ${JSON.stringify(s.response.data)}`),s}}async get(e,t={}){return await this.request("GET",e,t)}async post(e,t={}){return await this.request("POST",e,t)}async put(e,t={}){return await this.request("PUT",e,t)}async delete(e,t={}){return await this.request("DELETE",e,t)}}};
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});var e="1.9.29";const o={version:e};exports.default=o,exports.version=e;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});var e="1.9.32";const o={version:e};exports.default=o,exports.version=e;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("chalk"),r=require("./neoParams.js");var o,n;exports.__require=function(){if(n)return o;n=1;const t=e,{consoleTag:l}=r.__require();function c(e,r,o,n){const t=function(e){const r=/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g;return e.replace(r,"").length}(e),l=r-2*n,c=" ".repeat(n);if(t>=l)return c+e.slice(0,l)+c;const a=l-t;switch(o){case"right":return c+" ".repeat(a)+e+c;case"center":const r=Math.floor(a/2),o=a-r;return c+" ".repeat(r)+e+" ".repeat(o)+c;default:return c+e+" ".repeat(a)+c}}return o={tableLog:function(e,r={}){if(!Array.isArray(e)||0===e.length)return void console.log(`${l} ${t.yellow("警告: 数据为空或格式不正确")}`);const{columns:o,headers:n={},align:a={},padding:s=1,showBorder:g=!0,title:i}=r,u=(o||Object.keys(e[0])).filter(e=>!o||o.includes(e));if(0===u.length)return void console.log(`${l} ${t.yellow("警告: 没有可显示的列")}`);const $={};u.forEach(r=>{const o=n[r]||r;let t=String(o).length;e.forEach(e=>{const o=e[r],n=null!=o?String(o):"";t=Math.max(t,n.length)}),$[r]=t+2*s});const y=g?t.gray("─".repeat(u.reduce((e,r)=>e+$[r]+3,1))):"";i&&console.log(`${l} ${t.cyan.bold(i)}`),g&&y&&console.log(`${l} ${t.gray("┌")}${y.slice(1,-1)}${t.gray("┐")}`);const f=u.map((e,r)=>{const o=c(n[e]||e,$[e],a[e]||"left",s);return t.bold.cyan(o)}).join(g?t.gray(" │ "):" ");console.log(`${l} ${g?t.gray("│ "):""}${f}${g?t.gray(" │"):""}`),g&&y&&console.log(`${l} ${t.gray("├")}${y.slice(1,-1).replace(/─/g,"─")}${t.gray("┤")}`),e.forEach((e,r)=>{const o=u.map((r,o)=>{const n=e[r];return c(null!=n?String(n):"",$[r],a[r]||"left",s)}).join(g?t.gray(""):" ");console.log(`${l} ${g?t.gray("│ "):""}${o}${g?t.gray(" │"):""}`)}),g&&y&&console.log(`${l} ${t.gray("└")}${y.slice(1,-1)}${t.gray("┘")}`)}}};
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("chalk"),r=require("./neoParams.js");var t,n;exports.__require=function(){if(n)return t;n=1;const o=e,{consoleTag:c}=r.__require(),a=/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g;function i(e,r,t,n,c,i){return e.map(e=>{const l=function(e,r,t,n){const o=f(e),c=r-2*n,i=" ".repeat(n);let l=e;o>c&&(l=function(e,r){if(!e)return"";const t=e.replace(a,"");let n=0,o="";for(let e=0;e<t.length;e++){const c=t[e],a=u(c.charCodeAt(0))?2:1;if(n+a>r)break;o+=c,n+=a}return o}(e,c));const s=f(l),g=c-s;switch(t){case"right":return i+" ".repeat(g)+l+i;case"center":{const e=Math.floor(g/2),r=g-e;return i+" ".repeat(e)+l+" ".repeat(r)+i}default:return i+l+" ".repeat(g)+i}}(String(i?t[e]||e:t[e]??""),r[e],n[e]||"left",c);return i?o.bold.cyan(l):l})}function l(e,r){const t=r?o.gray(" │ "):" ",n=r?o.gray("│ "):"",c=r?o.gray(" │"):"";console.log(n+e.join(t)+c)}function s(e,r,t){const n="─".repeat(t);console.log(o.gray(e+n+r))}function u(e){return e>=19968&&e<=40959||e>=13312&&e<=19903||e>=63744&&e<=64255||e>=65280&&e<=65519||e>=12288&&e<=12351||e>=131072&&e<=173791}function f(e){if(!e)return 0;const r=e.replace(a,"");let t=0;for(let e=0;e<r.length;e++){t+=u(r[e].charCodeAt(0))?2:1}return t}return t={tableLog:function(e,r={}){if(!Array.isArray(e)||0===e.length)return void console.log(`${c} ${o.yellow("警告: 数据为空或格式不正确")}`);const{columns:t,headers:n={},align:a={},padding:u=1,showBorder:g=!0,title:d}=r,h=function(e,r){if(r&&Array.isArray(r))return r.filter(r=>e[0]&&r in e[0]);return Object.keys(e[0]||{})}(e,t);if(0===h.length)return void console.log(`${c} ${o.yellow("警告: 没有可显示的列")}`);const y=function(e,r,t,n){const o={};return r.forEach(r=>{let c=f(String(t[r]||r));e.forEach(e=>{const t=e[r],n=null!=t?String(t):"";c=Math.max(c,f(n))}),o[r]=c+2*n}),o}(e,h,n,u);!function(e,r,t,n){const{headers:c,align:a,padding:u,showBorder:f,title:g}=n;g&&console.log(o.cyan.bold(g));const d=f?r.reduce((e,r)=>e+t[r]+3,1)-2:0;f&&s("","┐",d);const h=i(r,t,c,a,u,!0);l(h,f),f&&s("├","┤",d);e.forEach(e=>{l(i(r,t,e,a,u,!1),f)}),f&&s("","",d)}(e,h,y,{headers:n,align:a,padding:u,showBorder:g,title:d})}}};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "neo-cmp-cli",
3
- "version": "1.9.30",
3
+ "version": "1.9.32",
4
4
  "description": "Neo 自定义组件开发工具,支持react 和 vue2.0技术栈。",
5
5
  "keywords": [
6
6
  "neo-cli",
@@ -10,113 +10,47 @@ function resolve(dir) {
10
10
  // 包括生产和开发的环境配置信息
11
11
  module.exports = {
12
12
  settings: {
13
- enableESLint: false, // 调试模式是否开启ESLint,默认开启ESLint检测代码格式
14
- enableESLintFix: false, // 是否自动修正代码格式,默认不自动修正
15
- enableStyleLint: false, // 是否开启StyleLint,默认开启ESLint检测代码格式
16
- enableStyleLintFix: false, // 是否需要StyleLint自动修正代码格式
13
+ enableESLint: false,
14
+ enableESLintFix: false,
15
+ enableStyleLint: false,
16
+ enableStyleLintFix: false
17
17
  },
18
18
  webpack: {
19
- target: ['web', 'es5'], // 指定目标环境为 web 和 es5,确保兼容性
19
+ target: [
20
+ "web",
21
+ "es5"
22
+ ],
20
23
  resolve: {
21
- // webpack的resolve配置
22
- extensions: ['.js', '.jsx', '.ts', '.tsx', '.umd.js', '.min.js', '.json'], // 用于配置webpack在尝试过程中用到的后缀列表
24
+ extensions: [
25
+ ".js",
26
+ ".jsx",
27
+ ".ts",
28
+ ".tsx",
29
+ ".umd.js",
30
+ ".min.js",
31
+ ".json"
32
+ ],
23
33
  alias: {
24
- '@': resolve('src'),
25
- $assets: resolve('src/assets'),
26
- $public: resolve('public'),
27
- $utils: resolve('src/utils'),
28
- },
34
+ "@": resolve("./src"),
35
+ $assets: resolve("./src/assets"),
36
+ $public: resolve("./public"),
37
+ $utils: resolve("./src/utils")
38
+ }
29
39
  },
30
- // sassResources中的sass文件会自动注入每一个sass文件中
31
40
  sassResources: [
32
- resolve('./src/assets/css/common.scss'),
33
- resolve('./src/assets/css/mixin.scss'),
41
+ resolve("./src/assets/css/common.scss"),
42
+ resolve("./src/assets/css/mixin.scss")
34
43
  ],
35
- // createDeclaration: true, // 打包时是否创建ts声明文件
36
- ignoreNodeModules: false, // 打包时是否忽略 node_modules
37
- // allowList: [], // ignoreNodeModules为true时生效
38
- // projectDir: ['src'],
39
- // template: resolve('./public/template.html'), // 自定义html模板
40
- // plugins: [],
41
- // babelPlugins: [],
42
- },
43
- // 用于添加 Neo 共享依赖模块的配置信息
44
- /*
45
- neoCommonModule: {
46
- // exports: ['xxModule'], // 数组写法,用于导出当前自定义组件中的第三方依赖模块
47
- exports: { // 对象写法,可用于导出自定义组件中的某个内容模块(需要使用绝对路径导出)
48
- 'xxModule': path.resolve('./src/components/xxModule'), // 导出 xx组件 或 xx模块
49
- },
50
- // remoteDeps: ['xxCmpType'], // 远程依赖组件,表示当前自定义组件会用到的依赖组件,需要和 externals 配合使用
51
- // externals: ['xxModule'], // 自定义组件中需要剔除的模块,仅支持数组写法
52
- },
53
- */
54
- preview: {
55
- // 用于开启本地预览模式的相关配置信息
56
- /*
57
- 【特别说明】以下配置项都自带默认值,非必填。如需自定义请自行配置。
58
- entry: { // 根据 src/components 目录下的文件自动生成 entry 相关配置
59
- // 本地预览自定义组件内容
60
- index: './src/preview.jsx',
61
- },
62
- NODE_ENV: 'development',
63
- port: 80, // 设置基础端口,如果被占用则自动寻找可用端口
64
- assetsPublicPath: '/', // 设置静态资源的引用路径(根域名+路径)
65
- assetsSubDirectory: '',
66
- hostname: 'localhost',
67
- proxyTable: {
68
- '/apiTest': {
69
- target: 'http://api-test.com.cn', // 不支持跨域的接口根地址
70
- ws: true,
71
- changeOrigin: true,
72
- },
73
- },
74
- */
75
- },
76
- linkDebug: {
77
- // 用于开启本地调试模式的相关配置信息
78
- /*
79
- 【特别说明】以下配置项都自带默认值,非必填。如需自定义请自行配置。
80
- entry: { // 根据 src/components 目录下的文件自动生成 entry 相关配置
81
- // 外链调试(在线上页面设计器端预览自定义组件)
82
- index: [
83
- './src/components/xxCmp/register.ts',
84
- './src/components/xxCmp/model.ts',
85
- ],
86
- },
87
- NODE_ENV: 'development',
88
- port: 80, // 设置基础端口,如果被占用则自动寻找可用端口
89
- closeHotReload: true, // 是否关闭热更新
90
- assetsPublicPath: '/', // 设置静态资源的引用路径(根域名+路径)
91
- assetsSubDirectory: '',
92
- hostname: 'localhost',
93
- proxyTable: {
94
- '/apiTest': {
95
- target: 'http://api-test.com.cn', // 不支持跨域的接口根地址
96
- ws: true,
97
- changeOrigin: true,
98
- },
99
- }
100
- */
44
+ ignoreNodeModules: false
101
45
  },
102
- // 选择「自定义环境」时需要添加 NeoCRM 平台配置,可自定义对接的任何环境
46
+ preview: {},
47
+ linkDebug: {},
103
48
  neoConfig: {
104
- // authType: 'oauth2', // 默认授权模式:OAuth2 授权码模式
105
- neoBaseURL: 'https://crm-test.xiaoshouyi.com', // 平台根地址(默认:https://crm.xiaoshouyi.com)
106
- loginURL: 'https://login-test.xiaoshouyi.com/auc/oauth2/auth', // 登录授权 URL(默认:https://login.xiaoshouyi.com/auc/oauth2/auth)
107
- tokenURL: 'https://login-test.xiaoshouyi.com/auc/oauth2/token', // Token 获取接口地址(默认:https://login.xiaoshouyi.com/auc/oauth2/token)
108
- },
109
- pushCmp: {
110
- // 用于构建并发布至 NeoCRM 的相关配置
111
- /*
112
- 【特别说明】以下配置项都自带默认值,非必填。如需自定义请自行配置。
113
- NODE_ENV: 'production',
114
- entry: { // 根据 src/components 目录下的文件自动生成 entry 相关配置
115
- InfoCardModel: './src/components/xxCmp/model.ts',
116
- infoCard: './src/components/xxCmp/register.ts'
117
- },
118
- cssExtract: false, // 不额外提取css文件
119
- assetsRoot: resolve('dist') // 上传指定目录下的脚本文件
120
- */
49
+ neoBaseURL: "https://crm-test.xiaoshouyi.com",
50
+ loginURL: "https://login-test.xiaoshouyi.com/auc/oauth2/auth",
51
+ tokenURL: "https://login-test.xiaoshouyi.com/auc/oauth2/token",
52
+ authType: "oauth2",
53
+ tokenAPI: "https://login-test.xiaoshouyi.com/auc/oauth2/token"
121
54
  },
55
+ pushCmp: {}
122
56
  };
@@ -0,0 +1 @@
1
+ <?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1760670196857" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4651" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M485.888 626.496 512 663.488l26.112-36.992c1.088-1.472 107.392-151.68 140.864-189.184C715.776 396.224 736 343.168 736 288 736 164.544 635.52 64 512 64s-224 100.48-224 224c0 55.232 20.224 108.288 57.088 149.376C378.624 474.816 484.8 625.024 485.888 626.496zM512 128c88.256 0 160 71.808 160 160 0 39.424-14.464 77.312-40.768 106.688C606.016 422.912 546.624 504.64 512 552.896 477.44 504.64 418.048 422.912 392.768 394.688 366.528 365.376 352 327.488 352 288 352 199.808 423.744 128 512 128zM512 384c52.928 0 96-43.072 96-96S564.928 192 512 192 416 235.072 416 288 459.072 384 512 384zM512 256c17.6 0 32 14.336 32 32S529.6 320 512 320 480 305.664 480 288 494.4 256 512 256zM960 129.024l0 703.168L680 960 384 832l-320 127.36L64 258.176l168.256-67.904C227.264 211.456 224 233.28 224 256c0 2.176 0.512 4.224 0.576 6.4L128 301.376l0 563.648 192-76.416L320 476.032c18.048 23.36 41.472 55.104 64 86.144l0 200.96 1.024-0.384 24.384 10.56L640 872.96 640 562.304c22.976-31.616 46.208-63.168 64-86.144l0 402.56 192-87.68L896 228.608l-97.536 44.544C798.784 267.392 800 261.76 800 256c0-17.664-2.176-34.752-5.184-51.584L960 129.024z" p-id="4652" fill="#0764f5"></path></svg>
@@ -0,0 +1,21 @@
1
+ import React from 'react';
2
+ import { Table } from 'antd';
3
+
4
+ const TableComponent = () => {
5
+ const columns = [
6
+ { title: '姓名', dataIndex: 'name', key: 'name' },
7
+ { title: '年龄', dataIndex: 'age', key: 'age' },
8
+ { title: '性别', dataIndex: 'gender', key: 'gender' },
9
+ { title: '职业', dataIndex: 'profession', key: 'profession' },
10
+ ];
11
+
12
+ const dataSource = [
13
+ { key: '1', name: '张三', age: 28, gender: '男', profession: '工程师' },
14
+ { key: '2', name: '李四', age: 32, gender: '女', profession: '设计师' },
15
+ { key: '3', name: '王五', age: 25, gender: '男', profession: '产品经理' },
16
+ ];
17
+
18
+ return <Table columns={columns} dataSource={dataSource} />;
19
+ };
20
+
21
+ export default TableComponent;
@@ -0,0 +1,55 @@
1
+ /**
2
+ * @file 自定义组件对接编辑器的描述文件
3
+ */
4
+ export class subfromModel {
5
+ // 组件名称,用于设置在编辑器左侧组件面板中展示的名称
6
+ label: string = '示例表格';
7
+
8
+ // 组件描述,用于设置在编辑器左侧组件面板中展示的描述
9
+ description: string = '暂无描述';
10
+
11
+ // 分类标签,用于设置在编辑器左侧组件面板哪个分类中展示
12
+ // tags: string[] = ['自定义组件'];
13
+
14
+ /**
15
+ * 用于设置组件支持的页面类型
16
+ *
17
+ * 当前 NeoCRM 平台存在的页面类型:
18
+ * all: 1 全页面
19
+ * entityFormPage: 4 实体表单页
20
+ * customPage: 6 自定义页面
21
+ */
22
+ targetPage: string[] = ['all'];
23
+
24
+ /**
25
+ * 用于设置组件支持的终端类型
26
+ *
27
+ * 当前 NeoCRM 平台存在的终端类型:
28
+ * web: 网页端
29
+ * mobile: 移动端
30
+ */
31
+ // targetDevice: string = 'web';
32
+
33
+
34
+ // 组件图标,用于设置在编辑器左侧组件面板中展示的图标
35
+ iconUrl: string = 'https://neo-widgets.bj.bcebos.com/custom-widget.svg';
36
+
37
+ // 初次插入页面的默认属性数据
38
+ defaultComProps = {
39
+ title: 'Hello, NeoCRM!'
40
+ };
41
+
42
+ /**
43
+ * 组件面板配置,用于生成编辑器右侧属性配置面板内容
44
+ */
45
+ propsSchema = [
46
+ {
47
+ type: 'textarea',
48
+ name: 'title',
49
+ label: '组件内容',
50
+ value: 'Hello, NeoCRM!',
51
+ },
52
+ ];
53
+ }
54
+
55
+ export default subfromModel;
@@ -0,0 +1,21 @@
1
+ :root {
2
+ --padding-bottom: 12px;
3
+ }
4
+
5
+ .subfrom__c-container {
6
+ position: relative;
7
+ box-sizing: border-box;
8
+
9
+ /* border-bottom: 1px solid #ececec; */
10
+ margin: 6px 12px;
11
+ padding: 6px var(--padding-bottom);
12
+ background-color: #fff;
13
+
14
+ .news-title {
15
+ padding: 6px 0;
16
+ font-family: PingFangSC-Regular;
17
+ font-size: 16px;
18
+ line-height: 22px;
19
+ color: #5f5e5e;
20
+ }
21
+ }
@@ -1,68 +1,40 @@
1
1
  {
2
2
  "compilerOptions": {
3
3
  "experimentalDecorators": true,
4
- /* Basic Options */
5
4
  "target": "esnext",
6
- /* 指定编译之后的版本: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017','ES2018' or 'ESNEXT'. */
7
- "module": "esnext" /* 指定要使用的模板标准: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */,
8
- // "lib": [], /* Specify library files to be included in the compilation. */
9
- "allowJs": false /* 指定是否允许编译JS文件,默认false,即不编译JS文件. */,
10
- // "checkJs": true, /* 指定是否检查和报告JS文件中的错误,默认false */
11
- "jsx": "react" /* 指定jsx代码用于的开发环境:'preserve','react-native', or 'react'. */,
12
- "declaration": false /* 指定是否在编译的时候生成相的d.ts声明文件 */,
13
- // "declarationMap": true, /* 指定编译时是否生成.map文件 */
14
- // "sourceMap": true, /* 指定编译时是否生成.map文件 */
15
- // "outFile": "./", /* 指定输出文件合并为一个文件 */
16
- // "outDir": "dist", /* 指定输出文件夹,值为一个文件夹路径字符串,输出的文件都将放置在这个文件夹*/
17
- // "rootDir": "src", /* 指定编译文件的根目录,编译器会在根目录查找入口文件 */
18
- // "composite": true, /* 是否编译构建引用项目 */
19
- // "removeComments": true, /* 指定是否将编译后的文件注释删掉,设为true的话即删除注释,默认为false */
20
- "noEmit": false /* 不生成编译文件 */,
21
- "importHelpers": true /* 指定是否引入tslib里的复制工具函数,默认为false */,
22
- // "downlevelIteration": true, /* 当target为"ES5"或"ES3"时,为"for-of" "spread"和"destructuring"中的迭代器提供完全支持 */
23
- "isolatedModules": false /* 指定是否将每个文件作为单独的模块,默认为true */,
24
-
25
- /* Strict Type-Checking Options */
26
- "strict": false /* 指定是否启动所有类型检查 */,
27
- "noImplicitAny": true /* Raise error on expressions and declarations with an implied 'any' type. */,
28
- "strictNullChecks": true /* Enable strict null checks. */,
29
- // "strictFunctionTypes": true, /* Enable strict checking of function types. */
30
- // "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */
31
- "noImplicitThis": true /* Raise error on 'this' expressions with an implied 'any' type. */,
32
- // "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */
33
-
34
- /* Additional Checks */
35
- "noUnusedLocals": false /* Report errors on unused locals. */,
36
- // "noUnusedParameters": true, /* Report errors on unused parameters. */
37
- "noImplicitReturns": true /* Report error when not all code paths in function return a value. */,
38
- // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */
39
-
40
- /* Module Resolution Options */
41
- "moduleResolution": "node" /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */,
42
- "baseUrl": "./" /* Base directory to resolve non-absolute module names. */,
5
+ "module": "esnext",
6
+ "allowJs": false,
7
+ "jsx": "react",
8
+ "declaration": false,
9
+ "noEmit": false,
10
+ "importHelpers": true,
11
+ "isolatedModules": false,
12
+ "strict": false,
13
+ "noImplicitAny": true,
14
+ "strictNullChecks": true,
15
+ "noImplicitThis": true,
16
+ "noUnusedLocals": false,
17
+ "noImplicitReturns": true,
18
+ "moduleResolution": "node",
19
+ "baseUrl": "./",
43
20
  "paths": {
44
- "@": ["./src"]
45
- } /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */,
46
- // "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */
47
- /* 指定声明文件或文件夹的路径列表,如果指定了此项,则只有在这里列出的声明文件才会被加载 */
48
- "typeRoots": ["./@types", "./node_modules/@types"],
49
- // "types": [], /* 指定需要包含的模块,只有在这里列出的模块的声明文件才会被加载 */
50
- "allowSyntheticDefaultImports": true /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */,
51
- "esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */,
52
- // "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */
53
-
54
- /* Source Map Options */
55
- // "sourceRoot": "./", /* Specify the location where debugger should locate TypeScript files instead of source locations. */
56
- // "mapRoot": "./", /* Specify the location where debugger should locate map files instead of generated locations. */
57
- // "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */
58
- // "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */
59
-
60
- /* Experimental Options */
61
- // "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */
62
- // "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */
63
- "forceConsistentCasingInFileNames": true /* Disallow inconsistently-cased references to the same file. */
64
- // "suppressImplicitAnyIndexErrors": true /* Suppress --noImplicitAny errors for indexing objects lacking index signatures. See issue #1232 for more details. */
21
+ "@": [
22
+ "./src"
23
+ ]
24
+ },
25
+ "typeRoots": [
26
+ "./@types",
27
+ "./node_modules/@types"
28
+ ],
29
+ "allowSyntheticDefaultImports": true,
30
+ "esModuleInterop": true,
31
+ "forceConsistentCasingInFileNames": true
65
32
  },
66
- "include": ["src", "test"],
67
- "exclude": ["node_modules"]
33
+ "include": [
34
+ "src",
35
+ "test"
36
+ ],
37
+ "exclude": [
38
+ "node_modules"
39
+ ]
68
40
  }