import v from "voca"; import { stripIndent } from "common-tags"; import { FileWriter } from "../../base"; import { IFileWriter, TFileWriterConfig } from "../../types"; import { GlobalHelpers } from "../../../helpers"; import { AppConfig } from "../../../../app-config"; class IndexFileWriter extends FileWriter implements IFileWriter { constructor(protected config: TFileWriterConfig) { super(config); } getFileContent() { let fileContent = ""; const { strategyName } = this.config; if (typeof strategyName === "string") { const baseComponentFileName = v.kebabCase(strategyName); const componentClassName = v.capitalize(strategyName); fileContent = stripIndent` export { ${componentClassName}, Pure${componentClassName} } from "./${baseComponentFileName}.view"; export type { ${componentClassName}Props, ${componentClassName}State } from "./${baseComponentFileName}.view"; `; } return fileContent; } execute() { try { this.write("wx"); } catch (error) { GlobalHelpers.showError(error); } } } export { IndexFileWriter };