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

feat(scripts): remove @internal stripping and enable no deps build needed for api generation #25575

Merged

Conversation

Hotell
Copy link
Contributor

@Hotell Hotell commented Nov 8, 2022

Current Behavior

  • apis marked with @internal are physically removed from rollup-ed index.d.ts
  • api.md generation works differently on CI and Local
    • ci triggers it under the hood as part of just-scripts build
    • locally one needs to execute build:local or lage build --to
  • api.md generation needs all dependencies to have api generated

New Behavior

  • no apis are physically removed from rollup-ed index.d.ts as that adds hard to reason about issues in user land
    • will be replaced by lint rule
  • api.md generation works the same on CI and Local
  • api.md generation doesn't need to to generate apis for dependencies

Related Issue(s)

Replaces #23369
Closes #19360

Follow up

💡 Note that this PR was merged after the declared followup.

Why?

Turns out our pipelines ran into race conditions which ended up in unexpected build followed by test task execution failures caused by hybrid state of tsc processing and api-extractor 🚨. Last but not least, we need to act on those Test memory leaks which will cause us a lot of issues when migrating to node 16 (that will fail on unhandled rejection promises )

@size-auditor
Copy link

size-auditor bot commented Nov 8, 2022

Asset size changes

Size Auditor did not detect a change in bundle size for any component!

Baseline commit: 131d20e15d6c59dce2dcbbd8794b5ee75701a670 (build)

@codesandbox-ci
Copy link

codesandbox-ci bot commented Nov 8, 2022

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit afda290:

Sandbox Source
@fluentui/react 8 starter Configuration
@fluentui/react-components 9 starter Configuration

@fabricteam
Copy link
Collaborator

fabricteam commented Nov 8, 2022

Perf Analysis (@fluentui/react-components)

No significant results to display.

All results

Scenario Render type Master Ticks PR Ticks Iterations Status
Avatar mount 1265 1269 5000
Button mount 931 917 5000
FluentProvider mount 1482 1490 5000
FluentProviderWithTheme mount 585 576 10
FluentProviderWithTheme virtual-rerender 550 536 10
FluentProviderWithTheme virtual-rerender-with-unmount 573 570 10
MakeStyles mount 1955 1997 50000
SpinButton mount 2337 2374 5000

@fabricteam
Copy link
Collaborator

fabricteam commented Nov 8, 2022

📊 Bundle size report

