Source file is corrupted when fetched from the Office-Addin-Taskpane-SSO repo
Prerequisites
Please answer the following questions before submitting an issue. YOU MAY DELETE THE PREREQUISITES SECTION.
- [x ] I am running the latest version of Node and the tools
- [x ] I checked the documentation and found no answer
- [x ] I checked to make sure that this issue has not already been filed
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.
- Install latest Yo Office.
- Run it.
- Select the SSO option.
- Select TypeScript.
- Give it any name you want.
- Choose any host you want.
- 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.
- Operating System: Windows
- Node version: 18.16.1, 18.19.0, 20.9.0, and 20.11.0
- Office version: N/A
- Tool version: fresh install of the latest
Failure Logs
Please include any relevant log snippets, screenshots or code samples here.
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.
- Not getting all files extracted · Issue #278 · ZJONSSON/node-unzipper (github.com)
- BUG: Incorrect binary files installed with Node.js 18.16.0 and later, Node.js 19.8.0 and later, and Node.js 20 · Issue #7 · go-task/go-npm (github.com)
- Files extracted from zip are currupt · Issue #271 · ZJONSSON/node-unzipper (github.com)
Documented here: 4425
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).