io.github.cdklabs.projen.web.ReactComponent Maven / Gradle / Ivy
Show all versions of projen Show documentation
package io.github.cdklabs.projen.web;
/**
*/
@javax.annotation.Generated(value = "jsii-pacmak/1.105.0 (build 0a2adcb)", date = "2024-11-15T17:03:55.500Z")
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@software.amazon.jsii.Jsii(module = io.github.cdklabs.projen.$Module.class, fqn = "projen.web.ReactComponent")
public class ReactComponent extends io.github.cdklabs.projen.Component {
protected ReactComponent(final software.amazon.jsii.JsiiObjectRef objRef) {
super(objRef);
}
protected ReactComponent(final software.amazon.jsii.JsiiObject.InitializationMode initializationMode) {
super(initializationMode);
}
/**
* @param project This parameter is required.
* @param options This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public ReactComponent(final @org.jetbrains.annotations.NotNull io.github.cdklabs.projen.javascript.NodeProject project, final @org.jetbrains.annotations.NotNull io.github.cdklabs.projen.web.ReactComponentOptions options) {
super(software.amazon.jsii.JsiiObject.InitializationMode.JSII);
software.amazon.jsii.JsiiEngine.getInstance().createNewObject(this, new Object[] { java.util.Objects.requireNonNull(project, "project is required"), java.util.Objects.requireNonNull(options, "options is required") });
}
/**
* (experimental) A fluent builder for {@link io.github.cdklabs.projen.web.ReactComponent}.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public static final class Builder implements software.amazon.jsii.Builder {
/**
* @return a new instance of {@link Builder}.
* @param project This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public static Builder create(final io.github.cdklabs.projen.javascript.NodeProject project) {
return new Builder(project);
}
private final io.github.cdklabs.projen.javascript.NodeProject project;
private final io.github.cdklabs.projen.web.ReactComponentOptions.Builder options;
private Builder(final io.github.cdklabs.projen.javascript.NodeProject project) {
this.project = project;
this.options = new io.github.cdklabs.projen.web.ReactComponentOptions.Builder();
}
/**
* (experimental) Rewire webpack configuration.
*
* Use this property to override webpack configuration properties provided
* by create-react-app, without needing to eject.
*
* This property will create a config-overrides.js
file in your root directory,
* which will contain the desired rewiring code.
*
* To override the configuration, you can provide simple key value pairs.
* Keys take the form of js code directives that traverse to the desired property.
* Values should be JSON serializable objects.
*
* For example, the following config:
*
*
* rewire: { "module.unknownContextCritical": false }
*
*
* Will translate to the following config-overrides.js
file:
*
*
* module.exports = function override(config, env) {
* config.module.unknownContextCritical = false;
* }
*
*
* Default: - No rewired config.
*
* @return {@code this}
* @see https://github.com/timarney/react-app-rewired
* @param rewire Rewire webpack configuration. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder rewire(final java.util.Map rewire) {
this.options.rewire(rewire);
return this;
}
/**
* (experimental) Whether to apply options specific for TypeScript React projects.
*
* Default: false
*
* @return {@code this}
* @param typescript Whether to apply options specific for TypeScript React projects. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder typescript(final java.lang.Boolean typescript) {
this.options.typescript(typescript);
return this;
}
/**
* @return a newly built instance of {@link io.github.cdklabs.projen.web.ReactComponent}.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@Override
public io.github.cdklabs.projen.web.ReactComponent build() {
return new io.github.cdklabs.projen.web.ReactComponent(
this.project,
this.options.build()
);
}
}
}