Skip to content
This repository was archived by the owner on Dec 4, 2017. It is now read-only.

Commit 39f1959

Browse files
petebacondarwinjtraband
authored andcommitted
refact(angular.io-package): compute the correct path rather than fixing up later
1 parent 166d932 commit 39f1959

File tree

3 files changed

+13
-34
lines changed

3 files changed

+13
-34
lines changed

public/api-builder/angular.io-package/index.js

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@ module.exports = new Package('angular.io', [basePackage])
1010

1111
.factory(require('./services/renderMarkdown'))
1212
.processor(require('./processors/addJadeDataDocsProcessor'))
13-
// MIGRATION: added this processor
14-
.processor(require('./processors/fixOutputPathProcessor'))
13+
1514
// MIGRATION: added packageInfo to point to angular/angular repo
1615
// overrides base packageInfo and returns the one for the 'angular/angular' repo.
1716
.factory(require('./services/packageInfo'))
@@ -59,26 +58,28 @@ module.exports = new Package('angular.io', [basePackage])
5958

6059
computePathsProcessor.pathTemplates.push({
6160
docTypes: ['module'],
62-
pathTemplate: '${id}/',
61+
getPath: function computeModulePath(doc) {
62+
return doc.id.replace(/^angular2\//, '');
63+
},
6364
// MIGRATION:
6465
// outputPathTemplate: MODULES_DOCS_PATH + '/${id}/index.jade'
65-
outputPathTemplate: '/${id}/index.jade'
66+
outputPathTemplate: '${path}/index.jade'
6667
});
6768

6869
computePathsProcessor.pathTemplates.push({
6970
docTypes: EXPORT_DOC_TYPES,
70-
pathTemplate: '${moduleDoc.id}/${name}-${docType}.html',
71+
pathTemplate: '${moduleDoc.path}/${name}-${docType}.html',
7172
// MIGRATION:
7273
// outputPathTemplate: MODULES_DOCS_PATH + '/${moduleDoc.id}/${name}-${docType}.jade',
73-
outputPathTemplate:'/${moduleDoc.id}/${name}-${docType}.jade',
74+
outputPathTemplate:'${moduleDoc.path}/${name}-${docType}.jade',
7475
});
7576

7677
computePathsProcessor.pathTemplates.push({
7778
docTypes: ['jade-data'],
78-
pathTemplate: '${originalDoc.id}/_data',
79+
pathTemplate: '${originalDoc.path}/_data',
7980
// MIGRATION:
8081
// outputPathTemplate: MODULES_DOCS_PATH + '/${path}.json'
81-
outputPathTemplate: '/${path}.json'
82+
outputPathTemplate: '${path}.json'
8283
});
8384
})
8485

public/api-builder/angular.io-package/processors/fixOutputPathProcessor.js

Lines changed: 0 additions & 23 deletions
This file was deleted.

public/api-builder/typescript-package/processors/readTypeScriptModules.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,10 @@ module.exports = function readTypeScriptModules(tsParser, modules, getFileInfo,
6363
var exportDoc = createExportDoc(exportSymbol.name, resolvedExport, moduleDoc, basePath, parseInfo.typeChecker);
6464
log.debug('>>>> EXPORT: ' + exportDoc.name + ' (' + exportDoc.docType + ') from ' + moduleDoc.id);
6565

66+
// Add this export doc to its module doc
67+
moduleDoc.exports.push(exportDoc);
68+
docs.push(exportDoc);
69+
6670
exportDoc.members = [];
6771
exportDoc.statics = [];
6872

@@ -123,9 +127,6 @@ module.exports = function readTypeScriptModules(tsParser, modules, getFileInfo,
123127
});
124128
}
125129

126-
// Add this export doc to its module doc
127-
moduleDoc.exports.push(exportDoc);
128-
docs.push(exportDoc);
129130
});
130131
});
131132
}

0 commit comments

Comments
 (0)