gant-core 2.0.7 → 2.0.9
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/CHANGELOG.md +12 -0
- package/lib/cli/create/module/index.mjs +1 -1
- package/lib/core/store/index.js +1 -1
- package/package.json +1 -1
- package/lib/cli/config/defineConfig.js +0 -104
- package/lib/cli/config/index.js +0 -156
- package/lib/cli/copyfiles/index.js +0 -34
- package/lib/cli/create/config/index.js +0 -1233
- package/lib/cli/create/index.js +0 -5
- package/lib/cli/create/module/index.js +0 -33215
- package/lib/cli/helper/index.d.ts +0 -17
- package/lib/cli/i18n/index.js +0 -22186
- package/lib/cli/i18n/utils.js +0 -181
- package/lib/cli/index.js +0 -3656
- package/lib/cli/ms/index.js +0 -23
- package/lib/cli/routes/index.js +0 -76
- package/lib/cli/template/core.txt +0 -1
- package/lib/cli/tsconfig/index.js +0 -71
- package/lib/cli/utils/detectPort.js +0 -121
- package/lib/cli/utils/getJavascriptfile.js +0 -15
- package/lib/cli/utils/index.d.ts +0 -18
- package/lib/cli/utils/index.js +0 -4949
- package/lib/cli/webpack/Webpack.js +0 -61
- package/lib/cli/webpack/config/analyzer.config.js +0 -18
- package/lib/cli/webpack/config/browsers.js +0 -14
- package/lib/cli/webpack/config/cssRules.js +0 -81
- package/lib/cli/webpack/config/default.config.js +0 -180
- package/lib/cli/webpack/config/development.config.js +0 -46
- package/lib/cli/webpack/config/framework/index.js +0 -26
- package/lib/cli/webpack/config/framework/react.js +0 -24
- package/lib/cli/webpack/config/framework/vue.js +0 -34
- package/lib/cli/webpack/config/index.js +0 -24
- package/lib/cli/webpack/config/production.config.js +0 -75
- package/lib/cli/webpack/plugins/copy.js +0 -21
- package/lib/cli/webpack/plugins/index.js +0 -5
- package/lib/core/event/index.js +0 -2
- package/lib/core/microservices/index.js +0 -11
- package/lib/core/utils/index.js +0 -84
- package/lib/helper/acorn-BmLbFX50.js +0 -19
- package/lib/helper/angular-DGof4p_D.js +0 -7
- package/lib/helper/babel-Nwboghbx.js +0 -22
- package/lib/helper/estree-CSMrPe9Y.js +0 -44
- package/lib/helper/flow-h7wrzCJb.js +0 -27
- package/lib/helper/glimmer-Bew2Vz0Y.js +0 -38
- package/lib/helper/graphql-BRv4I30B.js +0 -38
- package/lib/helper/html-uZad-YZz.js +0 -28
- package/lib/helper/index.js +0 -27848
- package/lib/helper/markdown-iwdpU9Ia.js +0 -68
- package/lib/helper/meriyah-UktrHj4H.js +0 -11
- package/lib/helper/postcss-H_0MYJut.js +0 -58
- package/lib/helper/typescript-CqdW0_wW.js +0 -31
- package/lib/helper/yaml-DXNEs-hZ.js +0 -170
package/lib/core/store/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{r as t}from"../request/index.js";import{groupBy as e,get as s,reduce as a,find as i,keyBy as n,pick as r,isEmpty as o,findIndex as c,isPlainObject as h,cloneDeep as u,mapValues as d,uniqBy as g}from"lodash-es";import m from"mitt";const l=new class{codeLists=[];codeMaps={};async findAllCodeList(){const s=await t("/codeList/findAll",{data:{},serviceId:"fwPlatform"})||[],a=e(s,"type");this.codeLists=s,this.codeMaps=a}getCodeLocaleList=t=>s(this.codeMaps,t,[]);getCodeLocaleName=(t,e)=>{const s=this.getCodeLocaleList(t);function n(t){const e=i(s,e=>e.value===String(t));return e?.name||""}if(Array.isArray(e)){const t=a(e,(t="",e="")=>t+","+n(e),"");return t.slice(1,t.length)}if(String(e).indexOf(",")>=0){const t=e.replace("[","").replace("]","").split(","),s=a(t,(t="",e="")=>t+","+n(e),"");return s.slice(1,s.length)}return n(e)}};l.getCodeLocaleList,l.getCodeLocaleName;const p=new class{parameterList=[];parameterMap={};findAllParameters=async()=>{const e=await t("/parameter/findAll",{serviceId:"fwPlatform",data:{}},{showError:!1})||[],s=n(e,"name");this.parameterList=e,this.parameterMap=s};getSystemParameterByName=t=>"string"==typeof t?this.parameterMap[t]:r(this.parameterMap,t)};const y=(({prefixKey:t="",storage:e=localStorage}={})=>new class{storage=e;prefixKey=t;getKey(t){return`${this.prefixKey}${t}`.toUpperCase()}set(t,e,s=604800){const a=JSON.stringify({value:e,expire:null!==s?(new Date).getTime()+1e3*s:null});this.storage.setItem(this.getKey(t),a)}get(t,e=null){const s=this.storage.getItem(this.getKey(t));if(s)try{const e=JSON.parse(s),{value:a,expire:i}=e;if(null===i||i>=Date.now())return a;this.remove(t)}catch(t){return console.error(t),e}return e}remove(t){this.storage.removeItem(this.getKey(t))}clear(){this.storage.clear()}setCookie(t,e,s=604800){document.cookie=`${this.getKey(t)}=${e}; Max-Age=${s}`}getCookie(t){const e=document.cookie.split("; ");for(let s=0,a=e.length;s<a;s++){const a=e[s].split("=");if(a[0]===this.getKey(t))return a[1]}return""}removeCookie(t){this.setCookie(t,1,-1)}clearCookie(){const t=document.cookie.match(/[^ =;]+(?==)/g);if(t)for(let e=t.length;e--;)document.cookie=t[e]+"=0;expire="+new Date(0).toUTCString()}})();class w{userIdentity={};currentUser={};isSuperAdmin=!1;roles=[];functions=[];delegations=[];userSetting={};users=[];getUserIdentity(){if(!o(this.userIdentity))return this.userIdentity;const t=y?.get("userIdentity");return t||{}}setUserIdentity(t){return this.userIdentity={...this.userIdentity,...t},y.set("userIdentity",this.userIdentity),this.userIdentity}clearUserIdentity(){y.remove("userIdentity"),this.userIdentity={}}setUserAggregateInfo=({delegations:t,roles:e,functions:s,isSuperAdmin:a,currentUser:i})=>{this.delegations=t,this.roles=e,this.functions=s,this.isSuperAdmin=a,this.currentUser=i};getUserSettingType=t=>`${this.currentUser.id}-${t}`;getUserSetting=async e=>{const s=this.getUserSettingType(e),a=this.currentUser.id;if(this.userSetting[s])return this.userSetting[s];const i=await async function(e){return t("/accountUserSelf/getUserData",{data:e,serviceId:"fwSecurity"})}({dataType:e,dataId:a+e}),n=i?.bigData?JSON.parse(i.bigData):void 0;return this.userSetting[s]=n,n};updateUserSetting=async(e,s)=>{const a=this.getUserSettingType(e),i=this.currentUser.id;return await async function(e,s){return t("/accountUserSelf/setUserData",{data:e,serviceId:"fwSecurity"},s)}({dataType:e,dataId:i+e,bigData:JSON.stringify(s)}),this.userSetting[a]=s,s};removeUserSetting=async e=>{const s=this.getUserSettingType(e),a=this.currentUser.id;await async function(e,s){return t("/accountUserSelf/delUserData",{data:e,serviceId:"fwSecurity"},s)}({dataType:e,dataId:a}),delete this.userSetting[s]};getUserInfo=async(e,a)=>{const i=c(this.users,t=>a?t.userLoginName===e:t.id===e);if(i>-1)return s(this.users,`[${i}]`);const n=a?await async function(e){return t("/security/getUserByUserLoginName",{method:"POST",data:{userLoginName:e},serviceId:"fwSecurity"})}(e):await async function(e){return t("/security/getUserById",{method:"POST",data:{id:e},serviceId:"fwSecurity"})}(e);return h(n)&&this.users.push(n),n}}const f=/^https?:\/\/(([a-zA-Z0-9_-])+(\.)?)*(:\d+)?(\/((\.)?(\?)?=?&?[a-zA-Z0-9_-](\?)?)*)*$/i,S=/^https?:\/\/(([a-zA-Z0-9_-])+(\.)?)*(:\d+)?(\/((\.)?(\?)?=?&?[a-zA-Z0-9_-](\?)?)*)*$/i,L=t=>f.test(t)||S.test(t)||0===t?.indexOf("/")?t:"/"+t,I="MENU_HISTORY_UPDATE",P="MENU_BREADCRUMBS_UPDATE";m();class U{menuDataMaps={};menuData=[];menuPathMaps={};breadcrumbs=[];menuHistorys=[];userId;emitter;constructor(){this.emitter=m()}addListenerMenuHistorys=t=>{this.emitter.on(I,t)};removeListenerMenuHistorys=t=>this.emitter.off(I,t);addListenerBreadcrumbs=t=>this.emitter.on(P,t);removeListenerBreadcrumbs=t=>this.emitter.off(P,t);getTreeMenuData=(t,e,s)=>t.map(t=>{const{id:a,path:i,leaf:n}=t,r=e[a],o={...t,key:a,path:s?s+L(i):L(i)};if(r&&!n){const t=this.getTreeMenuData(r,e,o.path);o.children=t}return this.menuDataMaps[o.path]=o,o}).sort((t,e)=>t.seqNum-e.seqNum);init=(t,s)=>{const a=u(t);if(o(a))return;const i=e(a,"parentResourceId"),{ROOT:n,...r}=i;this.menuData=this.getTreeMenuData(n,r),this.menuData=[...this.menuData];const c=d(this.menuDataMaps,"name");this.updateMenuMaps(c),this.initMenuHistorys(s)};updateMenuMaps=t=>{this.menuPathMaps={...this.menuPathMaps,...t};const e=this.menuHistorys.map(t=>{const e=this.menuPathMaps[t.pathname];return{pathname:t.pathname,name:e||t.name}}),s=this.breadcrumbs.map(t=>{const e=this.menuPathMaps[t.pathname];return{...t,name:e||t.name}});this.updatehistorys(e),this.updateBreadcrumbs(s)};liseterHistorys=t=>{let e=this.menuHistorys;this.menuDataMaps[t]?.leaf&&!e.some(e=>e.pathname===t)&&(e=[{pathname:t,name:this.menuPathMaps[t]},...e],this.updatehistorys(e))};updatehistorys=t=>{if(!this.userId)return;const e=t.map(t=>({...t,name:t.name?t.name:this.menuPathMaps[t.pathname]}));this.menuHistorys=e,this.menuHistorys=g(this.menuHistorys,"pathname"),this.emitter.emit(I,this.menuHistorys),y.set(`${this.userId}-menu-history`,this.menuHistorys)};initMenuHistorys=t=>{this.userId=t;const e=y.get(`${t}-menu-history`,this.menuHistorys);this.updatehistorys(e)};liseterBreadcrumbs=t=>{const e=t.split("/");let s=1;const a=[],i={pathname:t,name:this.menuPathMaps[t]};for(;s<e.length;){const t=e.slice(0,s).join("/");this.menuPathMaps[t]&&a.push({name:this.menuPathMaps[t],pathname:t}),s++}a.push(i),this.updateBreadcrumbs(a)};updateBreadcrumbs=t=>{this.breadcrumbs=t,this.breadcrumbs=g(this.breadcrumbs,"pathname"),this.emitter.emit(P,t)}}function C(){return t("/authentication/logout",{data:{},serviceId:"fwSecurity"})}class k{loginPathname;BASE="/";get baseLoginPathname(){return`${this.BASE}${this.loginPathname?.replace("/","")}`}tokenValue="";get isLoginPathname(){const t=window.location.pathname;return this.baseLoginPathname==t}getRealPath=t=>`${this.BASE}${t.replace("/","")}`;chekToken=async()=>{const e=await t("/authentication/checkToken",{serviceId:"fwSecurity"},{showError:!1});return e&&this.isLoginPathname&&window.location.replace(this.BASE),e};getLoginMethod=async()=>t("/authentication/getLoginMethod",{serviceId:"fwSecurity"});redirectBaseLogin=async()=>{const t=window.location.pathname,e=window.location.href;if(this.isLoginPathname)return!0;const s=new URLSearchParams(window.location.search),a=new URLSearchParams;"true"===s.get("forceLocal")&&a.append("forceLocal","true"),t!==this.BASE&&"/"!==t&&a.append("redirectUrl",e);const i=decodeURIComponent(a.toString());return window.location.replace(`${this.baseLoginPathname}${i?"?"+decodeURIComponent(a.toString()):""}`),!1};checkPassword=async()=>"noPass"!==await t("/security/checkPasswordUpdateTime",{data:{}},{showError:!1})||(this.tokenValue=await t("/authentication/extractToken",{data:{}}),!1);refactorToken=async()=>{var e;await(e=this.tokenValue,t("/authentication/refactorToken",{data:{value:e}}))};login=async t=>{const e=await this.baseLogin(t);return e.error,e};baseLogin=async e=>{const s={error:void 0,data:void 0};try{const a=await function(e){return t("/authentication/login",{data:e,serviceId:"fwSecurity"})}(e),{userToken:i,traceId:n}=a;if(i){s.data=a;return await this.checkPassword()||(s.error="passwordExpiration"),s}return n?(s.data=a,s.error="SLIDER_VERIFICATION_LOGIN",s):(s.error="passwordError",s)}catch(t){return s.error="validateError",s}};loginSuccess=()=>{let t=new URLSearchParams(window.location.search).get("redirectUrl");t?window.location.href=t:window.location.replace(this.BASE)};baseLoginOut=async t=>{const e=new URLSearchParams,s=window.location.href;window.location.pathname!==this.BASE&&e.append("redirectUrl",s),await C(),t?window.location.replace(`${this.baseLoginPathname}?${e.toString()}`):window.location.replace(this.baseLoginPathname)}}const v={sso:!1,ssoUrlSearchParams:["ticket"],ssoSuccessUrlkey:"successUrl",ssoLoginUrl:window.location.origin+"/fwSecurity/ssoAuth/login.api",ssologinOutUrl:window.location.origin+"/fwSecurity/ssoAuth/logout.api",ssoCheckTokenUrl:window.location.origin+"/fwSecurity/ssoAuth/checkToken.api"};class D{init(t){this.ssoConfig={...this.ssoConfig,...t}}ssoConfig=v;isSso=async(e,s)=>{if(!this.ssoConfig.sso)return!1;let a=!0,i=!1;try{if(i=await(n=this.ssoConfig.ssoCheckTokenUrl,t(n,{},{showError:!1})),!i)return!1}catch(t){console.error("sso",t)}var n;return e&&(a=await e(s)),a};ssoLogin=()=>{const{ssoSuccessUrlkey:t,ssoUrlSearchParams:e,ssoLoginUrl:s}=this.ssoConfig,a=new URLSearchParams(window.location.search.slice(1)),i=new URLSearchParams,n=window.location.href;return i.append(t,encodeURIComponent(n)),e.map(t=>{const e=a.get(t);e&&i.append(t,e)}),window.location.href=`${s}?${i.toString()}`,!1};ssoLoginOut=()=>{window.location.href=this.ssoConfig.ssologinOutUrl}}class A{getValidateCodeImage=e=>function(e={}){return t("/authentication/getValidateCode",{data:e,serviceId:"fwSecurity"})}(e);sliderVerificationCodeImage=()=>t("/authentication/sliderVerificationCode",{method:"POST",serviceId:"fwSecurity"});checkCaptcha=e=>{return s=e,t("/authentication/checkCaptcha",{method:"POST",data:{...s},serviceId:"fwSecurity"});var s}}class T extends k{ssoLogin;validate;noCheckPermissionsPath=[];ssoCallback;constructor(){super(),this.ssoLogin=new D,this.validate=new A}init=(t,e="/",s)=>{this.BASE=e,this.ssoCallback=s,this.noCheckPermissionsPath=t?.noCheckPermissionsPath,this.ssoLogin.init(t),this.loginPathname=t?.loginPathname||"/login"};isNoLoginRequiredPage=()=>{const t=window.location.pathname,e=this.noCheckPermissionsPath?.some(e=>this.getRealPath(e)==t);return e};loginOut=async t=>{await C();if(await this.ssoLogin.isSso(this.ssoCallback,!1))return void this.ssoLogin.ssoLoginOut();const e=new URLSearchParams,s=window.location.href;window.location.pathname!==this.BASE&&e.append("redirectUrl",s),t?window.location.replace(`${this.baseLoginPathname}?${e.toString()}`):window.location.replace(this.baseLoginPathname)};loginAuthentication=async e=>{var s;await(s=e,t("/authentication/beforeLoginCheckCode",{method:"POST",data:{...s},serviceId:"fwSecurity"})),this.loginSuccess()};redirectLogin=async()=>{if(this.ssoLogin.ssoConfig.sso){if(await this.ssoLogin.isSso())return this.ssoCallback(!0)?(this.ssoLogin.ssoLogin(),!1):!!this.isNoLoginRequiredPage()||this.redirectBaseLogin()}return!!this.isNoLoginRequiredPage()||(!!this.isLoginPathname||await this.redirectBaseLogin())}}const b=new class{userStore;menuStore;loginStore;isSuperAdmin=!1;loginCallback;constructor(){this.userStore=new w,this.menuStore=new U,this.loginStore=new T}platformLanguages=[];productInfo={isProdEnv:!1,productName:""};get isPrd(){return this.productInfo?.isProdEnv}get userInfo(){return this.userStore.currentUser}get menuData(){return this.menuStore.menuData}findPlantform=async()=>{const e=await t("/platformManage/getPlatformAggregateInfo",{method:"POST"},{showError:!1});this.platformLanguages=e.platformLanguages,this.productInfo=e.productInfo};getAggregateInfo=async e=>{const s=await async function(){return t("/security/findUserAggregateInfo",{method:"POST"})}(),{user:a,startMenus:i,isSuperAdmin:n,...r}=s;this.userStore.setUserAggregateInfo({...r,currentUser:a}),this.isSuperAdmin=n;const c="function"==typeof e?await e(s):e;this.menuStore.init(o(c)?i:c,a.id)};init=async t=>{const{base:e="/",menuData:s,loginSuccessCallback:a,ssoCallback:i}=t;this.loginStore.init(t?.loginConfig,e,i);try{const t=await this.loginStore.chekToken();return t?(this.userStore.setUserIdentity(t),await this.getAggregateInfo(s),await l.findAllCodeList(),await p.findAllParameters(),await(a?.()),!0):await this.loginStore.redirectLogin()}catch(t){console.error(t)}return!1}};const M="company-v1";var E=new class{data={};getCompanyDataType=t=>`${M}-${t}`;getCompanyData=async e=>{const s=this.getCompanyDataType(e);if(this.data[s])return this.data[s];const a=await async function(e){return t("/companyData/getCompanyData",{data:e,serviceId:"fwSecurity"})}({dataType:e,dataId:M}),i=a?.bigData?JSON.parse(a.bigData):void 0;return this.data[s]=i,i};updateCompanyData=async(e,s)=>{const a=this.getCompanyDataType(e);return await async function(e){return t("/companyData/setCompanyData",{data:e,serviceId:"fwSecurity"})}({dataType:e,dataId:M,bigData:JSON.stringify(s)}),this.data[a]=s,s};removeCompanyData=async e=>{const s=this.getCompanyDataType(e);await async function(e){return t("/companyData/delCompanyData",{data:e,serviceId:"fwSecurity"})}({dataType:e,dataId:M}),delete this.data[s]}};const O=l,$=p,B=b.userStore,N=b.loginStore,R=b.menuStore;export{P as M,I as a,O as c,E as i,N as l,R as m,$ as p,y as s,B as u};
|
|
1
|
+
import{r as t}from"../request/index.js";import{groupBy as e,get as s,reduce as a,find as i,keyBy as n,pick as r,isEmpty as o,findIndex as c,isPlainObject as h,cloneDeep as u,mapValues as d,uniqBy as g}from"lodash-es";import m from"mitt";const l=new class{codeLists=[];codeMaps={};async findAllCodeList(){const s=await t("/codeList/findAll",{data:{},serviceId:"fwPlatform"})||[],a=e(s,"type");this.codeLists=s,this.codeMaps=a}getCodeLocaleList=t=>s(this.codeMaps,t,[]);getCodeLocaleName=(t,e)=>{const s=this.getCodeLocaleList(t);function n(t){const e=i(s,e=>e.value===String(t));return e?.name||""}if(Array.isArray(e)){const t=a(e,(t="",e="")=>t+","+n(e),"");return t.slice(1,t.length)}if(String(e).indexOf(",")>=0){const t=e.replace("[","").replace("]","").split(","),s=a(t,(t="",e="")=>t+","+n(e),"");return s.slice(1,s.length)}return n(e)}};l.getCodeLocaleList,l.getCodeLocaleName;const p=new class{parameterList=[];parameterMap={};findAllParameters=async()=>{const e=await t("/parameter/findAll",{serviceId:"fwPlatform",data:{}},{showError:!1})||[],s=n(e,"name");this.parameterList=e,this.parameterMap=s};getSystemParameterByName=t=>"string"==typeof t?this.parameterMap[t]:r(this.parameterMap,t)};const y=(({prefixKey:t="",storage:e=localStorage}={})=>new class{storage=e;prefixKey=t;getKey(t){return`${this.prefixKey}${t}`.toUpperCase()}set(t,e,s=604800){const a=JSON.stringify({value:e,expire:null!==s?(new Date).getTime()+1e3*s:null});this.storage.setItem(this.getKey(t),a)}get(t,e=null){const s=this.storage.getItem(this.getKey(t));if(s)try{const e=JSON.parse(s),{value:a,expire:i}=e;if(null===i||i>=Date.now())return a;this.remove(t)}catch(t){return console.error(t),e}return e}remove(t){this.storage.removeItem(this.getKey(t))}clear(){this.storage.clear()}setCookie(t,e,s=604800){document.cookie=`${this.getKey(t)}=${e}; Max-Age=${s}`}getCookie(t){const e=document.cookie.split("; ");for(let s=0,a=e.length;s<a;s++){const a=e[s].split("=");if(a[0]===this.getKey(t))return a[1]}return""}removeCookie(t){this.setCookie(t,1,-1)}clearCookie(){const t=document.cookie.match(/[^ =;]+(?==)/g);if(t)for(let e=t.length;e--;)document.cookie=t[e]+"=0;expire="+new Date(0).toUTCString()}})();class w{userIdentity={};currentUser={};isSuperAdmin=!1;roles=[];functions=[];delegations=[];userSetting={};users=[];getUserIdentity(){if(!o(this.userIdentity))return this.userIdentity;const t=y?.get("userIdentity");return t||{}}setUserIdentity(t){return this.userIdentity={...this.userIdentity,...t},y.set("userIdentity",this.userIdentity),this.userIdentity}clearUserIdentity(){y.remove("userIdentity"),this.userIdentity={}}setUserAggregateInfo=({delegations:t,roles:e,functions:s,isSuperAdmin:a,currentUser:i})=>{this.delegations=t,this.roles=e,this.functions=s,this.isSuperAdmin=a,this.currentUser=i};getUserSettingType=t=>`${this.currentUser.id}-${t}`;getUserSetting=async e=>{const s=this.getUserSettingType(e),a=this.currentUser.id;if(this.userSetting[s])return this.userSetting[s];const i=await async function(e){return t("/accountUserSelf/getUserData",{data:e,serviceId:"fwSecurity"})}({dataType:e,dataId:a+e}),n=i?.bigData?JSON.parse(i.bigData):void 0;return this.userSetting[s]=n,n};updateUserSetting=async(e,s)=>{const a=this.getUserSettingType(e),i=this.currentUser.id;return await async function(e,s){return t("/accountUserSelf/setUserData",{data:e,serviceId:"fwSecurity"},s)}({dataType:e,dataId:i+e,bigData:JSON.stringify(s)}),this.userSetting[a]=s,s};removeUserSetting=async e=>{const s=this.getUserSettingType(e),a=this.currentUser.id;await async function(e,s){return t("/accountUserSelf/delUserData",{data:e,serviceId:"fwSecurity"},s)}({dataType:e,dataId:a}),delete this.userSetting[s]};getUserInfo=async(e,a)=>{const i=c(this.users,t=>a?t.userLoginName===e:t.id===e);if(i>-1)return s(this.users,`[${i}]`);const n=a?await async function(e){return t("/security/getUserByUserLoginName",{method:"POST",data:{userLoginName:e},serviceId:"fwSecurity"})}(e):await async function(e){return t("/security/getUserById",{method:"POST",data:{id:e},serviceId:"fwSecurity"})}(e);return h(n)&&this.users.push(n),n}}const f=/^https?:\/\/(([a-zA-Z0-9_-])+(\.)?)*(:\d+)?(\/((\.)?(\?)?=?&?[a-zA-Z0-9_-](\?)?)*)*$/i,S=/^https?:\/\/(([a-zA-Z0-9_-])+(\.)?)*(:\d+)?(\/((\.)?(\?)?=?&?[a-zA-Z0-9_-](\?)?)*)*$/i,L=t=>f.test(t)||S.test(t)||0===t?.indexOf("/")?t:"/"+t,I="MENU_HISTORY_UPDATE",P="MENU_BREADCRUMBS_UPDATE";m();class U{menuDataMaps={};menuData=[];menuPathMaps={};breadcrumbs=[];menuHistorys=[];userId;emitter;constructor(){this.emitter=m()}addListenerMenuHistorys=t=>{this.emitter.on(I,t)};removeListenerMenuHistorys=t=>this.emitter.off(I,t);addListenerBreadcrumbs=t=>this.emitter.on(P,t);removeListenerBreadcrumbs=t=>this.emitter.off(P,t);getTreeMenuData=(t,e,s)=>t.map(t=>{const{id:a,path:i,leaf:n}=t,r=e[a],o={...t,key:a,path:s?s+L(i):L(i)};if(r&&!n){const t=this.getTreeMenuData(r,e,o.path);o.children=t}return this.menuDataMaps[o.path]=o,o}).sort((t,e)=>t.seqNum-e.seqNum);init=(t,s)=>{const a=u(t);if(o(a))return;const i=e(a,"parentResourceId"),{ROOT:n,...r}=i;this.menuData=this.getTreeMenuData(n,r),this.menuData=[...this.menuData];const c=d(this.menuDataMaps,"name");this.updateMenuMaps(c),this.initMenuHistorys(s)};updateMenuMaps=t=>{this.menuPathMaps={...this.menuPathMaps,...t};const e=this.menuHistorys.map(t=>{const e=this.menuPathMaps[t.pathname];return{pathname:t.pathname,name:e||t.name}}),s=this.breadcrumbs.map(t=>{const e=this.menuPathMaps[t.pathname];return{...t,name:e||t.name}});this.updatehistorys(e),this.updateBreadcrumbs(s)};liseterHistorys=t=>{let e=this.menuHistorys;this.menuDataMaps[t]?.leaf&&!e.some(e=>e.pathname===t)&&(e=[{pathname:t,name:this.menuPathMaps[t]},...e],this.updatehistorys(e))};updatehistorys=t=>{if(!this.userId)return;const e=t.map(t=>({...t,name:t.name?t.name:this.menuPathMaps[t.pathname]}));this.menuHistorys=e,this.menuHistorys=g(this.menuHistorys,"pathname"),this.emitter.emit(I,this.menuHistorys),y.set(`${this.userId}-menu-history`,this.menuHistorys)};initMenuHistorys=t=>{this.userId=t;const e=y.get(`${t}-menu-history`,this.menuHistorys);this.updatehistorys(e)};liseterBreadcrumbs=t=>{const e=t.split("/");let s=1;const a=[],i={pathname:t,name:this.menuPathMaps[t]};for(;s<e.length;){const t=e.slice(0,s).join("/");this.menuPathMaps[t]&&a.push({name:this.menuPathMaps[t],pathname:t}),s++}a.push(i),this.updateBreadcrumbs(a)};updateBreadcrumbs=t=>{this.breadcrumbs=t,this.breadcrumbs=g(this.breadcrumbs,"pathname"),this.emitter.emit(P,t)}}function C(){return t("/authentication/logout",{data:{},serviceId:"fwSecurity"})}class k{loginPathname;BASE="/";get baseLoginPathname(){return`${this.BASE}${this.loginPathname?.replace("/","")}`}tokenValue="";get isLoginPathname(){const t=window.location.pathname;return this.baseLoginPathname==t}getRealPath=t=>`${this.BASE}${t.replace("/","")}`;chekToken=async()=>{const e=await t("/authentication/checkToken",{serviceId:"fwSecurity"},{showError:!1});return e&&this.isLoginPathname&&window.location.replace(this.BASE),e};getLoginMethod=async()=>t("/authentication/getLoginMethod",{serviceId:"fwSecurity"});redirectBaseLogin=async()=>{const t=window.location.pathname,e=window.location.href;if(this.isLoginPathname)return!0;const s=new URLSearchParams(window.location.search),a=new URLSearchParams;"true"===s.get("forceLocal")&&a.append("forceLocal","true"),t!==this.BASE&&"/"!==t&&a.append("redirectUrl",e);const i=decodeURIComponent(a.toString());return window.location.replace(`${this.baseLoginPathname}${i?"?"+decodeURIComponent(a.toString()):""}`),!1};checkPassword=async()=>"noPass"!==await t("/security/checkPasswordUpdateTime",{data:{}},{showError:!1})||(this.tokenValue=await t("/authentication/extractToken",{data:{}}),!1);refactorToken=async()=>{var e;await(e=this.tokenValue,t("/authentication/refactorToken",{data:{value:e}}))};login=async t=>{const e=await this.baseLogin(t);return e.error,e};baseLogin=async e=>{const s={error:void 0,data:void 0};try{const a=await function(e){return t("/authentication/login",{data:e,serviceId:"fwSecurity"})}(e),{userToken:i,traceId:n}=a;if(i){s.data=a;return await this.checkPassword()||(s.error="passwordExpiration"),s}return n?(s.data=a,s.error="SLIDER_VERIFICATION_LOGIN",s):(s.error="passwordError",s)}catch(t){return s.error="validateError",s}};loginSuccess=()=>{let t=new URLSearchParams(window.location.search).get("redirectUrl");t?window.location.href=t:window.location.replace(this.BASE)};baseLoginOut=async t=>{const e=new URLSearchParams,s=window.location.href;window.location.pathname!==this.BASE&&e.append("redirectUrl",s),await C(),t?window.location.replace(`${this.baseLoginPathname}?${e.toString()}`):window.location.replace(this.baseLoginPathname)}}const v={sso:!1,ssoUrlSearchParams:["ticket"],ssoSuccessUrlkey:"successUrl",ssoLoginUrl:window.location.origin+"/fwSecurity/ssoAuth/login",ssologinOutUrl:window.location.origin+"/fwSecurity/ssoAuth/logout",ssoCheckTokenUrl:window.location.origin+"/fwSecurity/ssoAuth/checkToken"};class D{init(t){this.ssoConfig={...this.ssoConfig,...t}}ssoConfig=v;isSso=async(t,e)=>{if(!this.ssoConfig.sso)return!1;let s=!0;return t&&(s=await t(e)),s};ssoLogin=()=>{const{ssoSuccessUrlkey:t,ssoUrlSearchParams:e,ssoLoginUrl:s}=this.ssoConfig,a=new URLSearchParams(window.location.search.slice(1)),i=new URLSearchParams,n=window.location.href;return i.append(t,encodeURIComponent(n)),e.map(t=>{const e=a.get(t);e&&i.append(t,e)}),window.location.href=`${s}?${i.toString()}`,!1};ssoLoginOut=()=>{window.location.href=this.ssoConfig.ssologinOutUrl}}class A{getValidateCodeImage=e=>function(e={}){return t("/authentication/getValidateCode",{data:e,serviceId:"fwSecurity"})}(e);sliderVerificationCodeImage=()=>t("/authentication/sliderVerificationCode",{method:"POST",serviceId:"fwSecurity"});checkCaptcha=e=>{return s=e,t("/authentication/checkCaptcha",{method:"POST",data:{...s},serviceId:"fwSecurity"});var s}}class b extends k{ssoLogin;validate;noCheckPermissionsPath=[];ssoCallback;constructor(){super(),this.ssoLogin=new D,this.validate=new A}init=(t,e="/",s)=>{this.BASE=e,this.ssoCallback=s,this.noCheckPermissionsPath=t?.noCheckPermissionsPath,this.ssoLogin.init(t),this.loginPathname=t?.loginPathname||"/login"};isNoLoginRequiredPage=()=>{const t=window.location.pathname,e=this.noCheckPermissionsPath?.some(e=>this.getRealPath(e)==t);return e};loginOut=async t=>{await C();if(await this.ssoLogin.isSso(this.ssoCallback,!1))return void this.ssoLogin.ssoLoginOut();const e=new URLSearchParams,s=window.location.href;window.location.pathname!==this.BASE&&e.append("redirectUrl",s),t?window.location.replace(`${this.baseLoginPathname}?${e.toString()}`):window.location.replace(this.baseLoginPathname)};loginAuthentication=async e=>{var s;await(s=e,t("/authentication/beforeLoginCheckCode",{method:"POST",data:{...s},serviceId:"fwSecurity"})),this.loginSuccess()};redirectLogin=async()=>{if(this.ssoLogin.ssoConfig.sso){if(await this.ssoLogin.isSso())return this.ssoCallback(!0)?(this.ssoLogin.ssoLogin(),!1):!!this.isNoLoginRequiredPage()||this.redirectBaseLogin()}return!!this.isNoLoginRequiredPage()||(!!this.isLoginPathname||await this.redirectBaseLogin())}}const M=new class{userStore;menuStore;loginStore;isSuperAdmin=!1;loginCallback;constructor(){this.userStore=new w,this.menuStore=new U,this.loginStore=new b}platformLanguages=[];productInfo={isProdEnv:!1,productName:""};get isPrd(){return this.productInfo?.isProdEnv}get userInfo(){return this.userStore.currentUser}get menuData(){return this.menuStore.menuData}findPlantform=async()=>{const e=await t("/platformManage/getPlatformAggregateInfo",{method:"POST"},{showError:!1});this.platformLanguages=e.platformLanguages,this.productInfo=e.productInfo};getAggregateInfo=async e=>{const s=await async function(){return t("/security/findUserAggregateInfo",{method:"POST"})}(),{user:a,startMenus:i,isSuperAdmin:n,...r}=s;this.userStore.setUserAggregateInfo({...r,currentUser:a}),this.isSuperAdmin=n;const c="function"==typeof e?await e(s):e;this.menuStore.init(o(c)?i:c,a.id)};init=async t=>{const{base:e="/",menuData:s,loginSuccessCallback:a,ssoCallback:i}=t;this.loginStore.init(t?.loginConfig,e,i);try{const t=await this.loginStore.chekToken();return t?(this.userStore.setUserIdentity(t),await this.getAggregateInfo(s),await l.findAllCodeList(),await p.findAllParameters(),await(a?.()),!0):await this.loginStore.redirectLogin()}catch(t){console.error(t)}return!1}};const T="company-v1";var O=new class{data={};getCompanyDataType=t=>`${T}-${t}`;getCompanyData=async e=>{const s=this.getCompanyDataType(e);if(this.data[s])return this.data[s];const a=await async function(e){return t("/companyData/getCompanyData",{data:e,serviceId:"fwSecurity"})}({dataType:e,dataId:T}),i=a?.bigData?JSON.parse(a.bigData):void 0;return this.data[s]=i,i};updateCompanyData=async(e,s)=>{const a=this.getCompanyDataType(e);return await async function(e){return t("/companyData/setCompanyData",{data:e,serviceId:"fwSecurity"})}({dataType:e,dataId:T,bigData:JSON.stringify(s)}),this.data[a]=s,s};removeCompanyData=async e=>{const s=this.getCompanyDataType(e);await async function(e){return t("/companyData/delCompanyData",{data:e,serviceId:"fwSecurity"})}({dataType:e,dataId:T}),delete this.data[s]}};const $=l,E=p,B=M.userStore,N=M.loginStore,R=M.menuStore;export{P as M,I as a,$ as c,O as i,N as l,R as m,E as p,y as s,B as u};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
package/package.json
CHANGED
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
'use strict';
|
|
3
|
-
|
|
4
|
-
var utils_index = require('../utils/index.js');
|
|
5
|
-
|
|
6
|
-
const defaultConfig = {
|
|
7
|
-
setting: {
|
|
8
|
-
BASE_CONFIG: {
|
|
9
|
-
title: {
|
|
10
|
-
zh_CN: '甘棠软件Core脚手架',
|
|
11
|
-
en: 'Gantsoftwore core framework',
|
|
12
|
-
},
|
|
13
|
-
slogan: {
|
|
14
|
-
zh_CN: '欢迎使用甘棠旗下的软件产品',
|
|
15
|
-
en: 'Welcome to using the software products offered by GantSoftware',
|
|
16
|
-
},
|
|
17
|
-
copyright: 'Copyright ©2012-{now} Gant Software All rights reserved.',
|
|
18
|
-
},
|
|
19
|
-
MAIN_CONFIG: {
|
|
20
|
-
//请求超时时间
|
|
21
|
-
requestTimeout: 64 * 1000,
|
|
22
|
-
//登陆配置
|
|
23
|
-
loginConfig: {
|
|
24
|
-
loginPathname: '/login',
|
|
25
|
-
loginOut: true,
|
|
26
|
-
loginType: ['account'],
|
|
27
|
-
},
|
|
28
|
-
homePath: '/dashboard',
|
|
29
|
-
headerMenu: true,
|
|
30
|
-
navType: 'tabs',
|
|
31
|
-
functionsConfig: {
|
|
32
|
-
//消息通知
|
|
33
|
-
notification: true,
|
|
34
|
-
//开启websocket
|
|
35
|
-
websocket: true,
|
|
36
|
-
//全局搜索
|
|
37
|
-
globalSearch: true,
|
|
38
|
-
//国际化
|
|
39
|
-
locale: true,
|
|
40
|
-
//转化工具
|
|
41
|
-
transformTool: true,
|
|
42
|
-
//热键全屏工具
|
|
43
|
-
hotKeyTool: true,
|
|
44
|
-
//全屏工具
|
|
45
|
-
fullScreenTool: true,
|
|
46
|
-
//测网速工具
|
|
47
|
-
networkSpeedTool: true,
|
|
48
|
-
//录制模式工具
|
|
49
|
-
recordModeTool: true,
|
|
50
|
-
//debugger 工具
|
|
51
|
-
debuggerTool: true,
|
|
52
|
-
//紧凑模式
|
|
53
|
-
compactMode: true,
|
|
54
|
-
//暗黑模式
|
|
55
|
-
drakMode: true,
|
|
56
|
-
//会议模式
|
|
57
|
-
meettingMode: true,
|
|
58
|
-
//动效模式
|
|
59
|
-
motionMode: true,
|
|
60
|
-
//全部菜单
|
|
61
|
-
menuCollection: true,
|
|
62
|
-
//版本信息
|
|
63
|
-
version: true,
|
|
64
|
-
//版本更新自动刷新页面
|
|
65
|
-
autoDetectVersion: true,
|
|
66
|
-
//本地数据库加密 暂时未用到
|
|
67
|
-
indexDbCrypt: true,
|
|
68
|
-
//显示用户客户端环境提示,如果是IE、或者浏览器宽度小于推荐值1680、或chrome版本低于66则显示
|
|
69
|
-
agentSuggest: true,
|
|
70
|
-
//用户代理
|
|
71
|
-
delegate: true,
|
|
72
|
-
tools: true,
|
|
73
|
-
userCardTypes: {},
|
|
74
|
-
},
|
|
75
|
-
fileConfig: {
|
|
76
|
-
uploadFileSize: 20,
|
|
77
|
-
tusFileSize: 100,
|
|
78
|
-
tusClient: true,
|
|
79
|
-
},
|
|
80
|
-
},
|
|
81
|
-
WATER_MARK_CONFIG: {
|
|
82
|
-
fontSize: 18,
|
|
83
|
-
lightColor: '#666',
|
|
84
|
-
darkColor: '#fefefe',
|
|
85
|
-
alpha: 0.3,
|
|
86
|
-
rotate: 30,
|
|
87
|
-
text: '甘棠软件',
|
|
88
|
-
padding: 10,
|
|
89
|
-
showTime: false,
|
|
90
|
-
status: 'none',
|
|
91
|
-
},
|
|
92
|
-
SYSMGMT_CONFIG: {
|
|
93
|
-
accountConfig: {
|
|
94
|
-
genderCodeType: 'FW_USER_GENDER',
|
|
95
|
-
},
|
|
96
|
-
},
|
|
97
|
-
},
|
|
98
|
-
};
|
|
99
|
-
const defineConfig = (config = defaultConfig) => {
|
|
100
|
-
return utils_index.mergeConfig(defaultConfig, config);
|
|
101
|
-
};
|
|
102
|
-
|
|
103
|
-
exports.defineConfig = defineConfig;
|
|
104
|
-
//# sourceMappingURL=defineConfig.js.map
|
package/lib/cli/config/index.js
DELETED
|
@@ -1,156 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var path = require('path');
|
|
4
|
-
var fs = require('fs');
|
|
5
|
-
var utils_index = require('../utils/index.js');
|
|
6
|
-
var utils_getJavascriptfile = require('../utils/getJavascriptfile.js');
|
|
7
|
-
|
|
8
|
-
const DEFAULT_CONFIG_FILES = ['config/config.ts', 'config/config.js', 'config.ts', 'config.js'];
|
|
9
|
-
const pickNames = ['routes', 'microServiceMap', 'setting', 'define', 'optimization', 'provide', 'htmlTemplatePath'];
|
|
10
|
-
class Config {
|
|
11
|
-
opts;
|
|
12
|
-
mainConfigFile;
|
|
13
|
-
configFiles = [];
|
|
14
|
-
constructor(opts) {
|
|
15
|
-
const defaultConfigFiles = opts.defaultConfigFiles ? opts.defaultConfigFiles : DEFAULT_CONFIG_FILES;
|
|
16
|
-
this.mainConfigFile = Config.getMainConfigFile({
|
|
17
|
-
cwd: opts.cwd,
|
|
18
|
-
defaultConfigFiles: defaultConfigFiles,
|
|
19
|
-
});
|
|
20
|
-
this.opts = {
|
|
21
|
-
...opts,
|
|
22
|
-
defaultConfigFiles: defaultConfigFiles,
|
|
23
|
-
};
|
|
24
|
-
}
|
|
25
|
-
getMsPagesUserConfig(cwd) {
|
|
26
|
-
const paths = typeof cwd === 'string' ? [cwd] : cwd;
|
|
27
|
-
let tempConfig = {};
|
|
28
|
-
paths.map(itemPath => {
|
|
29
|
-
const mainConfigFile = Config.getMainConfigFile({
|
|
30
|
-
cwd: itemPath,
|
|
31
|
-
defaultConfigFiles: this.opts.defaultConfigFiles,
|
|
32
|
-
});
|
|
33
|
-
const config = Config.getUserConfig({
|
|
34
|
-
cwd: itemPath,
|
|
35
|
-
mainConfigFile: mainConfigFile,
|
|
36
|
-
});
|
|
37
|
-
tempConfig = utils_index.mergeConfig(tempConfig, utils_index.pick(config, pickNames));
|
|
38
|
-
});
|
|
39
|
-
return tempConfig;
|
|
40
|
-
}
|
|
41
|
-
getMsUserConfig() {
|
|
42
|
-
this.configFiles = [];
|
|
43
|
-
let userConfig = Config.getUserConfig({
|
|
44
|
-
cwd: this.opts.cwd,
|
|
45
|
-
mainConfigFile: this.mainConfigFile,
|
|
46
|
-
});
|
|
47
|
-
this.mainConfigFile && this.configFiles.push(this.mainConfigFile);
|
|
48
|
-
const fileArray = [this.opts.cwd];
|
|
49
|
-
const srcPath = utils_index.getSrcPath();
|
|
50
|
-
utils_index.get(userConfig, 'mfa.pages', []);
|
|
51
|
-
const configAlias = utils_index.get(userConfig, 'alias', {});
|
|
52
|
-
const packages = utils_index.get(userConfig, 'packages', {});
|
|
53
|
-
const alias = {
|
|
54
|
-
'@gant': path.resolve(this.opts.cwd, srcPath, '.gant'),
|
|
55
|
-
'@@': path.resolve(this.opts.cwd),
|
|
56
|
-
...configAlias,
|
|
57
|
-
};
|
|
58
|
-
let tempConfig = {
|
|
59
|
-
context: this.opts.cwd,
|
|
60
|
-
publicPathDir: path.resolve(this.opts.cwd, srcPath, '.gant'),
|
|
61
|
-
resolve: {
|
|
62
|
-
alias: alias,
|
|
63
|
-
},
|
|
64
|
-
};
|
|
65
|
-
if (utils_index.isPlainObject(packages)) {
|
|
66
|
-
Object.keys(packages).map(name => {
|
|
67
|
-
const packagePath = packages[name];
|
|
68
|
-
if (fileArray.includes(packagePath))
|
|
69
|
-
return;
|
|
70
|
-
fileArray.push(packagePath);
|
|
71
|
-
const configFile = Config.getMainConfigFile({
|
|
72
|
-
cwd: packagePath,
|
|
73
|
-
defaultConfigFiles: this.opts.defaultConfigFiles,
|
|
74
|
-
});
|
|
75
|
-
configFile && this.configFiles.push(configFile);
|
|
76
|
-
const packageConfig = Config.getUserConfig({
|
|
77
|
-
cwd: packagePath,
|
|
78
|
-
mainConfigFile: configFile,
|
|
79
|
-
});
|
|
80
|
-
tempConfig = utils_index.mergeConfig(tempConfig, utils_index.pick(packageConfig, pickNames));
|
|
81
|
-
});
|
|
82
|
-
}
|
|
83
|
-
return {
|
|
84
|
-
...utils_index.mergeConfig(tempConfig, userConfig),
|
|
85
|
-
};
|
|
86
|
-
}
|
|
87
|
-
getUserConfig() {
|
|
88
|
-
this.configFiles = [];
|
|
89
|
-
let userConfig = Config.getUserConfig({
|
|
90
|
-
cwd: this.opts.cwd,
|
|
91
|
-
mainConfigFile: this.mainConfigFile,
|
|
92
|
-
});
|
|
93
|
-
this.mainConfigFile && this.configFiles.push(this.mainConfigFile);
|
|
94
|
-
const fileArray = [this.opts.cwd];
|
|
95
|
-
const packages = utils_index.get(userConfig, 'packages', {});
|
|
96
|
-
const srcPath = utils_index.getSrcPath();
|
|
97
|
-
const alias = {
|
|
98
|
-
'@gant': path.resolve(this.opts.cwd, srcPath, '.gant'),
|
|
99
|
-
[userConfig.name || '@@']: path.resolve(this.opts.cwd),
|
|
100
|
-
...packages,
|
|
101
|
-
};
|
|
102
|
-
let tempConfig = {
|
|
103
|
-
context: this.opts.cwd,
|
|
104
|
-
resolve: {
|
|
105
|
-
alias: alias,
|
|
106
|
-
},
|
|
107
|
-
};
|
|
108
|
-
if (utils_index.isPlainObject(packages)) {
|
|
109
|
-
Object.keys(packages).map(name => {
|
|
110
|
-
const packagePath = packages[name];
|
|
111
|
-
if (fileArray.includes(packagePath))
|
|
112
|
-
return;
|
|
113
|
-
fileArray.push(packagePath);
|
|
114
|
-
const configFile = Config.getMainConfigFile({
|
|
115
|
-
cwd: packagePath,
|
|
116
|
-
defaultConfigFiles: this.opts.defaultConfigFiles,
|
|
117
|
-
});
|
|
118
|
-
configFile && this.configFiles.push(configFile);
|
|
119
|
-
const packageConfig = Config.getUserConfig({
|
|
120
|
-
cwd: packagePath,
|
|
121
|
-
mainConfigFile: configFile,
|
|
122
|
-
});
|
|
123
|
-
tempConfig = utils_index.mergeConfig(tempConfig, utils_index.pick(packageConfig, pickNames));
|
|
124
|
-
});
|
|
125
|
-
}
|
|
126
|
-
return {
|
|
127
|
-
...utils_index.mergeConfig(tempConfig, userConfig),
|
|
128
|
-
};
|
|
129
|
-
}
|
|
130
|
-
static getMainConfigFile(opts) {
|
|
131
|
-
let mainConfigFile = null;
|
|
132
|
-
for (const configFile of opts.defaultConfigFiles || DEFAULT_CONFIG_FILES) {
|
|
133
|
-
const absConfigFile = path.join(opts.cwd, configFile);
|
|
134
|
-
if (fs.existsSync(absConfigFile)) {
|
|
135
|
-
mainConfigFile = absConfigFile;
|
|
136
|
-
break;
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
return mainConfigFile;
|
|
140
|
-
}
|
|
141
|
-
static getUserConfig(opts) {
|
|
142
|
-
let config = {};
|
|
143
|
-
if (!opts.mainConfigFile)
|
|
144
|
-
return config;
|
|
145
|
-
try {
|
|
146
|
-
config = utils_getJavascriptfile.getJavascriptfile(utils_index.getAbsFile(opts.mainConfigFile, opts.cwd));
|
|
147
|
-
}
|
|
148
|
-
catch (error) {
|
|
149
|
-
console.log('getUserConfig Error :', error);
|
|
150
|
-
}
|
|
151
|
-
return config;
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
exports.Config = Config;
|
|
156
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var path = require('path');
|
|
4
|
-
var utils_index = require('../utils/index.js');
|
|
5
|
-
var fs = require('fs');
|
|
6
|
-
|
|
7
|
-
const copyAppsFiles = (tempPath, packagesPaths) => {
|
|
8
|
-
let AppContent = '';
|
|
9
|
-
//复制public 并前置项目模块中的app文件
|
|
10
|
-
const APP_CONFIG_FILES = ['app.ts', 'app.tsx', 'app.js'];
|
|
11
|
-
packagesPaths.map((packagePath, index) => {
|
|
12
|
-
for (const fileName of APP_CONFIG_FILES) {
|
|
13
|
-
const appPath = path.resolve(packagePath, fileName);
|
|
14
|
-
if (fs.existsSync(appPath)) {
|
|
15
|
-
// 使用 path.posix 生成一致的路径分隔符
|
|
16
|
-
const normalizedAppPath = appPath.split(path.sep).join(path.posix.sep);
|
|
17
|
-
return (AppContent += `import '${normalizedAppPath}';\n`);
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
});
|
|
21
|
-
// 确保 tempPath 已经被正确定义
|
|
22
|
-
const targetPath = path.resolve(tempPath, 'app.ts');
|
|
23
|
-
utils_index.writeFileToJS(targetPath, AppContent);
|
|
24
|
-
};
|
|
25
|
-
const copyPublicFiles = (tempPath, publicPaths) => {
|
|
26
|
-
//复制public 并前置项目模块中的app文件
|
|
27
|
-
publicPaths?.map((path$1, index) => {
|
|
28
|
-
utils_index.copyFolder(path$1, path.resolve(tempPath, 'public'));
|
|
29
|
-
});
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
exports.copyAppsFiles = copyAppsFiles;
|
|
33
|
-
exports.copyPublicFiles = copyPublicFiles;
|
|
34
|
-
//# sourceMappingURL=index.js.map
|