Unchanged fixtures
Package & Exports Size (minified/GZIP)
global-context
createContext
533 B
341 B
global-context
createContextSelector
554 B
348 B
priority-overflow
createOverflowManager
3.153 kB
1.299 kB
react-accordion
Accordion (including children components)
79.294 kB
24.443 kB
react-alert
Alert
86.996 kB
21.732 kB
react-avatar
Avatar
51.181 kB
14.31 kB
react-avatar
AvatarGroup
15.006 kB
6.009 kB
react-avatar
AvatarGroupItem
65.759 kB
18.408 kB
react-badge
Badge
22.656 kB
7.225 kB
react-badge
CounterBadge
23.546 kB
7.508 kB
react-badge
PresenceBadge
24.106 kB
7.087 kB
react-button
Button
36.86 kB
9.913 kB
react-button
CompoundButton
43.885 kB
11.131 kB
react-button
MenuButton
41.537 kB
11.187 kB
react-button
SplitButton
48.983 kB
12.588 kB
react-button
ToggleButton
52.685 kB
11.415 kB
react-card
Card - All
71.873 kB
20.936 kB
react-card
Card
67.651 kB
19.892 kB
react-card
CardFooter
8.617 kB
3.62 kB
react-card
CardHeader
9.792 kB
3.995 kB
react-card
CardPreview
8.718 kB
3.674 kB
react-combobox
Combobox (including child components)
78.086 kB
24.988 kB
react-combobox
Dropdown (including child components)
77.373 kB
24.891 kB
react-components
react-components: Button, FluentProvider & webLightTheme
62.951 kB
17.675 kB
react-components
react-components: Accordion, Button, FluentProvider, Image, Menu, Popover
190.427 kB
53.087 kB
react-components
react-components: FluentProvider & webLightTheme
33.456 kB
11.029 kB
react-dialog
Dialog (including children components)
83.036 kB
24.754 kB
react-divider
Divider
16.515 kB
5.921 kB
react-image
Image
10.836 kB
4.283 kB
react-infobutton
InfoButton
117.938 kB
35.399 kB
react-input
Input
24.122 kB
7.889 kB
react-label
Label
9.394 kB
3.88 kB
react-link
Link
11.862 kB
4.885 kB
react-menu
Menu (including children components)
117.61 kB
36.287 kB
react-menu
Menu (including selectable components)
120.679 kB
36.82 kB
react-overflow
hooks only
11.004 kB
4.188 kB
react-persona
Persona
56.299 kB
15.708 kB
react-popover
Popover
103.682 kB
31.867 kB
react-portal
Portal
10.495 kB
3.851 kB
react-portal-compat
PortalCompatProvider
5.857 kB
1.978 kB
react-positioning
usePositioning
19.826 kB
7.417 kB
react-progress
Progress
13.536 kB
5.11 kB
react-provider
FluentProvider
15.817 kB
5.905 kB
react-radio
Radio
36.446 kB
12.123 kB
react-radio
RadioGroup
14.304 kB
5.72 kB
react-select
Select
23.438 kB
8.018 kB
react-slider
Slider
32.118 kB
10.192 kB
react-spinbutton
SpinButton
44.43 kB
12.812 kB
react-spinner
Spinner
20.013 kB
6.446 kB
react-switch
Switch
33.453 kB
10.581 kB
react-text
Text - Default
11.838 kB
4.625 kB
react-text
Text - Wrappers
15.148 kB
5.06 kB
react-textarea
Textarea
25.697 kB
8.328 kB
react-theme
Single theme token import
69 B
89 B
react-theme
Teams: all themes
29.65 kB
6.444 kB
react-theme
Teams: Light theme
17.486 kB
5.057 kB
react-tooltip
Tooltip
42.032 kB
14.739 kB
react-utilities
SSRProvider
180 B
159 B
🤖 This report was generated against 131d20e15d6c59dce2dcbbd8794b5ee75701a670

@fabricteam
Copy link
Collaborator

fabricteam commented Nov 8, 2022

Perf Analysis (@fluentui/react-northstar)

Perf tests with no regressions
Scenario Current PR Ticks Baseline Ticks Ratio
ChatDuplicateMessagesPerf.default 220 201 1.09:1
ButtonMinimalPerf.default 143 134 1.07:1
ButtonSlotsPerf.default 437 413 1.06:1
ListCommonPerf.default 530 502 1.06:1
LoaderMinimalPerf.default 270 257 1.05:1
IconMinimalPerf.default 583 554 1.05:1
HeaderSlotsPerf.default 688 660 1.04:1
TableMinimalPerf.default 365 352 1.04:1
BoxMinimalPerf.default 305 296 1.03:1
GridMinimalPerf.default 299 291 1.03:1
ImageMinimalPerf.default 346 335 1.03:1
ListNestedPerf.default 480 465 1.03:1
PortalMinimalPerf.default 145 141 1.03:1
TreeMinimalPerf.default 704 685 1.03:1
CardMinimalPerf.default 471 462 1.02:1
CarouselMinimalPerf.default 353 347 1.02:1
ItemLayoutMinimalPerf.default 981 965 1.02:1
ListMinimalPerf.default 460 449 1.02:1
ListWith60ListItems.default 489 480 1.02:1
MenuButtonMinimalPerf.default 1368 1343 1.02:1
PopupMinimalPerf.default 563 552 1.02:1
ProviderMergeThemesPerf.default 993 977 1.02:1
SegmentMinimalPerf.default 306 299 1.02:1
SliderMinimalPerf.default 1242 1220 1.02:1
StatusMinimalPerf.default 611 600 1.02:1
AnimationMinimalPerf.default 474 470 1.01:1
AttachmentSlotsPerf.default 868 856 1.01:1
ButtonOverridesMissPerf.default 1014 1007 1.01:1
ChatMinimalPerf.default 644 635 1.01:1
DatepickerMinimalPerf.default 4700 4667 1.01:1
DropdownManyItemsPerf.default 541 534 1.01:1
EmbedMinimalPerf.default 2647 2625 1.01:1
InputMinimalPerf.default 858 846 1.01:1
LabelMinimalPerf.default 340 335 1.01:1
RadioGroupMinimalPerf.default 389 387 1.01:1
SplitButtonMinimalPerf.default 3301 3253 1.01:1
TableManyItemsPerf.default 1580 1571 1.01:1
ToolbarMinimalPerf.default 783 779 1.01:1
CheckboxMinimalPerf.default 1533 1528 1:1
DialogMinimalPerf.default 688 687 1:1
DropdownMinimalPerf.default 2176 2173 1:1
FlexMinimalPerf.default 253 254 1:1
FormMinimalPerf.default 325 326 1:1
HeaderMinimalPerf.default 319 319 1:1
MenuMinimalPerf.default 728 727 1:1
RefMinimalPerf.default 186 186 1:1
TextMinimalPerf.default 302 301 1:1
CustomToolbarPrototype.default 2156 2148 1:1
AttachmentMinimalPerf.default 122 123 0.99:1
AvatarMinimalPerf.default 158 160 0.99:1
ChatWithPopoverPerf.default 290 294 0.99:1
LayoutMinimalPerf.default 314 318 0.99:1
RosterPerf.default 1706 1719 0.99:1
ProviderMinimalPerf.default 313 317 0.99:1
SkeletonMinimalPerf.default 298 301 0.99:1
VideoMinimalPerf.default 615 621 0.99:1
ReactionMinimalPerf.default 327 335 0.98:1
TextAreaMinimalPerf.default 410 417 0.98:1
TooltipMinimalPerf.default 1842 1909 0.96:1
DividerMinimalPerf.default 300 315 0.95:1
TreeWith60ListItems.default 122 129 0.95:1
AccordionMinimalPerf.default 120 127 0.94:1
AlertMinimalPerf.default 211 227 0.93:1

