Skip to content

Commit

Permalink
feat(core): nx 17 support (#778)
Browse files Browse the repository at this point in the history
BREAKING CHANGE: Drops Nx v15 support
  • Loading branch information
AgentEnder authored Oct 20, 2023
1 parent e8a60d7 commit 33344cd
Show file tree
Hide file tree
Showing 60 changed files with 956 additions and 703 deletions.
4 changes: 1 addition & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,10 @@ jobs:
with:
main-branch-name: 'master'
parallel-commands: |
npx nx-cloud record npx nx workspace-lint
npx nx-cloud record npx nx format:check
npx nx-cloud record yarn documentation:check --verbose
yarn nx affected --target build --exclude='*,!demo/**/*'
parallel-commands-on-agents: |
yarn nx affected --target lint build test --exclude='demo/**/*'
yarn nx affected --target lint build test
final-commands: |
yarn e2e
Expand Down
4 changes: 1 addition & 3 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,11 @@ jobs:
with:
main-branch-name: 'master'
parallel-commands: |
npx nx-cloud record yarn nx workspace-lint
npx nx-cloud record yarn nx format:check
npx nx-cloud record yarn documentation:check --verbose
npx nx-cloud record yarn commitlint --from ${{ github.event.pull_request.base.sha }} --to HEAD --verbose
yarn nx affected --target build --exclude='*,!demo/**/*'
parallel-commands-on-agents: |
yarn nx affected --target lint build test --exclude 'demo/**/*'
yarn nx affected --target lint build test
final-commands: |
yarn e2e
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,5 @@ Thumbs.db
**/bin
**/obj

.vs
.vs
.nx/cache
6 changes: 0 additions & 6 deletions .nx-dotnet.rc.json

This file was deleted.

3 changes: 2 additions & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@
/dist
/coverage
.docusaurus/
.yarn/
.yarn/
/.nx/cache
2 changes: 1 addition & 1 deletion demo/apps/web-frontend/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
"defaultConfiguration": "development"
},
"lint": {
"executor": "@nx/linter:eslint",
"executor": "@nx/eslint:lint",
"outputs": ["{options.outputFile}"],
"options": {
"lintFilePatterns": ["demo/apps/web-frontend/**/*.{ts,tsx,js,jsx}"]
Expand Down
5 changes: 3 additions & 2 deletions demo/libs/generated/webapi-types/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"name": "@nx-dotnet/demo-libs-generated-webapi-types",
"version": "0.0.1",
"type": "commonjs"
"version": "1.24.0-beta.1",
"type": "commonjs",
"private": true
}
2 changes: 1 addition & 1 deletion demo/libs/generated/webapi-types/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
}
},
"lint": {
"executor": "@nx/linter:eslint",
"executor": "@nx/eslint:lint",
"outputs": ["{options.outputFile}"],
"options": {
"lintFilePatterns": ["demo/libs/generated/webapi-types/**/*.ts"]
Expand Down
5 changes: 5 additions & 0 deletions e2e/core-e2e/tests/nx-dotnet.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import { unlinkSync, writeFileSync } from 'fs';
import { ensureDirSync } from 'fs-extra';
import { join } from 'path';
import { XmlDocument } from 'xmldoc';
import * as logger from 'console';

import { readDependenciesFromNxDepGraph } from '@nx-dotnet/utils/e2e';

Expand Down Expand Up @@ -516,7 +517,9 @@ function runNxCommandAsync(
}

function setupWorkspace() {
logger.log('Creating a sandbox project in ', e2eDir);
ensureNxProject('@nx-dotnet/core', 'dist/packages/core');
logger.log('✅');
// TODO: Update e2e tests and plugin generators to use the new workspace layout semantics.
updateFile('nx.json', (contents) => {
const nxJson: NxJsonConfiguration = JSON.parse(contents);
Expand All @@ -525,5 +528,7 @@ function setupWorkspace() {
nxJson.workspaceLayout.libsDir = 'libs';
return JSON.stringify(nxJson, null, 2);
});
logger.log('Initializing git repo');
initializeGitRepo(e2eDir);
logger.log('✅');
}
76 changes: 45 additions & 31 deletions nx.json
Original file line number Diff line number Diff line change
@@ -1,36 +1,23 @@
{
"$schema": "./node_modules/nx/schemas/nx-schema.json",
"npmScope": "nx-dotnet",
"affected": {
"defaultBase": "master"
},
"tasksRunnerOptions": {
"default": {
"runner": "nx-cloud",
"options": {
"cacheableOperations": [
"build",
"lint",
"test",
"e2e",
"prebuild",
"swagger",
"codegen",
"build:test"
],
"accessToken": "ZTMwZjcyY2ItZWRjYS00NzZjLTg3ZmQtYzdjM2Y3OGIzNDdhfHJlYWQtd3JpdGU=",
"canTrackAnalytics": false,
"showUsageWarnings": true,
"parallel": 3,
"useLightClient": true
}
}
},
"workspaceLayout": {
"appsDir": "",
"libsDir": ""
},
"plugins": ["@nx-dotnet/core"],
"plugins": [
{
"plugin": "@nx-dotnet/core",
"options": {
"nugetPackages": {
"Swashbuckle.AspNetCore": "6.5.0"
},
"inferProjects": false
}
}
],
"generators": {
"@nx-dotnet/nxdoc:generate-docs": {
"outputDirectory": "docs",
Expand All @@ -40,7 +27,8 @@
"targetDefaults": {
"build": {
"dependsOn": ["^build", "prebuild", "^prebuild", "^codegen", "codegen"],
"inputs": ["production", "^production"]
"inputs": ["production", "^production"],
"cache": true
},
"@nx-dotnet/core:build": {
"dependsOn": ["^build", "prebuild", "^prebuild", "^codegen", "codegen"],
Expand All @@ -52,19 +40,43 @@
]
},
"codegen": {
"dependsOn": ["^swagger", "swagger"]
"dependsOn": ["^swagger", "swagger"],
"cache": true
},
"swagger": {
"dependsOn": ["build"]
"dependsOn": ["build"],
"cache": true
},
"test": {
"inputs": ["default", "^production", "{workspaceRoot}/jest.preset.js"]
"inputs": ["default", "^production", "{workspaceRoot}/jest.preset.js"],
"cache": true
},
"smoke": {
"inputs": ["default", "^production", "{workspaceRoot}/jest.preset.js"]
"inputs": [
"default",
"^production",
"{workspaceRoot}/jest.preset.js",
{
"runtime": "npm show nx@latest version"
},
{
"runtime": "npm show @nx-dotnet/core@latest version"
}
],
"cache": true
},
"lint": {
"inputs": ["default", "{workspaceRoot}/.eslintrc.json"]
"inputs": ["default", "{workspaceRoot}/.eslintrc.json"],
"cache": true
},
"e2e": {
"cache": true
},
"prebuild": {
"cache": true
},
"build:test": {
"cache": true
}
},
"namedInputs": {
Expand All @@ -84,5 +96,7 @@
"!{projectRoot}/src/test-setup.[jt]s"
],
"projectSpecificFiles": []
}
},
"nxCloudAccessToken": "ZTMwZjcyY2ItZWRjYS00NzZjLTg3ZmQtYzdjM2Y3OGIzNDdhfHJlYWQtd3JpdGU=",
"parallel": 3
}
41 changes: 21 additions & 20 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "nx-dotnet",
"name": "@nx-dotnet/source",
"license": "MIT",
"scripts": {
"prepare": "husky install",
Expand All @@ -22,7 +22,7 @@
"@docusaurus/preset-classic": "^2.4.0",
"@docusaurus/theme-search-algolia": "^2.4.0",
"@mdx-js/react": "^1.6.21",
"@nx/devkit": "16.9.1",
"@nx/devkit": "17.0.0",
"@swc/helpers": "0.5.2",
"@trumbitta/nx-plugin-openapi": "^1.12.1",
"@types/xmldoc": "^1.1.6",
Expand All @@ -49,25 +49,25 @@
"@commitlint/config-conventional": "^17.1.0",
"@commitlint/types": "^17.4.4",
"@nx-plus/docusaurus": "15.0.0-rc.0",
"@nx/cypress": "16.9.1",
"@nx/eslint-plugin": "16.9.1",
"@nx/jest": "16.9.1",
"@nx/js": "16.9.1",
"@nx/linter": "16.9.1",
"@nx/node": "16.9.1",
"@nx/plugin": "16.9.1",
"@nx/react": "16.9.1",
"@nx/web": "16.9.1",
"@nx/webpack": "16.9.1",
"@nx/workspace": "16.9.1",
"@nx/cypress": "17.0.0",
"@nx/eslint": "17.0.0",
"@nx/eslint-plugin": "17.0.0",
"@nx/jest": "17.0.0",
"@nx/js": "17.0.0",
"@nx/node": "17.0.0",
"@nx/plugin": "17.0.0",
"@nx/react": "17.0.0",
"@nx/web": "17.0.0",
"@nx/webpack": "17.0.0",
"@nx/workspace": "17.0.0",
"@pmmmwh/react-refresh-webpack-plugin": "^0.5.7",
"@semantic-release/changelog": "^6.0.3",
"@semantic-release/commit-analyzer": "^9.0.2",
"@semantic-release/exec": "^6.0.3",
"@semantic-release/git": "^10.0.1",
"@semantic-release/release-notes-generator": "^10.0.3",
"@svgr/webpack": "^6.1.2",
"@swc-node/register": "^1.4.2",
"@swc-node/register": "1.6.8",
"@swc/cli": "0.1.62",
"@swc/core": "~1.3.51",
"@testing-library/react": "13.4.0",
Expand All @@ -79,19 +79,20 @@
"@types/node": "20.1.0",
"@types/node-fetch": "^2.6.2",
"@types/prettier": "2.7.1",
"@types/react": "18.2.14",
"@types/react-dom": "18.2.6",
"@types/react": "18.2.24",
"@types/react-dom": "18.2.9",
"@types/rimraf": "^3.0.2",
"@types/semver": "^7.3.9",
"@types/tmp": "^0.2.3",
"@types/yargs": "^17.0.29",
"@types/yargs-parser": "^21.0.0",
"@typescript-eslint/eslint-plugin": "5.62.0",
"@typescript-eslint/parser": "5.62.0",
"babel-jest": "28.1.3",
"css-loader": "^6.7.3",
"cypress": "^13.0.0",
"dotenv": "^16.0.3",
"eslint-config-prettier": "8.8.0",
"eslint-config-prettier": "9.0.0",
"eslint-plugin-cypress": "2.15.1",
"eslint-plugin-import": "2.26.0",
"eslint-plugin-jsx-a11y": "6.7.1",
Expand All @@ -106,8 +107,7 @@
"lint-staged": "^13.0.3",
"memfs": "3.4.13",
"node-fetch": "3.3.0",
"nx": "16.9.1",
"nx-cloud": "16.4.0",
"nx": "17.0.0",
"openapi-types": "^12.1.0",
"prettier": "2.7.1",
"react-refresh": "^0.10.0",
Expand All @@ -124,7 +124,8 @@
"url-loader": "^4.1.1",
"verdaccio": "^5.24.1",
"webpack": "^5.81.0",
"webpack-merge": "^5.8.0"
"webpack-merge": "^5.8.0",
"yargs": "^17.7.2"
},
"lint-staged": {
"**/*.{js,ts,md,json}": [
Expand Down
6 changes: 6 additions & 0 deletions packages/core/generators.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,12 @@
"schema": "./src/generators/preset/schema.json",
"description": "preset generator",
"hidden": true
},
"nxjson-config": {
"factory": "./src/generators/nxjson-config/generator",
"schema": "./src/generators/nxjson-config/schema.json",
"description": "Moves configuration from .nx-dotnet.rc to nx.json",
"hidden": true
}
}
}
5 changes: 5 additions & 0 deletions packages/core/migrations.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@
"description": "Adds build intermediates to Nx outputs arrays s.t. nx cloud is more effective.",
"cli": "nx",
"implementation": "./src/migrations/update-1.18.1/add-intermediate-outputs"
},
"update-1.24.0": {
"version": "1.24.0",
"description": "Migration for v1.24.0",
"implementation": "./src/migrations/update-1.24.0/update-1.24.0"
}
}
}
3 changes: 1 addition & 2 deletions packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
"postinstall": "node ./src/tasks/post-install"
},
"dependencies": {
"@nx/devkit": "17.0.0",
"@nx-dotnet/dotnet": "1.23.0",
"@nx-dotnet/utils": "1.23.0",
"@nx/devkit": "16.9.1",
"fast-glob": "3.2.12",
"inquirer": "^8.2.0",
"semver": "7.5.4",
Expand All @@ -22,7 +22,6 @@
"@nx/js": ">=16.0.0-beta.1",
"@trumbitta/nx-plugin-openapi": "^1.12.1",
"eslint": ">8.0.0",
"nx": ">=16.0.0-beta.1",
"prettier": ">=2.0.0"
},
"peerDependenciesMeta": {
Expand Down
2 changes: 1 addition & 1 deletion packages/core/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"projectType": "library",
"targets": {
"lint": {
"executor": "@nx/linter:eslint",
"executor": "@nx/eslint:lint",
"options": {
"lintFilePatterns": [
"packages/core/**/*.ts",
Expand Down
1 change: 0 additions & 1 deletion packages/core/src/executors/build/executor.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ describe('Build Executor', () => {
},
},
},
npmScope: 'unit-tests',
},
isVerbose: false,
};
Expand Down
1 change: 0 additions & 1 deletion packages/core/src/executors/format/executor.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ describe('Format Executor', () => {
},
},
},
npmScope: 'unit-tests',
},
isVerbose: false,
};
Expand Down
1 change: 0 additions & 1 deletion packages/core/src/executors/publish/executor.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ describe('Publish Executor', () => {
},
},
},
npmScope: 'unit-tests',
},
isVerbose: false,
};
Expand Down
Loading

0 comments on commit 33344cd

Please sign in to comment.