Skip to content

Commit

Permalink
check file availability
Browse files Browse the repository at this point in the history
  • Loading branch information
lcxfs1991 committed May 13, 2018
1 parent 737d30c commit 87cd590
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 5 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## 3.0.0-beta.8
- 文件拷贝时校验是否存在

## 3.0.0-beta.7
- 修复writeKitOpionts错误

Expand Down
16 changes: 12 additions & 4 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down

0 comments on commit 87cd590

Please sign in to comment.