Azure / azure-sdk-tools

Tools repository leveraged by the Azure SDK team.
MIT License
114 stars 180 forks source link

[bug]: tsp-client should honor the libraries along with specs #9346

Open archerzz opened 2 weeks ago

archerzz commented 2 weeks ago

Description

This is found during the analysis of error in pipeline: https://dev.azure.com/azure-sdk/internal/_build/results?buildId=4308242&view=logs&j=d731b843-2b38-5e88-bb49-012fa10bc295&t=f10e5fff-58d7-557f-26b5-c063ad57cd53&l=594

The current build pipeline of azure-sdk-for-net will have two node_modules folder when generating a typespec based SDK.

SDK_Folder
  +-- node_modules ==> tsp-client and its dependency
  +-- TempTypeSpecFiles
      +-- node_modules ==> spec dependency

tsp-client update will use the packages under SDK_Folder/node_modules, instead of SDK_Folder/TempTypeSpecFiles/node_modules. I think tsp-client should use packages under SDK_Folder/TempTypeSpecFiles/node_modules first.

weidongxu-microsoft commented 2 weeks ago

Yeah, we'd like to be sure that when tsp-client calls tsp compile, it uses the version of typespec compiler of SDK_Folder/TempTypeSpecFiles/node_modules (which is from emitter-package.json), instead of the version in the dependency of tsp-client itself. https://github.com/Azure/azure-sdk-tools/blob/main/tools/tsp-client/package.json#L69

catalinaperalta commented 1 week ago

We are resolving to the right path for typespec/compiler here: https://github.com/Azure/azure-sdk-tools/blob/816e86402f50a79b4b2f08688c087e1bf9217c9b/tools/tsp-client/src/typespec.ts#L167-L171

I'll look into whether we need to do something more to specify only the node_modules/ under TempTypeSpecFiles/