|
1 |
| -var _ = require('lodash'); |
| 1 | +"use strict"; |
| 2 | + |
2 | 3 | var path = require('canonical-path');
|
3 | 4 | var packagePath = __dirname;
|
4 | 5 |
|
5 |
| -var basePackage = require('dgeni-packages/ngdoc'); |
6 |
| -var examplesPackage = require('dgeni-packages/examples'); |
| 6 | +var Package = require('dgeni').Package; |
| 7 | + |
| 8 | +// Create and export a new Dgeni package called dgeni-example. This package depends upon |
| 9 | +// the jsdoc and nunjucks packages defined in the dgeni-packages npm module. |
| 10 | +module.exports = new Package('angularjs', [ |
| 11 | + require('dgeni-packages/ngdoc'), |
| 12 | + require('dgeni-packages/nunjucks'), |
| 13 | + require('dgeni-packages/examples') |
| 14 | +]) |
| 15 | + |
| 16 | + |
| 17 | +.factory(require('./services/errorNamespaceMap')) |
| 18 | +.factory(require('./services/getMinerrInfo')) |
| 19 | +.factory(require('./services/getVersion')) |
| 20 | +.factory(require('./services/gitData')) |
| 21 | + |
| 22 | +.factory(require('./services/deployments/debug')) |
| 23 | +.factory(require('./services/deployments/default')) |
| 24 | +.factory(require('./services/deployments/jquery')) |
| 25 | +.factory(require('./services/deployments/production')) |
| 26 | + |
| 27 | +.factory(require('./inline-tag-defs/type')) |
| 28 | + |
| 29 | + |
| 30 | +.processor(require('./processors/error-docs')) |
| 31 | +.processor(require('./processors/index-page')) |
| 32 | +.processor(require('./processors/keywords')) |
| 33 | +.processor(require('./processors/pages-data')) |
| 34 | +.processor(require('./processors/versions-data')) |
| 35 | + |
| 36 | + |
| 37 | +.config(function(dgeni, log, readFilesProcessor, writeFilesProcessor) { |
| 38 | + |
| 39 | + dgeni.stopOnValidationError = true; |
| 40 | + dgeni.stopOnProcessingError = true; |
| 41 | + |
| 42 | + log.level = 'info'; |
| 43 | + |
| 44 | + readFilesProcessor.basePath = path.resolve(__dirname,'../..'); |
| 45 | + readFilesProcessor.sourceFiles = [ |
| 46 | + { include: 'src/**/*.js', basePath: 'src' }, |
| 47 | + { include: 'docs/content/**/*.ngdoc', basePath: 'docs/content' } |
| 48 | + ]; |
| 49 | + |
| 50 | + writeFilesProcessor.outputFolder = 'build/docs'; |
| 51 | + |
| 52 | +}) |
| 53 | + |
| 54 | + |
| 55 | +.config(function(parseTagsProcessor) { |
| 56 | + parseTagsProcessor.tagDefinitions.push(require('./tag-defs/tutorial-step')); |
| 57 | + parseTagsProcessor.tagDefinitions.push(require('./tag-defs/sortOrder')); |
| 58 | +}) |
| 59 | + |
| 60 | + |
| 61 | +.config(function(inlineTagProcessor, typeInlineTagDef) { |
| 62 | + inlineTagProcessor.inlineTagDefinitions.push(typeInlineTagDef); |
| 63 | +}) |
| 64 | + |
| 65 | + |
| 66 | +.config(function(templateFinder, renderDocsProcessor, gitData) { |
| 67 | + templateFinder.templateFolders.unshift(path.resolve(packagePath, 'templates')); |
| 68 | + renderDocsProcessor.extraData.git = gitData; |
| 69 | +}) |
| 70 | + |
| 71 | + |
| 72 | +.config(function(computePathsProcessor, computeIdsProcessor) { |
| 73 | + |
| 74 | + computePathsProcessor.pathTemplates.push({ |
| 75 | + docTypes: ['error'], |
| 76 | + pathTemplate: 'error/${namespace}/${name}', |
| 77 | + outputPathTemplate: 'partials/error/${namespace}/${name}.html' |
| 78 | + }); |
| 79 | + |
| 80 | + computePathsProcessor.pathTemplates.push({ |
| 81 | + docTypes: ['errorNamespace'], |
| 82 | + pathTemplate: 'error/${name}', |
| 83 | + outputPathTemplate: 'partials/error/${name}.html' |
| 84 | + }); |
| 85 | + |
| 86 | + computePathsProcessor.pathTemplates.push({ |
| 87 | + docTypes: ['overview', 'tutorial'], |
| 88 | + getPath: function(doc) { |
| 89 | + var docPath = path.dirname(doc.fileInfo.relativePath); |
| 90 | + if ( doc.fileInfo.baseName !== 'index' ) { |
| 91 | + docPath = path.join(docPath, doc.fileInfo.baseName); |
| 92 | + } |
| 93 | + return docPath; |
| 94 | + }, |
| 95 | + getOutputPath: function(doc) { |
| 96 | + return 'partials/' + doc.path + |
| 97 | + ( doc.fileInfo.baseName === 'index' ? '/index.html' : '.html'); |
| 98 | + } |
| 99 | + }); |
| 100 | + |
| 101 | + computePathsProcessor.pathTemplates.push({ |
| 102 | + docTypes: ['e2e-test'], |
| 103 | + getPath: function() {}, |
| 104 | + outputPathTemplate: 'ptore2e/${example.id}/${deployment.name}_test.js' |
| 105 | + }); |
7 | 106 |
|
8 |
| -module.exports = function(config) { |
| 107 | + computePathsProcessor.pathTemplates.push({ |
| 108 | + docTypes: ['indexPage'], |
| 109 | + getPath: function() {}, |
| 110 | + outputPathTemplate: '${id}.html' |
| 111 | + }); |
9 | 112 |
|
10 |
| - config = basePackage(config); |
11 |
| - config = examplesPackage(config); |
12 | 113 |
|
13 |
| - config.append('processing.processors', [ |
14 |
| - require('./processors/git-data'), |
15 |
| - require('./processors/error-docs'), |
16 |
| - require('./processors/keywords'), |
17 |
| - require('./processors/versions-data'), |
18 |
| - require('./processors/pages-data'), |
19 |
| - require('./processors/protractor-generate'), |
20 |
| - require('./processors/index-page'), |
21 |
| - require('./processors/debug-dump') |
22 |
| - ]); |
| 114 | + computeIdsProcessor.idTemplates.push({ |
| 115 | + docTypes: ['overview', 'tutorial', 'e2e-test', 'indexPage'], |
| 116 | + getId: function(doc) { return doc.fileInfo.baseName; }, |
| 117 | + getAliases: function(doc) { return [doc.id]; } |
| 118 | + }); |
23 | 119 |
|
24 |
| - config.append('processing.tagDefinitions', [ |
25 |
| - require('./tag-defs/tutorial-step'), |
26 |
| - require('./tag-defs/sortOrder') |
27 |
| - ]); |
| 120 | + computeIdsProcessor.idTemplates.push({ |
| 121 | + docTypes: ['error', 'errorNamespace'], |
| 122 | + getId: function(doc) { return 'error:' + doc.name; }, |
| 123 | + getAliases: function(doc) { return [doc.id]; } |
| 124 | + }); |
| 125 | +}) |
28 | 126 |
|
29 |
| - config.append('processing.defaultTagTransforms', [ |
30 |
| - require('dgeni-packages/jsdoc/tag-defs/transforms/trim-whitespace') |
31 |
| - ]); |
32 | 127 |
|
33 |
| - config.append('processing.inlineTagDefinitions', [ |
34 |
| - require('./inline-tag-defs/type') |
35 |
| - ]); |
| 128 | +.config(function( |
| 129 | + generateIndexPagesProcessor, |
| 130 | + generateProtractorTestsProcessor, |
| 131 | + generateExamplesProcessor, |
| 132 | + debugDeployment, defaultDeployment, |
| 133 | + jqueryDeployment, productionDeployment) { |
36 | 134 |
|
37 |
| - config.set('processing.search.ignoreWordsFile', path.resolve(packagePath, 'ignore.words')); |
| 135 | + generateIndexPagesProcessor.deployments = [ |
| 136 | + debugDeployment, |
| 137 | + defaultDeployment, |
| 138 | + jqueryDeployment, |
| 139 | + productionDeployment |
| 140 | + ]; |
38 | 141 |
|
39 |
| - config.prepend('rendering.templateFolders', [ |
40 |
| - path.resolve(packagePath, 'templates') |
41 |
| - ]); |
| 142 | + generateProtractorTestsProcessor.deployments = [ |
| 143 | + defaultDeployment, |
| 144 | + jqueryDeployment |
| 145 | + ]; |
42 | 146 |
|
43 |
| - return config; |
44 |
| -}; |
| 147 | + generateExamplesProcessor.deployments = [ |
| 148 | + debugDeployment, |
| 149 | + defaultDeployment, |
| 150 | + jqueryDeployment, |
| 151 | + productionDeployment |
| 152 | + ]; |
| 153 | +}); |
0 commit comments