diff --git a/.gitignore b/.gitignore index 5af5f326d6ba..8da9f97dec62 100644 --- a/.gitignore +++ b/.gitignore @@ -55,6 +55,9 @@ UPCOMING.md # artifacts or bundleAnalysis folders. See scripts/pack-build-output.sh for more details. build_output_archive +# Nx cache +.nx/ + # Claude Code # Local settings contain author-specific information and should not be shared. **/.claude/**/*.local.* diff --git a/.mcp.json b/.mcp.json new file mode 100644 index 000000000000..960a0492348e --- /dev/null +++ b/.mcp.json @@ -0,0 +1,9 @@ +{ + "mcpServers": { + "nx-mcp": { + "type": "stdio", + "command": "npx", + "args": ["-y", "nx-mcp@latest", "--no-minimal"] + } + } +} diff --git a/.nxignore b/.nxignore new file mode 100644 index 000000000000..5fecfcdf98c3 --- /dev/null +++ b/.nxignore @@ -0,0 +1,7 @@ +# Exclude sub-workspaces that have their own nx.json and pnpm-workspace.yaml. +# Without these entries, `nx run-many` at the root discovers packages from these +# directories even though they are not part of the root pnpm workspace. +build-tools +server/routerlicious +server/gitrest +server/historian diff --git a/azure/packages/azure-local-service/project.json b/azure/packages/azure-local-service/project.json new file mode 100644 index 000000000000..fee38a89e2fd --- /dev/null +++ b/azure/packages/azure-local-service/project.json @@ -0,0 +1,17 @@ +{ + "$schema": "../../../node_modules/nx/schemas/project-schema.json", + "targets": { + "check:format": { + "executor": "nx:noop" + }, + "format": { + "executor": "nx:noop" + }, + "lint": { + "executor": "nx:noop" + }, + "lint:fix": { + "executor": "nx:noop" + } + } +} diff --git a/azure/packages/azure-service-utils/project.json b/azure/packages/azure-service-utils/project.json new file mode 100644 index 000000000000..463a48612c01 --- /dev/null +++ b/azure/packages/azure-service-utils/project.json @@ -0,0 +1,35 @@ +{ + "$schema": "../../../node_modules/nx/schemas/project-schema.json", + "targets": { + "api": { + "executor": "nx:noop" + }, + "build": { + "executor": "nx:noop" + }, + "build:api-reports": { + "executor": "nx:noop" + }, + "build:commonjs": { + "executor": "nx:noop" + }, + "build:compile": { + "executor": "nx:noop" + }, + "check:format": { + "executor": "nx:noop" + }, + "ci:build:api-reports": { + "executor": "nx:noop" + }, + "format": { + "executor": "nx:noop" + }, + "lint": { + "executor": "nx:noop" + }, + "lint:fix": { + "executor": "nx:noop" + } + } +} diff --git a/build-tools/.gitignore b/build-tools/.gitignore index 7b94c8120a4b..0e5ecafdd649 100644 --- a/build-tools/.gitignore +++ b/build-tools/.gitignore @@ -25,3 +25,6 @@ artifacts tsdoc-metadata.json packages/**/package-lock.json + +# Nx cache +.nx/ diff --git a/build-tools/.nxignore b/build-tools/.nxignore new file mode 100644 index 000000000000..31bd6577b02d --- /dev/null +++ b/build-tools/.nxignore @@ -0,0 +1,10 @@ +# Nx ignore file - exclude directories that should not be treated as projects +node_modules +dist +lib +nyc +coverage +.cache-loader +_api-extractor-temp +bundleAnalysis +artifacts diff --git a/build-tools/nx.json b/build-tools/nx.json new file mode 100644 index 000000000000..4f5b11e7d938 --- /dev/null +++ b/build-tools/nx.json @@ -0,0 +1,116 @@ +{ + "$schema": "./node_modules/nx/schemas/nx-schema.json", + "affected": { + "defaultBase": "main" + }, + "namedInputs": { + "source": [ + "{projectRoot}/src/**/*.ts", + "{projectRoot}/src/**/*.tsx", + "{projectRoot}/src/**/*.js", + "{projectRoot}/src/**/*.json" + ], + "config": [ + "{projectRoot}/package.json", + "{projectRoot}/tsconfig.json", + "{projectRoot}/tsconfig*.json", + "{projectRoot}/.eslintrc.*" + ], + "production": [ + "source", + "config", + "!{projectRoot}/src/test/**", + "!{projectRoot}/src/**/*.test.ts", + "!{projectRoot}/src/**/*.spec.ts" + ] + }, + "targetDefaults": { + "tsc": { + "dependsOn": ["^tsc"], + "inputs": ["production"], + "outputs": [ + "{projectRoot}/dist", + "{projectRoot}/lib", + "{projectRoot}/*.tsbuildinfo" + ], + "cache": true + }, + "build:esnext": { + "dependsOn": ["^tsc", "^build:esnext"], + "inputs": ["production"], + "outputs": ["{projectRoot}/lib"], + "cache": true + }, + "build:commonjs": { + "dependsOn": ["tsc", "build:test"], + "cache": false + }, + "build:test": { + "dependsOn": ["tsc"], + "inputs": ["source", "config"], + "outputs": ["{projectRoot}/dist/test"], + "cache": true + }, + "build:test:esm": { + "dependsOn": ["build:esnext"], + "inputs": ["source", "config"], + "outputs": ["{projectRoot}/lib/test"], + "cache": true + }, + "compile": { + "dependsOn": ["build:compile"] + }, + "build:compile": { + "dependsOn": ["tsc", "build:esnext", "build:test", "build:test:esm", "build:copy"] + }, + "build:copy": { + "cache": true + }, + "build": { + "dependsOn": ["compile", "lint", "build:docs", "build:manifest", "build:readme"] + }, + "build:docs": { + "dependsOn": ["tsc", "build:esnext"], + "cache": true + }, + "build:manifest": { + "dependsOn": ["compile"], + "cache": true + }, + "build:readme": { + "dependsOn": ["compile"], + "cache": true + }, + "lint": { + "dependsOn": ["eslint"] + }, + "eslint": { + "dependsOn": ["compile"], + "inputs": ["source"], + "cache": true + }, + "check:biome": { + "inputs": ["source"], + "cache": true + }, + "check:format": { + "inputs": ["source"], + "cache": true + }, + "test": { + "dependsOn": ["compile"], + "inputs": ["source", "config"], + "cache": true + }, + "test:mocha": { + "dependsOn": ["compile"], + "inputs": ["source", "config"], + "cache": true + }, + "clean": { + "cache": false + } + }, + "cacheDirectory": ".nx/cache", + "parallel": 3 +} diff --git a/build-tools/package.json b/build-tools/package.json index 9c415beaea7f..7de04dde447c 100644 --- a/build-tools/package.json +++ b/build-tools/package.json @@ -56,7 +56,16 @@ "test:mocha:bail": "pnpm run -r --no-sort --stream test:mocha", "tsc": "fluid-build --task tsc", "tsc:fast": "fluid-build --root . --task tsc --worker", - "watch": "pnpm run -r --parallel tsc --watch" + "watch": "pnpm run -r --parallel tsc --watch", + "nx:build": "nx run-many --target=build", + "nx:compile": "nx run-many --target=compile", + "nx:lint": "nx run-many --target=lint", + "nx:tsc": "nx run-many --target=tsc", + "nx:test": "nx run-many --target=test", + "nx:affected:build": "nx affected --target=build", + "nx:affected:compile": "nx affected --target=compile", + "nx:affected:lint": "nx affected --target=lint", + "nx:graph": "nx graph" }, "c8": { "all": true, @@ -81,6 +90,8 @@ "@fluidframework/build-tools": "~0.63.0", "@fluidframework/eslint-config-fluid": "link:../common/build/eslint-config-fluid", "@microsoft/api-extractor": "^7.55.1", + "@nx/js": "^22.5.4", + "@nx/workspace": "^22.5.4", "c8": "^10.1.3", "commitizen": "^4.3.1", "concurrently": "^9.2.1", @@ -92,6 +103,7 @@ "eslint": "~9.39.2", "inquirer": "^9.3.7", "jiti": "^2.6.1", + "nx": "^22.5.4", "rimraf": "^6.1.3", "run-script-os": "^1.1.6", "syncpack": "^13.0.4", @@ -198,6 +210,7 @@ "@biomejs/biome", "core-js", "es5-ext", + "nx", "sharp", "unrs-resolver" ] diff --git a/build-tools/packages/build-cli/docs/generate.md b/build-tools/packages/build-cli/docs/generate.md index 1c82ee5ff667..ee7b8972e78d 100644 --- a/build-tools/packages/build-cli/docs/generate.md +++ b/build-tools/packages/build-cli/docs/generate.md @@ -143,26 +143,26 @@ _See code: [src/commands/generate/bundleStats.ts](https://github.com/microsoft/F ## `flub generate changelog` -Generate a changelog for packages based on changesets. Note that this process deletes the changeset files! +Generate a changelog for packages based on changesets. ``` USAGE - $ flub generate changelog -g [-v | --quiet] [--version ] + $ flub generate changelog -g client|server|azure|build-tools|gitrest|historian [-v | --quiet] [--version ] + [--install] FLAGS - -g, --releaseGroup= (required) The name of a release group. - --version= The version for which to generate the changelog. If this is not provided, the version of - the package according to package.json will be used. + -g, --releaseGroup=