mirror of
https://github.com/aspnet/JavaScriptServices.git
synced 2025-12-22 17:47:53 +00:00
Don't leave behind an unused package.json.tmp file
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user