|
|
@@ -8,9 +8,12 @@ declare class UIComponent {
|
|
|
const packages = [];
|
|
|
config.nav.map((item) => {
|
|
|
item.packages.forEach((element) => {
|
|
|
- let { name, show, exportEmpty } = element;
|
|
|
+ let { name, show, exportEmpty, type } = element;
|
|
|
if (show || exportEmpty) {
|
|
|
- importStr += `declare class ${name} extends UIComponent {}\n`;
|
|
|
+ importStr +=
|
|
|
+ type == 'methods'
|
|
|
+ ? `declare function ${name}(options: any): void\n`
|
|
|
+ : `declare class ${name} extends UIComponent {}\n`;
|
|
|
packages.push(name);
|
|
|
}
|
|
|
});
|
|
|
@@ -28,14 +31,9 @@ declare const _default: {
|
|
|
};
|
|
|
export default _default;`;
|
|
|
let fileStr = importStr + installFunction;
|
|
|
-fs.outputFile(
|
|
|
- path.resolve(__dirname, '../dist/nutui.d.ts'),
|
|
|
- fileStr,
|
|
|
- 'utf8',
|
|
|
- (error) => {
|
|
|
- // logger.success(`${package_config_path} 文件写入成功`);
|
|
|
- }
|
|
|
-);
|
|
|
+fs.outputFile(path.resolve(__dirname, '../dist/nutui.d.ts'), fileStr, 'utf8', (error) => {
|
|
|
+ // logger.success(`${package_config_path} 文件写入成功`);
|
|
|
+});
|
|
|
fs.outputFile(
|
|
|
path.resolve(__dirname, '../dist/index.d.ts'),
|
|
|
`import * as NutUI from './nutui';
|