@fabricteam
Copy link
Collaborator

fabricteam commented Nov 8, 2022

Perf Analysis (@fluentui/react)

Scenario Render type Master Ticks PR Ticks Iterations Status
GroupedList mount 1897 2120 2 Possible regression
Stack mount 1298 827 5000 Possible regression
TeachingBubble mount 89364 94115 5000 Possible regression
All results

Scenario Render type Master Ticks PR Ticks Iterations Status
BaseButton mount 1198 1168 5000
Breadcrumb mount 2930 2666 1000
Checkbox mount 2488 2528 5000
CheckboxBase mount 2335 2307 5000
ChoiceGroup mount 4474 4306 5000
ComboBox mount 1236 1187 1000
CommandBar mount 9407 9694 1000
ContextualMenu mount 11694 11678 1000
DefaultButton mount 1335 1316 5000
DetailsRow mount 3438 5976 5000
DetailsRowFast mount 3591 3235 5000
DetailsRowNoStyles mount 3209 3368 5000
Dialog mount 3004 3095 1000
DocumentCardTitle mount 570 580 1000
Dropdown mount 3234 3222 5000
FocusTrapZone mount 1815 1903 5000
FocusZone mount 1843 1957 5000
GroupedList mount 1897 2120 2 Possible regression
GroupedList virtual-rerender 1115 1149 2
GroupedList virtual-rerender-with-unmount 1676 1648 2
GroupedListV2 mount 574 554 2
GroupedListV2 virtual-rerender 532 521 2
GroupedListV2 virtual-rerender-with-unmount 539 574 2
IconButton mount 1860 1913 5000
Label mount 716 726 5000
Layer mount 4092 4264 5000
Link mount 784 841 5000
MenuButton mount 1695 1596 5000
MessageBar mount 2372 2274 5000
Nav mount 3226 3128 1000
OverflowSet mount 1265 1312 5000
Panel mount 2545 2484 1000
Persona mount 1249 1230 1000
Pivot mount 1653 1605 1000
PrimaryButton mount 1499 1518 5000
Rating mount 7022 6971 5000
SearchBox mount 1509 1423 5000
Shimmer mount 2898 2821 5000
Slider mount 2105 2096 5000
SpinButton mount 4716 4703 5000
Spinner mount 790 819 5000
SplitButton mount 2928 2991 5000
Stack mount 1298 827 5000 Possible regression
StackWithIntrinsicChildren mount 2437 2256 5000
StackWithTextChildren mount 4901 4860 5000
SwatchColorPicker mount 10420 10463 5000
TagPicker mount 2547 2419 5000
TeachingBubble mount 89364 94115 5000 Possible regression
Text mount 790 793 5000
TextField mount 1471 1606 5000
ThemeProvider mount 1459 1532 5000
ThemeProvider virtual-rerender 1026 1077 5000
ThemeProvider virtual-rerender-with-unmount 2110 2113 5000
Toggle mount 1091 1097 5000
buttonNative mount 555 548 5000

