What is Trecli?

Trecli is a simple CLI tool dedicated for React developers that uses TypeScript.

Creating React component with styles file and props interface is a little bit to time-consuming but happily it can be easily automated with Trecli.

Checking out examples is the simplest way to understand how Trecli works :)

Example 1. Simple component#

trecli Foo

⬇ creates ⬇

Foo.tsx
import React from 'react';
import { FooProps } from './Foo.interface';
export function Foo(props: FooProps) {
return <>Foo rendered</>;
}
Foo.interface.ts
interface FooOwnProps {
}
export type FooProps = FooOwnProps;

Example 2. Component with index file and Material UI hook#

trecli Bar --idx -s=material-ui

⬇ creates ⬇

index.ts
export { default as Bar } from './Bar';
Bar.tsx
import React from 'react';
import { BarProps } from './Bar.interface';
import { useStyles } from './Bar.styles';
export default function Bar(props: BarProps) {
const classes = useStyles();
return <>Bar rendered</>;
}
Bar.interface.ts
interface BarOwnProps {
}
export type BarProps = BarOwnProps;
Bar.styles.ts
import { makeStyles, Theme } from '@material-ui/core';
export const useStyles = makeStyles((theme: Theme) => ({
}));