Skip to content

Commit

Permalink
feat: 生成头尾部选项修正
Browse files Browse the repository at this point in the history
  • Loading branch information
cloudcome committed Jan 2, 2025
1 parent 0a27f89 commit c353038
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions src/printer/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,17 +149,17 @@ export class Printer {
print(configs?: PrinterConfigs) {
Object.assign(this.configs, configs);
const { hideHeaders, hideHelpers, hideFooters, hideInfo, hideComponents, hideImports, hidePaths } = this.configs;
const headers = (this.options?.headers || []).join('\n');
const footers = (this.options?.footers || []).join('\n');
const header = (this.options?.header || '');
const footer = (this.options?.footer || '');

return [
!hideHeaders && headers,
!hideHeaders && header,
!hideInfo && this._printInfo(),
!hideImports && this._printImports(),
!hideHelpers && Printer.helpersCode,
!hideComponents && this._printComponents(),
!hidePaths && this._printPaths(),
!hideFooters && footers,
!hideFooters && footer,
]
.filter(Boolean)
.join('\n\n');
Expand Down
4 changes: 2 additions & 2 deletions src/printer/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,12 +104,12 @@ export interface PrinterOptions {
/**
* 生成文件的头部信息
*/
headers?: string[];
header?: string;

/**
* 生成文件的尾部信息
*/
footers?: string[];
footer?: string;
}

export interface PrinterConfigs {
Expand Down

0 comments on commit c353038

Please sign in to comment.