diff --git a/CODEOWNERS b/CODEOWNERS index b983bc355a0df9..02236afef83a7a 100644 --- a/CODEOWNERS +++ b/CODEOWNERS @@ -98,6 +98,7 @@ rust-toolchain @nrwl/nx-native-reviewers /packages/rspack/** @nrwl/nx-js-reviewers /packages/rspack/src/utils/module-federation @nrwl/nx-js-reviewers /e2e/rspack/** @nrwl/nx-js-reviewers +/packages/rsbuild/** @nrwl/nx-js-reviewers /packages/esbuild/** @nrwl/nx-js-reviewers /e2e/esbuild/** @nrwl/nx-js-reviewers /packages/rollup/** @nrwl/nx-js-reviewers diff --git a/docs/generated/manifests/menus.json b/docs/generated/manifests/menus.json index ad41be5c64eee5..0536857145d0fd 100644 --- a/docs/generated/manifests/menus.json +++ b/docs/generated/manifests/menus.json @@ -9885,6 +9885,14 @@ "isExternal": false, "disableCollapsible": false }, + { + "id": "rsbuild", + "path": "/nx-api/rsbuild", + "name": "rsbuild", + "children": [], + "isExternal": false, + "disableCollapsible": false + }, { "id": "rspack", "path": "/nx-api/rspack", diff --git a/docs/generated/manifests/nx-api.json b/docs/generated/manifests/nx-api.json index 75e17d79625233..cc2dbdfc3d0731 100644 --- a/docs/generated/manifests/nx-api.json +++ b/docs/generated/manifests/nx-api.json @@ -2891,6 +2891,18 @@ }, "path": "/nx-api/rollup" }, + "rsbuild": { + "githubRoot": "https://github.com/nrwl/nx/blob/master", + "name": "rsbuild", + "packageName": "@nx/rsbuild", + "description": "The Nx Plugin for Rsbuild contains an Nx plugin, executors and utilities that support building applications using Rsbuild.", + "documents": {}, + "root": "/packages/rsbuild", + "source": "/packages/rsbuild/src", + "executors": {}, + "generators": {}, + "path": "/nx-api/rsbuild" + }, "rspack": { "githubRoot": "https://github.com/nrwl/nx/blob/master", "name": "rspack", diff --git a/docs/generated/packages-metadata.json b/docs/generated/packages-metadata.json index 04e75a49bb135b..61749cbb9255ae 100644 --- a/docs/generated/packages-metadata.json +++ b/docs/generated/packages-metadata.json @@ -2865,6 +2865,17 @@ "root": "/packages/rollup", "source": "/packages/rollup/src" }, + { + "description": "The Nx Plugin for Rsbuild contains an Nx plugin, executors and utilities that support building applications using Rsbuild.", + "documents": [], + "executors": [], + "generators": [], + "githubRoot": "https://github.com/nrwl/nx/blob/master", + "name": "rsbuild", + "packageName": "@nx/rsbuild", + "root": "/packages/rsbuild", + "source": "/packages/rsbuild/src" + }, { "description": "The Nx Plugin for Rspack contains executors and generators that support building applications using Rspack.", "documents": [ diff --git a/docs/shared/reference/sitemap.md b/docs/shared/reference/sitemap.md index 54e8c777bb3621..9081a0ecc19610 100644 --- a/docs/shared/reference/sitemap.md +++ b/docs/shared/reference/sitemap.md @@ -685,6 +685,7 @@ - [init](/nx-api/rollup/generators/init) - [configuration](/nx-api/rollup/generators/configuration) - [convert-to-inferred](/nx-api/rollup/generators/convert-to-inferred) + - [rsbuild](/nx-api/rsbuild) - [rspack](/nx-api/rspack) - [documents](/nx-api/rspack/documents) - [Overview](/nx-api/rspack/documents/overview) diff --git a/packages/rsbuild/.eslintrc.json b/packages/rsbuild/.eslintrc.json new file mode 100644 index 00000000000000..654652abd23ff1 --- /dev/null +++ b/packages/rsbuild/.eslintrc.json @@ -0,0 +1,44 @@ +{ + "extends": ["../../.eslintrc.json"], + "ignorePatterns": ["!**/*"], + "overrides": [ + { + "files": ["*.ts", "*.tsx", "*.js", "*.jsx"], + "rules": {} + }, + { + "files": ["*.ts", "*.tsx"], + "rules": {} + }, + { + "files": ["*.js", "*.jsx"], + "rules": {} + }, + { + "files": ["./package.json", "./generators.json", "./executors.json"], + "parser": "jsonc-eslint-parser", + "rules": { + "@nx/nx-plugin-checks": "error" + } + }, + { + "files": ["./package.json"], + "parser": "jsonc-eslint-parser", + "rules": { + "@nx/dependency-checks": [ + "error", + { + "buildTargets": ["build-base"], + "ignoredDependencies": [ + "nx", + "eslint", + "typescript", + "@nx/cypress", + "@nx/playwright" + ] + } + ] + } + } + ] +} diff --git a/packages/rsbuild/README.md b/packages/rsbuild/README.md new file mode 100644 index 00000000000000..de52b1cb67bfc5 --- /dev/null +++ b/packages/rsbuild/README.md @@ -0,0 +1,18 @@ +

