Skip to content
Open
Show file tree
Hide file tree
Changes from 14 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
82 changes: 81 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,94 @@ 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 for both PR and merge
ci-checks:
runs-on: ubuntu-latest
name: CI Checks (Build, Lint, Test, Release Dry-Run)
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 (PR only)
if: github.event_name == 'pull_request'
run: npx nx release --first-release --dry-run --verbose

# Job that runs ONLY after merge (on push to master)
release:
if: github.event_name != 'pull_request'
needs: ci-checks
runs-on: ubuntu-latest
name: Release
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: 🚀 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/
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ Please use our [documentation site](https://data-driven-forms.org/). In case of

# Development setup

Data Driven Forms is a monorepo that uses [Lerna](https://github.com/lerna/lerna) and [yarn workspaces](https://classic.yarnpkg.com/blog/2017/08/02/introducing-workspaces/), so you can use all its commands as well.
Data Driven Forms is a monorepo that uses [NX](https://nx.dev/) and [yarn workspaces](https://classic.yarnpkg.com/blog/2017/08/02/introducing-workspaces/), so you can use all its commands as well.

---

Expand Down Expand Up @@ -286,7 +286,7 @@ yarn dev
### How to clean node_modules

```bash
yarn lerna clean
nx reset
rm -rf node_modules
```
### Cleaning built files
Expand Down Expand Up @@ -341,7 +341,7 @@ If you introduce a new feature, you should document this change in our documenta

### Correct commit message

A correct commit message is important, because we are using [semantic release](https://github.com/semantic-release/commit-analyzer) to automatically releease new versions. These messages are also used in our release notes, so other users can see what is being changed.
A correct commit message is important, because we are using [nx release](https://nx.dev/features/manage-releases) with conventional commits to automatically release new versions. These messages are also used in our release notes, so other users can see what is being changed.

**My change introduces a new feature**

Expand Down
5 changes: 0 additions & 5 deletions lerna.json

This file was deleted.

72 changes: 72 additions & 0 deletions nx.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
{
"$schema": "./node_modules/nx/schemas/nx-schema.json",
"workspaceLayout": {
"libsDir": "packages",
"appsDir": "apps"
},
"plugins": [
{
"plugin": "@nx/js",
"exclude": ["**/node_modules/**"],
"options": {
"typecheck": {
"targetName": "typecheck"
},
"build": {
"targetName": "build"
}
}
},
{
"plugin": "@nx/js/typescript",
"exclude": ["**/node_modules/**"],
"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",
"{projectRoot}/src/**/*",
"{projectRoot}/package.json",
"{projectRoot}/README.md",
"{projectRoot}/LICENSE",
"{projectRoot}/babel.config.js",
"{projectRoot}/tsconfig.json",
"!{projectRoot}/src/tests/**/*"
]
}
}
99 changes: 16 additions & 83 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@
"license": "Apache-2.0",
"private": true,
"scripts": {
"bootstrap": "lerna bootstrap",
"build": "yarn clean-build && lerna run build --concurrency 1 --ignore @data-driven-forms/react-renderer-demo --ignore @data-driven-forms/parsers",
"vendor": "lerna run vendor",
"bootstrap": "yarn install",
"build": "yarn clean-build && nx run-many -t build --exclude @data-driven-forms/react-renderer-demo,@data-driven-forms/parsers --parallel=1",
"vendor": "nx run-many -t vendor",
"test": "jest --coverage",
"test:ci": "jest --coverage --runInBand",
"test:update": "jest -u",
"release": "semantic-release",
"release": "nx release",
"codecov": "codecov",
"start-demo": "lerna run start --scope=@data-driven-forms/react-render-demo",
"start-demo": "nx run @data-driven-forms/react-renderer-demo:start",
"lint": "yarn eslint ./packages/*/src --ext .js",
"lint:ts": "tslint -c ./tslint.json 'packages/**/*.d.ts'",
"generate-template": "node ./scripts/generate-mapper.js",
Expand All @@ -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 @@ -67,16 +69,13 @@
"@babel/preset-env": "^7.16.8",
"@babel/preset-react": "^7.16.7",
"@babel/preset-typescript": "^7.16.7",
"@khala/commit-analyzer-wildcard": "^2.5.2",
"@khala/npm-release-monorepo": "^2.5.2",
"@khala/wildcard-release-notes": "^2.5.2",
"@semantic-release/exec": "^6.0.3",
"@semantic-release/git": "^10.0.1",
"@semantic-release/github": "^8.0.2",
"@semantic-release/npm": "^8.0.3",
"@nx/js": "22.0.1",
"@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",
"@testing-library/react": "^14.3.1",
"@testing-library/user-event": "^14.4.3",
"@types/react": "^19.1.2",
"@types/react-dom": "^19.1.3",
Expand Down Expand Up @@ -104,16 +103,15 @@
"identity-obj-proxy": "^3.0.0",
"inquirer": "^8.2.0",
"jest": "^27.4.7",
"lerna": "^4.0.0",
"ncp": "^2.0.0",
"sass": "^1.77.8",
"nx": "^22.0.2",
"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",
"style-loader": "^3.3.1",
"terser-webpack-plugin": "^5.3.0",
Expand All @@ -125,71 +123,6 @@
"webpack-cli": "^4.9.1",
"webpack-dev-server": "^4.7.3"
},
"release": {
"monorepo": "./packages",
"branches": [
"+([0-9])?(.{+([0-9]),x}).x",
"master",
"next",
"next-major",
{
"name": "beta",
"prerelease": true
},
{
"name": "alpha",
"prerelease": true
}
],
"plugins": [
"@khala/npm-release-monorepo",
[
"@khala/wildcard-release-notes",
{
"patterns": {
"major": "^(majormajor|breakingbreaking)\\(",
"minor": "^feat\\(",
"patch": "^(fix|patch)\\("
},
"repositoryName": "data-driven-forms/react-forms"
}
],
[
"@khala/commit-analyzer-wildcard",
{
"patterns": {
"major": "^(majormajor|breakingbreaking)\\(",
"minor": "^feat\\(",
"patch": "^(fix|patch)\\("
},
"defaultRelease": "no-release"
}
],
{
"path": "@semantic-release/github",
"assets": [
"package.json"
],
"successComment": ":tada: This ${issue.pull_request ? 'PR is included' : 'issue has been resolved'} in version ${nextRelease.version} :tada:\n\nThe release is available on \n\n- [react-form-renderer (@latest dist-tag)](https://www.npmjs.com/package/@data-driven-forms/react-form-renderer)\n\n- [ant-component-mapper (@latest dist-tag)](https://www.npmjs.com/package/@data-driven-forms/ant-component-mapper)\n\n- [blueprint-component-mapper (@latest dist-tag)](https://www.npmjs.com/package/@data-driven-forms/blueprint-component-mapper)\n\n- [carbon-component-mapper (@latest dist-tag)](https://www.npmjs.com/package/@data-driven-forms/carbon-component-mapper)\n\n- [mui-component-mapper (@latest dist-tag)](https://www.npmjs.com/package/@data-driven-forms/mui-component-mapper)\n\n- [pf4-component-mapper (@latest dist-tag)](https://www.npmjs.com/package/@data-driven-forms/pf4-component-mapper)\n\n- [suir-component-mapper (@latest dist-tag)](https://www.npmjs.com/package/@data-driven-forms/suir-component-mapper)\n\n[Data-Driven-Forms.org](http://data-driven-forms.org/)!"
},
[
"@semantic-release/git",
{
"assets": [
"package.json",
"packages/*/package.json"
],
"message": "Release of new version: ${nextRelease.version} <no> [skip ci]"
}
],
[
"@semantic-release/exec",
{
"prepareCmd": "node ./scripts/update-common.js ${nextRelease.version}"
}
]
]
},
"dependencies": {
"ts-node": "^10.9.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
1 change: 0 additions & 1 deletion packages/ant-component-mapper/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
"build:typings": "node ../../scripts/generate-typings.js",
"build:packages": "node ../../scripts/generate-packages.js",
"vendor": "webpack --env vendor --config ./config/webpack.config.js",
"release": "semantic-release",
"build:css": "node ../../scripts/copy-css.js",
"test": "yarn --cwd ../.. test packages/ant-component-mapper"
},
Expand Down
Loading