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

chore: migrate to nx 16.1.4 #28583

Merged
merged 10 commits into from
Jul 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// Default eslintrc for packages without one, or files outside a package
{
"parser": "@typescript-eslint/parser",
"parserOptions": {
Expand All @@ -20,5 +19,12 @@
"**/node_modules",
"**/temp",
"**/*.scss.ts"
],
"overrides": [
Copy link
Contributor Author

Choose a reason for hiding this comment

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

added by nx migration

{
"files": "*.json",
"parser": "jsonc-eslint-parser",
"rules": {}
}
]
}
1 change: 1 addition & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
},
"editor.rulers": [120],
"eslint.workingDirectories": [{ "mode": "auto" }], // infer working directory based on .eslintrc/package.json location
"eslint.validate": ["json"],
Copy link
Contributor Author

Choose a reason for hiding this comment

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

added by nx migration - enables to write lint rules for json as well in the future

"files.associations": {
"**/package.json.hbs": "json",
"**/*.json.hbs": "jsonc",
Expand Down
2 changes: 1 addition & 1 deletion azure-pipelines.release-vnext-nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ jobs:
- script: |
date=$(date +"%Y%m%d-%H%M")
#release version name will follow a 0.0.0-nightly-{year}{month}{day}-{hour}{minute} format.
yarn nx workspace-generator version-bump --all --bumpType nightly --prereleaseTag "nightly-${date}"
yarn nx g @fluentui/workspace-plugin:version-bump --all --bumpType nightly --prereleaseTag "nightly-${date}"
git add .
git commit -m "bump nightly versions"
yarn change --type prerelease --message "Release nightly v9" --dependent-change-type "prerelease"
Expand Down
6 changes: 3 additions & 3 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ jobs:

- script: |
yarn nx workspace-lint
yarn nx run @fluentui/nx-workspace-tools:check-graph
yarn nx workspace-generator tsconfig-base-all --verify
yarn nx workspace-generator normalize-package-dependencies --verify
yarn nx run @fluentui/workspace-plugin:check-graph
yarn nx g @fluentui/workspace-plugin:tsconfig-base-all --verify
yarn nx g @fluentui/workspace-plugin:normalize-package-dependencies --verify

displayName: Workspace lint

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "none",
"comment": "chore: exec migrations from @nrwl to @nx packages",
"packageName": "@fluentui/eslint-plugin",
"email": "[email protected]",
"dependentChangeType": "none"
}
2 changes: 1 addition & 1 deletion jest.config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const { getJestProjects } = require('@nrwl/jest');
const { getJestProjects } = require('@nx/jest');

