Skip to content

Commit d39f715

Browse files
authored
chore: migrate to nx 16.1.4 (#28583)
* chore: nx 16.0 migration * chore: exec migrations from @nrwl to @nx packages * chore: exec migration which converts tools/ to tools/workspace-plugin nx plugin * generate change file * chore: nx 16.1 migration * chore: bump swc/core to 1.3.45 which resolves issues with swc-node/register to make nx no-build DX work, without need to bump swc helpers to 0.5.x which increases v9 bundle size * chore: dedup deps * test(workspace-plugin): nx 16 changed transpilation which broke some of our generator test * fix: rollback to swc/core 1.3.44 which is the latest version to support swc/[email protected] and remove swc-node in order to use ts-node within nx(nx uses swc/helpers 0.5 if swc-node is used/installed)
1 parent 9958fee commit d39f715

File tree

211 files changed

+1204
-1409
lines changed

Some content is hidden

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

211 files changed

+1204
-1409
lines changed

.eslintrc.json

+7-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
// Default eslintrc for packages without one, or files outside a package
21
{
32
"parser": "@typescript-eslint/parser",
43
"parserOptions": {
@@ -20,5 +19,12 @@
2019
"**/node_modules",
2120
"**/temp",
2221
"**/*.scss.ts"
22+
],
23+
"overrides": [
24+
{
25+
"files": "*.json",
26+
"parser": "jsonc-eslint-parser",
27+
"rules": {}
28+
}
2329
]
2430
}

.vscode/settings.json

+1
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
},
4646
"editor.rulers": [120],
4747
"eslint.workingDirectories": [{ "mode": "auto" }], // infer working directory based on .eslintrc/package.json location
48+
"eslint.validate": ["json"],
4849
"files.associations": {
4950
"**/package.json.hbs": "json",
5051
"**/*.json.hbs": "jsonc",

azure-pipelines.release-vnext-nightly.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ jobs:
5656
- script: |
5757
date=$(date +"%Y%m%d-%H%M")
5858
#release version name will follow a 0.0.0-nightly-{year}{month}{day}-{hour}{minute} format.
59-
yarn nx workspace-generator version-bump --all --bumpType nightly --prereleaseTag "nightly-${date}"
59+
yarn nx g @fluentui/workspace-plugin:version-bump --all --bumpType nightly --prereleaseTag "nightly-${date}"
6060
git add .
6161
git commit -m "bump nightly versions"
6262
yarn change --type prerelease --message "Release nightly v9" --dependent-change-type "prerelease"

azure-pipelines.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@ jobs:
3030

3131
- script: |
3232
yarn nx workspace-lint
33-
yarn nx run @fluentui/nx-workspace-tools:check-graph
34-
yarn nx workspace-generator tsconfig-base-all --verify
35-
yarn nx workspace-generator normalize-package-dependencies --verify
33+
yarn nx run @fluentui/workspace-plugin:check-graph
34+
yarn nx g @fluentui/workspace-plugin:tsconfig-base-all --verify
35+
yarn nx g @fluentui/workspace-plugin:normalize-package-dependencies --verify
3636
3737
displayName: Workspace lint
3838
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"type": "none",
3+
"comment": "chore: exec migrations from @nrwl to @nx packages",
4+
"packageName": "@fluentui/eslint-plugin",
5+
"email": "[email protected]",
6+
"dependentChangeType": "none"
7+
}

jest.config.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const { getJestProjects } = require('@nrwl/jest');
1+
const { getJestProjects } = require('@nx/jest');
22

33
export default {
44
projects: [...getJestProjects()],

lerna.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"packages/react-components/*",
66
"scripts/*",
77
"packages/fluentui/*",
8-
"tools",
8+
"tools/*",
99
"typings"
1010
],
1111
"npmClient": "yarn",

migrations.json

