From 90688a68b51e26975177c4c009ef143b77dac330 Mon Sep 17 00:00:00 2001 From: "Zhenfei.Li" Date: Thu, 10 Mar 2022 20:22:13 +0800 Subject: [PATCH 1/3] =?UTF-8?q?KERNEL-10608=20feat:=20fineui=E6=89=93?= =?UTF-8?q?=E5=8C=85=E5=87=BAfineui.less=E4=BB=A5=E4=BE=9B=E7=94=A8?= =?UTF-8?q?=E6=88=B7=E5=9C=A8=E5=A4=96=E9=83=A8=E5=AE=9A=E5=88=B6=E4=B8=BB?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .npmignore | 3 -- dist/images/1x/icon/auto_normal.png | Bin 0 -> 1379 bytes dist/images/1x/icon/auto_select.png | Bin 0 -> 1361 bytes dist/images/1x/icon/dark/trans_disable.png | Bin 0 -> 200 bytes dist/images/2x/background/trans_disable.png | Bin 0 -> 200 bytes dist/images/2x/icon/dark/trans_disable.png | Bin 0 -> 200 bytes lib/prepublish/prepublish.js | 50 +++++++++++++++++++- 7 files changed, 48 insertions(+), 5 deletions(-) create mode 100644 dist/images/1x/icon/auto_normal.png create mode 100644 dist/images/1x/icon/auto_select.png create mode 100644 dist/images/1x/icon/dark/trans_disable.png create mode 100644 dist/images/2x/background/trans_disable.png create mode 100644 dist/images/2x/icon/dark/trans_disable.png diff --git a/.npmignore b/.npmignore index baaa993b9..f52935001 100644 --- a/.npmignore +++ b/.npmignore @@ -1,7 +1,4 @@ * -!src/less/*.less -!src/less/lib/*.less -!src/less/resource/*.less !dist/lib/*.d.ts !dist/lib/**/*.d.ts !dist/font.css diff --git a/dist/images/1x/icon/auto_normal.png b/dist/images/1x/icon/auto_normal.png new file mode 100644 index 0000000000000000000000000000000000000000..527212c100a53b3b6e4f8feb1586a1148713320a GIT binary patch literal 1379 zcmV-p1)TbcP)Px)9Z5t%R9FecS50VKRTMtw&7>KjHDF`u4_IgmL0!4A5sgp@idu=%O2K_5W{QiX zO=2R-ppr?3G+Ag;lM3!CM8#$!{(;blKc(1BskX(UVB1CGPtqVsXXYKxckjC|?@eYV zr3kr@++Wv2HjzENcqgLxc9}X~&Fv}`{5D_cc_My@ zL^j2EnQs!wIgja7qRyK+KGc6DhOcs2(|}Cx@co5CF(*WARb*5ItKgZsx@7-EzVGLX z1Oc$B0qM!fI{)IIBP4WKUzPwpGZpp!tnOd>#J?w*t^-~a+UAk$6rm@Twng_O;7VH} zrg5)n^UKeUgk(M&T z)EkD0>9oi72d0i4or_beiRAz&7g_#6U$GlFCjK~;qRczFfg9ztweGL<58k`9L=!@C z(8yu>mASsT+=!R~*6nj&+n2LGg0fSi{ckbr`zx$$_M7C~zh}0*oA0|;0j&-YPIu>C zSLUpSM&F{IXliVYhQo_81~E5ohw>9+18-JS4&hhlzyEfrP`ujFojVkjKV z)sPw;jzIU&0A#yOIO}%2JVLkXm_9Q6h`M(#5GC?6s|X?h<3$an0clbjT>(Bc0HtQK zT@wy5ul8~$m&t$0oz=UKBIe<}>;PGisbz#-k+8Zfkud;G#??8peXWF>o}Nx9{fjGl zB(b#2&#l~7pCA*mfq^dQ#Mu~7yd~P*)b(2DC^ejGt*?H((yBSI1vJVNl$N|uiw8K! zw!K8drd<^1q-5N$Y5kju7%?D{R(v0DuC}afo(0~v^e_pvx9dWO z!(MA;vmc~{*uIwKL$&5pLobvnE-XAR9ag7jtPVabXs>Gt_~YjF{jS3$JUV$| zbl{RE*#+?VWJ6g?MyNw|LbvBWsbF%wy_NtLvDwdj{=Jdc&VyD%XuP1k<5@JbTKrKR z&~0*{7DE)5?i*^*l6wX)jsM9I$DT1j6SF}s{ryA;zl}o@!^Exme+((UYPEQzAP4ld z^@fJ|r_SEtrhtC2DE^#&KN?AVZy= z*M{}qDn!5Ml~<-Gzm-Y$RmMi3B3obX$u&nH zv7_(PQx;%#8Ur+*GXby#-}4wpa4GnOLu#O<_q@&|CHF@Ev=Z7JpL)QSsRIOiAiD)u zjBeP?tplW@N@y}>l8Gde_=WvWP{NCpp92PaBAGO9#g&VtFrSc=kZBtjm#i+! z6dGWrR~;Y$)|VW_Bx6a`O~RM8g=!O{GspA&-#K{sKAG=3tNEn8o=ZAUU37Rm71_~D zWsFBB<QB6W!t+3-+=X#qXVC9;QC!UPCd5PoUo%|PwQPN+6Er*8X0aP zG9#Jlh^$rhx~@a1Gi+VQ^3aI&{9)pZz`kxj&7wx&j2RB2n^uT+yy`zr(N)pdT%DK8 lDZj5u!g7LY_y6nX`G2ogeysT~Jx~Au002ovPDHLkV1l(Jr@#OJ literal 0 HcmV?d00001 diff --git a/dist/images/1x/icon/auto_select.png b/dist/images/1x/icon/auto_select.png new file mode 100644 index 0000000000000000000000000000000000000000..49423cac0919bd14571a9255a836b548e2934920 GIT binary patch literal 1361 zcmV-X1+MyuP)Px)3rR#lR9FecSKVtIRTRHxcA8z~0R+lLBmLDYxZ7qe}evXwG6RK}1D1vVlG-C21S_DH9o3w~gEcFYEg0>H>U)^ms-QAhv`Q1BrcDk9_ zgd*fZa?d^AbM86ko+WjMt1!md#=p0=K-}$2Uzr-9%AKg9)e7w`Ep4m$jXtILAQA6k zR=KDwkt#FOf>Jcm;kc8tLz&A_dJ?>%1No8i1Kdz0RxHL>zev#}xoT+sSnm6FQi%>c z|2D7t_Rq>G5guUX6qJb4hWwk6D4b<-esdIG1>RS*nb^NiI3821dc|2+^AmZpkL|oC zd-RPFY%E&50d?SlZqE5=7DlRZ8668+VxBzoTc7T?WFm40zzuz5{1 zy*|x{rjFiqJ<1DsnFGeSnitx3%|JBXp;Z6OaPAt;t6jY(%Je10hVItd(SxbOwL^$Uv|zdW|#N*rB`Q@&JrMTCzlf#rLr zAMVN)qu1d?1Kt~^_Bcz@(ewyPmPb2)CS&Uy*}hW39r-|)2j#2~MZvB4wW>Ji8G(4nBi`jdooeXHu4I6+>R}CESIp}iIWLBzk z2>YI|!!M!#)o~cjN=eNW@jd`fT3WYmWZ+=^(K-ThMZ1g;pG^|B_`-Xfkx-ehW#@gD zJ3adbM)E@~0G^nH|pjBuREjQ(5V+YNx~6 zfDYJp?2`&1+uPeJU}dtO=;FDTa~HuY%5)S2dJ4^~oqW^=Z0jp%ClI9-PjaV(|4HB^ zgl8;`9LG4os`IzParqZ%$s^j)qE4t3en@hSex1bhiFo>$uNQU zyj29}YF){L!-n6X7gMg=9sP4C)o0~AZkRH)h+q$N_nIS3VAqq2OYTICYi~*|yBH<} z|At|T{tv=WbS;z5zB{$wbhIc(_lfc)3IBsZpBRkN0P8^|n65B40;j(S1EjP_jSwdW zTOXD^qf6W6ZXbbwOa>pu83)alqwG6+PL>}6&MxSLZk%Du4z1b&jg$dW8j6PoAvJ+X zCQKx+-Z)?tMa$3P?7q%*bXak&d(C`;E~8WBU<1Rdl?fdPrq?kLMBp$c8OtOo`?L7% zi$@pchH~dZd`QENJs-tNR2jpf#fHT_{? zoxr|kKh2^}0LBc5(GAlRh6$8wln1?Ca&7@#6^+f-d6Xv(UY3M$OmVpX>*x7@dy;K literal 0 HcmV?d00001 diff --git a/dist/images/1x/icon/dark/trans_disable.png b/dist/images/1x/icon/dark/trans_disable.png new file mode 100644 index 0000000000000000000000000000000000000000..c070eb9bbf73cf6d9c7e43efb127d4786fdb1e3f GIT binary patch literal 200 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`jKx9jP7LeL$-D$|nmk<`Lo5W7 z_Y^$6R?o)8!0oZVu}?}_Gc9Ic-R+0(?b||m{{Qbbnz%@C$+t^iZ+}xb>*K?-P{GcV zt-<8~@8cV!mPGmoe^u~gOStT_g>i?8a4Lh{Sr%S}C6enIk7OLnWY{=sqm)Be8V|F_ x)t)2<%UKWECajjsW2pMX;wiu_p?UTk!yNZCNh4i%W1wpoJYD@<);T3K0RU^qMF9W+ literal 0 HcmV?d00001 diff --git a/dist/images/2x/background/trans_disable.png b/dist/images/2x/background/trans_disable.png new file mode 100644 index 0000000000000000000000000000000000000000..c070eb9bbf73cf6d9c7e43efb127d4786fdb1e3f GIT binary patch literal 200 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`jKx9jP7LeL$-D$|nmk<`Lo5W7 z_Y^$6R?o)8!0oZVu}?}_Gc9Ic-R+0(?b||m{{Qbbnz%@C$+t^iZ+}xb>*K?-P{GcV zt-<8~@8cV!mPGmoe^u~gOStT_g>i?8a4Lh{Sr%S}C6enIk7OLnWY{=sqm)Be8V|F_ x)t)2<%UKWECajjsW2pMX;wiu_p?UTk!yNZCNh4i%W1wpoJYD@<);T3K0RU^qMF9W+ literal 0 HcmV?d00001 diff --git a/dist/images/2x/icon/dark/trans_disable.png b/dist/images/2x/icon/dark/trans_disable.png new file mode 100644 index 0000000000000000000000000000000000000000..c070eb9bbf73cf6d9c7e43efb127d4786fdb1e3f GIT binary patch literal 200 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`jKx9jP7LeL$-D$|nmk<`Lo5W7 z_Y^$6R?o)8!0oZVu}?}_Gc9Ic-R+0(?b||m{{Qbbnz%@C$+t^iZ+}xb>*K?-P{GcV zt-<8~@8cV!mPGmoe^u~gOStT_g>i?8a4Lh{Sr%S}C6enIk7OLnWY{=sqm)Be8V|F_ x)t)2<%UKWECajjsW2pMX;wiu_p?UTk!yNZCNh4i%W1wpoJYD@<);T3K0RU^qMF9W+ literal 0 HcmV?d00001 diff --git a/lib/prepublish/prepublish.js b/lib/prepublish/prepublish.js index 138ba1447..5cc1d3d84 100644 --- a/lib/prepublish/prepublish.js +++ b/lib/prepublish/prepublish.js @@ -1,5 +1,6 @@ -const { resolve } = require("path"); -const { writeFileSync } = require("fs"); +const { resolve, relative, join } = require("path"); +const { writeFileSync, readdirSync, statSync } = require("fs"); +const { spawnSync } = require('child_process'); function pad2(n) {// always returns a string return (n < 10 ? "0" : "") + n; @@ -27,3 +28,48 @@ packageJSON.publishConfig.registry = 'https://npm.fineres.com/'; packageJSON.name = "@fui/core"; writeFileSync(resolve(__dirname, "../../package.json"), JSON.stringify(packageJSON, null, 2)); + +// 将less打包成fineui.less发布到npm以供用户定制主题 +const lessPath = join(process.cwd(), '/src/less'); + +function copyFiles(from, to) { + spawnSync('cp', ['-r', from, to]); +} + +function removeFiles(src) { + spawnSync('rm', ['-rf', src]); +} + +function readDirSync(directoryPath) { + let content = ''; + const pa = readdirSync(directoryPath); + pa.forEach(file => { + const filePath = `${directoryPath}/${file}`; + const info = statSync(filePath); + if (info.isDirectory()) { + content += readDirSync(filePath); + } else { + content += `@import "./${relative(lessPath, filePath)}";\n`; + } + }); + + return content; +} + +function finalizeCompile() { + const componentsLessContent = readDirSync(lessPath); + + writeFileSync( + join(lessPath, 'fineui.less'), + componentsLessContent, + ); +} + +removeFiles(`${lessPath}/images`); +removeFiles(`${lessPath}/font`); +removeFiles(`${lessPath}/fineui.less`); + +finalizeCompile(); + +copyFiles(`${process.cwd()}/dist/images`, lessPath); +copyFiles(`${process.cwd()}/dist/font`, lessPath); From 324d1eb1a11926b1abd4ccb5654ab8e66c281ae9 Mon Sep 17 00:00:00 2001 From: "Zhenfei.Li" Date: Mon, 14 Mar 2022 11:23:19 +0800 Subject: [PATCH 2/3] =?UTF-8?q?KERNEL-10608=20refactor:=20=E4=B8=8D?= =?UTF-8?q?=E9=A2=9D=E5=A4=96=E6=94=BE=E5=9B=BE=E7=89=87=E5=8C=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .npmignore | 1 + dist/images/1x/icon/auto_normal.png | Bin 1379 -> 0 bytes dist/images/1x/icon/auto_select.png | Bin 1361 -> 0 bytes dist/images/1x/icon/dark/trans_disable.png | Bin 200 -> 0 bytes dist/images/2x/background/trans_disable.png | Bin 200 -> 0 bytes dist/images/2x/icon/dark/trans_disable.png | Bin 200 -> 0 bytes lib/prepublish/prepublish.js | 8 +++++--- 7 files changed, 6 insertions(+), 3 deletions(-) delete mode 100644 dist/images/1x/icon/auto_normal.png delete mode 100644 dist/images/1x/icon/auto_select.png delete mode 100644 dist/images/1x/icon/dark/trans_disable.png delete mode 100644 dist/images/2x/background/trans_disable.png delete mode 100644 dist/images/2x/icon/dark/trans_disable.png diff --git a/.npmignore b/.npmignore index f52935001..54bd43012 100644 --- a/.npmignore +++ b/.npmignore @@ -1,4 +1,5 @@ * +!src/less/**/*.less !dist/lib/*.d.ts !dist/lib/**/*.d.ts !dist/font.css diff --git a/dist/images/1x/icon/auto_normal.png b/dist/images/1x/icon/auto_normal.png deleted file mode 100644 index 527212c100a53b3b6e4f8feb1586a1148713320a..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1379 zcmV-p1)TbcP)Px)9Z5t%R9FecS50VKRTMtw&7>KjHDF`u4_IgmL0!4A5sgp@idu=%O2K_5W{QiX zO=2R-ppr?3G+Ag;lM3!CM8#$!{(;blKc(1BskX(UVB1CGPtqVsXXYKxckjC|?@eYV zr3kr@++Wv2HjzENcqgLxc9}X~&Fv}`{5D_cc_My@ zL^j2EnQs!wIgja7qRyK+KGc6DhOcs2(|}Cx@co5CF(*WARb*5ItKgZsx@7-EzVGLX z1Oc$B0qM!fI{)IIBP4WKUzPwpGZpp!tnOd>#J?w*t^-~a+UAk$6rm@Twng_O;7VH} zrg5)n^UKeUgk(M&T z)EkD0>9oi72d0i4or_beiRAz&7g_#6U$GlFCjK~;qRczFfg9ztweGL<58k`9L=!@C z(8yu>mASsT+=!R~*6nj&+n2LGg0fSi{ckbr`zx$$_M7C~zh}0*oA0|;0j&-YPIu>C zSLUpSM&F{IXliVYhQo_81~E5ohw>9+18-JS4&hhlzyEfrP`ujFojVkjKV z)sPw;jzIU&0A#yOIO}%2JVLkXm_9Q6h`M(#5GC?6s|X?h<3$an0clbjT>(Bc0HtQK zT@wy5ul8~$m&t$0oz=UKBIe<}>;PGisbz#-k+8Zfkud;G#??8peXWF>o}Nx9{fjGl zB(b#2&#l~7pCA*mfq^dQ#Mu~7yd~P*)b(2DC^ejGt*?H((yBSI1vJVNl$N|uiw8K! zw!K8drd<^1q-5N$Y5kju7%?D{R(v0DuC}afo(0~v^e_pvx9dWO z!(MA;vmc~{*uIwKL$&5pLobvnE-XAR9ag7jtPVabXs>Gt_~YjF{jS3$JUV$| zbl{RE*#+?VWJ6g?MyNw|LbvBWsbF%wy_NtLvDwdj{=Jdc&VyD%XuP1k<5@JbTKrKR z&~0*{7DE)5?i*^*l6wX)jsM9I$DT1j6SF}s{ryA;zl}o@!^Exme+((UYPEQzAP4ld z^@fJ|r_SEtrhtC2DE^#&KN?AVZy= z*M{}qDn!5Ml~<-Gzm-Y$RmMi3B3obX$u&nH zv7_(PQx;%#8Ur+*GXby#-}4wpa4GnOLu#O<_q@&|CHF@Ev=Z7JpL)QSsRIOiAiD)u zjBeP?tplW@N@y}>l8Gde_=WvWP{NCpp92PaBAGO9#g&VtFrSc=kZBtjm#i+! z6dGWrR~;Y$)|VW_Bx6a`O~RM8g=!O{GspA&-#K{sKAG=3tNEn8o=ZAUU37Rm71_~D zWsFBB<QB6W!t+3-+=X#qXVC9;QC!UPCd5PoUo%|PwQPN+6Er*8X0aP zG9#Jlh^$rhx~@a1Gi+VQ^3aI&{9)pZz`kxj&7wx&j2RB2n^uT+yy`zr(N)pdT%DK8 lDZj5u!g7LY_y6nX`G2ogeysT~Jx~Au002ovPDHLkV1l(Jr@#OJ diff --git a/dist/images/1x/icon/auto_select.png b/dist/images/1x/icon/auto_select.png deleted file mode 100644 index 49423cac0919bd14571a9255a836b548e2934920..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1361 zcmV-X1+MyuP)Px)3rR#lR9FecSKVtIRTRHxcA8z~0R+lLBmLDYxZ7qe}evXwG6RK}1D1vVlG-C21S_DH9o3w~gEcFYEg0>H>U)^ms-QAhv`Q1BrcDk9_ zgd*fZa?d^AbM86ko+WjMt1!md#=p0=K-}$2Uzr-9%AKg9)e7w`Ep4m$jXtILAQA6k zR=KDwkt#FOf>Jcm;kc8tLz&A_dJ?>%1No8i1Kdz0RxHL>zev#}xoT+sSnm6FQi%>c z|2D7t_Rq>G5guUX6qJb4hWwk6D4b<-esdIG1>RS*nb^NiI3821dc|2+^AmZpkL|oC zd-RPFY%E&50d?SlZqE5=7DlRZ8668+VxBzoTc7T?WFm40zzuz5{1 zy*|x{rjFiqJ<1DsnFGeSnitx3%|JBXp;Z6OaPAt;t6jY(%Je10hVItd(SxbOwL^$Uv|zdW|#N*rB`Q@&JrMTCzlf#rLr zAMVN)qu1d?1Kt~^_Bcz@(ewyPmPb2)CS&Uy*}hW39r-|)2j#2~MZvB4wW>Ji8G(4nBi`jdooeXHu4I6+>R}CESIp}iIWLBzk z2>YI|!!M!#)o~cjN=eNW@jd`fT3WYmWZ+=^(K-ThMZ1g;pG^|B_`-Xfkx-ehW#@gD zJ3adbM)E@~0G^nH|pjBuREjQ(5V+YNx~6 zfDYJp?2`&1+uPeJU}dtO=;FDTa~HuY%5)S2dJ4^~oqW^=Z0jp%ClI9-PjaV(|4HB^ zgl8;`9LG4os`IzParqZ%$s^j)qE4t3en@hSex1bhiFo>$uNQU zyj29}YF){L!-n6X7gMg=9sP4C)o0~AZkRH)h+q$N_nIS3VAqq2OYTICYi~*|yBH<} z|At|T{tv=WbS;z5zB{$wbhIc(_lfc)3IBsZpBRkN0P8^|n65B40;j(S1EjP_jSwdW zTOXD^qf6W6ZXbbwOa>pu83)alqwG6+PL>}6&MxSLZk%Du4z1b&jg$dW8j6PoAvJ+X zCQKx+-Z)?tMa$3P?7q%*bXak&d(C`;E~8WBU<1Rdl?fdPrq?kLMBp$c8OtOo`?L7% zi$@pchH~dZd`QENJs-tNR2jpf#fHT_{? zoxr|kKh2^}0LBc5(GAlRh6$8wln1?Ca&7@#6^+f-d6Xv(UY3M$OmVpX>*x7@dy;K diff --git a/dist/images/1x/icon/dark/trans_disable.png b/dist/images/1x/icon/dark/trans_disable.png deleted file mode 100644 index c070eb9bbf73cf6d9c7e43efb127d4786fdb1e3f..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 200 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`jKx9jP7LeL$-D$|nmk<`Lo5W7 z_Y^$6R?o)8!0oZVu}?}_Gc9Ic-R+0(?b||m{{Qbbnz%@C$+t^iZ+}xb>*K?-P{GcV zt-<8~@8cV!mPGmoe^u~gOStT_g>i?8a4Lh{Sr%S}C6enIk7OLnWY{=sqm)Be8V|F_ x)t)2<%UKWECajjsW2pMX;wiu_p?UTk!yNZCNh4i%W1wpoJYD@<);T3K0RU^qMF9W+ diff --git a/dist/images/2x/background/trans_disable.png b/dist/images/2x/background/trans_disable.png deleted file mode 100644 index c070eb9bbf73cf6d9c7e43efb127d4786fdb1e3f..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 200 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`jKx9jP7LeL$-D$|nmk<`Lo5W7 z_Y^$6R?o)8!0oZVu}?}_Gc9Ic-R+0(?b||m{{Qbbnz%@C$+t^iZ+}xb>*K?-P{GcV zt-<8~@8cV!mPGmoe^u~gOStT_g>i?8a4Lh{Sr%S}C6enIk7OLnWY{=sqm)Be8V|F_ x)t)2<%UKWECajjsW2pMX;wiu_p?UTk!yNZCNh4i%W1wpoJYD@<);T3K0RU^qMF9W+ diff --git a/dist/images/2x/icon/dark/trans_disable.png b/dist/images/2x/icon/dark/trans_disable.png deleted file mode 100644 index c070eb9bbf73cf6d9c7e43efb127d4786fdb1e3f..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 200 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`jKx9jP7LeL$-D$|nmk<`Lo5W7 z_Y^$6R?o)8!0oZVu}?}_Gc9Ic-R+0(?b||m{{Qbbnz%@C$+t^iZ+}xb>*K?-P{GcV zt-<8~@8cV!mPGmoe^u~gOStT_g>i?8a4Lh{Sr%S}C6enIk7OLnWY{=sqm)Be8V|F_ x)t)2<%UKWECajjsW2pMX;wiu_p?UTk!yNZCNh4i%W1wpoJYD@<);T3K0RU^qMF9W+ diff --git a/lib/prepublish/prepublish.js b/lib/prepublish/prepublish.js index 5cc1d3d84..badead82f 100644 --- a/lib/prepublish/prepublish.js +++ b/lib/prepublish/prepublish.js @@ -57,7 +57,9 @@ function readDirSync(directoryPath) { } function finalizeCompile() { - const componentsLessContent = readDirSync(lessPath); + let componentsLessContent = readDirSync(lessPath); + + componentsLessContent += `@import "./public.less";\n`; writeFileSync( join(lessPath, 'fineui.less'), @@ -65,11 +67,11 @@ function finalizeCompile() { ); } -removeFiles(`${lessPath}/images`); removeFiles(`${lessPath}/font`); +removeFiles(`${lessPath}/public.less`); removeFiles(`${lessPath}/fineui.less`); finalizeCompile(); -copyFiles(`${process.cwd()}/dist/images`, lessPath); copyFiles(`${process.cwd()}/dist/font`, lessPath); +copyFiles(`${process.cwd()}/public/less/var.less`, `${lessPath}/public.less`); From 208974fc15cb4d0970d4fdb40f821b080e4ef716 Mon Sep 17 00:00:00 2001 From: "Zhenfei.Li" Date: Mon, 14 Mar 2022 17:16:01 +0800 Subject: [PATCH 3/3] =?UTF-8?q?KERNEL-10608=20refactor:=20=E4=BD=BF?= =?UTF-8?q?=E7=94=A8withoutNormalize=E7=9A=84less?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .npmignore | 1 + lib/prepublish/prepublish.js | 31 ++++++++----------------------- 2 files changed, 9 insertions(+), 23 deletions(-) diff --git a/.npmignore b/.npmignore index 54bd43012..e0847049f 100644 --- a/.npmignore +++ b/.npmignore @@ -1,4 +1,5 @@ * +!public/less/*.less !src/less/**/*.less !dist/lib/*.d.ts !dist/lib/**/*.d.ts diff --git a/lib/prepublish/prepublish.js b/lib/prepublish/prepublish.js index badead82f..5a8f9034e 100644 --- a/lib/prepublish/prepublish.js +++ b/lib/prepublish/prepublish.js @@ -1,6 +1,7 @@ -const { resolve, relative, join } = require("path"); -const { writeFileSync, readdirSync, statSync } = require("fs"); +const { resolve, join } = require("path"); +const { writeFileSync } = require("fs"); const { spawnSync } = require('child_process'); +const { bundleWithoutNormalize } = require('../../webpack/attachments'); function pad2(n) {// always returns a string return (n < 10 ? "0" : "") + n; @@ -40,38 +41,22 @@ function removeFiles(src) { spawnSync('rm', ['-rf', src]); } -function readDirSync(directoryPath) { - let content = ''; - const pa = readdirSync(directoryPath); - pa.forEach(file => { - const filePath = `${directoryPath}/${file}`; - const info = statSync(filePath); - if (info.isDirectory()) { - content += readDirSync(filePath); - } else { - content += `@import "./${relative(lessPath, filePath)}";\n`; - } - }); - - return content; -} - function finalizeCompile() { - let componentsLessContent = readDirSync(lessPath); + let lessContent = ''; - componentsLessContent += `@import "./public.less";\n`; + bundleWithoutNormalize.forEach(path => { + lessContent += `@import "../.${path}";\n`; + }); writeFileSync( join(lessPath, 'fineui.less'), - componentsLessContent, + lessContent, ); } removeFiles(`${lessPath}/font`); -removeFiles(`${lessPath}/public.less`); removeFiles(`${lessPath}/fineui.less`); finalizeCompile(); copyFiles(`${process.cwd()}/dist/font`, lessPath); -copyFiles(`${process.cwd()}/public/less/var.less`, `${lessPath}/public.less`);