Don't leave behind an unused package.json.tmp file
This commit is contained in:
parent
a76b6e25d4
commit
4580412f73
|
|
@ -137,6 +137,7 @@ class MyGenerator extends yeoman.Base {
|
|||
if (emitFile) {
|
||||
let inputFullPath = path.join(templateRoot, fn);
|
||||
let destinationFullPath = this.destinationPath(outputFn);
|
||||
let deleteInputFileAfter = false;
|
||||
if (path.basename(fn) === 'package.json') {
|
||||
// Special handling for package.json, because we rewrite it dynamically
|
||||
const tempPath = destinationFullPath + '.tmp';
|
||||
|
|
@ -147,6 +148,7 @@ class MyGenerator extends yeoman.Base {
|
|||
/* space */ 2
|
||||
);
|
||||
inputFullPath = tempPath;
|
||||
deleteInputFileAfter = true;
|
||||
}
|
||||
|
||||
const outputDirBasename = path.basename(path.dirname(destinationFullPath));
|
||||
|
|
@ -164,6 +166,10 @@ class MyGenerator extends yeoman.Base {
|
|||
this._answers
|
||||
);
|
||||
}
|
||||
|
||||
if (deleteInputFileAfter) {
|
||||
this.fs.delete(inputFullPath);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue