Skip to content

feat: emit warp config instead of tshy for Azure monorepo packages#3802

Merged
MaryGao merged 5 commits intomainfrom
build-with-warp
Mar 3, 2026
Merged

feat: emit warp config instead of tshy for Azure monorepo packages#3802
MaryGao merged 5 commits intomainfrom
build-with-warp

Conversation

@deyaaeldeen
Copy link
Copy Markdown
Member

Replace tshy build configuration with warp for packages generated with azureSdkForJs=true. This generates a warp.config.yml file and resolved dist-level exports in package.json instead of inline tshy config.

Changes:

  • Add buildWarpConfig.ts to generate warp.config.yml with targets for browser, react-native, esm, and commonjs
  • Update packageCommon.ts to emit warp entrypoints (main, module, types, browser, react-native) and resolved exports for monorepo packages
  • Remove tshy from monorepo devDependencies
  • Update buildPackageFile.ts to handle warp exports in update path
  • Wire up warp config builder in typespec-ts emitter
  • Update unit tests for new warp behavior

Non-monorepo (standalone/flavorless) packages continue to use tshy.

Replace tshy build configuration with warp for packages generated with
azureSdkForJs=true. This generates a warp.config.yml file and resolved
dist-level exports in package.json instead of inline tshy config.

Changes:
- Add buildWarpConfig.ts to generate warp.config.yml with targets for
  workerd, browser, react-native, esm, and commonjs
- Update packageCommon.ts to emit warp entrypoints (main, module, types,
  browser, react-native) and resolved exports for monorepo packages
- Remove tshy from monorepo devDependencies
- Update buildPackageFile.ts to handle warp exports in update path
- Wire up warp config builder in typespec-ts emitter
- Update unit tests for new warp behavior

Non-monorepo (standalone/flavorless) packages continue to use tshy.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
deyaaeldeen and others added 2 commits February 28, 2026 07:18
The PR's change to skip tshy devDependency for azureSdkForJs packages
(using warp instead) wasn't reflected in the 5 committed autorest test
package.json files that default azureSdkForJs to true.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…ibility

Generated test packages have "type": "module" in their package.json,
which triggers Node.js ESM loader when ts-node/register (v8) is used.
The old ts-node/register only hooks into CJS require(), not the ESM
loader, causing 'Unknown file extension .ts' errors.

Replace ts-node with tsx for:
- mocha --require hooks in integration/rlc/version-tolerance tests
- standalone script execution (test commands, smoke test, copyFiles)

Keep ts-node for unit tests since they don't import from ESM packages.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copy link
Copy Markdown
Member

@MaryGao MaryGao left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if we have any dependency for SDK change and codegen change?

@kazrael2119 Could you double comfirm the removal should be safe if we guareent the SDK pr merge first?

@MaryGao
Copy link
Copy Markdown
Member

MaryGao commented Mar 2, 2026

@deyaaeldeen do we need to adjust the SDK repo's status with package.json file first?

Comment thread packages/typespec-ts/src/index.ts Outdated
Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 2, 2026

@deyaaeldeen I've opened a new pull request, #3806, to work on those changes. Once the pull request is ready, I'll request review from you.

deyaaeldeen added a commit to Azure/azure-sdk-for-js that referenced this pull request Mar 2, 2026
* Initial plan

* fix: don't overwrite existing warp.config.yml files

Co-authored-by: deyaaeldeen <6074665+deyaaeldeen@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: deyaaeldeen <6074665+deyaaeldeen@users.noreply.github.com>
@deyaaeldeen
Copy link
Copy Markdown
Member Author

@deyaaeldeen do we need to adjust the SDK repo's status with package.json file first?

No, warp is already in the repo and is preferred over tshy by dev-tool. First wave of migration is being done in Azure/azure-sdk-for-js#37372.

@kazrael2119
Copy link
Copy Markdown
Member

Hi @deyaaeldeen
I try to generate a package based on this pr and then build it in sdk repo with latest main,
but there's an error during build:

[browser] C:/...sdk/core/core-rest-pipeline/dist/esm/interfaces.d.ts(59,56): error TS2503: Cannot find namespace 'NodeJS'.
[browser] C:/...sdk/core/core-rest-pipeline/dist/esm/interfaces.d.ts(339,19): error TS2591: Cannot find name 'Buffer'.
[warp] Build failed for targets: browser

my steps:
1: generate sdk
2: run pnpm install && pnpm build -F @azure/arm-xxx...

do I miss some steps?

@deyaaeldeen
Copy link
Copy Markdown
Member Author

@kazrael2119 Thanks for catching this issue. I pulled out the fix from Azure/azure-sdk-for-js#37372 in Azure/azure-sdk-for-js#37430. Could you try with that branch and let me know if there are any other issues?

@kazrael2119
Copy link
Copy Markdown
Member

@kazrael2119 Thanks for catching this issue. I pulled out the fix from Azure/azure-sdk-for-js#37372 in Azure/azure-sdk-for-js#37430. Could you try with that branch and let me know if there are any other issues?

it passed with Azure/azure-sdk-for-js#37430
image

@MaryGao MaryGao enabled auto-merge (squash) March 3, 2026 06:47
@MaryGao MaryGao merged commit d9855d8 into main Mar 3, 2026
16 checks passed
@MaryGao MaryGao deleted the build-with-warp branch March 3, 2026 07:04
deyaaeldeen added a commit to Azure/azure-sdk-for-js that referenced this pull request Mar 3, 2026
As the title says. Code gen is also generating warp configs:
Azure/autorest.typescript#3802

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants