Skip to content

Commit

Permalink
fix(cli): 修复部分函数命名
Browse files Browse the repository at this point in the history
  • Loading branch information
GaoNeng-wWw authored and kagol committed Oct 5, 2022
1 parent 7c130ae commit 72e4e1b
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 26 deletions.
32 changes: 16 additions & 16 deletions packages/devui-vue/devui-cli/commands/build-volar-support.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
const path = require("path");
const {
bundleComponentItem,
bundleGlobalDTSEnd,
bundleGlobalDTSStart,
bundleComponents,
bundleDirectiveItem,
bundleDirective,
bundleServiceItem,
bundleService
buildComponentItem,
buildGlobalDTSEnd,
buildGlobalDTSStart,
buildComponents,
buildDirectiveItem,
buildDirective,
buildServiceItem,
buildService
} = require('../templates/dts');
const { writeFileSync } = require('fs');
const { useRelationTree } = require("../composables/use-relation-tree");
Expand Down Expand Up @@ -40,22 +40,22 @@ exports.volarSupport = (replaceIdentifier, readyToReleaseComponentName) => {
nodeName = replaceIdentifier[foldNode.name][node.name]?.['exportKey'];
}
if (node.type === 'component'){
componentDTSItem.push(bundleComponentItem(bigCamelCase(nodeName), reference));
componentDTSItem.push(buildComponentItem(bigCamelCase(nodeName), reference));
}
if (node.type === 'directive'){
directiveDTSItem.push(bundleDirectiveItem(nodeName, reference));
directiveDTSItem.push(buildDirectiveItem(nodeName, reference));
}
if (node.type === 'service'){
serviceDTSItem.push(bundleServiceItem(nodeName, reference));
serviceDTSItem.push(buildServiceItem(nodeName, reference));
}
});
});
const template = `
${bundleGlobalDTSStart()}
${bundleComponents(componentDTSItem.join('\n'))}
${bundleDirective(directiveDTSItem.join('\n'))}
${bundleService(serviceDTSItem.join('\n'))}
${bundleGlobalDTSEnd()}
${buildGlobalDTSStart()}
${buildComponents(componentDTSItem.join('\n'))}
${buildDirective(directiveDTSItem.join('\n'))}
${buildService(serviceDTSItem.join('\n'))}
${buildGlobalDTSEnd()}
`;
try {
writeFileSync('./build/global.d.ts', template);
Expand Down
4 changes: 2 additions & 2 deletions packages/devui-vue/devui-cli/commands/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,13 +102,13 @@ exports.build = async () => {
} catch {}
nuxtBuild.createNuxtPlugin();
logger.success('准备生成global.d.ts');
const volarSupportBundleState = volarSupport(replaceIdentifier, readyToReleaseComponentName);
const volarSupportbuildState = volarSupport(replaceIdentifier, readyToReleaseComponentName);
fs.writeFileSync('./build/index.d.ts', `
export * from './types/vue-devui';
import _default from './types/vue-devui';
export default _default;
`);
if (volarSupportBundleState){
if (volarSupportbuildState){
logger.success('global.d.ts生成成功');
} else {
logger.error('global.d.ts生成失败, 因为发生错误');
Expand Down
16 changes: 8 additions & 8 deletions packages/devui-vue/devui-cli/templates/dts.js
Original file line number Diff line number Diff line change
@@ -1,36 +1,36 @@
exports.bundleGlobalDTSStart = () => {
exports.buildGlobalDTSStart = () => {
return `
export{}
declare module '@vue/runtime-core' {`;
};
exports.bundleComponentItem = (componentName, key='') => {
exports.buildComponentItem = (componentName, key='') => {
return `D${componentName}: typeof import('./types/vue-devui')['${key || componentName}']`;
};
exports.bundleDirectiveItem = (directive, key='') => {
exports.buildDirectiveItem = (directive, key='') => {
return `v${directive}?: typeof import('./types/vue-devui')['${key || directive}']`;
};
exports.bundleServiceItem = (service,key='') => {
exports.buildServiceItem = (service,key='') => {
return `$${service}?: typeof import('./types/vue-devui')['${key || service}']`;
};
exports.bundleGlobalDTSEnd = () => {
exports.buildGlobalDTSEnd = () => {
return `
}`;
};
exports.bundleComponents = (componentString) => {
exports.buildComponents = (componentString) => {
return `
export interface GlobalComponents{
${componentString}
}
`;
};
exports.bundleDirective = (directiveString) => {
exports.buildDirective = (directiveString) => {
return `
export interface ComponentCustomProps {
${directiveString}
}
`;
};
exports.bundleService = (serviceSting) => {
exports.buildService = (serviceSting) => {
return `
export interface ComponentCustomProperties{
${serviceSting}
Expand Down

0 comments on commit 72e4e1b

Please sign in to comment.