Skip to content

Centralize build info#5571

Merged
compulim merged 34 commits intomainfrom
feat-build-info
Sep 10, 2025
Merged

Centralize build info#5571
compulim merged 34 commits intomainfrom
feat-build-info

Conversation

@compulim
Copy link
Copy Markdown
Contributor

@compulim compulim commented Sep 8, 2025

Changelog Entry

Added

  • Unified build info and injection of <meta> tag, in PR #5571, by @compulim

Description

Today, build info is aggregated and injected by the bundle package at once.

Tomorrow, build info will be exported by individual package on import: api, bundle, core, component, debug-theme, fluent-theme.

This pull request is part of the clean up of bundle package, which is part of the C2 modernization workstream.

Foundation change for C2 modernization

Today, the bundle package includes entry points and code (e.g. Adaptive Cards.)

Tomorrow, the bundle package will only includes entry point. The code will be split into another package. This enables multiple entry points:

  • Slim CJS/ESM for NPM/esbuild
    • External dependencies are not bundled
  • IIFE for UMD in browser (<script>)
    • External dependencies are bundled
    • React is polyfilled from globalThis.React and fallback to bundled React
  • 🆕 Fat CJS/ESM in browser (<script type="module">)
    • External dependencies are bundled
Type Format Delivered via Bundling deps Override React
Slim import CJS/ESM NPM No No
UMD IIFE CDN: <script> Yes globalThis.React fallback to bundled
🆕 Fat import ESM CDN: <script type="module"> Yes globalThis.React fallback to bundled

Design

Every package will have their own build info.

Specific Changes

  • Makes tsup output atomically
    • Outputs to dist.tmp and copy to dist on success
    • Moves --onSuccess into tsup.config.ts
  • Centralize creating build info and injecting <meta> tag into @msinternal/botframework-webchat-base package
    • Use define instead of env for build info
      • globalThis.WEB_CHAT_BUILD_INFO_BUILD_TOOL is tsup
      • globalThis.WEB_CHAT_BUILD_INFO_MODULE_FORMAT is commonjs, esmodules or global
      • globalThis.WEB_CHAT_BUILD_INFO_VERSION
    • Use change-case/kebab-case for injecting into <meta>
      • change-case needs to be devDependencies as it is ESM only
  • Added temporary tsup config (tsup.config.bundled_*.mjs) to .gitignore
  • Cleaned up .gitignore
  • Updated lint-staged config
  • Added missing precommit:eslint:* and precommit:typecheck:*
  • Removed overlapping tests related to <meta> and boot
    • Removed <meta name="botframework-webchat:ui:version">
    • Removed <meta name="botframework-webchat:bundle:variant">
    • Renamed to <meta name="botframework-webchat"> from <meta name="botframework-webchat:bundle">
  • I have added tests and executed them locally
  • I have updated CHANGELOG.md
  • I have updated documentation

Review Checklist

This section is for contributors to review your work.

  • Accessibility reviewed (tab order, content readability, alt text, color contrast)
  • Browser and platform compatibilities reviewed
  • CSS styles reviewed (minimal rules, no z-index)
  • Documents reviewed (docs, samples, live demo)
  • Internationalization reviewed (strings, unit formatting)
  • package.json and package-lock.json reviewed
  • Security reviewed (no data URIs, check for nonce leak)
  • Tests reviewed (coverage, legitimacy)

Comment thread tsup.base.config.ts Outdated
Comment thread packages/api/src/buildInfo.ts
Comment thread packages/base/package.json Outdated
@compulim compulim changed the title [WIP] Centralize build info Centralize build info Sep 8, 2025
@compulim compulim marked this pull request as ready for review September 8, 2025 21:07
Comment thread packages/base/tsup.config.ts
Comment thread packages/base/src/utils/setMetaTag.ts
Comment thread packages/base/src/utils/setMetaTag.ts Outdated
OEvgeny
OEvgeny previously approved these changes Sep 9, 2025
Co-authored-by: Eugene <EOlonov@gmail.com>
@compulim compulim merged commit 39fb447 into main Sep 10, 2025
28 checks passed
@compulim compulim deleted the feat-build-info branch September 10, 2025 01:06
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.

2 participants