Skip to content

Commit

Permalink
chore: migrate to nx 15.8.1 (introducing project.json migration with …
Browse files Browse the repository at this point in the history
…removal of workpsace.json, removal of helper methods in test and reading projectMetadata)
  • Loading branch information
Hotell committed Mar 3, 2023
1 parent 5260e31 commit 4034a5a
Show file tree
Hide file tree
Showing 213 changed files with 1,792 additions and 1,510 deletions.
3 changes: 2 additions & 1 deletion .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@

#### NX related files
/nx.json @microsoft/fluentui-react-build
/workspace.json @microsoft/fluentui-react-build
/migrations.json @microsoft/fluentui-react-build


#### Meta and License stuff
/LICENSE @microsoft/fluentui-react-build @justSlone @jurokapsiar @tudorpopams
/packages/react/LICENSE @microsoft/fluentui-react-build @justSlone @jurokapsiar @tudorpopams
Expand Down Expand Up @@ -289,3 +289,4 @@ packages/react-experiments/src/components/TileList @ThomasMichon
**/cypress.config.ts @microsoft/fluentui-react-build
**/api-extractor.json @microsoft/fluentui-react-build
**/api-extractor.unstable.json @microsoft/fluentui-react-build
**/project.json @microsoft/fluentui-react-build
6 changes: 6 additions & 0 deletions apps/perf-test-react-components/project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"name": "@fluentui/perf-test-react-components",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"projectType": "application",
"implicitDependencies": []
}
6 changes: 6 additions & 0 deletions apps/perf-test/project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"name": "@fluentui/perf-test",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"projectType": "application",
"implicitDependencies": []
}
6 changes: 6 additions & 0 deletions apps/pr-deploy-site/project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"name": "@fluentui/pr-deploy-site",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"projectType": "application",
"implicitDependencies": []
}
6 changes: 6 additions & 0 deletions apps/public-docsite-resources/project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"name": "@fluentui/public-docsite-resources",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"projectType": "application",
"implicitDependencies": []
}
7 changes: 7 additions & 0 deletions apps/public-docsite-v9/project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"name": "@fluentui/public-docsite-v9",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"projectType": "application",
"implicitDependencies": [],
"tags": ["platform:web"]
}
6 changes: 6 additions & 0 deletions apps/public-docsite/project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"name": "@fluentui/public-docsite",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"projectType": "application",
"implicitDependencies": []
}
6 changes: 6 additions & 0 deletions apps/react-18-tests-v8/project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"name": "@fluentui/react-18-tests-v8",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"projectType": "application",
"implicitDependencies": []
}
6 changes: 6 additions & 0 deletions apps/react-18-tests-v9/project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"name": "@fluentui/react-18-tests-v9",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"projectType": "application",
"implicitDependencies": []
}
8 changes: 8 additions & 0 deletions apps/recipes-react-components/project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"name": "@fluentui/recipes-react-components",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"projectType": "application",
"implicitDependencies": [],
"sourceRoot": "apps/recipes-react-components/src",
"tags": ["vNext"]
}
8 changes: 8 additions & 0 deletions apps/ssr-tests-v9/project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"name": "@fluentui/ssr-tests-v9",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"projectType": "application",
"implicitDependencies": [],
"sourceRoot": "apps/ssr-tests-v9/src",
"tags": ["vNext", "platform:node"]
}
6 changes: 6 additions & 0 deletions apps/ssr-tests/project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"name": "@fluentui/ssr-tests",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"projectType": "application",
"implicitDependencies": []
}
6 changes: 6 additions & 0 deletions apps/stress-test/project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"name": "@fluentui/stress-test",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"projectType": "application",
"implicitDependencies": []
}
6 changes: 6 additions & 0 deletions apps/test-bundles/project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"name": "@fluentui/test-bundles",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"projectType": "application",
"implicitDependencies": []
}
6 changes: 6 additions & 0 deletions apps/theming-designer/project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"name": "@fluentui/theming-designer",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"projectType": "application",
"implicitDependencies": []
}
5 changes: 5 additions & 0 deletions apps/ts-minbar-test-react-components/project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"name": "@fluentui/ts-minbar-test-react-components",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"projectType": "application"
}
5 changes: 5 additions & 0 deletions apps/ts-minbar-test-react/project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"name": "@fluentui/ts-minbar-test-react",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"projectType": "application"
}
6 changes: 6 additions & 0 deletions apps/vr-tests-react-components/project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"name": "@fluentui/vr-tests-react-components",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"projectType": "application",
"implicitDependencies": []
}
6 changes: 6 additions & 0 deletions apps/vr-tests/project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"name": "@fluentui/vr-tests",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"projectType": "application",
"implicitDependencies": []
}
14 changes: 13 additions & 1 deletion jest.preset.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,16 @@ const baseConfig = {
watchPlugins: ['jest-watch-typeahead/filename', 'jest-watch-typeahead/testname'],
};

