diff --git a/CHANGELOG.md b/CHANGELOG.md index 6108077..41b99fc 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +## 3.0.0-beta.8 + - 文件拷贝时校验是否存在 + ## 3.0.0-beta.7 - 修复writeKitOpionts错误 diff --git a/index.js b/index.js index 9294cc3..5d23f2d 100755 --- a/index.js +++ b/index.js @@ -342,13 +342,18 @@ class KitPlugin extends SteamerPlugin { }); files.forEach((item) => { - this.fs.copySync(path.join(kitPath, item), path.join(process.cwd(), item)); + let itemPath = path.join(kitPath, item); + if (this.fs.existsSync(itemPath)) { + this.fs.copySync(itemPath, path.join(process.cwd(), item)); + } }); } copyUpdatePkgJson(kitPath) { - this.fs.removeSync(path.join(process.cwd(), 'package-lock.json')); - + let pkgLockPath = path.join(process.cwd(), 'package-lock.json'); + if (this.fs.existsSync(pkgLockPath)) { + this.fs.removeSync(pkgLockPath); + } let oldPkgJsonPath = path.join(process.cwd(), 'package.json'); let newPkgJsonPath = path.join(kitPath, 'package.json'); @@ -916,7 +921,10 @@ class KitPlugin extends SteamerPlugin { files.forEach((item) => { let srcFiles = path.join(kitPath, item), destFile = path.join(folderPath, item); - this.fs.copySync(srcFiles, destFile); + + if (this.fs.existsSync(srcFiles)) { + this.fs.copySync(srcFiles, destFile); + } }); if (isSteamerKit) { diff --git a/package.json b/package.json index 97fef6e..71a2645 100755 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "steamer-plugin-kit", - "version": "3.0.0-beta.7", + "version": "3.0.0-beta.8", "description": "steamer-plugin-kit", "main": "index.js", "bin": "index.js",