org.projen.web.ReactComponent Maven / Gradle / Ivy
Show all versions of projen Show documentation
package org.projen.web;
/**
*/
@javax.annotation.Generated(value = "jsii-pacmak/1.34.0 (build 9b72778)", date = "2021-09-05T18:03:12.980Z")
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@software.amazon.jsii.Jsii(module = org.projen.$Module.class, fqn = "projen.web.ReactComponent")
public class ReactComponent extends org.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 org.projen.NodeProject project, final @org.jetbrains.annotations.NotNull org.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 org.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 org.projen.NodeProject project) {
return new Builder(project);
}
private final org.projen.NodeProject project;
private final org.projen.web.ReactComponentOptions.Builder options;
private Builder(final org.projen.NodeProject project) {
this.project = project;
this.options = new org.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;
}
/**
* @returns a newly built instance of {@link org.projen.web.ReactComponent}.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@Override
public org.projen.web.ReactComponent build() {
return new org.projen.web.ReactComponent(
this.project,
this.options.build()
);
}
}
}