export default {
projects: [...getJestProjects()],
Expand Down
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"packages/react-components/*",
"scripts/*",
"packages/fluentui/*",
"tools",
"tools/*",
"typings"
],
"npmClient": "yarn",
Expand Down
98 changes: 69 additions & 29 deletions migrations.json
Original file line number Diff line number Diff line change
@@ -1,52 +1,92 @@
{
"migrations": [
{
"version": "15.7.0-beta.0",
"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.",
"cli": "nx",
"implementation": "./src/migrations/update-15-7-0/split-configuration-into-project-json-files",
"package": "@nrwl/workspace",
"name": "15-7-0-split-configuration-into-project-json-files"
"version": "16.0.0-beta.0",
"description": "Remove @nrwl/cli.",
"implementation": "./src/migrations/update-16-0-0/remove-nrwl-cli",
"package": "nx",
"name": "16.0.0-remove-nrwl-cli"
},
{
"cli": "nx",
"version": "16.0.0-beta.9",
"description": "Replace `dependsOn.projects` and `inputs` definitions with new configuration format.",
"implementation": "./src/migrations/update-16-0-0/update-depends-on-to-tokens",
"package": "nx",
"name": "16.0.0-tokens-for-depends-on"
},
{
"cli": "nx",
"version": "15.8.2-beta.0",
"description": "Updates the nx wrapper.",
"implementation": "./src/migrations/update-15-8-2/update-nxw",
"version": "16.0.0-beta.0",
"description": "Replace @nrwl/nx-cloud with nx-cloud",
"implementation": "./src/migrations/update-16-0-0/update-nx-cloud-runner",
"package": "nx",
"name": "15.8.2-update-nx-wrapper"
"name": "16.0.0-update-nx-cloud-runner"
},
{
"cli": "nx",
"version": "16.0.0-beta.1",
"description": "Replace @nx/devkit with @nx/devkit",
"implementation": "./src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages",
"package": "@nx/devkit",
"name": "update-16-0-0-add-nx-packages"
},
{
"cli": "nx",
"version": "16.0.0-beta.1",
"description": "Replace @nx/workspace with @nx/workspace",
"implementation": "./src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages",
"package": "@nx/workspace",
"name": "update-16-0-0-add-nx-packages"
},
{
"cli": "nx",
"version": "16.0.0-beta.1",
"description": "Replace @nx/js with @nx/js",
"implementation": "./src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages",
"package": "@nx/js",
"name": "update-16-0-0-add-nx-packages"
},
{
"cli": "nx",
"version": "16.0.0-beta.1",
"description": "Replace @nx/jest with @nx/jest",
"implementation": "./src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages",
"package": "@nx/jest",
"name": "update-16-0-0-add-nx-packages"
},
{
"cli": "nx",
"version": "15.8.0-beta.0",
"description": "Rename .lib.swcrc to .swcrc for better SWC support throughout the workspace",
"factory": "./src/migrations/update-15-8-0/rename-swcrc-config",
"package": "@nrwl/js",
"name": "rename-swcrc-config"
"version": "16.0.0-beta.1",
"description": "Replace @nx/node with @nx/node",
"implementation": "./src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages",
"package": "@nx/node",
"name": "update-16-0-0-add-nx-packages"
},
{
"version": "15.7.0-beta.0",
"description": "Split global configuration files (e.g., workspace.json) into individual project.json files.",
"cli": "nx",
"implementation": "./src/migrations/update-15-7-0/split-configuration-into-project-json-files",
"package": "@nrwl/workspace",
"name": "15-7-0-split-configuration-into-project-json-files"
"version": "16.0.0-beta.5",
"description": "Replace @nx/node:webpack with @nx/node:webpack",
"implementation": "./src/migrations/update-16-0-0/update-webpack-executor",
"package": "@nx/node",
"name": "update-16-0-0-update-executor"
},
{
"version": "15.8.0-beta.0",
"version": "16.0.0-beta.9",
"description": "Fix .babelrc presets if it contains an invalid entry for @nx/web/babel.",
"cli": "nx",
"description": "Update jest configs to support jest 29 changes (https://jestjs.io/docs/upgrading-to-jest29)",
"factory": "./src/migrations/update-15-8-0/update-configs-jest-29",
"package": "@nrwl/jest",
"name": "update-configs-jest-29"
"implementation": "./src/migrations/update-16-0-0/fix-invalid-babelrc",
"package": "@nx/workspace",
"name": "16-0-0-fix-invalid-babelrc"
},
{
"version": "15.8.0-beta.0",
"version": "16.0.0-beta.4",
"description": "Generates a plugin called 'workspace-plugin' containing your workspace generators.",
"cli": "nx",
"description": "Update jest test files to support jest 29 changes (https://jestjs.io/docs/upgrading-to-jest29)",
"factory": "./src/migrations/update-15-8-0/update-tests-jest-29",
"package": "@nrwl/jest",
"name": "update-tests-jest-29"
"implementation": "./src/migrations/update-16-0-0/move-workspace-generators-to-local-plugin",
"package": "@nx/workspace",
"name": "16-0-0-move-workspace-generators-into-local-plugin"
}
]
}
2 changes: 1 addition & 1 deletion nx.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"defaultBase": "master"
},
"pluginsConfig": {
"@nrwl/js": {
"@nx/js": {
"analyzeSourceFiles": true
}
},
Expand Down
27 changes: 14 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
"code-style": "lage code-style --verbose",
"codepen": "cd packages/react && node ../../scripts/executors/local-codepen.js",
"copy-notices": "node scripts/generators/copy-notices.js",
"create-component": "yarn nx workspace-generator react-component",
"create-package": "yarn nx workspace-generator react-library",
"create-component": "yarn nx g @fluentui/workspace-plugin:react-component",
"create-package": "yarn nx g @fluentui/workspace-plugin:react-library",
"e2e": "lage e2e --verbose --concurrency=1",
"format": "node scripts/executors/format.js",
"generate-version-files": "node -r ./scripts/ts-node/register ./scripts/generators/generate-version-files",
Expand Down Expand Up @@ -101,12 +101,12 @@
"@microsoft/load-themed-styles": "1.10.26",
"@microsoft/loader-load-themed-styles": "2.0.17",
"@microsoft/tsdoc": "0.14.1",
"@nrwl/cli": "15.9.4",
"@nrwl/devkit": "15.9.4",
"@nrwl/jest": "15.9.4",
"@nrwl/js": "15.9.4",
"@nrwl/node": "15.9.4",
"@nrwl/workspace": "15.9.4",
"@nx/devkit": "16.1.4",
"@nx/jest": "16.1.4",
"@nx/js": "16.1.4",
"@nx/node": "16.1.4",
"@nx/plugin": "16.1.4",
"@nx/workspace": "16.1.4",
"@octokit/rest": "18.12.0",
"@phenomnomnominal/tsquery": "6.1.2",
"@storybook/addon-a11y": "6.5.15",
Expand All @@ -126,8 +126,8 @@
"@storybook/manager-webpack5": "6.5.15",
"@storybook/react": "6.5.15",
"@storybook/theming": "6.5.15",
"@swc-node/register": "1.6.1",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

removing for now as swc-node is incompatible with swc/helpers 0.4 - thus making nx explode. as a fallback nx will use ts-node which is our only option for now.

"@swc/core": "1.3.30",
"@swc/cli": "0.1.62",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

added by nx migration ( @nx/js uses it for transpilation )

"@swc/core": "1.3.44",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

last swc/core version that works with swc/helpers v0.4.x, beyond this we need to migrate all v9 packages dep to helpers 0.5

Copy link
Contributor Author

Choose a reason for hiding this comment

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

from API and semver, swc should have bumped to 2.0 as switching to helper 0.5 its a breaking change. welp

Copy link
Member

Choose a reason for hiding this comment

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

we should trigger an issue for this in swc

Copy link
Contributor Author

Choose a reason for hiding this comment

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

that's definitely the right approach but it looks like that train has already left the station. ATM core latest version is 1.3.71, based on their approach I don't think they would be willing to do anything about it.

"@swc/helpers": "0.4.14",
"@testing-library/dom": "8.11.3",
"@testing-library/jest-dom": "5.16.5",
Expand Down Expand Up @@ -269,6 +269,7 @@
"jju": "1.4.0",
"json-schema": "0.4.0",
"json-stable-stringify-without-jsonify": "1.0.1",
"jsonc-eslint-parser": "2.3.0",
"just-scripts": "1.8.2",
"lage": "1.8.8",
"lerna": "5.5.2",
Expand All @@ -284,7 +285,7 @@
"monosize-storage-azure": "0.0.3",
"node-plop": "0.25.0",
"node-polyfill-webpack-plugin": "1.0.2",
"nx": "15.9.4",
"nx": "16.1.4",
"p-queue": "6.6.2",
"parallel-webpack": "2.6.0",
"parse-diff": "0.7.1",
Expand Down Expand Up @@ -338,7 +339,7 @@
"terser-webpack-plugin": "5.3.9",
"through2": "4.0.2",
"tmp": "0.2.1",
"ts-jest": "29.1.0",
"ts-jest": "29.1.1",
"ts-loader": "9.3.1",
"ts-node": "10.9.1",
"tsconfig-paths": "4.1.0",
Expand Down Expand Up @@ -370,7 +371,7 @@
"packages/fluentui/*",
"packages/react-components/*",
"scripts/*",
"tools",
"tools/*",
"typings"
],
"nohoist": [
Expand Down
8 changes: 4 additions & 4 deletions packages/eslint-plugin/src/utils/configHelpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,23 @@ const jju = require('jju');
// eslint-disable-next-line import/no-extraneous-dependencies
const { FsTree } = require('nx/src/generators/tree');
// eslint-disable-next-line import/no-extraneous-dependencies
const { readProjectConfiguration } = require('@nrwl/devkit');
const { readProjectConfiguration } = require('@nx/devkit');

/**
* @typedef {{root: string, name: string}} Options
* @typedef {{name: string, version: string, dependencies: {[key: string]: string}}} PackageJson
* @typedef {import("@nrwl/devkit").WorkspaceJsonConfiguration} WorkspaceJsonConfiguration
* @typedef {import("@nx/devkit").WorkspaceJsonConfiguration} WorkspaceJsonConfiguration
*/

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

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as _ from 'lodash';
import * as path from 'path';
import { workspaceRoot } from '@nrwl/devkit';
import { workspaceRoot } from '@nx/devkit';
import { perfTestEnv } from '@fluentui/scripts-tasks';

import { config } from './perf-test.config';
Expand Down
2 changes: 1 addition & 1 deletion packages/fluentui/react-northstar/jest.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const path = require('path');
const fs = require('fs');
const { workspaceRoot } = require('@nrwl/devkit');
const { workspaceRoot } = require('@nx/devkit');
const { pathsToModuleNameMapper } = require('ts-jest');
const { createV0Config: commonConfig } = require('@fluentui/scripts-jest');

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
const { registerTsProject } = require('nx/src/utils/register');

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

registerTsProject(joinPathFragments(__dirname, '..'), 'tsconfig.lib.json');
Expand Down
2 changes: 1 addition & 1 deletion scripts/babel/preset-v9.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const fs = require('fs');
const path = require('path');

const { workspaceRoot } = require('@nrwl/devkit');
const { workspaceRoot } = require('@nx/devkit');

const cwd = process.cwd();
const rootOffset = path.relative(cwd, workspaceRoot);
Expand Down
2 changes: 1 addition & 1 deletion scripts/beachball/shared.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export const config: typeof baseConfig & Required<Pick<BeachballConfig, 'changel
];

