rapid-replace
Advanced tools
Comparing version 0.1.0 to 0.1.1
@@ -58,3 +58,3 @@ | ||
function replaceFile(originFile, newFile){ | ||
function replaceFile(originFile, newFile, mode){ | ||
// replace | ||
@@ -68,3 +68,3 @@ try{ | ||
// 复制新文件 | ||
fs.createReadStream(newFile).pipe(fs.createWriteStream(originFile)); | ||
fs.createReadStream(newFile, { mode: mode && 0o666, }).pipe(fs.createWriteStream(originFile)); | ||
// fs.rename(newFile, originFile); | ||
@@ -82,5 +82,5 @@ console.log('文件替换完成:',newFile, originFile); | ||
files.forEach((file, idx) => { | ||
if(file.new && file.origin){ | ||
replaceFile(path.join(npmProject, path.sep, file.origin), | ||
path.join(projectRoot, path.sep, file.new)); | ||
if(file.new && file.origin) { | ||
const newFile = path.join(projectRoot, path.sep, file.new); | ||
replaceFile(path.join(npmProject, path.sep, file.origin), newFile, file.permission); | ||
} | ||
@@ -87,0 +87,0 @@ }); |
{ | ||
"name": "rapid-replace", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"description": "repid replace node modules file", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
7607