This is a CLI utility for generating React components in Meteor.
npm i --save-dev @xch/meteor-create-react-componentnpx createNewUiComponent [options] <component-name>Use --help flag to learn more about the options.
npx createNewUiComponent some-componentThis creates a new component file at imports/ui/components/some-component/index.js in the Meteor app. If react-redux package is detected in the app, the component file will be renamed to component.js and a Redux container file will be created with the name index.js.
You can customize the behavior of the generators with CLI options. You can also save any option under the "meteor-create-react-component" namespace in your NPM manifest (package.json) to change the default behavior across the project.
CLI options would always take priority but not all options are available.
- Relative path from the root of your project to the single place for all of your UI components.
- Default value:
imports/ui/components. - Can only be configured in the manifest.
- Set to
trueto create areact-reduxcontainer for the component. - If
react-reduxis detected in your project, the default value would betrue, otherwisefalse. - When this is active, the component would be named
component.jswhile the container would be namedindex.js. - Use
--no-containerflag to suppress this option per command.
- Set to
trueto create a pure React component (with an arrow function) instead of a complex one (that extendsReact.Component). - Use
--pure-componentflag to activate this option per command.
- Set to
trueto see the results described in text without performing any changes. - Use
--dry-runflag to activate this option per command.
MIT