Skip to content

Commit 3da4204

Browse files
authored
chore: replace lage with nx for task(targets) orchestration (#31949)
1 parent b5c9a8c commit 3da4204

File tree

83 files changed

+392
-864
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

83 files changed

+392
-864
lines changed

.devops/templates/build-test-lint.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ steps:
1818
# @fluentui/api-docs is used within apps/public-docsite-resources/just.config.ts,
1919
# @fluentui/digest is used within packages/fluentui/perf-test-northstar/just.config.ts, thus it needs to be build in advance
2020
#
21-
# NOTE: we are running this via lage in order to get cache hits later on
22-
yarn lage build --to @fluentui/api-docs @fluentui/digest --verbose
21+
# NOTE: we are running this via nx in order to get cache hits later on
22+
yarn nx run-many -t build -p api-docs digest
2323
yarn tsc -p ./tsconfig.just-scripts-configs.json
2424
displayName: Type-check just.config.ts files
2525

.devops/templates/deployE2E.yml

+5-4
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,16 @@ steps:
1616
1717
# this also builds FUI N* docs if appropriate
1818
- script: |
19-
yarn bundle $(sinceArg)
19+
yarn nx affected -t bundle --nxBail $(sinceArg)
2020
displayName: bundle
2121
2222
- script: |
23-
yarn lage build-storybook --verbose $(sinceArg)
23+
yarn nx affected -t build-storybook --nxBail $(sinceArg)
2424
displayName: build Storybooks
2525
2626
## This runs regardless of scope, the app will adapt to the scope as well
2727
- script: |
28-
yarn workspace @fluentui/pr-deploy-site generate:site
28+
yarn nx run pr-deploy-site:generate:site
2929
displayName: generate PR Deploy Site
3030
3131
- task: AzureCLI@2
@@ -53,8 +53,9 @@ steps:
5353
# This MUST have a trailing slash, or the links to PR deploy site assets won't work
5454
githubTargetLink: $(deployUrl)/
5555

56+
# TODO: once https://github.com/nrwl/nx/issues/26903 will be fixed we can remove NX_PARALLEL=1 override via env variable
5657
- script: |
57-
yarn e2e $(sinceArg)
58+
NX_PARALLEL=1 yarn nx affected -t e2e --nxBail --parallel 1 $(sinceArg)
5859
displayName: Cypress E2E tests
5960
6061
- template: cleanup.yml

.devops/templates/runpublishvrscreenshot.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ parameters:
44
default: v8
55
- name: vrTestPackageName
66
type: string
7-
default: '@fluentui/vr-tests'
7+
default: vr-tests'
88
- name: vrTestPackagePath
99
type: string
1010
default: 'apps/vr-tests'
@@ -33,7 +33,7 @@ steps:
3333
echo $isPR
3434
echo "##vso[task.setvariable variable=isPR;]$isPR"
3535
if [[ $isPR == true ]]; then
36-
packageAffected=$(yarn --silent check:affected --package ${{ parameters.vrTestPackageName }})
36+
packageAffected=$(yarn --silent check:affected --project ${{ parameters.vrTestPackageName }})
3737
if [[ $packageAffected == false ]]; then
3838
echo "In PR pipeline but NOT affecting test package. Skipping test run"
3939
echo "##vso[task.setvariable variable=vrTestSkip;]yes"
@@ -48,7 +48,7 @@ steps:
4848
displayName: Check if vrTests should be skipped
4949
5050
- script: |
51-
yarn lage test-vr --to ${{ parameters.vrTestPackageName }} --verbose
51+
yarn nx run ${{ parameters.vrTestPackageName }}:test-vr --nxBail
5252
displayName: 'Run VR tests'
5353
condition: eq(variables['vrTestSkip'], 'no')
5454

.devops/templates/variables.yml

+4
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ variables:
1616
# Prevents failures on CI when "caniuse-lite" becomes outdated
1717
BROWSERSLIST_IGNORE_OLD_DATA: true
1818

19+
NX_PARALLEL: 8
20+
NX_PREFER_TS_NODE: true
21+
NX_VERBOSE_LOGGING: true
22+
1923
# Also accessed as process.env.DEPLOYHOST
2024
deployHost: 'fluentuipr.z22.web.core.windows.net'
2125

.github/actions/build-to/action.yml

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# TODO: Remove or replace with NX cache - we don't use lage(backfill) anymore
2+
13
name: 'Build workspaces'
24
description: 'Runs the build command for specific workspaces.'
35
inputs:

.github/policies/botRules.yml

+1-2
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,6 @@ configuration:
336336
files:
337337
- package.json
338338
- scripts
339-
- rush.json
340339
- apps/vr-tests/screener.config.js
341340
- apps/vr-tests/screener.local.config.js
342341
- apps/pr-deploy-site
@@ -348,7 +347,7 @@ configuration:
348347
- packages/codemods
349348
- packages/monaco-editor
350349
- packages/eslint-plugin
351-
- lage.config.js
350+
- nx.json
352351
- tools
353352
excludedFiles:
354353
- change

.github/workflows/docsite-publish-chromatic.yml

+2-5
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,9 @@ jobs:
4444
run: yarn install --frozen-lockfile
4545

4646
- name: Build dependencies
47-
uses: ./.github/actions/build-to
48-
with:
49-
workspaces: '@fluentui/public-docsite-v9'
50-
backfill-cache-provider-options: ${{ secrets.BACKFILL_CACHE_PROVIDER_OPTIONS }}
47+
run: yarn nx run public-docsite-v9:build --nxBail
5148

5249
- name: Publish to Chromatic
53-
run: yarn workspace @fluentui/public-docsite-v9 chromatic
50+
run: yarn nx run public-docsite-v9:chromatic --nxBail
5451
env:
5552
CHROMATIC_PROJECT_TOKEN: ${{ secrets.CHROMATIC_PROJECT_TOKEN }}

.github/workflows/docsite-publish-ghpages.yml

+2-5
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,10 @@ jobs:
4444
run: yarn install --frozen-lockfile
4545

4646
- name: Build dependencies
47-
uses: ./.github/actions/build-to
48-
with:
49-
workspaces: '@fluentui/public-docsite-v9'
50-
backfill-cache-provider-options: ${{ secrets.BACKFILL_CACHE_PROVIDER_OPTIONS }}
47+
run: yarn nx run public-docsite-v9:build --nxBail
5148

5249
- name: Build storybook
53-
run: yarn workspace @fluentui/public-docsite-v9 build-storybook
50+
run: yarn nx run public-docsite-v9:build-storybook --nxBail
5451
env:
5552
STORYBOOK_APPINSIGHTS_INSTRUMENTATION_KEY: ${{ secrets.STORYBOOK_APPINSIGHTS_INSTRUMENTATION_KEY }}
5653

.storybook/main.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ module.exports = /** @type {Omit<StorybookConfig,'typescript'|'babel'>} */ ({
8080
webpackFinal: config => {
8181
registerTsPaths({ config, configFile: tsConfigPath });
8282

83-
if ((process.env.CI || process.env.TF_BUILD || process.env.LAGE_PACKAGE_NAME) && config.plugins) {
83+
if ((process.env.CI || process.env.TF_BUILD) && config.plugins) {
8484
// Disable ProgressPlugin in PR/CI builds to reduce log verbosity (warnings and errors are still logged)
8585
config.plugins = config.plugins.filter(value => value && value.constructor.name !== 'ProgressPlugin');
8686
}

apps/perf-test-react-components/project.json

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"implicitDependencies": [],
66
"tags": ["vNext"],
77
"targets": {
8+
"test-perf": { "dependsOn": ["bundle"] },
89
"bundle": { "dependsOn": [] }
910
}
1011
}

apps/perf-test/project.json

+2-3
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@
55
"implicitDependencies": [],
66
"tags": ["v8"],
77
"targets": {
8-
"bundle": {
9-
"dependsOn": []
10-
}
8+
"test-perf": { "dependsOn": ["bundle"] },
9+
"bundle": { "dependsOn": [] }
1110
}
1211
}
+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "public-docsite-resources",
33
"$schema": "../../node_modules/nx/schemas/project-schema.json",
4-
"projectType": "application",
4+
"projectType": "library",
55
"implicitDependencies": [],
66
"tags": ["v8"]
77
}

apps/public-docsite/README.md

+4-5
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,9 @@ Once your repo is set up, run the following to start a local copy of the website
1212

1313
```
1414
yarn
15-
yarn buildto public-docsite
16-
cd apps
17-
cd public-docsite
18-
yarn start
15+
yarn nx run public-docsite:build
16+
17+
yarn nx run public-docsite:start
1918
```
2019

21-
`yarn start` will open your operating system's default web browser with the website. You can make changes to the code which will automatically build and refresh the page using live-reload.
20+
`yarn nx run public-docsite:start` will open your operating system's default web browser with the website. You can make changes to the code which will automatically build and refresh the page using live-reload.

apps/react-18-tests-v8/README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,10 @@ For that purpose we use `tsconfig.react-compat-check.json` as target for `type-c
3131
**Local machine flow:**
3232

3333
```sh
34-
lage build --to @fluentui/react-18-tests-v8
35-
yarn workspace @fluentui/react-18-tests-v8 type-check
34+
yarn nx run react-18-tests-v8:build
35+
yarn nx run react-18-tests-v8:type-check
3636
```
3737

3838
**CI:**
3939

40-
lage defines `build` targets to be executed prior to `type-check`.
40+
nx defines `build` targets to be executed prior to `type-check`.

apps/react-18-tests-v9/README.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# @fluentui/react-18-tests-v9
22

3-
**Tests for React 18 compatability in [Fluent UI React v9](https://react.fluentui.dev)**.
3+
**Tests for React 18 compatibility in [Fluent UI React v9](https://react.fluentui.dev)**.
44

55
## Usage
66

@@ -31,11 +31,11 @@ For that purpose we use `tsconfig.react-compat-check.json` as target for `type-c
3131
**Local machine flow:**
3232

3333
```sh
34-
lage build --to @fluentui/react-18-tests-v9
34+
yarn nx run react-18-tests-v9:build
3535

36-
yarn workspace @fluentui/react-18-tests-v9 type-check
36+
yarn nx run react-18-tests-v9:type-check
3737
```
3838

3939
**CI:**
4040

41-
lage defines `build` targets to be executed prior to `type-check`.
41+
nx defines `build` targets to be executed prior to `type-check`.

apps/ssr-tests/project.json

+4-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
"implicitDependencies": [],
66
"tags": ["v8"],
77
"targets": {
8-
"test-ssr": { "dependsOn": ["bundle", "^bundle"] }
8+
"test-ssr": {
9+
"dependsOn": ["bundle"]
10+
},
11+
"bundle": { "dependsOn": ["^build"] }
912
}
1013
}

apps/vr-tests-web-components/.storybook/main.cjs

+1-1
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ module.exports = /** @type {import('../../../.storybook/types').StorybookBaseCon
7575
);
7676

7777
// Disable ProgressPlugin which logs verbose webpack build progress. Warnings and Errors are still logged.
78-
if (process.env.TF_BUILD || process.env.LAGE_PACKAGE_NAME) {
78+
if (process.env.TF_BUILD) {
7979
config.plugins = config.plugins.filter(({ constructor }) => constructor.name !== 'ProgressPlugin');
8080
}
8181

azure-pipelines-pr.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ trigger: none
88
variables:
99
- ${{ if not(startsWith(variables['Build.SourceBranch'], 'refs/heads/')) }}:
1010
- name: sinceArg
11-
value: --since $(targetBranch)
11+
value: --base $(targetBranch)
1212

1313
- group: fabric-variables
1414

azure-pipelines.bundlesize.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ trigger:
77
variables:
88
- ${{ if not(startsWith(variables['Build.SourceBranch'], 'refs/heads/')) }}:
99
- name: sinceArg
10-
value: --since $(targetBranch)
10+
value: --base $(targetBranch)
1111

1212
- template: .devops/templates/variables.yml
1313

@@ -25,7 +25,7 @@ jobs:
2525
displayName: yarn
2626

2727
- script: |
28-
yarn lage bundle-size --verbose $(sinceArg)
28+
yarn nx affected -t bundle-size --nxBail $(sinceArg)
2929
displayName: build packages & create reports
3030
3131
- script: |

azure-pipelines.hotfix.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ extends:
6767
displayName: 'Manually set package version'
6868
6969
- script: |
70-
yarn buildto @fluentui/react --production
70+
yarn nx run react:build --production
7171
displayName: yarn build to FUIR (Create production build)
7272
7373
- script: yarn workspace @fluentui/react bundle --production

azure-pipelines.perf-test.yml

+7-7
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ jobs:
2121
displayName: yarn
2222

2323
- script: |
24-
NorthstarAffected=$(yarn --silent check:affected --package @fluentui/react-northstar)
25-
V8Affected=$(yarn --silent check:affected --package @fluentui/react)
26-
ReactComponentsAffected=$(yarn --silent check:affected --package @fluentui/react-components)
24+
NorthstarAffected=$(yarn --silent check:affected --project react-northstar)
25+
V8Affected=$(yarn --silent check:affected --project react)
26+
ReactComponentsAffected=$(yarn --silent check:affected --project react-components)
2727
if [[ $NorthstarAffected == true ]]; then
2828
echo "##vso[task.setvariable variable=NorthstarPackageAffected;isOutput=true]true"
2929
fi
@@ -51,12 +51,12 @@ jobs:
5151
displayName: yarn
5252

5353
- script: |
54-
yarn lage test-perf --to perf-test-northstar --base --verbose
54+
yarn nx run perf-test-northstar:test-perf --base
5555
condition: eq(variables.isPR, false)
5656
displayName: Run Perf Test Base (Northstar)
5757
5858
- script: |
59-
yarn lage test-perf --to perf-test-northstar --verbose
59+
yarn nx run perf-test-northstar:test-perf
6060
condition: eq(variables.isPR, true)
6161
displayName: Run Perf Test (Northstar)
6262
@@ -120,7 +120,7 @@ jobs:
120120
displayName: yarn
121121

122122
- script: |
123-
yarn lage test-perf --to perf-test --verbose
123+
yarn nx run perf-test:test-perf
124124
condition: eq(variables.isPR, true)
125125
displayName: Run Perf Test
126126
@@ -166,7 +166,7 @@ jobs:
166166
displayName: yarn
167167

168168
- script: |
169-
yarn lage test-perf --to @fluentui/perf-test-react-components --verbose
169+
yarn nx run perf-test-react-components:test-perf
170170
condition: eq(variables.isPR, true)
171171
displayName: Run Perf Test
172172

azure-pipelines.release-fluentui.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ extends:
8888
displayName: build,test,lint northstar packages
8989
inputs:
9090
script: |
91-
yarn nx run-many --targets=build,test,lint,type-check,test-ssr,verify-packaging --projects='packages/fluentui/*' --parallel $(getconf _NPROCESSORS_ONLN) --nxBail --verbose
91+
yarn nx run-many --targets=build,test,lint,type-check,test-ssr,verify-packaging --projects='packages/fluentui/*' --nxBail
9292
9393
- task: CmdLine@2
9494
displayName: '[NPM] Publish to NPM'

azure-pipelines.release-vnext-nightly.yml

+6-8
Original file line numberDiff line numberDiff line change
@@ -82,19 +82,17 @@ extends:
8282
yarn change --type prerelease --message "Release nightly v9" --dependent-change-type "prerelease"
8383
displayName: 'Bump and commit nightly versions'
8484
85-
# --only makes it only run tests (otherwise due to the missing --production arg, lage would re-run the build)
86-
# https://github.com/microsoft/fluentui/issues/21686
8785
- script: |
88-
yarn lage test --to @fluentui/react-components
89-
displayName: yarn test
86+
yarn nx run react-components:build --nxBai
87+
displayName: build
9088
9189
- script: |
92-
yarn lage lint --to @fluentui/react-components
93-
displayName: yarn lint
90+
yarn nx run react-components:lint --nxBai
91+
displayName: lint
9492
9593
- script: |
96-
yarn lage build --to @fluentui/react-components
97-
displayName: yarn build
94+
yarn nx run react-components:test --nxBai
95+
displayName: test
9896
9997
- script: |
10098
yarn publish:beachball -n $(npmToken) --no-push --tag nightly --config scripts/beachball/src/release-vNext.config.js

azure-pipelines.release-vnext.yml

+6-8
Original file line numberDiff line numberDiff line change
@@ -69,19 +69,17 @@ extends:
6969
filePath: yarn-ci.sh
7070
displayName: yarn
7171

72-
# --only makes it only run tests (otherwise due to the missing --production arg, lage would re-run the build)
73-
# https://github.com/microsoft/fluentui/issues/21686
7472
- script: |
75-
yarn run:published test
76-
displayName: yarn test
73+
yarn nx run-many -t build -p tag:vNext --exclude 'tag:tools,apps/**' --nxBail --production
74+
displayName: build
7775
7876
- script: |
79-
yarn run:published lint
80-
displayName: yarn lint
77+
yarn nx run-many -t test -p tag:vNext --exclude 'tag:tools,apps/**' --nxBail
78+
displayName: test
8179
8280
- script: |
83-
yarn run:published build --production
84-
displayName: yarn build
81+
yarn nx run-many -t lint -p tag:vNext --exclude 'tag:tools,apps/**' --nxBail
82+
displayName: lint
8583
8684
- script: |
8785
yarn publish:beachball -n $(npmToken) --config scripts/beachball/src/release-vNext.config.js --message 'release: applying package updates - react-components'

0 commit comments

Comments
 (0)