OfficeDev / generator-office

Yeoman generator for building Microsoft Office related projects.
https://www.npmjs.com/package/generator-office
MIT License
815 stars 207 forks source link

Source file is corrupted when fetched from the Office-Addin-Taskpane-SSO repo #811

Closed Rick-Kirkham closed 4 weeks ago

Rick-Kirkham commented 5 months ago

Prerequisites

Please answer the following questions before submitting an issue. YOU MAY DELETE THE PREREQUISITES SECTION.

Expected behavior

No files are corrupted.

Current behavior

When a project is created taking the SSO and TypeScript options (and any host), the file \src\middle-tier\ssoauth-helper.ts is corrupt. Specifically, the first 15 lines and most of line 16 are deleted.

The following is line 16 as it appears in the repo. In the generated project, everything except the string e<any> { at the end is deleted and all lines above this one are deleted.

export async function getAccessToken(authorization: string): Promise<any> {

This breaks the project.

I can reproduce this on multiple machines and several versions of Node.js in the 18.x.x and 20.x.x ranges. It happens in both a Command Prompt and a git bash.

If I clone the template repo and manually test the convertToSingleHost.js file, the file is not corrupted, so I think it must happen when the file is fetched from the repo by the generator.

If I take the JavaScript option, the resulting project is fine. The corresponding JS file, ssoauth-helper.js, is not corrupted.

Steps to Reproduce

Please provide detailed steps for reproducing the issue.

  1. Install latest Yo Office.
  2. Run it.
  3. Select the SSO option.
  4. Select TypeScript.
  5. Give it any name you want.
  6. Choose any host you want.
  7. When the project is generated, the ssoauth-helper.ts file is corrupt as described above.

Context

Please provide any relevant information about your setup. This is important in case the issue is not reproducible except for under certain conditions.

Failure Logs

Please include any relevant log snippets, screenshots or code samples here.

millerds commented 5 months ago

You'll find those missing lines at the end of the file (they should be moved to the top). This looks like a problem with newer versions of node (18.16+) the package we are using to unzip the templates files downloaded from the github repo they are stored in (see the posts linked to bellow). We are tracking work to fix this internally (item: 8084264) but can't promise the timeline to fix it.

Rick-Kirkham commented 5 months ago

Documented here: 4425

millerds commented 4 weeks ago

This should be fixed now . . . published a new version of generator-office that uses a different unzipper (also I think there was a bug in node that was fixed that helped the previous unzipper library).