Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions plugins/docusaurus-plugin-ionic-component-api/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
const fetch = require('node-fetch');
// temp data to test docs generated from these changes https://github.com/perrygovier/ionic/pull/1
import tempData from './tempDocs.json';

module.exports = function (context, options) {
return {
Expand All @@ -19,9 +21,10 @@ module.exports = function (context, options) {
*/
const generateMarkdownForVersion = async (version, npmTag, isCurrentVersion) => {
let COMPONENT_LINK_REGEXP;
const response = await fetch(`https://unpkg.com/@ionic/docs@${npmTag}/core.json`);
const { components } = await response.json();

// replace fetch of components with tempData generated from build for this PR https://github.com/perrygovier/ionic/pull/1
// const response = await fetch(`https://unpkg.com/@ionic/docs@${npmTag}/core.json`);
// const { components } = await response.json();
const { components } = tempData;
const names = components.map((component) => component.tag.slice(4));
// matches all relative markdown links to a component, e.g. (../button)
COMPONENT_LINK_REGEXP = new RegExp(`\\(../(${names.join('|')})/?(#[^)]+)?\\)`, 'g');
Expand Down
Loading