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) {
|
if (emitFile) {
|
||||||
let inputFullPath = path.join(templateRoot, fn);
|
let inputFullPath = path.join(templateRoot, fn);
|
||||||
let destinationFullPath = this.destinationPath(outputFn);
|
let destinationFullPath = this.destinationPath(outputFn);
|
||||||
|
let deleteInputFileAfter = false;
|
||||||
if (path.basename(fn) === 'package.json') {
|
if (path.basename(fn) === 'package.json') {
|
||||||
// Special handling for package.json, because we rewrite it dynamically
|
// Special handling for package.json, because we rewrite it dynamically
|
||||||
const tempPath = destinationFullPath + '.tmp';
|
const tempPath = destinationFullPath + '.tmp';
|
||||||
@@ -147,6 +148,7 @@ class MyGenerator extends yeoman.Base {
|
|||||||
/* space */ 2
|
/* space */ 2
|
||||||
);
|
);
|
||||||
inputFullPath = tempPath;
|
inputFullPath = tempPath;
|
||||||
|
deleteInputFileAfter = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
const outputDirBasename = path.basename(path.dirname(destinationFullPath));
|
const outputDirBasename = path.basename(path.dirname(destinationFullPath));
|
||||||
@@ -164,6 +166,10 @@ class MyGenerator extends yeoman.Base {
|
|||||||
this._answers
|
this._answers
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (deleteInputFileAfter) {
|
||||||
|
this.fs.delete(inputFullPath);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user