Skip to content
Open
Show file tree
Hide file tree
Changes from 11 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 68 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Copy link
Contributor

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

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed

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 }}
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -78,3 +78,6 @@ packages/**/size-snapshot.json
.nvmrc

.DS_STORE

# NX cache
.nx/
61 changes: 61 additions & 0 deletions nx.json
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": {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Jakub007d quick AI review comment:

Your nx.json sets namedInputs.default to only sharedGlobals. For run-commands with cache=true this can cause stale cache. Suggest:
In nx.json:
Set namedInputs.default to include project sources, e.g. ["sharedGlobals", "{projectRoot}/**/*", "!{projectRoot}/dist/**", "!{projectRoot}/.next/**"].
Optionally add a production namedInput variant if needed.
Or, per target in project.json, define inputs: ["default", "^default"].

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

"sharedGlobals": ["{workspaceRoot}/.github/workflows/release.yml"],
"default": ["sharedGlobals"]
}
}
13 changes: 10 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@
"verbose": true,
"testPathIgnorePatterns": [
"/node_modules/",
"packages/suir-component-mapper/"
"packages/suir-component-mapper/",
"/.nx/"
],
"setupFilesAfterEnv": [
"<rootDir>/config/jest.setup.js"
Expand All @@ -53,7 +54,8 @@
"\\.(css|scss)$": "identity-obj-proxy"
},
"modulePathIgnorePatterns": [
"<rootDir>/templates/"
"<rootDir>/templates/",
"<rootDir>/.nx/"
],
"globalSetup": "<rootDir>/config/globalSetup.js"
},
Expand All @@ -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",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Jakub007d since we are switching to NX's release process, I think we can remove the legacy semantic-release packages right?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right removed

"@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",
Expand Down Expand Up @@ -106,12 +112,13 @@
"jest": "^27.4.7",
"lerna": "^4.0.0",
"ncp": "^2.0.0",
"sass": "^1.77.8",
"nx": "^22.0.1",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NIT - looks like in the past 2 days NX released 22.0.2 😂

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh :D updated

"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",
Expand Down
1 change: 1 addition & 0 deletions packages/ant-component-mapper/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ vendor
!generate-packages.js
!LICENSE
!package.json
!project.json
!README.md
!tsconfig.json
!generate-typings.js
Expand Down
73 changes: 73 additions & 0 deletions packages/ant-component-mapper/project.json
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"
}
}
}
}
1 change: 1 addition & 0 deletions packages/blueprint-component-mapper/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ vendor
!generate-packages.js
!LICENSE
!package.json
!project.json
!README.md
!tsconfig.json
!generate-typings.js
Expand Down
67 changes: 67 additions & 0 deletions packages/blueprint-component-mapper/project.json
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"
}
}
}
}
1 change: 1 addition & 0 deletions packages/carbon-component-mapper/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ vendor
!generate-packages.js
!LICENSE
!package.json
!project.json
!README.md
!tsconfig.json
!generate-typings.js
Expand Down
Loading