+ + + Nx - Smart Monorepos · Fast CI + +

+ +{{links}} + +
+ +# Nx: Smart Monorepos · Fast CI + +Nx is a build system, optimized for monorepos, with plugins for popular frameworks and tools and advanced CI capabilities including caching and distribution. + +This package is a [Rsbuild plugin for Nx](https://nx.dev/nx-api/rsbuild). + +{{content}} diff --git a/packages/rsbuild/executors.json b/packages/rsbuild/executors.json new file mode 100644 index 00000000000000..b64f99d988d2c4 --- /dev/null +++ b/packages/rsbuild/executors.json @@ -0,0 +1,4 @@ +{ + "$schema": "http://json-schema.org/schema", + "executors": {} +} diff --git a/packages/rsbuild/index.ts b/packages/rsbuild/index.ts new file mode 100644 index 00000000000000..e69de29bb2d1d6 diff --git a/packages/rsbuild/jest.config.ts b/packages/rsbuild/jest.config.ts new file mode 100644 index 00000000000000..173af9656c3a8b --- /dev/null +++ b/packages/rsbuild/jest.config.ts @@ -0,0 +1,16 @@ +/* eslint-disable */ +export default { + displayName: 'rsbuild', + preset: '../../jest.preset.js', + globals: {}, + transform: { + '^.+\\.[tj]s$': [ + 'ts-jest', + { + tsconfig: '/tsconfig.spec.json', + }, + ], + }, + moduleFileExtensions: ['ts', 'js', 'html'], + coverageDirectory: '../../coverage/packages/rsbuild', +}; diff --git a/packages/rsbuild/migrations.json b/packages/rsbuild/migrations.json new file mode 100644 index 00000000000000..0967ef424bce67 --- /dev/null +++ b/packages/rsbuild/migrations.json @@ -0,0 +1 @@ +{} diff --git a/packages/rsbuild/package.json b/packages/rsbuild/package.json new file mode 100644 index 00000000000000..1f9dcca306d71a --- /dev/null +++ b/packages/rsbuild/package.json @@ -0,0 +1,34 @@ +{ + "name": "@nx/rsbuild", + "description": "The Nx Plugin for Rsbuild contains an Nx plugin, executors and utilities that support building applications using Rsbuild.", + "version": "0.0.1", + "type": "commonjs", + "repository": { + "type": "git", + "url": "https://github.com/nrwl/nx.git", + "directory": "packages/rsbuild" + }, + "bugs": { + "url": "https://github.com/nrwl/nx/issues" + }, + "keywords": [ + "Monorepo", + "Rspack", + "Webpack", + "Bundling", + "Module Federation", + "Rsbuild" + ], + "author": "Colum Ferry", + "license": "MIT", + "homepage": "https://nx.dev", + "main": "index.js", + "executors": "./executors.json", + "dependencies": { + "tslib": "^2.3.0" + }, + "peerDependencies": {}, + "nx-migrations": { + "migrations": "./migrations.json" + } +} diff --git a/packages/rsbuild/project.json b/packages/rsbuild/project.json new file mode 100644 index 00000000000000..ffd082d65bc43d --- /dev/null +++ b/packages/rsbuild/project.json @@ -0,0 +1,55 @@ +{ + "name": "rsbuild", + "$schema": "../../node_modules/nx/schemas/project-schema.json", + "sourceRoot": "packages/rsbuild", + "projectType": "library", + "targets": { + "build-base": { + "executor": "@nx/js:tsc", + "options": { + "outputPath": "build/packages/rsbuild", + "tsConfig": "packages/rsbuild/tsconfig.lib.json", + "main": "packages/rsbuild/index.ts", + "assets": [ + { + "input": "packages/rsbuild", + "glob": "**/files/**", + "output": "/" + }, + { + "input": "packages/rsbuild", + "glob": "**/files/**/.gitkeep", + "output": "/" + }, + { + "input": "packages/rsbuild", + "glob": "**/*.json", + "ignore": ["**/tsconfig*.json", "project.json", ".eslintrc.json"], + "output": "/" + }, + { + "input": "packages/rsbuild", + "glob": "**/*.js", + "ignore": ["**/jest.config.js"], + "output": "/" + }, + { + "input": "packages/rsbuild", + "glob": "**/*.d.ts", + "output": "/" + }, + { + "input": "", + "glob": "LICENSE", + "output": "/" + } + ] + }, + "outputs": ["{options.outputPath}"] + }, + "build": { + "command": "node ./scripts/copy-readme.js rsbuild", + "outputs": ["{workspaceRoot}/build/packages/rsbuild"] + } + } +} diff --git a/packages/rsbuild/tsconfig.json b/packages/rsbuild/tsconfig.json new file mode 100644 index 00000000000000..19b9eece4df145 --- /dev/null +++ b/packages/rsbuild/tsconfig.json @@ -0,0 +1,16 @@ +{ + "extends": "../../tsconfig.base.json", + "compilerOptions": { + "module": "commonjs" + }, + "files": [], + "include": [], + "references": [ + { + "path": "./tsconfig.lib.json" + }, + { + "path": "./tsconfig.spec.json" + } + ] +} diff --git a/packages/rsbuild/tsconfig.lib.json b/packages/rsbuild/tsconfig.lib.json new file mode 100644 index 00000000000000..7bfc80f73e6fad --- /dev/null +++ b/packages/rsbuild/tsconfig.lib.json @@ -0,0 +1,10 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "outDir": "../../dist/out-tsc", + "declaration": true, + "types": ["node"] + }, + "include": ["**/*.ts"], + "exclude": ["jest.config.ts", "**/*.spec.ts", "**/*.test.ts"] +} diff --git a/packages/rsbuild/tsconfig.spec.json b/packages/rsbuild/tsconfig.spec.json new file mode 100644 index 00000000000000..546f12877f7f05 --- /dev/null +++ b/packages/rsbuild/tsconfig.spec.json @@ -0,0 +1,9 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "outDir": "../../dist/out-tsc", + "module": "commonjs", + "types": ["jest", "node"] + }, + "include": ["jest.config.ts", "**/*.test.ts", "**/*.spec.ts", "**/*.d.ts"] +} diff --git a/scripts/commitizen.js b/scripts/commitizen.js index a591f1ba253950..eda0982dd22d4c 100644 --- a/scripts/commitizen.js +++ b/scripts/commitizen.js @@ -20,7 +20,8 @@ const scopes = [ { value: 'react', name: 'react: anything React specific' }, { value: 'react-native', name: 'react-native: anything React Native specific' }, { value: 'remix', name: 'remix: anything Remix specific' }, - { value: 'rspack', name: 'rspack: anything Rspack specific' }, + { value: 'rspack', name: 'rspack: anything Rspack specific' }, + { value: 'rsbuild', name: 'rsbuild: anything Rsbuild specific' }, { value: 'expo', name: 'expo: anything Expo specific' }, { value: 'release', name: 'release: anything related to nx release' }, { value: 'repo', name: 'repo: anything related to managing the repo itself' }, diff --git a/tsconfig.base.json b/tsconfig.base.json index 4283250d13bccb..76efa5f2d32b2e 100644 --- a/tsconfig.base.json +++ b/tsconfig.base.json @@ -132,6 +132,8 @@ "@nx/remix/*": ["packages/remix/*"], "@nx/rollup": ["packages/rollup"], "@nx/rollup/*": ["packages/rollup/*"], + "@nx/rsbuild": ["packages/rsbuild/src"], + "@nx/rsbuild/*": ["packages/rsbuild/src/*"], "@nx/rspack": ["packages/rspack/src"], "@nx/rspack/*": ["packages/rspack/src/*"], "@nx/storybook": ["packages/storybook"],