Skip to content

Commit 31911d0

Browse files
committed
chore(): keep the components file in the previous format. This change applies only to the JP domain.
1 parent 88cbac2 commit 31911d0

File tree

1 file changed

+15
-5
lines changed
  • plugins/docusaurus-plugin-ionic-component-api

1 file changed

+15
-5
lines changed

plugins/docusaurus-plugin-ionic-component-api/index.js

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,21 @@ module.exports = function (context, options) {
2020
*/
2121
const generateMarkdownForVersion = async (version, npmTag, lang, isCurrentVersion) => {
2222
let COMPONENT_LINK_REGEXP;
23-
const response =
24-
isCurrentVersion && lang === 'ja'
25-
? await fetch(`https://raw.githubusercontent.com/ionic-jp/ionic-docs/main/scripts/data/translated-api.json`)
26-
: await fetch(`https://unpkg.com/@ionic/docs@${npmTag}/core.json`);
27-
const { components } = await response.json();
23+
const components = await (async () => {
24+
if (isCurrentVersion) {
25+
const { components } = require(process.cwd() + `/scripts/data/translated-api.json`);
26+
return components;
27+
} else {
28+
const response = await fetch(`https://unpkg.com/@ionic/docs@${npmTag}/core.json`);
29+
const { components } = await response.json();
30+
return components;
31+
}
32+
})();
33+
// const response =
34+
// isCurrentVersion && lang === 'ja'
35+
// ? await fetch(`https://raw.githubusercontent.com/ionic-jp/ionic-docs/main/scripts/data/translated-api.json`)
36+
// : await fetch(`https://unpkg.com/@ionic/docs@${npmTag}/core.json`);
37+
// const { components } = await response.json();
2838

2939
const names = components.map((component) => component.tag.slice(4));
3040
// matches all relative markdown links to a component, e.g. (../button)

0 commit comments

Comments
 (0)