Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// Since our base directory is the Bazel execroot, we need to make sure that Dgeni can
// find all templates needed to output the API docs.
templateFinder.templateFolders = [join(execRootPath, 'tools/dgeni/templates/')];
// The output path for files will be computed by joining the output folder with the base path
// from the "readFilesProcessors". Since the base path is the execroot, we can just use
// the output path passed from Bazel (e.g. $EXECROOT/bazel-out/bin/src/docs-content)
writeFilesProcessor.outputFolder = outputDirPath;
});
// Run the docs generation. The process will be automatically kept alive until Dgeni
// completed. In case the returned promise has been rejected, we need to manually exit the
// process with the proper exit code because Dgeni doesn't use native promises which would
// automatically cause the error to propagate.
new Dgeni([apiDocsPackage]).generate().catch((e: any) => {
console.error(e);
process.exit(1);
});
}
// tslint:disable-next-line: no-non-null-assertion
tsParser.options.paths!['*'] = [relative(packagePath, join(execRootPath, 'node_modules/*'))];
// Since our base directory is the Bazel execroot, we need to make sure that Dgeni can
// find all templates needed to output the API docs.
templateFinder.templateFolders = [
join(execRootPath, 'schematics/documentation/dgeni/templates/')
];
// The output path for files will be computed by joining the output folder with the base path
// from the "readFilesProcessors". Since the base path is the execroot, we can just use
// the output path passed from Bazel (e.g. $EXECROOT/bazel-out/bin/src/docs-content)
writeFilesProcessor.outputFolder = outputDirPath;
});
const docs = new Dgeni([apiDocsPackage]);
await docs.generate().catch((e: any) => {
console.error(e);
process.exit(1);
});
}
module.exports = function(currentVersion, initialVersionBuild) {
return new Package('ionic-v2-docs',
[jsdocPackage, nunjucksPackage, typescriptPackage,
linksPackage, gitPackage])
.processor(require('./processors/latest-version'))
.processor(require('./processors/index-page'))
.processor(require('./processors/remove-private-members'))
.processor(require('./processors/jekyll'))
.processor(require('./processors/hide-private-api'))
.processor(require('./processors/collect-inputs-outputs'))
.processor(require('./processors/parse-returns-object'))
.processor(require('./processors/parse-optional'))
.processor(require('./processors/parse-sass'))
// for debugging docs
// .processor(function test(){
// return {
function next(error) {
if (error) {
console.log(error);
}
}
let p = Promise.resolve();
if (process.argv.indexOf('--watch-only') === -1) {
console.log('================================================================');
console.log('Running initial doc generation');
console.log('----------------------------------------------------------------');
console.log('Skip the full doc-gen by running: `yarn docs-watch --watch-only`');
console.log('================================================================');
const {Dgeni} = require('dgeni');
const dgeni = new Dgeni([require('../angular.io-package')]);
// Turn off all the potential failures for this doc-gen one-off run.
// This enables authors to run `docs-watch` while the docs are still in an unstable state.
const injector = dgeni.configureInjector();
injector.get('linkInlineTagDef').failOnBadLink = false;
injector.get('checkAnchorLinksProcessor').$enabled = false;
injector.get('renderExamples').ignoreBrokenExamples = true;
p = dgeni.generate();
}
p.then(() => {
console.log('===================================================================');
console.log('Started watching files in:');
console.log(' - ', CONTENTS_PATH);
console.log(' - ', API_SOURCE_PATH);
var basePackage = require('dgeni-packages/base');
var jsdocPackage = require('dgeni-packages/jsdoc');
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, jsdocPackage])
// 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('./services/convertPrivateClassesToInterfaces'))
.factory('EXPORT_DOC_TYPES', function() {
return [
'class',
'interface',
'function',
var basePackage = require('dgeni-packages/base');
var jsdocPackage = require('dgeni-packages/jsdoc');
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, jsdocPackage])
// 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('./services/convertPrivateClassesToInterfaces'))
.factory('EXPORT_DOC_TYPES', function() {
return [
'class',
'interface',
'function',
tagDefs.push({name: 'view'});
tagDefs.push({name: 'template'});
tagDefs.push({name: 'fileoverview'});
tagDefs.push({name: 'const'});
tagDefs.push({name: 'throws'});
tagDefs.push({name: 'typedef'});
tagDefs.push({name: 'override'});
tagDefs.push({name: 'implements'});
tagDefs.push({name: 'final'});
// The name tag should not be required.
var nameTag = _.find(tagDefs, {name: 'name'});
nameTag.required = false;
});
var myPackage = new Package('myPackage', [
jsDocProcessor,
require('dgeni-packages/nunjucks')
]);
// Handle Inline Tags
myPackage.factory(require('./inline_tags/code'))
.config(function(inlineTagProcessor, codeTagDef) {
inlineTagProcessor.inlineTagDefinitions.push(codeTagDef);
});
/*
* Add a couple of processors to the pipe to do extra parsing and rendering.
* Note that the order in which these are included is very important.
*
* tag-fixer: Get the name of the function, format the @param and @return
* annotations to prepare them for rendering.
// Canonical path provides a consistent path (i.e. always forward slashes) across different OSes
var path = require('canonical-path');
var Package = require('dgeni').Package;
// Create and export a new Dgeni package called dgeni-example. This package depends upon
// the jsdoc and nunjucks packages defined in the dgeni-packages npm module.
module.exports = new Package('mobie', [
require('dgeni-packages/ngdoc'),
require('dgeni-packages/nunjucks'),
require('dgeni-packages/examples')
])
.factory(require('./services/deployments/default'))
.processor(require('./processors/module-docs'))
.processor(require('./processors/index-page'))
.processor(require('./processors/pages-data'))
.config(function (renderDocsProcessor) {
renderDocsProcessor.extraData.git = {
version: {
branch: 'master',
isSnapshot: true
var path = require('canonical-path');
var packagePath = __dirname;
var Package = require('dgeni').Package;
module.exports = new Package('myDoc', [
// require('dgeni-packages/ngdoc'),
// require('dgeni-packages/nunjucks'),
require('dgeni-markdown')
])
.processor(require('./index-page'))
.config(function(log, readFilesProcessor, writeFilesProcessor) {
// Set the log level to 'info', switch to 'debug' when troubleshooting
log.level = 'info';
// Specify the base path used when resolving relative paths to source and output files
readFilesProcessor.basePath = path.resolve(packagePath, '../..');
// Specify the source files to extract
/* eslint-disable no-template-curly-in-string */
/* eslint-disable prefer-arrow-callback */
const {Package} = require('dgeni');
const tsPkg = require('dgeni-packages/typescript');
const cartBasePkg = require('../base-package/index');
const {TYPESCRIPT_SOURCES, ASSETS} = require('../config');
module.exports = exports = new Package('cartApi', [cartBasePkg, tsPkg])
.processor(require('./processors/filterUnusedDocs'))
.processor(require('./processors/filterIgnoredFiles'))
.processor(require('./processors/generateKebabNames'))
.processor(require('./processors/computeNgType'))
.processor(require('./processors/addTypeParameters'))
.processor(require('./processors/addServiceDependencies'))
.processor(require('./processors/generateApiModules'))
.processor(require('./processors/fixHeritageInfo'))
.processor(require('./processors/fixMembersType'))
.processor(require('./processors/generateApiRoutes'))
.processor(require('./processors/generateSearchService'))
.processor(require('./processors/generateBadgeInfo'))
.factory(require('./services/getTypeFolder'))
.config(function(parseTagsProcessor, getInjectables) {
parseTagsProcessor.tagDefinitions = [
...parseTagsProcessor.tagDefinitions,