修正没有配置 override 时报错的问题

This commit is contained in:
2024-05-24 12:53:01 +08:00
parent d130ad1838
commit b6b4383569

View File

@@ -18,7 +18,7 @@ export interface Configurations {
output: { output: {
[key: string]: ExporterConfigs, [key: string]: ExporterConfigs,
} }
override: Record<string, string>, override?: Record<string, string>,
} }
@@ -58,9 +58,11 @@ export class ExcelExporterApplication {
let sheets = this.parser.parse_xlsl(file); let sheets = this.parser.parse_xlsl(file);
const base = path.basename(file).replace(/\.xlsx?$/, ''); const base = path.basename(file).replace(/\.xlsx?$/, '');
for (const name in sheets) { for (const name in sheets) {
const override = this.configs.override[`${base}/${name}`];
const table = sheets[name]; const table = sheets[name];
if (this.configs.override) {
const override = this.configs.override[`${base}/${name}`];
table.output = override; table.output = override;
}
this.tables[name] = table; this.tables[name] = table;
} }
} }