From f38bf2730a880a810591f43f174068c2840a84cb Mon Sep 17 00:00:00 2001 From: ruan-cat <1219043956@qq.com> Date: Fri, 18 Oct 2024 20:13:35 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=B3=20chore(vercel-deploy-tool):=20?= =?UTF-8?q?=E5=B0=9D=E8=AF=95=E4=BD=BF=E7=94=A8=20cpx.copy=20=E5=AE=9E?= =?UTF-8?q?=E7=8E=B0=E6=96=87=E4=BB=B6=E7=A7=BB=E5=8A=A8=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- demos/vercel-deploy-tool/package.json | 1 + demos/vercel-deploy-tool/src/index.ts | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/demos/vercel-deploy-tool/package.json b/demos/vercel-deploy-tool/package.json index d421528..8c6ce24 100644 --- a/demos/vercel-deploy-tool/package.json +++ b/demos/vercel-deploy-tool/package.json @@ -63,6 +63,7 @@ "vercel": "^34.2.7" }, "devDependencies": { + "@types/cpx": "^1.5.5", "@types/gulp": "^4.0.17", "@types/lodash-es": "^4.17.12", "@types/node": "^22.5.1", diff --git a/demos/vercel-deploy-tool/src/index.ts b/demos/vercel-deploy-tool/src/index.ts index 634ea3c..486ba0b 100644 --- a/demos/vercel-deploy-tool/src/index.ts +++ b/demos/vercel-deploy-tool/src/index.ts @@ -1,6 +1,7 @@ // 学习一下如何使用 https://github.com/sindresorhus/execa/blob/main/readme.md import fs from "node:fs"; import { dirname, resolve } from "node:path"; +import { cp } from "node:fs/promises"; import { execa } from "execa"; import { concat, isEmpty, isUndefined } from "lodash-es"; import { consola } from "consola"; @@ -9,6 +10,7 @@ import gulp from "gulp"; import { deleteAsync } from "del"; import { mkdirpSync } from "mkdirp"; import cpy from "cpy"; +import cpx from "cpx"; import { initVercelConfig, @@ -308,7 +310,9 @@ function generateCopyDistTasks(deployTarget: WithUserCommands) { consola.start(` 开始文件复制任务 `); consola.info(` 从 ${pathOutputDirectory} 开始 `); consola.info(` 复制到 ${pathVercelOutputStatic} 内`); - await cpy(pathOutputDirectory, pathVercelOutputStatic); + // await cp(pathOutputDirectory, pathVercelOutputStatic, { recursive: true }); + // await cpy(pathOutputDirectory, pathVercelOutputStatic); + await cpx.copy(pathOutputDirectory, pathVercelOutputStatic); consola.success(` 完成文件复制任务 `); }