Skip to content

Commit

Permalink
chore: update gen-types.js
Browse files Browse the repository at this point in the history
  • Loading branch information
eiinu committed Jan 15, 2024
1 parent 4914e90 commit 53f31ab
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions scripts/generate-types-taro.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ let packages = [];

const preContent = `
declare type Install<T> = T & {
install(app: import('vue').App): void;
install(app: import('vue').App): void;
};\n`;
const start = 'declare const _default:';
const end = ';\nexport default _default;\n';
Expand Down Expand Up @@ -105,9 +105,9 @@ fs.cp(sourceDir, toDir, { recursive: true }, (err) => {
if (componentName) {
let remain = `
declare module 'vue' {
interface GlobalComponents {
Nut${componentName}: typeof _default;
}
interface GlobalComponents {
Nut${componentName}: typeof _default;
}
}`;
let changeContent = content.replace(regex, `${preContent}${start} Install<${inputs[1]}>${end}${remain}`);
fs.writeFileSync(item, changeContent);
Expand Down
8 changes: 4 additions & 4 deletions scripts/generate-types.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ let packages = [];

const preContent = `
declare type Install<T> = T & {
install(app: import('vue').App): void;
install(app: import('vue').App): void;
};\n`;
const start = 'declare const _default:';
const end = ';\nexport default _default;\n';
Expand Down Expand Up @@ -105,9 +105,9 @@ fs.cp(sourceDir, toDir, { recursive: true }, (err) => {
if (componentName) {
let remain = `
declare module 'vue' {
interface GlobalComponents {
Nut${componentName}: typeof _default;
}
interface GlobalComponents {
Nut${componentName}: typeof _default;
}
}`;
let changeContent = content.replace(regex, `${preContent}${start} Install<${inputs[1]}>${end}${remain}`);
fs.writeFileSync(item, changeContent);
Expand Down

0 comments on commit 53f31ab

Please sign in to comment.