@Hotell Hotell removed this from the October Project Cycle Q4 2022 milestone Nov 9, 2022
scripts/tasks/utils.ts Outdated Show resolved Hide resolved
const apiExtractor = templates.apiExtractor();
const scripts = {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

collocate to proper boundary so its possible to run only particular migrations if needed

scripts/tasks/utils.ts Outdated Show resolved Hide resolved
@@ -9,10 +9,7 @@
},
"dtsRollup": {
"enabled": true,
// TODO: replace following line with these 2 commented ones after all v9 is migrated to new build and .d.ts API stripping
Copy link
Contributor Author

Choose a reason for hiding this comment

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

we wont strip @internal apis thus removing

) as TsConfig;

function createNormalizedTsPaths(options: { definitionsRootPath: string; rootTsConfig: TsConfig }) {
const paths = (options.rootTsConfig.compilerOptions.paths as unknown) as Record<string, string[]>;
Copy link
Contributor Author

@Hotell Hotell Nov 9, 2022

Choose a reason for hiding this comment

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

just-scripts provides invalid types for CompilerOptions thus need of override

@@ -155,12 +155,6 @@ const templates = {
main: {
$schema: 'https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json',
extends: '@fluentui/scripts/api-extractor/api-extractor.common.v-next.json',
// TODO: remove after all v9 is migrated to new build and .d.ts API stripping
Copy link
Contributor Author

Choose a reason for hiding this comment

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

we wont stript @internal marked APIs thus removing

@Hotell Hotell removed the request for review from spmonahan November 10, 2022 16:51
@Hotell Hotell marked this pull request as ready for review November 10, 2022 16:51
@@ -576,11 +569,11 @@ function setupUnstableApi(tree: Tree, options: NormalizedSchemaWithTsConfigs) {
}

updateUnstablePackageJson();
updateUnstableApiExtractorForLocalBuilds();
updateUnstableApiExtractor();
Copy link
Contributor Author

Choose a reason for hiding this comment

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

remove Local from name as with this we have only 1 api-extractor config 🙌

@Hotell Hotell force-pushed the hotell/build/api-generation-improvements branch from b7f0540 to f21a110 Compare November 10, 2022 17:46
@Hotell Hotell closed this Nov 10, 2022
@Hotell Hotell reopened this Nov 10, 2022
@Hotell Hotell removed this from the October Project Cycle Q4 2022 milestone Nov 10, 2022
@Hotell Hotell force-pushed the hotell/build/api-generation-improvements branch from b57cdcd to f21a110 Compare November 11, 2022 10:40
@Hotell Hotell closed this Nov 11, 2022
@Hotell Hotell reopened this Nov 11, 2022
@Hotell Hotell force-pushed the hotell/build/api-generation-improvements branch 2 times, most recently from af6ec45 to edf3f55 Compare November 14, 2022 13:06
@Hotell Hotell requested review from a team as code owners November 14, 2022 16:17
@Hotell Hotell marked this pull request as draft November 14, 2022 17:00
@Hotell Hotell force-pushed the hotell/build/api-generation-improvements branch from 3cdd4c7 to def9c4b Compare November 15, 2022 14:09
@Hotell Hotell removed the request for review from a team November 15, 2022 14:16
@Hotell Hotell force-pushed the hotell/build/api-generation-improvements branch 3 times, most recently from 07f933a to afda290 Compare November 15, 2022 16:03
@Hotell Hotell marked this pull request as ready for review November 15, 2022 17:26
@Hotell Hotell merged commit bd0257f into microsoft:master Nov 16, 2022
@Hotell Hotell deleted the hotell/build/api-generation-improvements branch November 16, 2022 13:14
NotWoods pushed a commit to NotWoods/fluentui that referenced this pull request Nov 18, 2022
Hotell added a commit to Hotell/fluentui that referenced this pull request Feb 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
6 participants