-
Notifications
You must be signed in to change notification settings - Fork 94
[RHCLOUD-42870] Nx tool migration #1518
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
base: master
Are you sure you want to change the base?
Changes from 11 commits
b0f58be
3919997
1d2408e
3435b1e
b88a661
ec9b4ed
d7e9daf
8a2f1d9
62ad341
23e49e8
9186926
3ce4078
06e8e80
3cfa84f
5ecbdd8
cee450b
7f14cf1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,14 +2,81 @@ on: | |
| pull_request: | ||
| branches: | ||
| - master | ||
| push: | ||
| branches: | ||
| - master | ||
|
|
||
| jobs: | ||
| github-action-show-version: | ||
| if: github.event_name == 'pull_request' | ||
| runs-on: ubuntu-latest | ||
| name: Next version is | ||
| steps: | ||
| - name: Publish a version comment | ||
| uses: rvsia/[email protected] | ||
| id: comment | ||
| with: | ||
| GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} | ||
| GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} | ||
|
|
||
| # Job that runs on PR (before merge) | ||
| pr-checks: | ||
| if: github.event_name == 'pull_request' | ||
| runs-on: ubuntu-latest | ||
| name: PR Checks | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 | ||
|
|
||
| - name: Setup Node.js | ||
| uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: '20' | ||
| cache: 'yarn' | ||
|
|
||
| - name: Install dependencies | ||
| run: yarn install --frozen-lockfile | ||
|
|
||
| - name: Derive appropriate SHAs for base and head for nx affected commands | ||
| uses: nrwl/nx-set-shas@v4 | ||
| with: | ||
| main-branch-name: 'master' | ||
|
|
||
| - name: Run build on affected projects | ||
| run: npx nx affected --target=build --parallel=3 | ||
| continue-on-error: false | ||
|
|
||
| - name: Run lint on affected projects | ||
| run: npx nx affected --target=lint --parallel=3 | ||
| continue-on-error: false | ||
|
|
||
| - name: Run typecheck on affected projects | ||
| run: npx nx affected --target=typecheck --parallel=3 | ||
| continue-on-error: false | ||
|
|
||
| - name: Clear Jest cache | ||
| run: yarn jest --clearCache | ||
|
|
||
| - name: Run tests on affected projects | ||
| run: npx nx affected --target=test --parallel=3 --coverage | ||
| continue-on-error: false | ||
|
|
||
| - name: Run Nx release dry-run | ||
| run: npx nx release --first-release --dry-run --verbose | ||
|
|
||
| # Job that runs after merge (on push to master) | ||
| post-merge: | ||
| if: github.event_name == 'push' | ||
| runs-on: ubuntu-latest | ||
| name: Post-merge Actions | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
| - name: 🚀 Run Nx Release | ||
| run: | | ||
| npx nx release --first-release --skip-publish --verbose | ||
| npx nx release --first-release publish --skip-existing --verbose | ||
| env: | ||
| NODE_AUTH_TOKEN: ${{ secrets.NODE_AUTH_TOKEN }} | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -78,3 +78,6 @@ packages/**/size-snapshot.json | |
| .nvmrc | ||
|
|
||
| .DS_STORE | ||
|
|
||
| # NX cache | ||
| .nx/ | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,61 @@ | ||
| { | ||
| "$schema": "./node_modules/nx/schemas/nx-schema.json", | ||
| "workspaceLayout": { | ||
| "libsDir": "packages", | ||
| "appsDir": "apps" | ||
| }, | ||
| "plugins": [ | ||
| { | ||
| "plugin": "@nx/js", | ||
| "options": { | ||
| "typecheck": { | ||
| "targetName": "typecheck" | ||
| }, | ||
| "build": { | ||
| "targetName": "build" | ||
| } | ||
| } | ||
| }, | ||
| { | ||
| "plugin": "@nx/js/typescript", | ||
| "options": { | ||
| "typecheck": { | ||
| "targetName": "typecheck" | ||
| }, | ||
| "build": { | ||
| "targetName": "build", | ||
| "buildDepsName": "build-deps", | ||
| "watchDepsName": "watch-deps" | ||
| } | ||
| } | ||
| } | ||
| ], | ||
| "release": { | ||
| "projects": [ | ||
| "@data-driven-forms/ant-component-mapper", | ||
| "@data-driven-forms/blueprint-component-mapper", | ||
| "@data-driven-forms/carbon-component-mapper", | ||
| "@data-driven-forms/common", | ||
| "@data-driven-forms/mui-component-mapper", | ||
| "@data-driven-forms/parsers", | ||
| "@data-driven-forms/pf4-component-mapper", | ||
| "@data-driven-forms/react-form-renderer", | ||
| "@data-driven-forms/react-renderer-demo", | ||
| "@data-driven-forms/suir-component-mapper" | ||
| ], | ||
| "changelog": { | ||
| "projectChangelogs": { | ||
| "createRelease": "github" | ||
| } | ||
| }, | ||
| "projectsRelationship": "independent", | ||
| "version": { | ||
| "conventionalCommits": true, | ||
| "fallbackCurrentVersionResolver": "disk" | ||
| } | ||
| }, | ||
| "namedInputs": { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @Jakub007d quick AI review comment:
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. fixed |
||
| "sharedGlobals": ["{workspaceRoot}/.github/workflows/release.yml"], | ||
| "default": ["sharedGlobals"] | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -32,7 +32,8 @@ | |
| "verbose": true, | ||
| "testPathIgnorePatterns": [ | ||
| "/node_modules/", | ||
| "packages/suir-component-mapper/" | ||
| "packages/suir-component-mapper/", | ||
| "/.nx/" | ||
| ], | ||
| "setupFilesAfterEnv": [ | ||
| "<rootDir>/config/jest.setup.js" | ||
|
|
@@ -53,7 +54,8 @@ | |
| "\\.(css|scss)$": "identity-obj-proxy" | ||
| }, | ||
| "modulePathIgnorePatterns": [ | ||
| "<rootDir>/templates/" | ||
| "<rootDir>/templates/", | ||
| "<rootDir>/.nx/" | ||
| ], | ||
| "globalSetup": "<rootDir>/config/globalSetup.js" | ||
| }, | ||
|
|
@@ -70,10 +72,14 @@ | |
| "@khala/commit-analyzer-wildcard": "^2.5.2", | ||
| "@khala/npm-release-monorepo": "^2.5.2", | ||
| "@khala/wildcard-release-notes": "^2.5.2", | ||
| "@nx/js": "22.0.1", | ||
| "@semantic-release/exec": "^6.0.3", | ||
|
||
| "@semantic-release/git": "^10.0.1", | ||
| "@semantic-release/github": "^8.0.2", | ||
| "@semantic-release/npm": "^8.0.3", | ||
| "@swc-node/register": "~1.9.1", | ||
| "@swc/core": "~1.5.7", | ||
| "@swc/helpers": "~0.5.11", | ||
| "@testing-library/dom": "^8.17.1", | ||
| "@testing-library/jest-dom": "^5.16.5", | ||
| "@testing-library/react": "^13.4.0", | ||
|
|
@@ -106,12 +112,13 @@ | |
| "jest": "^27.4.7", | ||
| "lerna": "^4.0.0", | ||
| "ncp": "^2.0.0", | ||
| "sass": "^1.77.8", | ||
| "nx": "^22.0.1", | ||
|
||
| "prettier": "^2.5.1", | ||
| "react": "^19.1.0", | ||
| "react-dom": "^19.1.0", | ||
| "regenerator-runtime": "^0.13.9", | ||
| "replace-in-file": "^6.3.2", | ||
| "sass": "^1.77.8", | ||
| "sass-loader": "^12.4.0", | ||
| "semantic-release": "^19.0.3", | ||
| "strip-ansi": "^7.0.1", | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,73 @@ | ||
| { | ||
| "$schema": "../../node_modules/nx/schemas/project-schema.json", | ||
| "name": "@data-driven-forms/ant-component-mapper", | ||
| "root": "packages/ant-component-mapper", | ||
| "sourceRoot": "packages/ant-component-mapper/src", | ||
| "projectType": "library", | ||
| "targets": { | ||
| "build": { | ||
| "executor": "nx:run-commands", | ||
| "outputs": [ | ||
| "{projectRoot}/index.js", | ||
| "{projectRoot}/esm", | ||
| "{projectRoot}/*.d.ts" | ||
| ], | ||
| "options": { | ||
| "command": "yarn build", | ||
| "cwd": "packages/ant-component-mapper" | ||
| }, | ||
| "dependsOn": ["^build"], | ||
| "cache": true | ||
| }, | ||
| "build:cjs": { | ||
| "executor": "nx:run-commands", | ||
| "outputs": ["{projectRoot}/*.js"], | ||
| "options": { | ||
| "command": "yarn build:cjs", | ||
| "cwd": "packages/ant-component-mapper" | ||
| }, | ||
| "cache": true | ||
| }, | ||
| "build:esm": { | ||
| "executor": "nx:run-commands", | ||
| "outputs": ["{projectRoot}/esm"], | ||
| "options": { | ||
| "command": "yarn build:esm", | ||
| "cwd": "packages/ant-component-mapper" | ||
| }, | ||
| "cache": true | ||
| }, | ||
| "test": { | ||
| "executor": "nx:run-commands", | ||
| "options": { | ||
| "command": "yarn test", | ||
| "cwd": "packages/ant-component-mapper" | ||
| }, | ||
| "cache": true | ||
| }, | ||
| "typecheck": { | ||
| "executor": "@nx/js:tsc", | ||
| "options": { | ||
| "main": "packages/ant-component-mapper/src/index.js", | ||
| "tsConfig": "packages/ant-component-mapper/tsconfig.json", | ||
| "outputPath": "packages/ant-component-mapper/dist" | ||
| }, | ||
| "outputs": ["{options.outputPath}"], | ||
| "cache": true | ||
| }, | ||
| "start": { | ||
| "executor": "nx:run-commands", | ||
| "options": { | ||
| "command": "yarn start", | ||
| "cwd": "packages/ant-component-mapper" | ||
| } | ||
| }, | ||
| "vendor": { | ||
| "executor": "nx:run-commands", | ||
| "options": { | ||
| "command": "yarn vendor", | ||
| "cwd": "packages/ant-component-mapper" | ||
| } | ||
| } | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,67 @@ | ||
| { | ||
| "$schema": "../../node_modules/nx/schemas/project-schema.json", | ||
| "name": "@data-driven-forms/blueprint-component-mapper", | ||
| "root": "packages/blueprint-component-mapper", | ||
| "sourceRoot": "packages/blueprint-component-mapper/src", | ||
| "projectType": "library", | ||
| "tags": ["type:component-mapper", "ui:blueprint", "scope:publishable", "platform:react"], | ||
| "targets": { | ||
| "build": { | ||
| "executor": "nx:run-commands", | ||
| "outputs": [ | ||
| "{projectRoot}/index.js", | ||
| "{projectRoot}/esm", | ||
| "{projectRoot}/*.d.ts" | ||
| ], | ||
| "options": { | ||
| "command": "yarn build", | ||
| "cwd": "packages/blueprint-component-mapper" | ||
| }, | ||
| "dependsOn": ["^build"], | ||
| "cache": true | ||
| }, | ||
| "build:cjs": { | ||
| "executor": "nx:run-commands", | ||
| "outputs": ["{projectRoot}/*.js"], | ||
| "options": { | ||
| "command": "yarn build:cjs", | ||
| "cwd": "packages/blueprint-component-mapper" | ||
| }, | ||
| "cache": true | ||
| }, | ||
| "build:esm": { | ||
| "executor": "nx:run-commands", | ||
| "outputs": ["{projectRoot}/esm"], | ||
| "options": { | ||
| "command": "yarn build:esm", | ||
| "cwd": "packages/blueprint-component-mapper" | ||
| }, | ||
| "cache": true | ||
| }, | ||
| "test": { | ||
| "executor": "nx:run-commands", | ||
| "options": { | ||
| "command": "yarn test", | ||
| "cwd": "packages/blueprint-component-mapper" | ||
| }, | ||
| "cache": true | ||
| }, | ||
| "typecheck": { | ||
| "executor": "@nx/js:tsc", | ||
| "options": { | ||
| "main": "packages/blueprint-component-mapper/src/index.js", | ||
| "tsConfig": "packages/blueprint-component-mapper/tsconfig.json", | ||
| "outputPath": "packages/blueprint-component-mapper/dist" | ||
| }, | ||
| "outputs": ["{options.outputPath}"], | ||
| "cache": true | ||
| }, | ||
| "start": { | ||
| "executor": "nx:run-commands", | ||
| "options": { | ||
| "command": "yarn start", | ||
| "cwd": "packages/blueprint-component-mapper" | ||
| } | ||
| } | ||
| } | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Jakub007d I'm wondering if we want the PR checks to also run for merge jobs, and just exclude the release for PRs. Something like we do here: https://github.com/RedHatInsights/javascript-clients/blob/main/.github/workflows/ci.yml
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed