async exportIssueToCSV()

in packages/issue-to-kintone-importer/src/LKSImporter.ts [71:97]


  async exportIssueToCSV() {
    const issues = await this.getIssues();
    if (issues === undefined) {
      throw new Error("Issue is not found!");
    }

    const transformedIssue = this.transformDateOfIssue(issues);

    const headerKeys = Object.keys(issues[0]).filter(
      // _ is skipped because it will not be registered in the kintone application.
      // description is skipped because it contains a line feed code.
      (param) => param.startsWith("_") === false && param !== "description"
    );

    const headers = headerKeys.map((key) => {
      return {
        id: key,
        title: key,
      };
    });

    await createObjectCsvWriter({
      path: "./export.csv",
      header: headers,
      alwaysQuote: true,
    }).writeRecords(transformedIssue.reverse()); // Reverse to output in record number order
  }