generators.forEach(generator => {
const cmd = `yarn nx workspace-generator ${generator}`;
const cmd = `yarn nx g @fluentui/workspace-plugin:${generator}`;
const out = execSync(cmd);
console.log(out.toString());
});
Expand Down
2 changes: 1 addition & 1 deletion scripts/bundle-size-auditor/src/cli.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as path from 'path';
import * as fs from 'fs';

import { stripIndents } from '@nrwl/devkit';
import { stripIndents } from '@nx/devkit';

import { bundleSizeAuditor } from './cli';

Expand Down
2 changes: 1 addition & 1 deletion scripts/generators/create-package/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { spawnSync } from 'child_process';
import * as path from 'path';

import { PackageJson, findGitRoot, flushTreeChanges, getProjectMetadata, tree } from '@fluentui/scripts-monorepo';
import { addProjectConfiguration } from '@nrwl/devkit';
import { addProjectConfiguration } from '@nx/devkit';
import chalk from 'chalk';
import * as fs from 'fs-extra';
import _ from 'lodash';
Expand Down
2 changes: 1 addition & 1 deletion scripts/generators/generate-version-files.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import childProcess from 'child_process';
import * as fs from 'fs';
import * as path from 'path';

import { stripIndents } from '@nrwl/devkit';
import { stripIndents } from '@nx/devkit';
import * as tmp from 'tmp';

import { generateVersionFiles } from './generate-version-files';
Expand Down
2 changes: 1 addition & 1 deletion scripts/generators/generate-version-files.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { spawnSync } from 'child_process';
import * as path from 'path';

import { findGitRoot } from '@fluentui/scripts-monorepo';
import { stripIndents } from '@nrwl/devkit';
import { stripIndents } from '@nx/devkit';
import * as fs from 'fs-extra';
import * as glob from 'glob';

Expand Down
2 changes: 1 addition & 1 deletion scripts/jest/src/jest.preset.v0.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { workspaceRoot } from '@nrwl/devkit';
import { workspaceRoot } from '@nx/devkit';

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

Expand Down
2 changes: 1 addition & 1 deletion scripts/jest/src/jest.preset.v8.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { workspaceRoot } from '@nrwl/devkit';
import { workspaceRoot } from '@nx/devkit';

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

Expand Down
Loading