build(aio): process contributor.json file
This commit is contained in:

committed by
Alex Rickabaugh

parent
3e793f079d
commit
2454a3b641
@ -55,7 +55,7 @@ module.exports =
|
||||
// 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/navigation'))
|
||||
.factory(require('./readers/json'))
|
||||
|
||||
.config(function(checkAnchorLinksProcessor, log) {
|
||||
// TODO: re-enable
|
||||
@ -64,13 +64,13 @@ module.exports =
|
||||
|
||||
// Where do we get the source files?
|
||||
.config(function(
|
||||
readTypeScriptModules, readFilesProcessor, collectExamples, generateKeywordsProcessor, navigationFileReader) {
|
||||
readTypeScriptModules, readFilesProcessor, collectExamples, generateKeywordsProcessor, jsonFileReader) {
|
||||
|
||||
// API files are typescript
|
||||
readTypeScriptModules.basePath = API_SOURCE_PATH;
|
||||
readTypeScriptModules.ignoreExportsMatching = [/^_/];
|
||||
readTypeScriptModules.hidePrivateMembers = true;
|
||||
readFilesProcessor.fileReaders.push(navigationFileReader)
|
||||
readFilesProcessor.fileReaders.push(jsonFileReader);
|
||||
readTypeScriptModules.sourceFiles = [
|
||||
'common/index.ts',
|
||||
'common/testing/index.ts',
|
||||
@ -145,7 +145,12 @@ module.exports =
|
||||
{
|
||||
basePath: CONTENTS_PATH,
|
||||
include: CONTENTS_PATH + '/navigation.json',
|
||||
fileReader: 'navigationFileReader'
|
||||
fileReader: 'jsonFileReader'
|
||||
},
|
||||
{
|
||||
basePath: CONTENTS_PATH,
|
||||
include: CONTENTS_PATH + '/marketing/contributor.json',
|
||||
fileReader: 'jsonFileReader'
|
||||
},
|
||||
];
|
||||
|
||||
@ -278,7 +283,8 @@ module.exports =
|
||||
getPath: (doc) => `${doc.id.replace(/\/index$/, '')}`,
|
||||
outputPathTemplate: '${path}.json'
|
||||
},
|
||||
{docTypes: ['navigation-map'], pathTemplate: '${id}', outputPathTemplate: '../${id}.json'}
|
||||
{docTypes: ['navigation-json'], pathTemplate: '${id}', outputPathTemplate: '../${id}.json'},
|
||||
{docTypes: ['contributor-json'], pathTemplate: '${id}', outputPathTemplate: '../${id}.json'}
|
||||
];
|
||||
})
|
||||
|
||||
|
@ -4,11 +4,11 @@ module.exports = function processNavigationMap(versionInfo, log) {
|
||||
$runBefore: ['rendering-docs'],
|
||||
$process: function(docs) {
|
||||
|
||||
const navigationDoc = docs.find(doc => doc.docType === 'navigation-map');
|
||||
const navigationDoc = docs.find(doc => doc.docType === 'navigation-json');
|
||||
|
||||
if (!navigationDoc) {
|
||||
throw new Error(
|
||||
'Missing navigation map document (docType="navigation-map").' +
|
||||
'Missing navigation map document (docType="navigation-json").' +
|
||||
'Did you forget to add it to the readFileProcessor?');
|
||||
}
|
||||
|
||||
|
@ -1,18 +1,18 @@
|
||||
/**
|
||||
* Read in the navigation JSON
|
||||
* Read in JSON files
|
||||
*/
|
||||
module.exports = function navigationFileReader() {
|
||||
module.exports = function jsonFileReader() {
|
||||
return {
|
||||
name: 'navigationFileReader',
|
||||
name: 'jsonFileReader',
|
||||
getDocs: function(fileInfo) {
|
||||
|
||||
// We return a single element array because content files only contain one document
|
||||
return [{
|
||||
docType: 'navigation-map',
|
||||
docType: fileInfo.baseName + '-json',
|
||||
data: JSON.parse(fileInfo.content),
|
||||
template: 'json-doc.template.json',
|
||||
id: 'navigation',
|
||||
aliases: ['navigation', 'navigation.json']
|
||||
id: fileInfo.baseName,
|
||||
aliases: [fileInfo.baseName, fileInfo.relativePath]
|
||||
}];
|
||||
}
|
||||
};
|
Reference in New Issue
Block a user