diff --git a/docgen/content-sources/v2/toc.yaml b/docgen/content-sources/v2/toc.yaml index 18b5215fb..42fb44fcc 100644 --- a/docgen/content-sources/v2/toc.yaml +++ b/docgen/content-sources/v2/toc.yaml @@ -1,23 +1,38 @@ toc: - - title: globals.html - path: /docs/reference/functions/modules.html - - title: index.html - path: /docs/reference/functions/index.html - - title: logger_common.html - path: /docs/reference/functions/logger_common.html - - title: logger.LogEntry.html - path: /docs/reference/functions/logger.LogEntry.html - - title: v2_core.html - path: /docs/reference/functions/v2_core.html - - title: v2.html - path: /docs/reference/functions/v2.html - - title: v2_options.eventhandleroptions.html - path: /docs/reference/functions/v2_options.eventhandleroptions.html - - title: v2_options.globaloptions.html - path: /docs/reference/functions/v2_options.globaloptions.html - - title: v2_options.html - path: /docs/reference/functions/v2_options.html - - title: v2_providers_https.html - path: /docs/reference/functions/v2_providers_https.html - - title: v2_providers_https.httpsoptions.html - path: /docs/reference/functions/v2_providers_https.httpsoptions.html + - title: functions + path: /docs/functions/alpha/v2.html + - title: functions.core + path: /docs/functions/alpha/v2_core.html + section: + - title: functions.CloudEvent + path: /docs/functions/alpha/v2_core.cloudevent.html + - title: functions.CloudFunction + path: /docs/functions/alpha/v2_core.cloudfunction.html + - title: functions.https + path: /docs/functions/alpha/v2_providers_https.html + section: + - title: functions.https.options + path: /docs/functions/alpha/v2_providers_https.httpsoptions.html + - title: 'functions.logger' + path: /docs/functions/alpha/logger.html + section: + - title: 'LogEntry' + path: /docs/functions/alpha/logger.LogEntry.html + - title: functions.options + path: /docs/functions/alpha/v2_options.html + section: + - title: functions.options.GlobalOptions + path: /docs/functions/alpha/v2_options.globaloptions.html + - title: functions.options.EventHandlerOptions + path: /docs/functions/alpha/v2_options.eventhandleroptions.html + - title: functions.params + path: /docs/functions/alpha/v2_params.html + - title: 'functions.pubsub' + path: /docs/functions/v2_providers_pubsub.html + section: + - title: 'Message' + path: /docs/functions/alpha/v2_providers_pubsub.Message.html + - title: 'TopicBuilder' + path: /docs/functions/alpha/v2_providers_pubsub.MessagePublishedData.html + - title: 'PubSubOptions' + path: /docs/functions/alpha/v2_providers_pubsub.PubSubOptions.html diff --git a/docgen/generate-docs.js b/docgen/generate-docs.js index 5e66392cf..ab7b128a7 100644 --- a/docgen/generate-docs.js +++ b/docgen/generate-docs.js @@ -33,13 +33,15 @@ const { api: apiVersion } = yargs .version(false) .help().argv; -let sourceFile; +let sourceFile, devsitePath; switch (apiVersion) { case 'v1': sourceFile = `${repoPath}/src/{v1,logger}`; + devsitePath = '/docs/reference/functions/'; break; case 'v2': sourceFile = `${repoPath}/src/{v2,logger}`; + devsitePath = '/docs/functions/alpha/'; break; default: throw new Error( @@ -50,7 +52,6 @@ switch (apiVersion) { const docPath = path.resolve(`${__dirname}/html`); const contentPath = path.resolve(`${__dirname}/content-sources/${apiVersion}`); const tempHomePath = path.resolve(`${contentPath}/HOME_TEMP.md`); -const devsitePath = `/docs/reference/functions/`; const { JSDOM } = require('jsdom'); @@ -198,7 +199,10 @@ async function checkForMissingFilesAndFixFilenameCase(tocText) { const filenames = tocText .split('\n') .filter((line) => line.includes('path:')) - .map((line) => line.split(devsitePath)[1].replace(/#.*$/, '')); + .map((line) => { + parts = line.split('/'); + return parts[parts.length - 1].replace(/#.*$/, ''); + }); // Logs warning to console if a file from TOC is not found. const fileCheckPromises = filenames.map(async (filename) => { // Warns if file does not exist, fixes filename case if it does.