From 90688a68b51e26975177c4c009ef143b77dac330 Mon Sep 17 00:00:00 2001 From: "Zhenfei.Li" Date: Thu, 10 Mar 2022 20:22:13 +0800 Subject: [PATCH] =?UTF-8?q?KERNEL-10608=20feat:=20fineui=E6=89=93=E5=8C=85?= =?UTF-8?q?=E5=87=BAfineui.less=E4=BB=A5=E4=BE=9B=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E5=9C=A8=E5=A4=96=E9=83=A8=E5=AE=9A=E5=88=B6=E4=B8=BB=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!C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&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);