Skip to content

Commit

Permalink
feat(rsbuild): add intial package (#29147)
Browse files Browse the repository at this point in the history
## Current Behavior
We do not currently have a package or plugin to officially support
Rsbuild (http://rsbuild.dev)

## Expected Behavior
We should have a package to manage Rsbuild support
  • Loading branch information
Coly010 authored Dec 6, 2024
1 parent cc14411 commit 50d83e2
Show file tree
Hide file tree
Showing 18 changed files with 247 additions and 1 deletion.
1 change: 1 addition & 0 deletions CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ rust-toolchain @nrwl/nx-native-reviewers
/e2e/webpack/** @nrwl/nx-js-reviewers
/packages/rspack/** @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
Expand Down
8 changes: 8 additions & 0 deletions docs/generated/manifests/menus.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
12 changes: 12 additions & 0 deletions docs/generated/manifests/nx-api.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
11 changes: 11 additions & 0 deletions docs/generated/packages-metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": [
Expand Down
1 change: 1 addition & 0 deletions docs/shared/reference/sitemap.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
44 changes: 44 additions & 0 deletions packages/rsbuild/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -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"
]
}
]
}
}
]
}
18 changes: 18 additions & 0 deletions packages/rsbuild/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<p style="text-align: center;">
<picture>
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/nrwl/nx/master/images/nx-dark.svg">
<img alt="Nx - Smart Monorepos · Fast CI" src="https://raw.githubusercontent.com/nrwl/nx/master/images/nx-light.svg" width="100%">
</picture>
</p>

{{links}}

<hr>

# 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}}
4 changes: 4 additions & 0 deletions packages/rsbuild/executors.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"$schema": "http://json-schema.org/schema",
"executors": {}
}
Empty file added packages/rsbuild/index.ts
Empty file.
16 changes: 16 additions & 0 deletions packages/rsbuild/jest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/* eslint-disable */
export default {
displayName: 'rsbuild',
preset: '../../jest.preset.js',
globals: {},
transform: {
'^.+\\.[tj]s$': [
'ts-jest',
{
tsconfig: '<rootDir>/tsconfig.spec.json',
},
],
},
moduleFileExtensions: ['ts', 'js', 'html'],
coverageDirectory: '../../coverage/packages/rsbuild',
};
1 change: 1 addition & 0 deletions packages/rsbuild/migrations.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
37 changes: 37 additions & 0 deletions packages/rsbuild/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
"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",
"publishConfig": {
"access": "private"
},
"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"
}
}
55 changes: 55 additions & 0 deletions packages/rsbuild/project.json
Original file line number Diff line number Diff line change
@@ -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"]
}
}
}
16 changes: 16 additions & 0 deletions packages/rsbuild/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"module": "commonjs"
},
"files": [],
"include": [],
"references": [
{
"path": "./tsconfig.lib.json"
},
{
"path": "./tsconfig.spec.json"
}
]
}
10 changes: 10 additions & 0 deletions packages/rsbuild/tsconfig.lib.json
Original file line number Diff line number Diff line change
@@ -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"]
}
9 changes: 9 additions & 0 deletions packages/rsbuild/tsconfig.spec.json
Original file line number Diff line number Diff line change
@@ -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"]
}
3 changes: 2 additions & 1 deletion scripts/commitizen.js
Original file line number Diff line number Diff line change
Expand Up @@ -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' },
Expand Down
2 changes: 2 additions & 0 deletions tsconfig.base.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"],
Expand Down

0 comments on commit 50d83e2

Please sign in to comment.