build(aio): move copyContentAssets processor to the base package
This allows other processors who need to know about the copyContentAssets processors to ensure that the runs after the content has been copied.
This commit is contained in:
parent
6d9da73090
commit
9945ce2259
|
@ -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) {
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
|
||||
module.exports = function copyContentAssetsProcessor(copyFolder) {
|
||||
return {
|
||||
$runAfter: ['files-written'],
|
||||
assetMappings: [],
|
||||
$process() {
|
||||
this.assetMappings.forEach(map => {
|
|
@ -0,0 +1,5 @@
|
|||
const {copySync} = require('fs-extra');
|
||||
|
||||
module.exports = function copyFolder() {
|
||||
return (from, to) => copySync(from, to);
|
||||
};
|
|
@ -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') }
|
||||
);
|
||||
})
|
||||
|
||||
|
||||
|
|
|
@ -1,5 +0,0 @@
|
|||
const {cp} = require('shelljs');
|
||||
|
||||
module.exports = function copyFolder() {
|
||||
return (from, to) => cp('-rf', from, to);
|
||||
};
|
Loading…
Reference in New Issue