feat(create-turbo): create basic

This commit is contained in:
Turbobot
2024-01-10 12:41:11 +07:00
committed by Thanu Poptiphueng
commit af28fc43a4
59 changed files with 6625 additions and 0 deletions

View File

@@ -0,0 +1,30 @@
import type { PlopTypes } from "@turbo/gen";
// Learn more about Turborepo Generators at https://turbo.build/repo/docs/core-concepts/monorepos/code-generation
export default function generator(plop: PlopTypes.NodePlopAPI): void {
// A simple generator to add a new React component to the internal UI library
plop.setGenerator("react-component", {
description: "Adds a new react component",
prompts: [
{
type: "input",
name: "name",
message: "What is the name of the component?",
},
],
actions: [
{
type: "add",
path: "{{pascalCase name}}.tsx",
templateFile: "templates/component.hbs",
},
{
type: "append",
path: "index.tsx",
pattern: /(?<insertion>\/\/ component exports)/g,
template: 'export * from "./{{pascalCase name}}";',
},
],
});
}

View File

@@ -0,0 +1,14 @@
import * as React from "react";
interface Props {
children?: React.ReactNode;
}
export const {{ pascalCase name }} = ({ children }: Props) => {
return (
<div>
<h1>{{ name }}</h1>
{children}
</div>
);
};