From 752f0dbafd4cf7c2e924a9dadf2c81fd5fc11253 Mon Sep 17 00:00:00 2001 From: pengfeizhou Date: Tue, 23 Feb 2021 10:55:00 +0800 Subject: [PATCH] feat:add assets dealing --- doric-cli/src/actions.ts | 17 +++++++++++++++-- doric-demo/assets/fonts/assets_iconfont.ttf | Bin 0 -> 2108 bytes doric-demo/assets/iconfont.ttf | Bin 0 -> 2108 bytes 3 files changed, 15 insertions(+), 2 deletions(-) create mode 100644 doric-demo/assets/fonts/assets_iconfont.ttf create mode 100644 doric-demo/assets/iconfont.ttf diff --git a/doric-cli/src/actions.ts b/doric-cli/src/actions.ts index 9df3ac12..16d59d1d 100644 --- a/doric-cli/src/actions.ts +++ b/doric-cli/src/actions.ts @@ -1,8 +1,8 @@ import { Shell } from "./shell"; import { createMergedSourceMapFromFiles } from "source-map-merger" -import fs from "fs" +import fs from "fs"; import { glob } from "./util"; - +import path from "path"; export async function build() { await Shell.exec("node", ["node_modules/.bin/tsc", "-p", "."]); await Shell.exec("node", ["node_modules/.bin/rollup", "-c"]); @@ -10,6 +10,19 @@ export async function build() { for (let bundleFile of bundleFiles) { await doMerge(bundleFile); } + if (fs.existsSync("assets")) { + const assets = await fs.promises.readdir("assets") + for (let asset of assets) { + const assetFile = path.resolve("assets", asset); + const stat = await fs.promises.stat(assetFile); + await Shell.exec("cp", ["-rf", assetFile, "bundle"]); + if (stat.isDirectory()) { + console.log(`Asset -> ${asset.yellow}`); + } else { + console.log(`Asset -> ${asset.green}`); + } + } + } } export async function clean() { diff --git a/doric-demo/assets/fonts/assets_iconfont.ttf b/doric-demo/assets/fonts/assets_iconfont.ttf new file mode 100644 index 0000000000000000000000000000000000000000..6ea00a93968c042413b0fded35f6c6d7e1b29ecb GIT binary patch literal 2108 zcmd^APiP!f9RA+S?##|c+N9~m9@;XSq&aBVY&L(?nrcinQ7F2!Yd{cmx|!Wg+1*(t z)6zhM1@Yji5j+IVAvZw;BZ8-bIeJjYp&*E@Jw-(dUc5-V@q2IHVod~lcXr?JeZTL0 zzu)`4w{PD-0O&y*Ch`lHUZ30Ue0dKLPm`T{?b29b=98C)=&#XVEH}K?&u@Hnj{c8q zt!jO>^5;*tJ_XDYV9eBfZ|TGf-*60f*`{kG>^tVW#5dW7YmMl7ih!}VXj1i{?1|IT zH!sjw4exqO4B%IepP=tHy@vl>sq+qyTxb49D_Ds(Ha_zhDubQ@Yd72bZM>O~K4|4? z9)1kPkiBUPzw*}6nLp4IYk&A)?iVSH`~7wT#tphD7&=^LGH@Gd|In<20Vcg2p}QM<{QCgu|F8@Ses3z4%;X14r<+#wPjiG)@rT);Ng)+|$@X zuP`-EV^Q>L+=CIZoIW4=UgR&imsj28a?q><%_!Xk7yathx)*lcZolYZWfGOLSm^5;*tJ_XDYV9eBfZ|TGf-*60f*`{kG>^tVW#5dW7YmMl7ih!}VXj1i{?1|IT zH!sjw4exqO4B%IepP=tHy@vl>sq+qyTxb49D_Ds(Ha_zhDubQ@Yd72bZM>O~K4|4? z9)1kPkiBUPzw*}6nLp4IYk&A)?iVSH`~7wT#tphD7&=^LGH@Gd|In<20Vcg2p}QM<{QCgu|F8@Ses3z4%;X14r<+#wPjiG)@rT);Ng)+|$@X zuP`-EV^Q>L+=CIZoIW4=UgR&imsj28a?q><%_!Xk7yathx)*lcZolYZWfGOLSm