module.exports = { ...baseConfig };
module.exports = {
...baseConfig,
/* TODO: Update to latest Jest snapshotFormat
* By default Nx has kept the older style of Jest Snapshot formats
* to prevent breaking of any existing tests with snapshots.
* It's recommend you update to the latest format.
* You can do this by removing snapshotFormat property
* and running tests with --update-snapshot flag.
* Example: "nx affected --targets=test --update-snapshot"
* More info: https://jestjs.io/docs/upgrading-to-jest29#snapshot-format
*/
// snapshotFormat: { escapeString: true, printBasicPrototype: true },
};
42 changes: 37 additions & 5 deletions migrations.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,44 @@
{
"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",
"version": "15.0.12-beta.1",
"description": "Set project names in project.json files",
"implementation": "./src/migrations/update-15-1-0/set-project-names",
"package": "nx",
"name": "15.1.0-set-project-names"
"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": "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": "15.8.0-beta.0",
"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"
},
{
"version": "15.8.0-beta.0",
"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"
},
{
"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"
}
]
}
21 changes: 11 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -102,12 +102,12 @@
"@microsoft/eslint-plugin-sdl": "0.1.9",
"@microsoft/load-themed-styles": "1.10.26",
"@microsoft/loader-load-themed-styles": "2.0.17",
"@nrwl/cli": "15.6.3",
"@nrwl/devkit": "15.6.3",
"@nrwl/jest": "15.6.3",
"@nrwl/js": "15.6.3",
"@nrwl/node": "15.6.3",
"@nrwl/workspace": "15.6.3",
"@nrwl/cli": "15.8.1",
"@nrwl/devkit": "15.8.1",
"@nrwl/jest": "15.8.1",
"@nrwl/js": "15.8.1",
"@nrwl/node": "15.8.1",
"@nrwl/workspace": "15.8.1",
"@octokit/rest": "18.12.0",
"@storybook/addon-a11y": "6.5.15",
"@storybook/addon-actions": "6.5.15",
Expand All @@ -126,8 +126,9 @@
"@storybook/manager-webpack5": "6.5.15",
"@storybook/react": "6.5.15",
"@storybook/theming": "6.5.15",
"@swc/core": "1.3.30",
"@swc/core": "1.3.37",
"@swc/helpers": "0.4.14",
"@swc-node/register": "1.6.2",
"@testing-library/dom": "8.11.3",
"@testing-library/jest-dom": "5.16.5",
"@testing-library/react": "12.1.2",
Expand Down Expand Up @@ -280,7 +281,7 @@
"node-fetch": "2.6.7",
"node-plop": "0.25.0",
"node-polyfill-webpack-plugin": "1.0.2",
"nx": "15.6.3",
"nx": "15.8.1",
"p-queue": "6.6.2",
"parse-diff": "0.7.1",
"path-browserify": "1.0.1",
Expand Down Expand Up @@ -336,9 +337,9 @@
"ts-jest": "28.0.8",
"ts-loader": "9.3.1",
"ts-node": "10.9.1",
"tsconfig-paths": "4.1.0",
"tsconfig-paths": "4.1.2",
"tsconfig-paths-webpack-plugin": "4.0.0",
"tslib": "2.4.1",
"tslib": "2.5.0",
"typescript": "4.3.5",
"vinyl": "2.2.0",
"vrscreenshotdiff": "0.0.17",
Expand Down
7 changes: 7 additions & 0 deletions packages/a11y-testing/project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"name": "@fluentui/a11y-testing",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"projectType": "library",
"implicitDependencies": [],
"tags": ["platform:node"]
}
7 changes: 7 additions & 0 deletions packages/api-docs/project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"name": "@fluentui/api-docs",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"projectType": "library",
"implicitDependencies": [],
"tags": ["v8", "platform:node"]
}
6 changes: 6 additions & 0 deletions packages/azure-themes/project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"name": "@fluentui/azure-themes",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"projectType": "library",
"implicitDependencies": []
}
8 changes: 8 additions & 0 deletions packages/bundle-size/project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"name": "@fluentui/bundle-size",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"projectType": "library",
"sourceRoot": "packages/bundle-size/src",
"tags": ["platform:node"],
"implicitDependencies": []
}
7 changes: 7 additions & 0 deletions packages/codemods/project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"name": "@fluentui/codemods",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"projectType": "library",
"implicitDependencies": [],
"tags": ["v8", "platform:node"]
}
6 changes: 6 additions & 0 deletions packages/common-styles/project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"name": "@fluentui/common-styles",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"projectType": "library",
"implicitDependencies": []
}
6 changes: 6 additions & 0 deletions packages/cra-template/project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"name": "@fluentui/cra-template",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"projectType": "library",
"implicitDependencies": []
}
6 changes: 6 additions & 0 deletions packages/date-time-utilities/project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"name": "@fluentui/date-time-utilities",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"projectType": "library",
"implicitDependencies": []
}
6 changes: 6 additions & 0 deletions packages/dom-utilities/project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"name": "@fluentui/dom-utilities",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"projectType": "library",
"implicitDependencies": []
}
6 changes: 6 additions & 0 deletions packages/eslint-plugin/project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"name": "@fluentui/eslint-plugin",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"projectType": "library",
"implicitDependencies": []
}
29 changes: 23 additions & 6 deletions packages/eslint-plugin/src/utils/configHelpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,26 @@ const fs = require('fs-extra');
const path = require('path');
const jju = require('jju');

