fix(aio): convert API and content docs to JSON

This commit is contained in:
Peter Bacon Darwin
2017-02-21 16:57:19 +00:00
committed by Igor Minar
parent 5e9474d24c
commit dfed388139
3 changed files with 32 additions and 4 deletions

View File

@ -46,6 +46,7 @@ module.exports =
.processor(require('./processors/extractDecoratedClasses'))
.processor(require('./processors/matchUpDirectiveDecorators'))
.processor(require('./processors/filterMemberDocs'))
.processor(require('./processors/convertToJson'))
// overrides base packageInfo and returns the one for the 'angular/angular' repo.
.factory('packageInfo', function() { return require(path.resolve(PROJECT_ROOT, 'package.json')); })
@ -211,12 +212,12 @@ module.exports =
doc.id.replace(/^@angular\//, API_SEGMENT + '/').replace(/\/index$/, '');
return doc.moduleFolder;
},
outputPathTemplate: '${moduleFolder}/index.html'
outputPathTemplate: '${moduleFolder}/index.json'
},
{
docTypes: EXPORT_DOC_TYPES.concat(['decorator', 'directive', 'pipe']),
pathTemplate: '${moduleDoc.moduleFolder}/${name}',
outputPathTemplate: '${moduleDoc.moduleFolder}/${name}.html',
outputPathTemplate: '${moduleDoc.moduleFolder}/${name}.json',
},
{
docTypes: ['api-list-data', 'api-list-audit'],
@ -229,10 +230,17 @@ module.exports =
outputPathTemplate: '${path}'
},
{docTypes: ['example-region'], getOutputPath: function() {}},
{docTypes: ['content'], pathTemplate: '${id}', outputPathTemplate: '${path}.html'}
{docTypes: ['content'], pathTemplate: '${id}', outputPathTemplate: '${path}.json'}
];
})
.config(function(convertToJsonProcessor, EXPORT_DOC_TYPES) {
convertToJsonProcessor.docTypes = EXPORT_DOC_TYPES.concat([
'content', 'decorator', 'directive', 'pipe', 'module'
]);
});
function requireFolder(folderPath) {
const absolutePath = path.resolve(__dirname, folderPath);
return fs.readdirSync(absolutePath)