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

improvement(build-tools): fixes for ESM builds #19625

Merged
merged 4 commits into from
Feb 14, 2024

Conversation

jason-ha
Copy link
Contributor

@jason-ha jason-ha commented Feb 14, 2024

  1. generate typetest with full path
  2. policy fixes for ESM builds
    • Relax package.json module expectation for ESM
    • Recognize more multi-command scripts in package.json
      Ideally, we would use broken down scripts, but
      those result in additional dependency complexities
      and don't offer simple atomicity.
    • Recognize tsc-multi.node16.cjs as using
      tsconfig.json when checking project references.
  3. fix tsc-multi incremental build
    • update TscMultiTask for tsc-multi patch
    • update tsc-multi patch to have better tsconfig*.tsbuildinfo pattern

There are no unit test for these change. The were
manually tested against repo with the exclusions
for fluid-build-tasks-tsc and npm-package-json-esm
fully reverted.

@github-actions github-actions bot added area: build Build related issues base: main PRs targeted against main branch labels Feb 14, 2024
@github-actions github-actions bot added the dependencies Pull requests that update a dependency file label Feb 14, 2024
- Recognize more multi-command scripts in package.json
  Ideally we would use broken down scripts, but
  those result in additional dependecy complexies
  and don't offer simple atomicity.
- Recognize tsc-multi.node16.cjs as using
  tsconfig.json when checking project references.

There are no unit test for these change. The were
manually tested against repo with the exclusions
for fluid-build-tasks-tsc and npm-package-json-esm
fully reverted.
+ update TscMultiTask for tsc-multi patch
+ update tsc-multi patch to have better tsconfig*.tsbuildinfo pattern
@msfluid-bot
Copy link
Collaborator

msfluid-bot commented Feb 14, 2024

Could not find a usable baseline build with search starting at CI b2d0476

Generated by 🚫 dangerJS against 2f93756

@@ -113,7 +113,7 @@ const testString: string[] = [
* Generated by fluid-type-test-generator in @fluidframework/build-tools.
*/
import type * as old from "${previousPackageName}";
import type * as current from "../../index";
import type * as current from "../../index.js";
Copy link
Contributor

Choose a reason for hiding this comment

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

No need to handle cjs/mjs here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't think /index would be found as /index.cjs or /index.mjs, which makes this a non-change [except maybe in the case that index was a folder].
If we are building tests with tsc-multi and renaming (pattern we are going away from), then this would be renamed. If building only the product code with tsc-multi and renaming, then I think this was already broken.
Nothing broken on my local system when this was run for client group.

}
}
return undefined;
return bestScript.script;
Copy link
Contributor

Choose a reason for hiding this comment

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

Seams reasonablish... I vaguely understand that FluidBuild is looking for tasks containing 'tsc' to build/check dependencies and assume the complication is that we're now using 'tsc && copyfiles'.

From your comments on the overall PR, I'm guessing the alternative would be to break 'tsc && copyfiles' into separate scripts/tasks with more scripts/tasks to tie them together.

I'm happy to trust your judgement on the tradeoffs.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There was already some support for && in the dependencies but it didn't extend to the tsc searches.
Once I added support for && to that, I found that there were other packages with tsc commands embeded. packages/dd/matrix bench:profile is the notable one. AFAIK it is actually outside the general build:fast support and doesn't actually build like the cases this is trying to find.
I had added this comment to the description but didn't find a good place to have it in code:

  • Recognize more multi-command scripts in package.json
    Ideally, we would use broken down scripts, but
    those result in additional dependency complexities
    and don't offer simple atomicity.

Copy link
Contributor

@DLehenbauer DLehenbauer left a comment

Choose a reason for hiding this comment

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

Some minor comments/questions. No changes requested.

@jason-ha jason-ha enabled auto-merge (squash) February 14, 2024 18:51
@jason-ha jason-ha merged commit 40e6559 into microsoft:main Feb 14, 2024
37 checks passed
@jason-ha jason-ha deleted the tool-updates-for-esm branch February 14, 2024 19:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: build Build related issues base: main PRs targeted against main branch dependencies Pull requests that update a dependency file
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants