mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-15 01:03:03 +08:00
chore(): update stencil + api-spec file
This commit is contained in:

committed by
Manu MA

parent
b645bfd1b7
commit
a85ef06ac9
35
core/scripts/api-spec-generator.js
Normal file
35
core/scripts/api-spec-generator.js
Normal file
@ -0,0 +1,35 @@
|
||||
|
||||
const fs = require('fs');
|
||||
|
||||
function apiSpecGenerator(opts) {
|
||||
return (docsData) => {
|
||||
const content = [];
|
||||
docsData.components.forEach(cmp => generateComponent(cmp, content));
|
||||
|
||||
const contentStr = content.join('\n');
|
||||
return new Promise(resolve => {
|
||||
fs.writeFile(opts.file, contentStr, () => {
|
||||
resolve();
|
||||
});
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
function generateComponent(component, content) {
|
||||
content.push('');
|
||||
|
||||
component.props.forEach(prop => {
|
||||
content.push(`${component.tag},prop,${prop.name},${prop.type},${prop.default},${prop.required}`);
|
||||
});
|
||||
component.methods.forEach(prop => {
|
||||
content.push(`${component.tag},method,${prop.name},${prop.signature}`);
|
||||
});
|
||||
component.events.forEach(prop => {
|
||||
content.push(`${component.tag},event,${prop.event},${prop.detail},${prop.bubbles}`);
|
||||
});
|
||||
component.styles.forEach(prop => {
|
||||
content.push(`${component.tag},style,${prop.name}`);
|
||||
});
|
||||
}
|
||||
|
||||
exports.apiSpecGenerator = apiSpecGenerator;
|
Reference in New Issue
Block a user