Forge
Plugins

React

Plugin for React applications and libraries

@bjb-forge/nx-react-project

Installation

npx @bjb-forge/cli add @bjb-forge/nx-react-project

Plugin Options

{
  "plugin": "@bjb-forge/nx-react-project/nx-plugin",
  "options": {}
}
OptionTypeDescription
build.targetNamestringThe name of the build target
serve.targetNamestringThe name of the serve target
lint.targetNamestringThe name of the lint target
test.targetNamestringThe name of the test target

Inferred Targets

build

Builds the React application using Vite.

Condition: All React projects with a package.json

serve

Starts the Vite development server with hot module replacement.

Condition: All React projects with a package.json

lint

Runs ESLint to check code quality.

Condition: All React projects with a package.json

test

Runs unit tests using Vitest.

Condition: All React projects with a package.json

nx-release-publish

Publishes the application as a container image using JIB.

Condition: When jib.yml exists in project root

Generators

application-project

Create a React application.

nx g @bjb-forge/nx-react-project:application-project [options]
OptionTypeRequiredDefaultDescription
directorystringYes-A directory where the project is placed
scopestringYesforgeImport path scope

library-project

Create a React library.

nx g @bjb-forge/nx-react-project:library-project [options]
OptionTypeRequiredDefaultDescription
directorystringYes-A directory where the project is placed
scopestringYesforgeImport path scope

component

Create a React component.

nx g @bjb-forge/nx-react-project:component [options]
OptionTypeRequiredDefaultDescription
directorystringYes-A directory where the component is placed
namestringYes-Name of the component

On this page