Skip to content

Commit 2ea7cf6

Browse files
authored
[code-infra] Fix and update bundling fixtures (#43709)
1 parent f38d286 commit 2ea7cf6

File tree

25 files changed

+488
-270
lines changed

25 files changed

+488
-270
lines changed

.circleci/config.yml

+93-95
Original file line numberDiff line numberDiff line change
@@ -60,13 +60,12 @@ default-context: &default-context
6060
# key: v1-repo-{{ .Branch }}-{{ .Revision }}
6161

6262
commands:
63-
install_js:
63+
setup_corepack:
6464
parameters:
6565
browsers:
6666
type: boolean
6767
default: false
6868
description: 'Set to true if you intend to any browser (for example with playwright).'
69-
7069
steps:
7170
- when:
7271
condition: << parameters.browsers >>
@@ -89,6 +88,17 @@ commands:
8988
node --version
9089
pnpm --version
9190
91+
install_js:
92+
parameters:
93+
browsers:
94+
type: boolean
95+
default: false
96+
description: 'Set to true if you intend to any browser (for example with playwright).'
97+
98+
steps:
99+
- setup_corepack:
100+
browsers: << parameters.browsers >>
101+
92102
- run:
93103
name: Resolve React version
94104
command: |
@@ -472,192 +482,174 @@ jobs:
472482
- run:
473483
name: Build packages for fixtures
474484
command: pnpm lerna run --scope "@mui/*" build
485+
- run:
486+
name: Pack packages
487+
command: pnpm release:pack
475488
- persist_to_workspace:
476-
root: packages
489+
root: packed
477490
paths:
478-
- '*/build'
491+
- '*'
479492

480-
test_bundling_node-esm:
493+
test_bundling_node_cjs:
481494
<<: *default-job
482-
working_directory: /tmp/material-ui/test/bundling/fixtures/node-esm/
495+
working_directory: /tmp/material-ui/test/bundling/fixtures/node-cjs/
483496
steps:
484497
- checkout:
485498
path: /tmp/material-ui
486499
- attach_workspace:
487-
at: /tmp/material-ui/packages
500+
at: /tmp/material-ui/packed
501+
- setup_corepack
488502
- run:
489-
name: Prepare fixture
490-
command: |
491-
node ../../scripts/createFixture node-esm
503+
name: Install dependencies
504+
command: pnpm install --ignore-workspace
505+
- run:
506+
name: Test fixture
507+
command: pnpm start
508+
test_bundling_node_esm:
509+
<<: *default-job
510+
working_directory: /tmp/material-ui/test/bundling/fixtures/node-esm/
511+
steps:
512+
- checkout:
513+
path: /tmp/material-ui
514+
- attach_workspace:
515+
at: /tmp/material-ui/packed
516+
- setup_corepack
492517
- run:
493518
name: Install dependencies
494-
command: |
495-
pnpm
496-
node ../../scripts/useBuildFromSource.js .
519+
command: pnpm install --ignore-workspace
497520
- run:
498521
name: Test fixture
499-
command: |
500-
# TODO: Known failure
501-
set +e
502-
pnpm start
503-
exit 0
504-
test_bundling_next-webpack4:
522+
# TODO: Known failure
523+
command: pnpm start
524+
test_bundling_next_webpack4:
505525
<<: *default-job
506-
working_directory: /tmp/material-ui/test/bundling/fixtures/next-webpack4/
507526
docker:
508527
- image: mcr.microsoft.com/playwright:v1.47.2-focal
528+
working_directory: /tmp/material-ui/test/bundling/fixtures/next-webpack4/
509529
steps:
510530
- checkout:
511531
path: /tmp/material-ui
512532
- attach_workspace:
513-
at: /tmp/material-ui/packages
514-
- run:
515-
name: Prepare fixture
516-
command: |
517-
node ../../scripts/createFixture next-webpack4
533+
at: /tmp/material-ui/packed
534+
- setup_corepack:
535+
browsers: true
518536
- run:
519537
name: Install dependencies
520-
command: |
521-
pnpm
522-
node ../../scripts/useBuildFromSource.js .
538+
command: pnpm install --ignore-workspace
523539
- run:
524540
name: Test fixture
525541
command: pnpm start
526-
test_bundling_next-webpack5:
542+
test_bundling_next_webpack5:
527543
<<: *default-job
528-
working_directory: /tmp/material-ui/test/bundling/fixtures/next-webpack5/
529544
docker:
530545
- image: mcr.microsoft.com/playwright:v1.47.2-focal
546+
working_directory: /tmp/material-ui/test/bundling/fixtures/next-webpack5/
531547
steps:
532548
- checkout:
533549
path: /tmp/material-ui
534550
- attach_workspace:
535-
at: /tmp/material-ui/packages
536-
- run:
537-
name: Prepare fixture
538-
command: |
539-
node ../../scripts/createFixture next-webpack5
551+
at: /tmp/material-ui/packed
552+
- setup_corepack:
553+
browsers: true
540554
- run:
541555
name: Install dependencies
542-
command: |
543-
pnpm
544-
node ../../scripts/useBuildFromSource.js .
556+
command: pnpm install --ignore-workspace
545557
- run:
546558
name: Test fixture
547559
command: pnpm start
548-
test_bundling_create-react-app:
560+
test_bundling_create_react_app:
549561
<<: *default-job
550-
working_directory: /tmp/material-ui/test/bundling/fixtures/create-react-app/
551562
docker:
552563
- image: mcr.microsoft.com/playwright:v1.47.2-focal
564+
working_directory: /tmp/material-ui/test/bundling/fixtures/create-react-app/
553565
steps:
554566
- checkout:
555567
path: /tmp/material-ui
556568
- attach_workspace:
557-
at: /tmp/material-ui/packages
558-
- run:
559-
name: Prepare fixture
560-
command: |
561-
node ../../scripts/createFixture create-react-app
569+
at: /tmp/material-ui/packed
570+
- setup_corepack:
571+
browsers: true
562572
- run:
563573
name: Install dependencies
564-
command: |
565-
pnpm
566-
node ../../scripts/useBuildFromSource.js .
574+
command: pnpm install --ignore-workspace
567575
- run:
568576
name: Test fixture
569577
command: pnpm start
570578
test_bundling_snowpack:
571579
<<: *default-job
572-
working_directory: /tmp/material-ui/test/bundling/fixtures/snowpack/
573580
docker:
574581
- image: mcr.microsoft.com/playwright:v1.47.2-focal
582+
working_directory: /tmp/material-ui/test/bundling/fixtures/snowpack/
575583
steps:
576584
- checkout:
577585
path: /tmp/material-ui
578586
- attach_workspace:
579-
at: /tmp/material-ui/packages
580-
- run:
581-
name: Prepare fixture
582-
command: |
583-
node ../../scripts/createFixture snowpack
587+
at: /tmp/material-ui/packed
588+
- setup_corepack:
589+
browsers: true
584590
- run:
585591
name: Install dependencies
586-
command: |
587-
pnpm
588-
node ../../scripts/useBuildFromSource.js .
592+
command: pnpm install --ignore-workspace
589593
- run:
590594
name: Test fixture
591595
command: pnpm start
592596
test_bundling_vite:
593597
<<: *default-job
594-
working_directory: /tmp/material-ui/test/bundling/fixtures/vite/
595598
docker:
596599
- image: mcr.microsoft.com/playwright:v1.47.2-focal
600+
working_directory: /tmp/material-ui/test/bundling/fixtures/vite/
597601
steps:
598602
- checkout:
599603
path: /tmp/material-ui
600604
- attach_workspace:
601-
at: /tmp/material-ui/packages
602-
- run:
603-
name: Prepare fixture
604-
command: |
605-
node ../../scripts/createFixture vite
605+
at: /tmp/material-ui/packed
606+
- setup_corepack:
607+
browsers: true
606608
- run:
607609
name: Install dependencies
608-
command: |
609-
pnpm
610-
node ../../scripts/useBuildFromSource.js .
610+
command: pnpm install --ignore-workspace
611611
- run:
612612
name: Test fixture
613613
command: pnpm start
614614
test_bundling_esbuild:
615615
<<: *default-job
616-
working_directory: /tmp/material-ui/test/bundling/fixtures/esbuild/
617616
docker:
618617
- image: mcr.microsoft.com/playwright:v1.47.2-focal
618+
working_directory: /tmp/material-ui/test/bundling/fixtures/esbuild/
619619
steps:
620620
- checkout:
621621
path: /tmp/material-ui
622622
- attach_workspace:
623-
at: /tmp/material-ui/packages
624-
- run:
625-
name: Prepare fixture
626-
command: |
627-
node ../../scripts/createFixture esbuild
623+
at: /tmp/material-ui/packed
624+
- setup_corepack:
625+
browsers: true
628626
- run:
629627
name: Install dependencies
630-
command: |
631-
pnpm
632-
node ../../scripts/useBuildFromSource.js .
628+
command: pnpm install --ignore-workspace
633629
- run:
634630
name: Test fixture
635-
command: |
636-
# TODO: Known failure
637-
set +e
638-
pnpm start
639-
exit 0
631+
command: pnpm start
640632
test_bundling_gatsby:
641633
<<: *default-job
642-
working_directory: /tmp/material-ui/test/bundling/fixtures/gatsby/
643634
docker:
644635
- image: mcr.microsoft.com/playwright:v1.47.2-focal
636+
environment:
637+
GATSBY_CPU_COUNT: '3'
638+
working_directory: /tmp/material-ui/test/bundling/fixtures/gatsby/
645639
steps:
646640
- checkout:
647641
path: /tmp/material-ui
648642
- attach_workspace:
649-
at: /tmp/material-ui/packages
650-
- run:
651-
name: Prepare fixture
652-
command: |
653-
node ../../scripts/useBuildFromSource.js .
654-
node ../../scripts/createFixture gatsby
643+
at: /tmp/material-ui/packed
644+
- setup_corepack:
645+
browsers: true
655646
- run:
656647
name: Install dependencies
657-
command: pnpm
648+
command: pnpm install --ignore-workspace
658649
- run:
659650
name: Test fixture
660651
command: pnpm start
652+
661653
test_bundle_size_monitor:
662654
<<: *default-job
663655
steps:
@@ -668,6 +660,7 @@ jobs:
668660
command: pnpm danger ci
669661
environment:
670662
DANGER_COMMAND: prepareBundleSizeReport
663+
- setup_corepack
671664
- run:
672665
name: build @mui packages
673666
command: pnpm lerna run --ignore @mui/icons-material --concurrency 6 --scope "@mui/*" build
@@ -807,19 +800,15 @@ workflows:
807800
jobs:
808801
- test_bundling_prepare:
809802
<<: *default-context
810-
- test_bundling_node-esm:
803+
- test_bundling_node_cjs:
811804
<<: *default-context
812805
requires:
813806
- test_bundling_prepare
814-
- test_bundling_next-webpack4:
807+
- test_bundling_node_esm:
815808
<<: *default-context
816809
requires:
817810
- test_bundling_prepare
818-
- test_bundling_next-webpack5:
819-
<<: *default-context
820-
requires:
821-
- test_bundling_prepare
822-
- test_bundling_create-react-app:
811+
- test_bundling_create_react_app:
823812
<<: *default-context
824813
requires:
825814
- test_bundling_prepare
@@ -839,6 +828,15 @@ workflows:
839828
<<: *default-context
840829
requires:
841830
- test_bundling_prepare
831+
- test_bundling_next_webpack4:
832+
<<: *default-context
833+
requires:
834+
- test_bundling_prepare
835+
- test_bundling_next_webpack5:
836+
<<: *default-context
837+
requires:
838+
- test_bundling_prepare
839+
842840
profile:
843841
when:
844842
equal: [profile, << pipeline.parameters.workflow >>]

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -43,3 +43,4 @@ docs/public/static/blog/feed/*
4343
.nx/cache
4444
.nx/workspace-data
4545
screenshots
46+
packed

apps/pigment-css-vite-app/src/pages/fixtures/index.tsx

+1-3
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,7 @@ export default function Layout() {
1717
);
1818

1919
const demo = new URLSearchParams(location.search).get('demo');
20-
const fixturesRoutes = (matchedRoute?.route.children ?? []).filter(
21-
(item) => !!item.path && item.path !== 'index.test',
22-
);
20+
const fixturesRoutes = (matchedRoute?.route.children ?? []).filter((item) => !!item.path);
2321

2422
const demosRoutes = (materialUIRoute?.route.children ?? []).filter(
2523
(item) => !!item.path && !item.path.includes('react-pagination'),

apps/pigment-css-vite-app/vite.config.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,10 @@ export default defineConfig({
4343
sourceMap: true,
4444
displayName: true,
4545
}),
46-
Pages(),
4746
splitVendorChunkPlugin(),
47+
Pages({
48+
exclude: ['**/*.test.*'],
49+
}),
4850
nodePolyfills(),
4951
],
5052
});

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
"release:publish": "pnpm publish --recursive --tag latest",
1919
"release:publish:dry-run": "pnpm publish --recursive --tag latest --registry=\"http://localhost:4873/\"",
2020
"release:tag": "node scripts/releaseTag.mjs",
21+
"release:pack": "tsx scripts/releasePack.mts",
2122
"docs:api": "rimraf --glob ./docs/pages/**/api-docs ./docs/pages/**/api && pnpm docs:api:build",
2223
"docs:api:build": "tsx ./scripts/buidApiDocs/index.ts",
2324
"docs:build": "pnpm --filter docs build",

0 commit comments

Comments
 (0)