+69-29
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,92 @@
11
{
22
"migrations": [
33
{
4-
"version": "15.7.0-beta.0",
5-
"description": "Split global configuration files into individual project.json files. This migration has been added automatically to the beginning of your migration set to retroactively make them work with the new version of Nx.",
64
"cli": "nx",
7-
"implementation": "./src/migrations/update-15-7-0/split-configuration-into-project-json-files",
8-
"package": "@nrwl/workspace",
9-
"name": "15-7-0-split-configuration-into-project-json-files"
5+
"version": "16.0.0-beta.0",
6+
"description": "Remove @nrwl/cli.",
7+
"implementation": "./src/migrations/update-16-0-0/remove-nrwl-cli",
8+
"package": "nx",
9+
"name": "16.0.0-remove-nrwl-cli"
10+
},
11+
{
12+
"cli": "nx",
13+
"version": "16.0.0-beta.9",
14+
"description": "Replace `dependsOn.projects` and `inputs` definitions with new configuration format.",
15+
"implementation": "./src/migrations/update-16-0-0/update-depends-on-to-tokens",
16+
"package": "nx",
17+
"name": "16.0.0-tokens-for-depends-on"
1018
},
1119
{
1220
"cli": "nx",
13-
"version": "15.8.2-beta.0",
14-
"description": "Updates the nx wrapper.",
15-
"implementation": "./src/migrations/update-15-8-2/update-nxw",
21+
"version": "16.0.0-beta.0",
22+
"description": "Replace @nrwl/nx-cloud with nx-cloud",
23+
"implementation": "./src/migrations/update-16-0-0/update-nx-cloud-runner",
1624
"package": "nx",
17-
"name": "15.8.2-update-nx-wrapper"
25+
"name": "16.0.0-update-nx-cloud-runner"
26+
},
27+
{
28+
"cli": "nx",
29+
"version": "16.0.0-beta.1",
30+
"description": "Replace @nx/devkit with @nx/devkit",
31+
"implementation": "./src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages",
32+
"package": "@nx/devkit",
33+
"name": "update-16-0-0-add-nx-packages"
34+
},
35+
{
36+
"cli": "nx",
37+
"version": "16.0.0-beta.1",
38+
"description": "Replace @nx/workspace with @nx/workspace",
39+
"implementation": "./src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages",
40+
"package": "@nx/workspace",
41+
"name": "update-16-0-0-add-nx-packages"
42+
},
43+
{
44+
"cli": "nx",
45+
"version": "16.0.0-beta.1",
46+
"description": "Replace @nx/js with @nx/js",
47+
"implementation": "./src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages",
48+
"package": "@nx/js",
49+
"name": "update-16-0-0-add-nx-packages"
50+
},
51+
{
52+
"cli": "nx",
53+
"version": "16.0.0-beta.1",
54+
"description": "Replace @nx/jest with @nx/jest",
55+
"implementation": "./src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages",
56+
"package": "@nx/jest",
57+
"name": "update-16-0-0-add-nx-packages"
1858
},
1959
{
2060
"cli": "nx",
21-
"version": "15.8.0-beta.0",
22-
"description": "Rename .lib.swcrc to .swcrc for better SWC support throughout the workspace",
23-
"factory": "./src/migrations/update-15-8-0/rename-swcrc-config",
24-
"package": "@nrwl/js",
25-
"name": "rename-swcrc-config"
61+
"version": "16.0.0-beta.1",
62+
"description": "Replace @nx/node with @nx/node",
63+
"implementation": "./src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages",
64+
"package": "@nx/node",
65+
"name": "update-16-0-0-add-nx-packages"
2666
},
2767
{
28-
"version": "15.7.0-beta.0",
29-
"description": "Split global configuration files (e.g., workspace.json) into individual project.json files.",
3068
"cli": "nx",
31-
"implementation": "./src/migrations/update-15-7-0/split-configuration-into-project-json-files",
32-
"package": "@nrwl/workspace",
33-
"name": "15-7-0-split-configuration-into-project-json-files"
69+
"version": "16.0.0-beta.5",
70+
"description": "Replace @nx/node:webpack with @nx/node:webpack",
71+
"implementation": "./src/migrations/update-16-0-0/update-webpack-executor",
72+
"package": "@nx/node",
73+
"name": "update-16-0-0-update-executor"
3474
},
3575
{
36-
"version": "15.8.0-beta.0",
76+
"version": "16.0.0-beta.9",
77+
"description": "Fix .babelrc presets if it contains an invalid entry for @nx/web/babel.",
3778
"cli": "nx",
38-
"description": "Update jest configs to support jest 29 changes (https://jestjs.io/docs/upgrading-to-jest29)",
39-
"factory": "./src/migrations/update-15-8-0/update-configs-jest-29",
40-
"package": "@nrwl/jest",
41-
"name": "update-configs-jest-29"
79+
"implementation": "./src/migrations/update-16-0-0/fix-invalid-babelrc",
80+
"package": "@nx/workspace",
81+
"name": "16-0-0-fix-invalid-babelrc"
4282
},
4383
{
44-
"version": "15.8.0-beta.0",
84+
"version": "16.0.0-beta.4",
85+
"description": "Generates a plugin called 'workspace-plugin' containing your workspace generators.",
4586
"cli": "nx",
46-
"description": "Update jest test files to support jest 29 changes (https://jestjs.io/docs/upgrading-to-jest29)",
47-
"factory": "./src/migrations/update-15-8-0/update-tests-jest-29",
48-
"package": "@nrwl/jest",
49-
"name": "update-tests-jest-29"
87+
"implementation": "./src/migrations/update-16-0-0/move-workspace-generators-to-local-plugin",
88+
"package": "@nx/workspace",
89+
"name": "16-0-0-move-workspace-generators-into-local-plugin"
5090
}
5191
]
5292
}

