diff --git a/docs/angular.io-package/index.js b/docs/angular.io-package/index.js
index 965b08c0d6..9e6eab4470 100644
--- a/docs/angular.io-package/index.js
+++ b/docs/angular.io-package/index.js
@@ -21,12 +21,11 @@ module.exports = new Package('angular.io', [basePackage])
writeFilesProcessor.outputFolder = 'dist/angular.io';
})
-.config(function(readFilesProcessor, generateNavigationDoc, createOverviewDump, createTypeDefinitionFile) {
+.config(function(readFilesProcessor, generateNavigationDoc, createOverviewDump) {
// Clear out unwanted processors
readFilesProcessor.$enabled = false;
generateNavigationDoc.$enabled = false;
createOverviewDump.$enabled = false;
- createTypeDefinitionFile.$enabled = false;
})
diff --git a/docs/dgeni-package/index.js b/docs/docs-package/index.js
similarity index 65%
rename from docs/dgeni-package/index.js
rename to docs/docs-package/index.js
index fca60b6976..4771f79f3a 100644
--- a/docs/dgeni-package/index.js
+++ b/docs/docs-package/index.js
@@ -3,45 +3,21 @@ require('../../tools/transpiler/index.js').init();
var Package = require('dgeni').Package;
var jsdocPackage = require('dgeni-packages/jsdoc');
var nunjucksPackage = require('dgeni-packages/nunjucks');
+var typescriptPackage = require('../typescript-package');
var linksPackage = require('../links-package');
var gitPackage = require('dgeni-packages/git');
var path = require('canonical-path');
-var PARTIAL_PATH = 'partials';
-var MODULES_DOCS_PATH = PARTIAL_PATH + '/modules';
-var GUIDES_PATH = PARTIAL_PATH + '/guides';
-
// Define the dgeni package for generating the docs
-module.exports = new Package('angular', [jsdocPackage, nunjucksPackage, linksPackage, gitPackage])
+module.exports = new Package('angular-v2-docs', [jsdocPackage, nunjucksPackage, typescriptPackage, linksPackage, gitPackage])
// Register the services and file readers
-.factory(require('./services/modules'))
-.factory(require('./services/tsParser'))
-.factory(require('./services/tsParser/createCompilerHost'))
-.factory(require('./services/tsParser/getFileInfo'))
-.factory(require('./services/tsParser/getExportDocType'))
-.factory(require('./services/tsParser/getContent'))
.factory(require('./readers/ngdoc'))
-.factory('EXPORT_DOC_TYPES', function() {
- return [
- 'class',
- 'interface',
- 'function',
- 'var',
- 'const',
- 'enum',
- 'type-alias'
- ];
-})
-
-
// Register the processors
-.processor(require('./processors/readTypeScriptModules'))
.processor(require('./processors/generateNavigationDoc'))
.processor(require('./processors/extractTitleFromGuides'))
.processor(require('./processors/createOverviewDump'))
-.processor(require('./processors/createTypeDefinitionFile'))
// Configure the log service
@@ -67,7 +43,7 @@ module.exports = new Package('angular', [jsdocPackage, nunjucksPackage, linksPac
'*/*.@(js|es6|ts)',
'*/src/**/*.@(js|es6|ts)'
];
- readTypeScriptModules.basePath = 'modules';
+ readTypeScriptModules.basePath = path.resolve(readFilesProcessor.basePath, 'modules');
})
@@ -122,13 +98,7 @@ module.exports = new Package('angular', [jsdocPackage, nunjucksPackage, linksPac
// Configure ids and paths
-.config(function(computeIdsProcessor, computePathsProcessor, EXPORT_DOC_TYPES) {
-
- computeIdsProcessor.idTemplates.push({
- docTypes: ['member'],
- idTemplate: '${classDoc.id}.${name}',
- getAliases: function(doc) { return [doc.id]; }
- });
+.config(function(computeIdsProcessor, computePathsProcessor) {
computeIdsProcessor.idTemplates.push({
docTypes: ['guide'],
@@ -144,29 +114,9 @@ module.exports = new Package('angular', [jsdocPackage, nunjucksPackage, linksPac
getAliases: function(doc) { return [doc.id]; }
});
-
- computePathsProcessor.pathTemplates.push({
- docTypes: ['module'],
- pathTemplate: '/${id}',
- outputPathTemplate: MODULES_DOCS_PATH + '/${id}/index.html'
- });
-
- computePathsProcessor.pathTemplates.push({
- docTypes: EXPORT_DOC_TYPES,
- pathTemplate: '${moduleDoc.path}/${name}',
- outputPathTemplate: MODULES_DOCS_PATH + '/${path}/index.html'
- });
-
- computePathsProcessor.pathTemplates.push({
- docTypes: ['member'],
- pathTemplate: '${classDoc.path}/${name}',
- getOutputPath: function() {} // These docs are not written to their own file, instead they are part of their class doc
- });
-
-
computePathsProcessor.pathTemplates.push({
docTypes: ['guide'],
pathTemplate: '/${id}',
- outputPathTemplate: GUIDES_PATH + '/${id}.html'
+ outputPathTemplate: 'partials/guides/${id}.html'
});
});
diff --git a/docs/dgeni-package/mocks/importedSrc.ts b/docs/docs-package/mocks/importedSrc.ts
similarity index 100%
rename from docs/dgeni-package/mocks/importedSrc.ts
rename to docs/docs-package/mocks/importedSrc.ts
diff --git a/docs/dgeni-package/mocks/mockPackage.js b/docs/docs-package/mocks/mockPackage.js
similarity index 100%
rename from docs/dgeni-package/mocks/mockPackage.js
rename to docs/docs-package/mocks/mockPackage.js
diff --git a/docs/dgeni-package/mocks/testSrc.ts b/docs/docs-package/mocks/testSrc.ts
similarity index 100%
rename from docs/dgeni-package/mocks/testSrc.ts
rename to docs/docs-package/mocks/testSrc.ts
diff --git a/docs/dgeni-package/processors/createOverviewDump.js b/docs/docs-package/processors/createOverviewDump.js
similarity index 100%
rename from docs/dgeni-package/processors/createOverviewDump.js
rename to docs/docs-package/processors/createOverviewDump.js
diff --git a/docs/dgeni-package/processors/extractTitleFromGuides.js b/docs/docs-package/processors/extractTitleFromGuides.js
similarity index 100%
rename from docs/dgeni-package/processors/extractTitleFromGuides.js
rename to docs/docs-package/processors/extractTitleFromGuides.js
diff --git a/docs/dgeni-package/processors/generateNavigationDoc.js b/docs/docs-package/processors/generateNavigationDoc.js
similarity index 100%
rename from docs/dgeni-package/processors/generateNavigationDoc.js
rename to docs/docs-package/processors/generateNavigationDoc.js
diff --git a/docs/dgeni-package/readers/ngdoc.js b/docs/docs-package/readers/ngdoc.js
similarity index 100%
rename from docs/dgeni-package/readers/ngdoc.js
rename to docs/docs-package/readers/ngdoc.js
diff --git a/docs/dgeni-package/readers/ngdoc.spec.js b/docs/docs-package/readers/ngdoc.spec.js
similarity index 100%
rename from docs/dgeni-package/readers/ngdoc.spec.js
rename to docs/docs-package/readers/ngdoc.spec.js
diff --git a/docs/dgeni-package/tag-defs/exportedAs.js b/docs/docs-package/tag-defs/exportedAs.js
similarity index 100%
rename from docs/dgeni-package/tag-defs/exportedAs.js
rename to docs/docs-package/tag-defs/exportedAs.js
diff --git a/docs/dgeni-package/tag-defs/private.js b/docs/docs-package/tag-defs/private.js
similarity index 100%
rename from docs/dgeni-package/tag-defs/private.js
rename to docs/docs-package/tag-defs/private.js
diff --git a/docs/dgeni-package/tag-defs/public.js b/docs/docs-package/tag-defs/public.js
similarity index 100%
rename from docs/dgeni-package/tag-defs/public.js
rename to docs/docs-package/tag-defs/public.js
diff --git a/docs/dgeni-package/templates/angular2/angular2.d.ts.template.html b/docs/docs-package/templates/angular2/angular2.d.ts.template.html
similarity index 100%
rename from docs/dgeni-package/templates/angular2/angular2.d.ts.template.html
rename to docs/docs-package/templates/angular2/angular2.d.ts.template.html
diff --git a/docs/dgeni-package/templates/class.template.html b/docs/docs-package/templates/class.template.html
similarity index 100%
rename from docs/dgeni-package/templates/class.template.html
rename to docs/docs-package/templates/class.template.html
diff --git a/docs/dgeni-package/templates/common.template.html b/docs/docs-package/templates/common.template.html
similarity index 100%
rename from docs/dgeni-package/templates/common.template.html
rename to docs/docs-package/templates/common.template.html
diff --git a/docs/dgeni-package/templates/const.template.html b/docs/docs-package/templates/const.template.html
similarity index 100%
rename from docs/dgeni-package/templates/const.template.html
rename to docs/docs-package/templates/const.template.html
diff --git a/docs/dgeni-package/templates/data-module.template.js b/docs/docs-package/templates/data-module.template.js
similarity index 100%
rename from docs/dgeni-package/templates/data-module.template.js
rename to docs/docs-package/templates/data-module.template.js
diff --git a/docs/dgeni-package/templates/function.template.html b/docs/docs-package/templates/function.template.html
similarity index 100%
rename from docs/dgeni-package/templates/function.template.html
rename to docs/docs-package/templates/function.template.html
diff --git a/docs/dgeni-package/templates/guide.template.html b/docs/docs-package/templates/guide.template.html
similarity index 100%
rename from docs/dgeni-package/templates/guide.template.html
rename to docs/docs-package/templates/guide.template.html
diff --git a/docs/dgeni-package/templates/interface.template.html b/docs/docs-package/templates/interface.template.html
similarity index 100%
rename from docs/dgeni-package/templates/interface.template.html
rename to docs/docs-package/templates/interface.template.html
diff --git a/docs/dgeni-package/templates/layout/base.template.html b/docs/docs-package/templates/layout/base.template.html
similarity index 100%
rename from docs/dgeni-package/templates/layout/base.template.html
rename to docs/docs-package/templates/layout/base.template.html
diff --git a/docs/dgeni-package/templates/lib/githubLinks.html b/docs/docs-package/templates/lib/githubLinks.html
similarity index 100%
rename from docs/dgeni-package/templates/lib/githubLinks.html
rename to docs/docs-package/templates/lib/githubLinks.html
diff --git a/docs/dgeni-package/templates/lib/paramList.html b/docs/docs-package/templates/lib/paramList.html
similarity index 100%
rename from docs/dgeni-package/templates/lib/paramList.html
rename to docs/docs-package/templates/lib/paramList.html
diff --git a/docs/dgeni-package/templates/module.template.html b/docs/docs-package/templates/module.template.html
similarity index 100%
rename from docs/dgeni-package/templates/module.template.html
rename to docs/docs-package/templates/module.template.html
diff --git a/docs/dgeni-package/templates/overview-dump.template.html b/docs/docs-package/templates/overview-dump.template.html
similarity index 100%
rename from docs/dgeni-package/templates/overview-dump.template.html
rename to docs/docs-package/templates/overview-dump.template.html
diff --git a/docs/dgeni-package/templates/type-alias.template.html b/docs/docs-package/templates/type-alias.template.html
similarity index 100%
rename from docs/dgeni-package/templates/type-alias.template.html
rename to docs/docs-package/templates/type-alias.template.html
diff --git a/docs/dgeni-package/templates/type-definition.template.html b/docs/docs-package/templates/type-definition.template.html
similarity index 100%
rename from docs/dgeni-package/templates/type-definition.template.html
rename to docs/docs-package/templates/type-definition.template.html
diff --git a/docs/dgeni-package/templates/var.template.html b/docs/docs-package/templates/var.template.html
similarity index 100%
rename from docs/dgeni-package/templates/var.template.html
rename to docs/docs-package/templates/var.template.html
diff --git a/docs/public-docs-package/index.js b/docs/public-docs-package/index.js
index 44a0f3776a..8b17e5b337 100644
--- a/docs/public-docs-package/index.js
+++ b/docs/public-docs-package/index.js
@@ -1,7 +1,7 @@
var Package = require('dgeni').Package;
-var basePackage = require('../dgeni-package');
+var basePackage = require('../docs-package');
-module.exports = new Package('angular-public', [basePackage])
+module.exports = new Package('angular-v2-public-docs', [basePackage])
.config(function(readTypeScriptModules) {
readTypeScriptModules.sourceFiles = [
diff --git a/docs/typescript-definition-package/index.js b/docs/typescript-definition-package/index.js
new file mode 100644
index 0000000000..b46ffa3993
--- /dev/null
+++ b/docs/typescript-definition-package/index.js
@@ -0,0 +1,89 @@
+var Package = require('dgeni').Package;
+var jsdocPackage = require('dgeni-packages/jsdoc');
+var nunjucksPackage = require('dgeni-packages/nunjucks');
+var typescriptPackage = require('../typescript-package');
+var gitPackage = require('dgeni-packages/git');
+var path = require('canonical-path');
+
+// Define the dgeni package for generating the docs
+module.exports = new Package('angular-v2-docs', [jsdocPackage, nunjucksPackage, typescriptPackage, gitPackage])
+
+// Register the processors
+.processor(require('./processors/createTypeDefinitionFile'))
+
+.config(function(readFilesProcessor, inlineTagProcessor) {
+ readFilesProcessor.basePath = path.resolve(__dirname, '../..');
+ // Don't run unwanted processors
+ readFilesProcessor.$enabled = false;
+ inlineTagProcessor.$enabled = false;
+})
+
+
+// Configure the log service
+.config(function(log) {
+ log.level = 'info';
+})
+
+
+.config(function(renderDocsProcessor, versionInfo) {
+ renderDocsProcessor.extraData.versionInfo = versionInfo;
+})
+
+.config(function(readFilesProcessor, inlineTagProcessor, readTypeScriptModules) {
+
+ // Don't run unwanted processors
+ readFilesProcessor.$enabled = false; // We are not using the normal file reading processor
+ inlineTagProcessor.$enabled = false; // We are not actually processing the inline link tags
+
+ // Configure file reading
+ readFilesProcessor.basePath = path.resolve(__dirname, '../..');
+ readTypeScriptModules.sourceFiles = [
+ 'angular2/angular2.ts',
+ 'angular2/router.ts'
+ ];
+ readTypeScriptModules.basePath = path.resolve(path.resolve(__dirname, '../../modules'));
+})
+
+
+.config(function(parseTagsProcessor, getInjectables) {
+ parseTagsProcessor.tagDefinitions.push(require('./tag-defs/public'));
+ parseTagsProcessor.tagDefinitions.push(require('./tag-defs/private'));
+ parseTagsProcessor.tagDefinitions.push(require('./tag-defs/exportedAs'));
+
+ // We actually don't want to parse param docs in this package as we are getting the data out using TS
+ parseTagsProcessor.tagDefinitions.forEach(function(tagDef) {
+ if (tagDef.name === 'param') {
+ tagDef.docProperty = 'paramData';
+ tagDef.transforms = [];
+ }
+ });
+
+})
+
+
+// Configure file writing
+.config(function(writeFilesProcessor) {
+ writeFilesProcessor.outputFolder = 'dist/docs';
+})
+
+
+// Configure rendering
+.config(function(templateFinder, templateEngine) {
+
+ // Nunjucks and Angular conflict in their template bindings so change Nunjucks
+ templateEngine.config.tags = {
+ variableStart: '{$',
+ variableEnd: '$}'
+ };
+
+ templateFinder.templateFolders
+ .unshift(path.resolve(__dirname, 'templates'));
+
+ templateFinder.templatePatterns = [
+ '${ doc.template }',
+ '${ doc.id }.${ doc.docType }.template.html',
+ '${ doc.id }.template.html',
+ '${ doc.docType }.template.html',
+ 'common.template.html'
+ ];
+});
\ No newline at end of file
diff --git a/docs/dgeni-package/processors/createTypeDefinitionFile.js b/docs/typescript-definition-package/processors/createTypeDefinitionFile.js
similarity index 95%
rename from docs/dgeni-package/processors/createTypeDefinitionFile.js
rename to docs/typescript-definition-package/processors/createTypeDefinitionFile.js
index d07bbef69d..e00f9af23a 100644
--- a/docs/dgeni-package/processors/createTypeDefinitionFile.js
+++ b/docs/typescript-definition-package/processors/createTypeDefinitionFile.js
@@ -61,11 +61,12 @@ module.exports = function createTypeDefinitionFile(log) {
});
});
- _.forEach(typeDefDocs, function(doc) {
+ return _.filter(typeDefDocs, function(doc) {
_.forEach(doc.moduleDocs, function(modDoc, alias) {
- if (!modDoc.doc) {
+ if (!doc || !modDoc.doc) {
log.error('createTypeDefinitionFile processor: no such module "' + alias + '" (Did you forget to add it to the modules to load?)');
doc = null;
+ return;
}
_.forEach(modDoc.doc.exports, function(exportDoc) {
@@ -86,9 +87,7 @@ module.exports = function createTypeDefinitionFile(log) {
}
});
});
- if (doc) {
- docs.push(doc);
- }
+ return !!doc;
});
}
};
diff --git a/docs/typescript-definition-package/tag-defs/exportedAs.js b/docs/typescript-definition-package/tag-defs/exportedAs.js
new file mode 100644
index 0000000000..aa36151697
--- /dev/null
+++ b/docs/typescript-definition-package/tag-defs/exportedAs.js
@@ -0,0 +1,4 @@
+module.exports = {
+ name: 'exportedAs',
+ multi: true
+};
\ No newline at end of file
diff --git a/docs/typescript-definition-package/tag-defs/private.js b/docs/typescript-definition-package/tag-defs/private.js
new file mode 100644
index 0000000000..328ec0ac5b
--- /dev/null
+++ b/docs/typescript-definition-package/tag-defs/private.js
@@ -0,0 +1,4 @@
+module.exports = {
+ name: 'private',
+ transforms: function(doc, tag) { return true; }
+};
\ No newline at end of file
diff --git a/docs/typescript-definition-package/tag-defs/public.js b/docs/typescript-definition-package/tag-defs/public.js
new file mode 100644
index 0000000000..a85d5dd43c
--- /dev/null
+++ b/docs/typescript-definition-package/tag-defs/public.js
@@ -0,0 +1,4 @@
+module.exports = {
+ name: 'public',
+ transforms: function(doc, tag) { return true; }
+};
\ No newline at end of file
diff --git a/docs/typescript-definition-package/templates/angular2/angular2.d.ts.template.html b/docs/typescript-definition-package/templates/angular2/angular2.d.ts.template.html
new file mode 100644
index 0000000000..fe2051c2e9
--- /dev/null
+++ b/docs/typescript-definition-package/templates/angular2/angular2.d.ts.template.html
@@ -0,0 +1,32 @@
+{% extends '../type-definition.template.html' %}
+{% block staticDeclarations %}
+// Angular depends transitively on these libraries.
+// If you don't have them installed you can run
+// $ tsd query es6-promise rx rx-lite --action install --save
+///
+///
+
+interface List extends Array {}
+interface Map {}
+interface StringMap extends Map {}
+
+declare module ng {
+ type SetterFn = typeof Function;
+ type int = number;
+ interface Type extends Function {
+ new (...args);
+ }
+
+ // See https://github.com/Microsoft/TypeScript/issues/1168
+ class BaseException /* extends Error */ {
+ message: string;
+ stack: string;
+ toString(): string;
+ }
+ interface InjectableReference {}
+}
+{% endblock %}
+
+declare module "angular2/angular2" {
+ export = ng;
+}
diff --git a/docs/typescript-definition-package/templates/type-definition.template.html b/docs/typescript-definition-package/templates/type-definition.template.html
new file mode 100644
index 0000000000..4ebceffaa0
--- /dev/null
+++ b/docs/typescript-definition-package/templates/type-definition.template.html
@@ -0,0 +1,72 @@
+
+{%- macro commentBlock(doc, level) -%}
+{%- if doc.content | trim %}
+
+{% if level > 1 %}{$ '/**' | indent(level-1, true) | replace(r/\n$/, "") $}{% else %}/**{% endif %}
+{$ doc.content | trim | replace(r/^/gm, "* ") | indent(level, true) | replace(r/\n$/, "") $}
+{$ '*/' | indent(level, true) | replace(r/\n$/, "") $}{% endif -%}
+{%- endmacro -%}
+
+
+{%- macro memberInfo(member) -%}
+{$ commentBlock(member, 5) $}
+ {$ member.name $}{% if member.optional %}?{% endif -%}
+{% if member.typeParameters %}<{% for typeParam in member.typeParameters %}{$ typeParam $}{% if not loop.last %}, {% endif %}{% endfor %}>{% endif -%}
+{%- if member.parameters -%}({% for param in member.parameters %}{$ param $}{% if not loop.last %}, {% endif %}{% endfor %}){%- endif -%}
+{%- if member.returnType == 'Directive' %}: DirectiveAnnotation{%- elif member.returnType -%}: {$ member.returnType $}{%- else -%}: void
+{%- endif -%};
+{%- endmacro -%}
+
+
+// Type definitions for Angular v{$ versionInfo.currentVersion.full | replace(r/\+/, "_") $}
+// Project: http://angular.io/
+// Definitions by: angular team
+// Definitions: https://github.com/borisyankov/DefinitelyTyped
+
+// ***********************************************************
+// This file is generated by the Angular build process.
+// Please do not create manual edits or send pull requests
+// modifying this file.
+// ***********************************************************
+{% block staticDeclarations %}{% endblock %}
+{% for alias, module in doc.moduleDocs %}
+{$ commentBlock(module.doc, 1) $}
+declare module ng {
+
+ {%- for export in module.doc.exports -%}
+ {%- if export.content -%}
+ {$ commentBlock(export, 3) $}
+ {%- endif %}
+ {$ export.docType $} {$ export.name $}{$ export.typeParams $}{%- if export.heritage == ' extends Directive' %} extends DirectiveAnnotation{% else %}{$ export.heritage $}{% endif %}
+ {%- if export.docType == 'class' or export.docType == 'interface' %} {
+ {%- if export.newMember %}
+ {$ memberInfo(export.newMember) $}
+ {% endif %}
+ {%- if export.callMember %}
+ {$ memberInfo(export.callMember) $}
+ {% endif -%}
+ {%- for member in export.members %}
+ {$ memberInfo(member) $}
+ {%- endfor %}
+ }
+
+ {%- elif export.docType == 'enum' %} {
+ {%- for member in export.members %}
+ {$ member $}{% if not loop.last %},
+ {%- endif -%}
+ {%- endfor %}
+ }
+
+ {%- else -%}
+ {% if export.parameters %}({% for param in export.parameters %}{$ param $}{% if not loop.last %}, {% endif %}{% endfor %}){%- endif %}
+ {%- if export.returnType %} : {$ export.returnType $} {% endif -%}
+ ;
+ {%- endif %}
+ {% endfor %}
+}
+
+{% endfor %}
+
+declare module "angular2/angular2" {
+ export = ng;
+}
diff --git a/docs/typescript-package/index.js b/docs/typescript-package/index.js
new file mode 100644
index 0000000000..165c654640
--- /dev/null
+++ b/docs/typescript-package/index.js
@@ -0,0 +1,70 @@
+require('../../tools/transpiler/index.js').init();
+
+var basePackage = require('dgeni-packages/base');
+var Package = require('dgeni').Package;
+var path = require('canonical-path');
+
+// Define the dgeni package for generating the docs
+module.exports = new Package('typescript-parsing', [basePackage])
+
+// Register the services and file readers
+.factory(require('./services/modules'))
+.factory(require('./services/tsParser'))
+.factory(require('./services/tsParser/createCompilerHost'))
+.factory(require('./services/tsParser/getFileInfo'))
+.factory(require('./services/tsParser/getExportDocType'))
+.factory(require('./services/tsParser/getContent'))
+
+.factory('EXPORT_DOC_TYPES', function() {
+ return [
+ 'class',
+ 'interface',
+ 'function',
+ 'var',
+ 'const',
+ 'enum',
+ 'type-alias'
+ ];
+})
+
+
+// Register the processors
+.processor(require('./processors/readTypeScriptModules'))
+
+
+// Configure the log service
+.config(function(log) {
+ log.level = 'warn';
+})
+
+
+// Configure ids and paths
+.config(function(computeIdsProcessor, computePathsProcessor, EXPORT_DOC_TYPES) {
+
+ computeIdsProcessor.idTemplates.push({
+ docTypes: ['member'],
+ idTemplate: '${classDoc.id}.${name}',
+ getAliases: function(doc) { return [doc.id]; }
+ });
+
+ computePathsProcessor.pathTemplates.push({
+ docTypes: ['member'],
+ pathTemplate: '${classDoc.path}/${name}',
+ getOutputPath: function() {} // These docs are not written to their own file, instead they are part of their class doc
+ });
+
+ var MODULES_DOCS_PATH = 'partials/modules';
+
+ computePathsProcessor.pathTemplates.push({
+ docTypes: ['module'],
+ pathTemplate: '/${id}',
+ outputPathTemplate: MODULES_DOCS_PATH + '/${id}/index.html'
+ });
+
+ computePathsProcessor.pathTemplates.push({
+ docTypes: EXPORT_DOC_TYPES,
+ pathTemplate: '${moduleDoc.path}/${name}',
+ outputPathTemplate: MODULES_DOCS_PATH + '/${path}/index.html'
+ });
+
+});
diff --git a/docs/typescript-package/mocks/mockPackage.js b/docs/typescript-package/mocks/mockPackage.js
new file mode 100644
index 0000000000..834d53c959
--- /dev/null
+++ b/docs/typescript-package/mocks/mockPackage.js
@@ -0,0 +1,11 @@
+var Package = require('dgeni').Package;
+
+module.exports = function mockPackage() {
+
+ return new Package('mockPackage', [require('../')])
+
+ // provide a mock log service
+ .factory('log', function() { return require('dgeni/lib/mocks/log')(false); })
+ .factory('templateEngine', function() { return {}; });
+
+};
diff --git a/docs/dgeni-package/mocks/readTypeScriptModules/ignoreExportsMatching.ts b/docs/typescript-package/mocks/readTypeScriptModules/ignoreExportsMatching.ts
similarity index 100%
rename from docs/dgeni-package/mocks/readTypeScriptModules/ignoreExportsMatching.ts
rename to docs/typescript-package/mocks/readTypeScriptModules/ignoreExportsMatching.ts
diff --git a/docs/dgeni-package/mocks/readTypeScriptModules/interfaces.ts b/docs/typescript-package/mocks/readTypeScriptModules/interfaces.ts
similarity index 100%
rename from docs/dgeni-package/mocks/readTypeScriptModules/interfaces.ts
rename to docs/typescript-package/mocks/readTypeScriptModules/interfaces.ts
diff --git a/docs/dgeni-package/mocks/readTypeScriptModules/orderingOfMembers.ts b/docs/typescript-package/mocks/readTypeScriptModules/orderingOfMembers.ts
similarity index 100%
rename from docs/dgeni-package/mocks/readTypeScriptModules/orderingOfMembers.ts
rename to docs/typescript-package/mocks/readTypeScriptModules/orderingOfMembers.ts
diff --git a/docs/typescript-package/mocks/tsParser/importedSrc.ts b/docs/typescript-package/mocks/tsParser/importedSrc.ts
new file mode 100644
index 0000000000..74a115e5fe
--- /dev/null
+++ b/docs/typescript-package/mocks/tsParser/importedSrc.ts
@@ -0,0 +1 @@
+export var x = 100;
\ No newline at end of file
diff --git a/docs/typescript-package/mocks/tsParser/testSrc.ts b/docs/typescript-package/mocks/tsParser/testSrc.ts
new file mode 100644
index 0000000000..7b6d3f18dd
--- /dev/null
+++ b/docs/typescript-package/mocks/tsParser/testSrc.ts
@@ -0,0 +1,34 @@
+/**
+ * @module
+ * @description
+ * This is the module description
+ */
+
+export * from 'importedSrc';
+
+/**
+ * This is some random other comment
+ */
+
+/**
+ * This is MyClass
+ */
+export class MyClass {
+ message: String;
+
+ /**
+ * Create a new MyClass
+ * @param {String} name The name to say hello to
+ */
+ constructor(name) { this.message = 'hello ' + name; }
+
+ /**
+ * Return a greeting message
+ */
+ greet() { return this.message; }
+}
+
+/**
+ * An exported function
+ */
+export var myFn = (val: number) => return val * 2;
\ No newline at end of file
diff --git a/docs/dgeni-package/processors/readTypeScriptModules.js b/docs/typescript-package/processors/readTypeScriptModules.js
similarity index 98%
rename from docs/dgeni-package/processors/readTypeScriptModules.js
rename to docs/typescript-package/processors/readTypeScriptModules.js
index 0e9f310f1f..a40e497ab0 100644
--- a/docs/dgeni-package/processors/readTypeScriptModules.js
+++ b/docs/typescript-package/processors/readTypeScriptModules.js
@@ -3,7 +3,7 @@ var path = require('canonical-path');
var _ = require('lodash');
var ts = require('typescript');
-module.exports = function readTypeScriptModules(tsParser, readFilesProcessor, modules, getFileInfo,
+module.exports = function readTypeScriptModules(tsParser, modules, getFileInfo,
getExportDocType, getContent, log) {
return {
@@ -37,7 +37,7 @@ module.exports = function readTypeScriptModules(tsParser, readFilesProcessor, mo
var hidePrivateMembers = this.hidePrivateMembers;
var sortClassMembers = this.sortClassMembers;
- var basePath = path.resolve(readFilesProcessor.basePath, this.basePath);
+ var basePath = path.resolve(this.basePath);
var filesPaths = expandSourceFiles(this.sourceFiles, basePath);
var parseInfo = tsParser.parse(filesPaths, this.basePath);
var moduleSymbols = parseInfo.moduleSymbols;
diff --git a/docs/dgeni-package/processors/readTypeScriptModules.spec.js b/docs/typescript-package/processors/readTypeScriptModules.spec.js
similarity index 100%
rename from docs/dgeni-package/processors/readTypeScriptModules.spec.js
rename to docs/typescript-package/processors/readTypeScriptModules.spec.js
diff --git a/docs/dgeni-package/services/modules.js b/docs/typescript-package/services/modules.js
similarity index 100%
rename from docs/dgeni-package/services/modules.js
rename to docs/typescript-package/services/modules.js
diff --git a/docs/dgeni-package/services/tsParser/createCompilerHost.js b/docs/typescript-package/services/tsParser/createCompilerHost.js
similarity index 100%
rename from docs/dgeni-package/services/tsParser/createCompilerHost.js
rename to docs/typescript-package/services/tsParser/createCompilerHost.js
diff --git a/docs/dgeni-package/services/tsParser/createCompilerHost.spec.js b/docs/typescript-package/services/tsParser/createCompilerHost.spec.js
similarity index 92%
rename from docs/dgeni-package/services/tsParser/createCompilerHost.spec.js
rename to docs/typescript-package/services/tsParser/createCompilerHost.spec.js
index 13bf9c9eee..38eecb91e0 100644
--- a/docs/dgeni-package/services/tsParser/createCompilerHost.spec.js
+++ b/docs/typescript-package/services/tsParser/createCompilerHost.spec.js
@@ -12,7 +12,7 @@ describe('createCompilerHost', function() {
var createCompilerHost = injector.get('createCompilerHost');
options = { charset: 'utf8' };
- baseDir = path.resolve(__dirname, '../../mocks/');
+ baseDir = path.resolve(__dirname, '../../mocks/tsParser');
extensions = ['.ts', '.js'];
host = createCompilerHost(options, baseDir, extensions);
@@ -30,8 +30,8 @@ describe('createCompilerHost', function() {
var sourceFile = host.getSourceFile('testSrc.js');
expect(sourceFile.fileName).toEqual('testSrc.ts');
- sourceFile = host.getSourceFile('mockPackage.ts');
- expect(sourceFile.fileName).toEqual('mockPackage.js');
+ sourceFile = host.getSourceFile('../mockPackage.ts');
+ expect(sourceFile.fileName).toEqual('../mockPackage.js');
});
});
diff --git a/docs/dgeni-package/services/tsParser/getContent.js b/docs/typescript-package/services/tsParser/getContent.js
similarity index 100%
rename from docs/dgeni-package/services/tsParser/getContent.js
rename to docs/typescript-package/services/tsParser/getContent.js
diff --git a/docs/dgeni-package/services/tsParser/getExportDocType.js b/docs/typescript-package/services/tsParser/getExportDocType.js
similarity index 100%
rename from docs/dgeni-package/services/tsParser/getExportDocType.js
rename to docs/typescript-package/services/tsParser/getExportDocType.js
diff --git a/docs/dgeni-package/services/tsParser/getFileInfo.js b/docs/typescript-package/services/tsParser/getFileInfo.js
similarity index 100%
rename from docs/dgeni-package/services/tsParser/getFileInfo.js
rename to docs/typescript-package/services/tsParser/getFileInfo.js
diff --git a/docs/dgeni-package/services/tsParser.js b/docs/typescript-package/services/tsParser/index.js
similarity index 100%
rename from docs/dgeni-package/services/tsParser.js
rename to docs/typescript-package/services/tsParser/index.js
diff --git a/docs/dgeni-package/services/tsParser.spec.js b/docs/typescript-package/services/tsParser/index.spec.js
similarity index 88%
rename from docs/dgeni-package/services/tsParser.spec.js
rename to docs/typescript-package/services/tsParser/index.spec.js
index a7819276ca..190b104c49 100644
--- a/docs/dgeni-package/services/tsParser.spec.js
+++ b/docs/typescript-package/services/tsParser/index.spec.js
@@ -1,4 +1,4 @@
-var mockPackage = require('../mocks/mockPackage');
+var mockPackage = require('../../mocks/mockPackage');
var Dgeni = require('dgeni');
var path = require('canonical-path');
@@ -12,7 +12,7 @@ describe('tsParser', function() {
});
it("should parse a TS file", function() {
- var parseInfo = parser.parse(['testSrc.ts'], path.resolve(__dirname, '../mocks/'));
+ var parseInfo = parser.parse(['testSrc.ts'], path.resolve(__dirname, '../../mocks/tsParser'));
var tsModules = parseInfo.moduleSymbols;
expect(tsModules.length).toEqual(1);
expect(tsModules[0].exportArray.length).toEqual(3);
diff --git a/gulpfile.js b/gulpfile.js
index 2143bc0ea4..2fe69353b2 100644
--- a/gulpfile.js
+++ b/gulpfile.js
@@ -380,10 +380,10 @@ gulp.task('docs/bower', function() {
});
-function createDocsTasks(publicBuild) {
- var dgeniPackage = publicBuild ? './docs/public-docs-package' : './docs/dgeni-package';
- var distDocsPath = publicBuild ? 'dist/public_docs' : 'dist/docs';
- var taskPrefix = publicBuild ? 'public_docs' : 'docs';
+function createDocsTasks(options) {
+ var dgeniPackage = options.package;
+ var distDocsPath = options.path;
+ var taskPrefix = options.prefix;
gulp.task(taskPrefix + '/dgeni', function() {
try {
@@ -423,8 +423,9 @@ function createDocsTasks(publicBuild) {
});
}
-createDocsTasks(true);
-createDocsTasks(false);
+
+createDocsTasks({ package: './docs/docs-package', path: 'dist/docs', prefix: 'docs'});
+createDocsTasks({ package: './docs/public-docs-package', path: 'dist/public_docs', prefix: 'public_docs'});
gulp.task('docs/angular.io', ['build/clean.docs_angular_io'], function() {
try {
@@ -437,6 +438,17 @@ gulp.task('docs/angular.io', ['build/clean.docs_angular_io'], function() {
}
});
+gulp.task('docs/typings', [], function() {
+ try {
+ var dgeni = new Dgeni([require('./docs/typescript-definition-package')]);
+ return dgeni.generate();
+ } catch(x) {
+ console.log(x);
+ console.log(x.stack);
+ throw x;
+ }
+});
+
// ------------------
// CI tests suites
@@ -642,7 +654,7 @@ gulp.task('post-test-checks', function(done) {
});
-gulp.task('!pre.test.typings', [], function() {
+gulp.task('!pre.test.typings', ['docs/typings'], function() {
return gulp
.src([
'modules/angular2/typings/**/*'], {