|
@@ -6,10 +6,15 @@ let importStr = `import { App } from 'vue';
|
|
|
import Locale from './locale';\n`;
|
|
import Locale from './locale';\n`;
|
|
|
let importScssStr = `\n`;
|
|
let importScssStr = `\n`;
|
|
|
const packages = [];
|
|
const packages = [];
|
|
|
|
|
+const methods = [];
|
|
|
config.nav.map((item) => {
|
|
config.nav.map((item) => {
|
|
|
item.packages.forEach((element) => {
|
|
item.packages.forEach((element) => {
|
|
|
let { name, type, exclude } = element;
|
|
let { name, type, exclude } = element;
|
|
|
- importStr += `import ${name} from './__VUE/${name.toLowerCase()}/index${type === 'methods' ? '' : '.vue'}';\n`;
|
|
|
|
|
|
|
+ importStr += `import ${name} from './__VUE/${name.toLowerCase()}/index.vue';\n`;
|
|
|
|
|
+ if (type === 'methods') {
|
|
|
|
|
+ importStr += `import { show${name} } from './__VUE/${name.toLowerCase()}/index';\n`;
|
|
|
|
|
+ methods.push(`show${name}`);
|
|
|
|
|
+ }
|
|
|
importScssStr += `import './__VUE/${name.toLowerCase()}/index.scss';\n`;
|
|
importScssStr += `import './__VUE/${name.toLowerCase()}/index.scss';\n`;
|
|
|
if (exclude != true) {
|
|
if (exclude != true) {
|
|
|
packages.push(name);
|
|
packages.push(name);
|
|
@@ -29,7 +34,7 @@ let installFunction = `function install(app: App) {
|
|
|
let fileStrBuild = `${importStr}
|
|
let fileStrBuild = `${importStr}
|
|
|
${installFunction}
|
|
${installFunction}
|
|
|
const version = '${packageConfig.version}';
|
|
const version = '${packageConfig.version}';
|
|
|
-export { install, version, Locale, ${packages.join(',')}};
|
|
|
|
|
|
|
+export { install, version, Locale, ${packages.join(',')}, ${methods.join(',')}};
|
|
|
export default { install, version, Locale};`;
|
|
export default { install, version, Locale};`;
|
|
|
|
|
|
|
|
fs.outputFile(path.resolve(__dirname, '../src/packages/nutui.vue.build.ts'), fileStrBuild, 'utf8', (error) => {
|
|
fs.outputFile(path.resolve(__dirname, '../src/packages/nutui.vue.build.ts'), fileStrBuild, 'utf8', (error) => {
|
|
@@ -40,7 +45,7 @@ let fileStrDev = `${importStr}
|
|
|
${installFunction}
|
|
${installFunction}
|
|
|
${importScssStr}
|
|
${importScssStr}
|
|
|
export const testComponents = { ${packages.join(',')}};
|
|
export const testComponents = { ${packages.join(',')}};
|
|
|
-export { install, Locale, ${packages.join(',')} };
|
|
|
|
|
|
|
+export { install, Locale, ${packages.join(',')}, ${methods.join(',')} };
|
|
|
export default { install, version:'${packageConfig.version}', Locale};`;
|
|
export default { install, version:'${packageConfig.version}', Locale};`;
|
|
|
fs.outputFile(path.resolve(__dirname, '../src/packages/nutui.vue.ts'), fileStrDev, 'utf8', (error) => {
|
|
fs.outputFile(path.resolve(__dirname, '../src/packages/nutui.vue.ts'), fileStrDev, 'utf8', (error) => {
|
|
|
// logger.success(`${package_config_path} 文件写入成功`);
|
|
// logger.success(`${package_config_path} 文件写入成功`);
|