build(aio): move file cleaning to later in the doc gen (#21540)

Previously the generated files were cleaned out before
doc-gen began (via a yarn pre-script). This can cause a
race condition in the CLI server, which prevents the new
generated files from being picked up.

Now we delay the cleaning until the last minute to ensure
that they ar still picked up by the webpack server.

PR Close #21540
This commit is contained in:
Pete Bacon Darwin 2018-01-15 16:10:32 +00:00 committed by Alex Eagle
parent 7c414fc746
commit d6ba9f9fb4
3 changed files with 11 additions and 1 deletions

View File

@ -39,7 +39,6 @@
"check-env": "yarn ~~check-env",
"postcheck-env": "yarn aio-check-local",
"payload-size": "scripts/payload.sh",
"predocs": "rimraf src/generated/{docs,*.json}",
"docs": "dgeni ./tools/transforms/angular.io-package",
"docs-watch": "node tools/transforms/authors-package/watchr.js",
"docs-lint": "eslint --ignore-path=\"tools/transforms/.eslintignore\" tools/transforms",

View File

@ -17,6 +17,7 @@ module.exports = new Package('angular.io', [gitPackage, apiPackage, contentPacka
// This processor relies upon the versionInfo. See below...
.processor(require('./processors/processNavigationMap'))
.processor(require('./processors/cleanGeneratedFiles'))
// We don't include this in the angular-base package because the `versionInfo` stuff
// accesses the file system and git, which is slow.

View File

@ -0,0 +1,10 @@
const rimraf = require('rimraf');
module.exports = function cleanGeneratedFiles() {
return {
$runAfter: ['writing-files'],
$runBefore: ['writeFilesProcessor'],
$process: function() {
rimraf.sync('src/generated/{docs,*.json}');
}
};
};