diff --git a/aio/tools/transforms/angular-base-package/index.js b/aio/tools/transforms/angular-base-package/index.js index 126ae0437b..9015325dc4 100644 --- a/aio/tools/transforms/angular-base-package/index.js +++ b/aio/tools/transforms/angular-base-package/index.js @@ -16,7 +16,7 @@ const targetPackage = require('../target-package'); const remarkPackage = require('../remark-package'); const postProcessPackage = require('../post-process-package'); -const { PROJECT_ROOT, DOCS_OUTPUT_PATH, TEMPLATES_PATH, requireFolder } = require('../config'); +const { PROJECT_ROOT, CONTENTS_PATH, OUTPUT_PATH, DOCS_OUTPUT_PATH, TEMPLATES_PATH, AIO_PATH, requireFolder } = require('../config'); module.exports = new Package('angular-base', [ jsdocPackage, nunjucksPackage, linksPackage, examplesPackage, targetPackage, remarkPackage, postProcessPackage @@ -28,10 +28,12 @@ module.exports = new Package('angular-base', [ .processor(require('./processors/checkUnbalancedBackTicks')) .processor(require('./processors/convertToJson')) .processor(require('./processors/fixInternalDocumentLinks')) + .processor(require('./processors/copyContentAssets')) // overrides base packageInfo and returns the one for the 'angular/angular' repo. .factory('packageInfo', function() { return require(path.resolve(PROJECT_ROOT, 'package.json')); }) .factory(require('./readers/json')) + .factory(require('./services/copyFolder')) .config(function(checkAnchorLinksProcessor) { // This is disabled here to prevent false negatives for the `docs-watch` task. @@ -93,7 +95,11 @@ module.exports = new Package('angular-base', [ }; }) - + .config(function(copyContentAssetsProcessor) { + copyContentAssetsProcessor.assetMappings.push( + { from: path.resolve(CONTENTS_PATH, 'images'), to: path.resolve(OUTPUT_PATH, 'images') } + ); + }) // We are not going to be relaxed about ambiguous links .config(function(getLinkInfo) { diff --git a/aio/tools/transforms/angular-content-package/processors/copyContentAssets.js b/aio/tools/transforms/angular-base-package/processors/copyContentAssets.js similarity index 86% rename from aio/tools/transforms/angular-content-package/processors/copyContentAssets.js rename to aio/tools/transforms/angular-base-package/processors/copyContentAssets.js index f8b9a56ec1..1486a280b5 100644 --- a/aio/tools/transforms/angular-content-package/processors/copyContentAssets.js +++ b/aio/tools/transforms/angular-base-package/processors/copyContentAssets.js @@ -1,7 +1,6 @@ module.exports = function copyContentAssetsProcessor(copyFolder) { return { - $runAfter: ['files-written'], assetMappings: [], $process() { this.assetMappings.forEach(map => { diff --git a/aio/tools/transforms/angular-content-package/processors/copyContentAssets.spec.js b/aio/tools/transforms/angular-base-package/processors/copyContentAssets.spec.js similarity index 100% rename from aio/tools/transforms/angular-content-package/processors/copyContentAssets.spec.js rename to aio/tools/transforms/angular-base-package/processors/copyContentAssets.spec.js diff --git a/aio/tools/transforms/angular-base-package/services/copyFolder.js b/aio/tools/transforms/angular-base-package/services/copyFolder.js new file mode 100644 index 0000000000..7a1ce297bf --- /dev/null +++ b/aio/tools/transforms/angular-base-package/services/copyFolder.js @@ -0,0 +1,5 @@ +const {copySync} = require('fs-extra'); + +module.exports = function copyFolder() { + return (from, to) => copySync(from, to); +}; diff --git a/aio/tools/transforms/angular-content-package/index.js b/aio/tools/transforms/angular-content-package/index.js index e5bed771a9..e835080c4d 100644 --- a/aio/tools/transforms/angular-content-package/index.js +++ b/aio/tools/transforms/angular-content-package/index.js @@ -5,23 +5,17 @@ * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ -const path = require('path'); const Package = require('dgeni').Package; const basePackage = require('../angular-base-package'); const contentPackage = require('../content-package'); -const { CONTENTS_PATH, OUTPUT_PATH } = require('../config'); +const { CONTENTS_PATH } = require('../config'); module.exports = new Package('angular-content', [basePackage, contentPackage]) - // Register the processors - .processor(require('./processors/copyContentAssets')) - - .factory(require('./services/copyFolder')) - // Where do we get the source files? - .config(function(readFilesProcessor, collectExamples, copyContentAssetsProcessor) { + .config(function(readFilesProcessor, collectExamples) { readFilesProcessor.sourceFiles = readFilesProcessor.sourceFiles.concat([ { @@ -82,10 +76,6 @@ module.exports = new Package('angular-content', [basePackage, contentPackage]) ]); collectExamples.exampleFolders.push('examples'); - - copyContentAssetsProcessor.assetMappings.push( - { from: path.resolve(CONTENTS_PATH, 'images'), to: path.resolve(OUTPUT_PATH, 'images') } - ); }) diff --git a/aio/tools/transforms/angular-content-package/services/copyFolder.js b/aio/tools/transforms/angular-content-package/services/copyFolder.js deleted file mode 100644 index f6d848b427..0000000000 --- a/aio/tools/transforms/angular-content-package/services/copyFolder.js +++ /dev/null @@ -1,5 +0,0 @@ -const {cp} = require('shelljs'); - -module.exports = function copyFolder() { - return (from, to) => cp('-rf', from, to); -};