// TODO: this is not ok (to depend on nx packages within this plugin - redo)
// 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');

/**
* Gets project metadata from monorepo source of truth which is `project.json` per project
* @param {Options} options
* @returns {import('@nrwl/devkit').ProjectConfiguration}
*/
function getProjectMetadata(options) {
/**
* @type {import('@nrwl/devkit').Tree}
*/
const tree = new FsTree(options.root, false);

return readProjectConfiguration(tree, options.name);
}

/**
* @typedef {{root: string, name: string}} Options
* @typedef {{name: string, version: string, dependencies: {[key: string]: string}}} PackageJson
Expand Down Expand Up @@ -232,9 +252,7 @@ module.exports = {
* @returns {PackageJson} package.json file of the provided package name.
*/
getPackageJson: (/** @type {Options} */ options) => {
/** @type {WorkspaceJsonConfiguration} */
const nxWorkspace = JSON.parse(fs.readFileSync(path.join(options.root, 'workspace.json'), 'utf-8'));
const projectMetaData = nxWorkspace.projects[options.name];
const projectMetaData = getProjectMetadata(options);
const packagePath = path.join(options.root, projectMetaData.root);
/** @type {PackageJson} */
const packageJson = fs.readJSONSync(path.join(packagePath, 'package.json'));
Expand All @@ -248,9 +266,8 @@ module.exports = {
* @returns {Set<string>} Returns a set of v9 packages that are currently unstable.
*/
getV9UnstablePackages: (/** @type {string} */ root) => {
const nxWorkspace = JSON.parse(fs.readFileSync(path.join(root, 'workspace.json'), 'utf-8'));
const v9ProjectMetaData = nxWorkspace.projects['@fluentui/react-components'];
const v9PackagePath = path.join(root, v9ProjectMetaData.sourceRoot, 'unstable', 'index.ts');
const v9ProjectMetaData = getProjectMetadata({ root, name: '@fluentui/react-components' });
const v9PackagePath = path.join(root, v9ProjectMetaData.sourceRoot ?? '', 'unstable', 'index.ts');
const unstableV9Packages = new Set();
fs.readFileSync(v9PackagePath)
.toString()
Expand Down
6 changes: 6 additions & 0 deletions packages/example-data/project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"name": "@fluentui/example-data",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"projectType": "library",
"implicitDependencies": []
}
Loading

0 comments on commit 4034a5a

Please sign in to comment.