2017-03-21 06:13:47 +08:00
|
|
|
module.exports = function npmId(renderDocsProcessor) {
|
|
|
|
return {
|
|
|
|
name: 'npm-id',
|
|
|
|
$runAfter: ['paths-computed'],
|
2017-03-24 03:18:35 +08:00
|
|
|
$runBefore: ['jekyll'],
|
2017-03-21 06:13:47 +08:00
|
|
|
$process: function(docs) {
|
|
|
|
var currentVersion = renderDocsProcessor.extraData.version.current.name;
|
|
|
|
|
|
|
|
// pretty up and sort the docs object for menu generation
|
|
|
|
docs = docs.filter(function(doc) {
|
|
|
|
return (!!doc.name && !!doc.outputPath) || doc.docType === 'index-page';
|
|
|
|
});
|
|
|
|
|
|
|
|
docs.forEach(function(doc, i) {
|
2017-03-21 08:14:51 +08:00
|
|
|
doc.npmId = doc.outputPath.replace('/README.md', '') // for readmes
|
|
|
|
.replace('@ionic-native/plugins/','') // for readmes
|
|
|
|
.replace('content/docs/v2/native/', '') // for docs
|
|
|
|
.replace('/index.md', ''); // for docs
|
2017-03-21 06:13:47 +08:00
|
|
|
});
|
|
|
|
|
|
|
|
// returning docs will replace docs object in the next process
|
|
|
|
return docs;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|