Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

noahdarveau/Rollup changes for treeshaking #2513

Merged
merged 76 commits into from
Sep 25, 2024

Conversation

noahdarveau-MSFT
Copy link
Contributor

@noahdarveau-MSFT noahdarveau-MSFT commented Sep 16, 2024

For more information about how to contribute to this repo, visit this page.

Description

Summarize the changes, including the goals and reasons for this change. Be sure to call out any technical or behavior changes that reviewers should be aware of.

If this Pull Request should close/resolve any issues when merged, use the special syntax for that here.

Main changes in the PR:

  1. Added Rollup to the repository which will be used to build a treeshakable version of Teams-JS once the treeshaking code changes go in.
  2. Changed the pkg.json file to have the main field point to the minified cdn bundle and added the module field to point to the esm bundle.
  3. Updated the Build-Test-Publish pipeline so the CDN package does not included the Rollup-built code.
  4. Added a basic tree shaking test app that was used to verify tree shaking is working in teams-js. Note that there are currently no automated tests to check if tree shaking is working and verification must be done manually by examining the bundled package built with the test app.

Validation

Validation performed:

  1. All unit and e2e tests continue to pass.

@noahdarveau-MSFT noahdarveau-MSFT changed the title noahdarveau/treeshaking noahdarveau/Rollup changes fo treeshaking Sep 23, 2024
@noahdarveau-MSFT noahdarveau-MSFT changed the title noahdarveau/Rollup changes fo treeshaking noahdarveau/Rollup changes for treeshaking Sep 23, 2024
@noahdarveau-MSFT noahdarveau-MSFT marked this pull request as ready for review September 25, 2024 15:48
@noahdarveau-MSFT noahdarveau-MSFT requested a review from a team as a code owner September 25, 2024 15:48
TargetFolder: '$(Build.ArtifactStagingDirectory)\NPMFeed\dist'
flattenFolders: true
flattenFolders: false
Copy link
Contributor

Choose a reason for hiding this comment

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

I assume this is to for backcompat in case a developer doesn't have ESModules configured

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, that is one reason, but mostly it is because the rollup-built package keeps all of the files separate, so if we flatten all of the files to one folder level, our published artifact would be a huge mess of every file in teams-js condensed to a single folder level. Keeping the folder structure helps keep the artifact neat.

Copy link
Contributor

Choose a reason for hiding this comment

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

Got it, thanks for the explanation

import { barCode } from 'testlibraryfortreeshaking';
//import { PrintTestMessage } from 'testlibraryfortreeshaking/app';
import { geoLocation } from '@microsoft/teams-js';
//import { app } from '@microsoft/teams-js';
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we want to keep these commented out? If so can we have an added comment explaining why

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh, yeah, I forgot about that file. The whole tree-shaking test app isn't actually doing anything. I was just using it for testing, and wanted to check it in for use later. I'll go ahead and remove the comments so it looks nicer.

jadahiya-MSFT
jadahiya-MSFT previously approved these changes Sep 25, 2024
@@ -18,7 +18,7 @@ export {
registerUserSettingsChangeHandler,
openFilePreview,
} from './privateAPIs';
export { conversations } from './conversations';
export { conversations, OpenConversationRequest, ConversationResponse } from './conversations';
Copy link
Contributor

Choose a reason for hiding this comment

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

What is this change needed for?

Copy link
Contributor Author

@noahdarveau-MSFT noahdarveau-MSFT Sep 25, 2024

Choose a reason for hiding this comment

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

While developing, I was running into a bug where OpenConversationRequest and ConversationResponse were not able to be imported by the teams test app, so I had to export it directly to resolve the issue. I just tried removing the change and it seems to be working ok, so I've reverted the change.

Copy link
Contributor

@TrevorJoelHarris TrevorJoelHarris left a comment

Choose a reason for hiding this comment

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

Had one question about a change to the private\index.ts file

@noahdarveau-MSFT noahdarveau-MSFT merged commit bb17ff5 into main Sep 25, 2024
28 checks passed
@noahdarveau-MSFT noahdarveau-MSFT deleted the noahdarveau/treeshaking branch September 25, 2024 21:16
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.

3 participants