Skip to content

Commit 9eb0c53

Browse files
committed
finishing native docgen
1 parent 96ab8fe commit 9eb0c53

File tree

1 file changed

+52
-17
lines changed

1 file changed

+52
-17
lines changed

scripts/native.js

Lines changed: 52 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,9 @@ function writePage(page) {
1616
renderIntro(page),
1717
renderSalesCTA(page),
1818
renderInstallation(page),
19-
// renderProperties(page),
20-
// renderEvents(page),
21-
// renderMethods(page),
22-
// renderParts(page),
23-
// renderCustomProps(page),
24-
// renderSlots(page)
19+
renderSupportedPlatforms(page),
20+
renderCapIncompat(page),
21+
renderUsage(page),
2522
].join("");
2623

2724
const path = `docs/native/plugins/${page.packageName.replace('@ionic-native/','')}.md`;
@@ -84,28 +81,66 @@ function renderInstallation({cordovaPlugin, packageName}) {
8481
<a href="#installation">Installation</a>
8582
</h2>
8683
<Tabs defaultValue="Capacitor" values={[
87-
{value: 'Capacitor', label: 'CAPACITOR'},
88-
{value: 'Cordova', label: 'CORDOVA'},
89-
{value: 'Enterprise', label: 'ENTERPRISE'},
84+
{value: 'Capacitor', label: 'Capacitor'},
85+
{value: 'Cordova', label: 'Cordova'},
86+
{value: 'Enterprise', label: 'Enterprise'},
9087
]}>
9188
<TabItem value="Capacitor">
92-
<CodeBlock>
93-
npm install ${cordovaPlugin.name}
94-
npm install ${packageName}
95-
ionic cap sync
89+
<CodeBlock className="language-shell">
90+
$ npm install ${cordovaPlugin.name} {"\\n"}
91+
$ npm install ${packageName} {"\\n"}
92+
$ ionic cap sync
9693
</CodeBlock>
9794
</TabItem>
9895
<TabItem value="Cordova">
99-
<CodeBlock>
100-
ionic cordova plugin add ${cordovaPlugin.name}
101-
npm install ${packageName}
96+
<CodeBlock className="language-shell">
97+
$ ionic cordova plugin add ${cordovaPlugin.name} {"\\n"}
98+
$ npm install ${packageName} {"\\n"}
10299
</CodeBlock>
103100
</TabItem>
104101
<TabItem value="Enterprise">
105102
<blockquote>Ionic Enterprise comes with fully supported and maintained plugins from the Ionic Team. &nbsp;
106103
<a class="btn" href="https://ionic.io/docs/premier-plugins">Learn More</a> or if you're interested in an enterprise version of this plugin <a class="btn" href="https://ionicframework.com/sales?product_of_interest=Ionic%20Enterprise%20Engine">Contact Us</a></blockquote>
107104
</TabItem>
108105
</Tabs>
109-
`
106+
`
110107
}
111108

109+
function renderSupportedPlatforms({platforms}) {
110+
return `
111+
## Supported Platforms
112+
113+
${platforms.map(platform => `- ${platform}`).join('\n')}
114+
`;
115+
}
116+
117+
function renderCapIncompat({capacitorIncompatible}) {
118+
if (!capacitorIncompatible) {
119+
return null;
120+
}
121+
122+
return `
123+
## Capacitor
124+
125+
Not Compatible
126+
`;
127+
}
128+
129+
function renderUsage({usage}) {
130+
if (!usage) {
131+
return null;
132+
}
133+
134+
return `
135+
## Usage
136+
137+
### React
138+
139+
[Learn more about using Ionic Native components in React](/docs/native/community#react)
140+
141+
142+
### Angular
143+
144+
${usage.replace(/</g,'&lt;')}
145+
`;
146+
}

0 commit comments

Comments
 (0)