Skip to content

Commit

Permalink
feat(core): migrate to v16 and nx plugin API v2 (#763)
Browse files Browse the repository at this point in the history
  • Loading branch information
AgentEnder committed Oct 8, 2023
1 parent 6398a06 commit 4451e8a
Show file tree
Hide file tree
Showing 182 changed files with 5,002 additions and 3,300 deletions.
8 changes: 4 additions & 4 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
"root": true,
"ignorePatterns": ["**/*"],
"plugins": ["@nrwl/nx"],
"plugins": ["@nx"],
"overrides": [
{
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
"rules": {
"@nrwl/nx/enforce-module-boundaries": [
"@nx/enforce-module-boundaries": [
"error",
{
"enforceBuildableLibDependency": true,
Expand All @@ -23,14 +23,14 @@
},
{
"files": ["*.ts", "*.tsx"],
"extends": ["plugin:@nrwl/nx/typescript"],
"extends": ["plugin:@nx/typescript"],
"rules": {
"eqeqeq": ["error", "smart"]
}
},
{
"files": ["*.js", "*.jsx"],
"extends": ["plugin:@nrwl/nx/javascript"],
"extends": ["plugin:@nx/javascript"],
"rules": {}
},
{
Expand Down
5 changes: 2 additions & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,9 @@ jobs:
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 --parallel 3
yarn nx affected -- --target=build --parallel 3
yarn nx affected -- --target=test --parallel 3
yarn nx affected --target lint build test --exclude='demo/**/*'
final-commands: |
yarn e2e
Expand Down
8 changes: 7 additions & 1 deletion .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ concurrency:
group: ${{ github.workflow }}-${{ github.event.number || github.ref }}
cancel-in-progress: true

# TODO: Figure out why DTE is not handling demo app well.
# It appears that the task graph on the DTE side doesn't
# contain the relationship between the demo webapi and the
# demo models library. This causes the C# build to fail.

jobs:
main:
name: Nx Cloud - Main Job
Expand All @@ -17,8 +22,9 @@ jobs:
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 --parallel 3
yarn nx affected --target lint build test --exclude 'demo/**/*'
final-commands: |
yarn e2e
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
## Prerequisites

- You have an existing nx workspace (empty, or otherwise)
- You have the [@nrwl/js](https://www.npmjs.com/package/@nrwl/js) plugin added to the workspace
- You have the [@nx/js](https://www.npmjs.com/package/@nx/js) plugin added to the workspace

## Adding .NET capabilities to your workspace

Expand Down Expand Up @@ -53,7 +53,7 @@ Run `nx serve my-app` for a dev server. The app will automatically reload if you
<!--
## Code scaffolding
Run `nx g @nrwl/react:component my-component --project=my-app` to generate a new component.
Run `nx g @nx/react:component my-component --project=my-app` to generate a new component.
-->

## Build
Expand Down
2 changes: 1 addition & 1 deletion apps/docs-site/project.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"name": "docs-site",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"projectType": "application",
"sourceRoot": "apps/docs-site/src",
"targets": {
Expand Down
Binary file modified assets/black.avif
Binary file not shown.
Binary file modified assets/color.avif
Binary file not shown.
Binary file modified assets/white.avif
Binary file not shown.
2 changes: 1 addition & 1 deletion demo/apps/web-frontend/.babelrc
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"presets": [
[
"@nrwl/react/babel",
"@nx/react/babel",
{
"runtime": "automatic"
}
Expand Down
2 changes: 1 addition & 1 deletion demo/apps/web-frontend/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": ["plugin:@nrwl/nx/react", "../../../.eslintrc.json"],
"extends": ["plugin:@nx/react", "../../../.eslintrc.json"],
"ignorePatterns": ["!**/*"],
"overrides": [
{
Expand Down
4 changes: 2 additions & 2 deletions demo/apps/web-frontend/jest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ export default {
displayName: 'demo-web-frontend',
preset: '../../../jest.preset.js',
transform: {
'^(?!.*\\.(js|jsx|ts|tsx|css|json)$)': '@nrwl/react/plugins/jest',
'^.+\\.[tj]sx?$': ['babel-jest', { presets: ['@nrwl/react/babel'] }],
'^(?!.*\\.(js|jsx|ts|tsx|css|json)$)': '@nx/react/plugins/jest',
'^.+\\.[tj]sx?$': ['babel-jest', { presets: ['@nx/react/babel'] }],
},
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'],
coverageDirectory: '../../coverage//demo/apps/web-frontend',
Expand Down
8 changes: 4 additions & 4 deletions demo/apps/web-frontend/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"projectType": "application",
"targets": {
"build": {
"executor": "@nrwl/webpack:webpack",
"executor": "@nx/webpack:webpack",
"outputs": ["{options.outputPath}"],
"defaultConfiguration": "production",
"options": {
Expand Down Expand Up @@ -49,7 +49,7 @@
}
},
"serve": {
"executor": "@nrwl/webpack:dev-server",
"executor": "@nx/webpack:dev-server",
"options": {
"buildTarget": "demo-frontend:build",
"hmr": true
Expand All @@ -66,14 +66,14 @@
"defaultConfiguration": "development"
},
"lint": {
"executor": "@nrwl/linter:eslint",
"executor": "@nx/linter:eslint",
"outputs": ["{options.outputFile}"],
"options": {
"lintFilePatterns": ["demo/apps/web-frontend/**/*.{ts,tsx,js,jsx}"]
}
},
"test": {
"executor": "@nrwl/jest:jest",
"executor": "@nx/jest:jest",
"outputs": ["{workspaceRoot}/coveragedemo/apps/web-frontend"],
"options": {
"jestConfig": "demo/apps/web-frontend/jest.config.ts",
Expand Down
5 changes: 5 additions & 0 deletions demo/apps/web-frontend/src/app/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ const x: WeatherForecast = {
temperatureC: 12,
temperatureF: 53,
},
forecaster: {
employer: {
employees: undefined,
},
},
};

export function App() {
Expand Down
10 changes: 7 additions & 3 deletions demo/apps/web-frontend/tsconfig.app.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,15 @@
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "../../dist/out-tsc",
"types": ["node"]
"types": [
"node",
"@nx/react/typings/cssmodule.d.ts",
"@nx/react/typings/image.d.ts"
]
},
"files": [
"../../../node_modules/@nrwl/react/typings/cssmodule.d.ts",
"../../../node_modules/@nrwl/react/typings/image.d.ts"
"../../../node_modules/@nx/react/typings/cssmodule.d.ts",
"../../../node_modules/@nx/react/typings/image.d.ts"
],
"exclude": [
"**/*.spec.ts",
Expand Down
11 changes: 8 additions & 3 deletions demo/apps/web-frontend/tsconfig.spec.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,12 @@
"compilerOptions": {
"outDir": "../../dist/out-tsc",
"module": "commonjs",
"types": ["jest", "node"]
"types": [
"jest",
"node",
"@nx/react/typings/cssmodule.d.ts",
"@nx/react/typings/image.d.ts"
]
},
"include": [
"**/*.test.ts",
Expand All @@ -18,7 +23,7 @@
"jest.config.ts"
],
"files": [
"../../../node_modules/@nrwl/react/typings/cssmodule.d.ts",
"../../../node_modules/@nrwl/react/typings/image.d.ts"
"../../../node_modules/@nx/react/typings/cssmodule.d.ts",
"../../../node_modules/@nx/react/typings/image.d.ts"
]
}
4 changes: 2 additions & 2 deletions demo/apps/web-frontend/webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const { composePlugins, withNx } = require('@nrwl/webpack');
const { withReact } = require('@nrwl/react');
const { composePlugins, withNx } = require('@nx/webpack');
const { withReact } = require('@nx/react');

// Nx plugins for webpack.
module.exports = composePlugins(
Expand Down
2 changes: 1 addition & 1 deletion demo/apps/webapi/project.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"$schema": "../../../node_modules/nx/schemas/project-schema.json",
"name": "demo-webapi",
"$schema": "../../../node_modules/nx/schemas/project-schema.json",
"projectType": "application",
"sourceRoot": "demo/apps/webapi",
"targets": {
Expand Down
4 changes: 2 additions & 2 deletions demo/libs/csharp-models/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
"build": {
"executor": "@nx-dotnet/core:build",
"outputs": [
"{workspaceRoot}/dist/demo/libs/csharp-models",
"{workspaceRoot}/dist/intermediates/demo/libs/csharp-models/obj"
"{workspaceRoot}/dist/{projectRoot}",
"{workspaceRoot}/dist/intermediates/{projectRoot}"
],
"options": {
"configuration": "Debug",
Expand Down
2 changes: 1 addition & 1 deletion demo/libs/generated/webapi-swagger/project.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"$schema": "../../../../node_modules/nx/schemas/project-schema.json",
"name": "demo-libs-generated-webapi-swagger",
"$schema": "../../../../node_modules/nx/schemas/project-schema.json",
"targets": {
"build": {
"executor": "nx:noop",
Expand Down
8 changes: 4 additions & 4 deletions demo/libs/generated/webapi-types/project.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"$schema": "../../../../node_modules/nx/schemas/project-schema.json",
"name": "demo-libs-generated-webapi-types",
"$schema": "../../../../node_modules/nx/schemas/project-schema.json",
"sourceRoot": "demo/libs/generated/webapi-types/src",
"targets": {
"build": {
"executor": "@nrwl/js:tsc",
"executor": "@nx/js:tsc",
"outputs": ["{options.outputPath}"],
"options": {
"outputPath": "dist/demo/libs/generated/webapi-types",
Expand All @@ -14,14 +14,14 @@
}
},
"lint": {
"executor": "@nrwl/linter:eslint",
"executor": "@nx/linter:eslint",
"outputs": ["{options.outputFile}"],
"options": {
"lintFilePatterns": ["demo/libs/generated/webapi-types/**/*.ts"]
}
},
"test": {
"executor": "@nrwl/jest:jest",
"executor": "@nx/jest:jest",
"outputs": ["{workspaceRoot}/coverage/demo/libs/generated/webapi-types"],
"options": {
"jestConfig": "demo/libs/generated/webapi-types/jest.config.ts",
Expand Down
2 changes: 1 addition & 1 deletion demo/libs/generated/webapi-types/src/interfaces/person.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Company } from './company';

export interface Person {
employer?: Company;
employer: Company;
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Person } from './person';

export interface WeatherForecast {
date: string;
temperature?: Temperature;
temperature: Temperature;
summary?: string;
forecaster?: Person;
forecaster: Person;
}
13 changes: 7 additions & 6 deletions e2e/core-e2e/jest.config.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
module.exports = {
displayName: 'core-e2e',
preset: '../../jest.preset.js',
globals: {
'ts-jest': {
tsconfig: '<rootDir>/tsconfig.spec.json',
},
},
globals: {},
transform: {
'^.+\\.[tj]s$': 'ts-jest',
'^.+\\.[tj]s$': [
'ts-jest',
{
tsconfig: '<rootDir>/tsconfig.spec.json',
},
],
},
moduleFileExtensions: ['ts', 'js', 'html'],
coverageDirectory: '../../coverage/e2ecore-e2e',
Expand Down
11 changes: 6 additions & 5 deletions e2e/core-e2e/project.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
{
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"name": "core-e2e",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"projectType": "application",
"sourceRoot": "e2e/core-e2e/src",
"targets": {
"e2e": {
"executor": "@nrwl/nx-plugin:e2e",
"executor": "@nx/jest:jest",
"options": {
"target": "core:noop",
"jestConfig": "e2e/core-e2e/jest.config.js"
}
"jestConfig": "e2e/core-e2e/jest.config.js",
"runInBand": true
},
"dependsOn": ["core:noop"]
}
},
"tags": [],
Expand Down

0 comments on commit 4451e8a

Please sign in to comment.