nx.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"defaultBase": "master"
2020
},
2121
"pluginsConfig": {
22-
"@nrwl/js": {
22+
"@nx/js": {
2323
"analyzeSourceFiles": true
2424
}
2525
},

package.json

+14-13
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@
2828
"code-style": "lage code-style --verbose",
2929
"codepen": "cd packages/react && node ../../scripts/executors/local-codepen.js",
3030
"copy-notices": "node scripts/generators/copy-notices.js",
31-
"create-component": "yarn nx workspace-generator react-component",
32-
"create-package": "yarn nx workspace-generator react-library",
31+
"create-component": "yarn nx g @fluentui/workspace-plugin:react-component",
32+
"create-package": "yarn nx g @fluentui/workspace-plugin:react-library",
3333
"e2e": "lage e2e --verbose --concurrency=1",
3434
"format": "node scripts/executors/format.js",
3535
"generate-version-files": "node -r ./scripts/ts-node/register ./scripts/generators/generate-version-files",
@@ -101,12 +101,12 @@
101101
"@microsoft/load-themed-styles": "1.10.26",
102102
"@microsoft/loader-load-themed-styles": "2.0.17",
103103
"@microsoft/tsdoc": "0.14.1",
104-
"@nrwl/cli": "15.9.4",
105-
"@nrwl/devkit": "15.9.4",
106-
"@nrwl/jest": "15.9.4",
107-
"@nrwl/js": "15.9.4",
108-
"@nrwl/node": "15.9.4",
109-
"@nrwl/workspace": "15.9.4",
104+
"@nx/devkit": "16.1.4",
105+
"@nx/jest": "16.1.4",
106+
"@nx/js": "16.1.4",
107+
"@nx/node": "16.1.4",
108+
"@nx/plugin": "16.1.4",
109+
"@nx/workspace": "16.1.4",
110110
"@octokit/rest": "18.12.0",
111111
"@phenomnomnominal/tsquery": "6.1.2",
112112
"@storybook/addon-a11y": "6.5.15",
@@ -126,8 +126,8 @@
126126
"@storybook/manager-webpack5": "6.5.15",
127127
"@storybook/react": "6.5.15",
128128
"@storybook/theming": "6.5.15",
129-
"@swc-node/register": "1.6.1",
130-
"@swc/core": "1.3.30",
129+
"@swc/cli": "0.1.62",
130+
"@swc/core": "1.3.44",
131131
"@swc/helpers": "0.4.14",
132132
"@testing-library/dom": "8.11.3",
133133
"@testing-library/jest-dom": "5.16.5",
@@ -269,6 +269,7 @@
269269
"jju": "1.4.0",
270270
"json-schema": "0.4.0",
271271
"json-stable-stringify-without-jsonify": "1.0.1",
272+
"jsonc-eslint-parser": "2.3.0",
272273
"just-scripts": "1.8.2",
273274
"lage": "1.8.8",
274275
"lerna": "5.5.2",
@@ -284,7 +285,7 @@
284285
"monosize-storage-azure": "0.0.3",
285286
"node-plop": "0.25.0",
286287
"node-polyfill-webpack-plugin": "1.0.2",
287-
"nx": "15.9.4",
288+
"nx": "16.1.4",
288289
"p-queue": "6.6.2",
289290
"parallel-webpack": "2.6.0",
290291
"parse-diff": "0.7.1",
@@ -338,7 +339,7 @@
338339
"terser-webpack-plugin": "5.3.9",
339340
"through2": "4.0.2",
340341
"tmp": "0.2.1",
341-
"ts-jest": "29.1.0",
342+
"ts-jest": "29.1.1",
342343
"ts-loader": "9.3.1",
343344
"ts-node": "10.9.1",
344345
"tsconfig-paths": "4.1.0",
@@ -370,7 +371,7 @@
370371
"packages/fluentui/*",
371372
"packages/react-components/*",
372373
"scripts/*",
373-
"tools",
374+
"tools/*",
374375
"typings"
375376
],
376377
"nohoist": [

packages/eslint-plugin/src/utils/configHelpers.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -7,23 +7,23 @@ const jju = require('jju');
77
// eslint-disable-next-line import/no-extraneous-dependencies
88
const { FsTree } = require('nx/src/generators/tree');
99
// eslint-disable-next-line import/no-extraneous-dependencies
10-
const { readProjectConfiguration } = require('@nrwl/devkit');
10+
const { readProjectConfiguration } = require('@nx/devkit');
1111

1212
/**
1313
* @typedef {{root: string, name: string}} Options
1414
* @typedef {{name: string, version: string, dependencies: {[key: string]: string}}} PackageJson
15-
* @typedef {import("@nrwl/devkit").WorkspaceJsonConfiguration} WorkspaceJsonConfiguration
15+
* @typedef {import("@nx/devkit").WorkspaceJsonConfiguration} WorkspaceJsonConfiguration
1616
*/
1717

1818
// FIXME: this is not ok (to depend on nx packages within this plugin - redo)
1919
/**
2020
* Gets project metadata from monorepo source of truth which is `project.json` per project
2121
* @param {Options} options
22-
* @returns {import('@nrwl/devkit').ProjectConfiguration}
22+
* @returns {import('@nx/devkit').ProjectConfiguration}
2323
*/
2424
function getProjectMetadata(options) {
2525
/**
26-
* @type {import('@nrwl/devkit').Tree}
26+
* @type {import('@nx/devkit').Tree}
2727
*/
2828
const tree = new FsTree(options.root, false);
2929

packages/fluentui/perf-test-northstar/tasks/fluentPerfRegressions.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import * as _ from 'lodash';
22
import * as path from 'path';
3-
import { workspaceRoot } from '@nrwl/devkit';
3+
import { workspaceRoot } from '@nx/devkit';
44
import { perfTestEnv } from '@fluentui/scripts-tasks';
55

66
import { config } from './perf-test.config';

packages/fluentui/react-northstar/jest.config.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
const path = require('path');
22
const fs = require('fs');
3-
const { workspaceRoot } = require('@nrwl/devkit');
3+
const { workspaceRoot } = require('@nx/devkit');
44
const { pathsToModuleNameMapper } = require('ts-jest');
55
const { createV0Config: commonConfig } = require('@fluentui/scripts-jest');
66

packages/react-components/babel-preset-storybook-full-source/src/index.dev.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
const { registerTsProject } = require('nx/src/utils/register');
44

55
// This is internal code and should be a dev dependency
6-
const { joinPathFragments } = require('@nrwl/devkit');
6+
const { joinPathFragments } = require('@nx/devkit');
77
/* eslint-enable import/no-extraneous-dependencies */
88

99
registerTsProject(joinPathFragments(__dirname, '..'), 'tsconfig.lib.json');

scripts/babel/preset-v9.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
const fs = require('fs');
22
const path = require('path');
33

4-
const { workspaceRoot } = require('@nrwl/devkit');
4+
const { workspaceRoot } = require('@nx/devkit');
55

66
const cwd = process.cwd();
77
const rootOffset = path.relative(cwd, workspaceRoot);

scripts/beachball/shared.config.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export const config: typeof baseConfig & Required<Pick<BeachballConfig, 'changel
2929
];
3030

3131
generators.forEach(generator => {
32-
const cmd = `yarn nx workspace-generator ${generator}`;
32+
const cmd = `yarn nx g @fluentui/workspace-plugin:${generator}`;
3333
const out = execSync(cmd);
3434
console.log(out.toString());
3535
});

scripts/bundle-size-auditor/src/cli.spec.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import * as path from 'path';
22
import * as fs from 'fs';
33

4-
import { stripIndents } from '@nrwl/devkit';
4+
import { stripIndents } from '@nx/devkit';
55

66
import { bundleSizeAuditor } from './cli';
77

scripts/generators/create-package/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { spawnSync } from 'child_process';
22
import * as path from 'path';
33

44
import { PackageJson, findGitRoot, flushTreeChanges, getProjectMetadata, tree } from '@fluentui/scripts-monorepo';
5-
import { addProjectConfiguration } from '@nrwl/devkit';
5+
import { addProjectConfiguration } from '@nx/devkit';
66
import chalk from 'chalk';
77
import * as fs from 'fs-extra';
88
import _ from 'lodash';

scripts/generators/generate-version-files.spec.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import childProcess from 'child_process';
22
import * as fs from 'fs';
33
import * as path from 'path';
44

5-
import { stripIndents } from '@nrwl/devkit';
5+
import { stripIndents } from '@nx/devkit';
66
import * as tmp from 'tmp';
77

88
import { generateVersionFiles } from './generate-version-files';

scripts/generators/generate-version-files.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { spawnSync } from 'child_process';
22
import * as path from 'path';
33

44
import { findGitRoot } from '@fluentui/scripts-monorepo';
5-
import { stripIndents } from '@nrwl/devkit';
5+
import { stripIndents } from '@nx/devkit';
66
import * as fs from 'fs-extra';
77
import * as glob from 'glob';
88

scripts/jest/src/jest.preset.v0.spec.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { workspaceRoot } from '@nrwl/devkit';
1+
import { workspaceRoot } from '@nx/devkit';
22

33
import preset from './jest.preset.v0';
44

scripts/jest/src/jest.preset.v8.spec.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { workspaceRoot } from '@nrwl/devkit';
1+
import { workspaceRoot } from '@nx/devkit';
22

33
import preset from './jest.preset.v8';
44

0 commit comments

Comments
 (0)