From e9d692b59d9fb66fa2967f413f9de0b1fcc9b9b0 Mon Sep 17 00:00:00 2001 From: Tal Koren Date: Thu, 29 Aug 2024 18:23:47 +0300 Subject: [PATCH] chore: remove unused plop actions --- .../component-stories-mdx.txt | 0 .../component-stories-tsx.txt | 0 .../component-tests.txt | 3 +- packages/core/plop/component/index.js | 10 ++--- packages/core/plop/hooks/hook-story-js.txt | 18 -------- packages/core/plop/hooks/hook-story-scss.txt | 3 -- packages/core/plop/hooks/hook-story.txt | 41 ----------------- packages/core/plop/hooks/hook.txt | 5 --- packages/core/plop/hooks/index.js | 45 ------------------- packages/core/plop/stories/index.js | 41 ----------------- packages/core/plop/tests/index.js | 30 ------------- packages/core/plopfile.js | 6 --- 12 files changed, 7 insertions(+), 195 deletions(-) rename packages/core/plop/{general => component}/component-stories-mdx.txt (100%) rename packages/core/plop/{general => component}/component-stories-tsx.txt (100%) rename packages/core/plop/{general => component}/component-tests.txt (68%) delete mode 100644 packages/core/plop/hooks/hook-story-js.txt delete mode 100644 packages/core/plop/hooks/hook-story-scss.txt delete mode 100644 packages/core/plop/hooks/hook-story.txt delete mode 100644 packages/core/plop/hooks/hook.txt delete mode 100644 packages/core/plop/hooks/index.js delete mode 100644 packages/core/plop/stories/index.js delete mode 100644 packages/core/plop/tests/index.js diff --git a/packages/core/plop/general/component-stories-mdx.txt b/packages/core/plop/component/component-stories-mdx.txt similarity index 100% rename from packages/core/plop/general/component-stories-mdx.txt rename to packages/core/plop/component/component-stories-mdx.txt diff --git a/packages/core/plop/general/component-stories-tsx.txt b/packages/core/plop/component/component-stories-tsx.txt similarity index 100% rename from packages/core/plop/general/component-stories-tsx.txt rename to packages/core/plop/component/component-stories-tsx.txt diff --git a/packages/core/plop/general/component-tests.txt b/packages/core/plop/component/component-tests.txt similarity index 68% rename from packages/core/plop/general/component-tests.txt rename to packages/core/plop/component/component-tests.txt index 4e2f63a9cc..0b7e0a89d9 100644 --- a/packages/core/plop/general/component-tests.txt +++ b/packages/core/plop/component/component-tests.txt @@ -1,8 +1,9 @@ import React from "react"; import { fireEvent, render } from "@testing-library/react"; import {{properCase componentName}} from "../{{properCase componentName}}"; +import { {{properCase componentName}}Props } from "../{{properCase componentName}}.types"; -const renderComponent = props => { +const renderComponent = (props: {{properCase componentName}}Props) => { return render(<{{properCase componentName}} {...props} />); }; diff --git a/packages/core/plop/component/index.js b/packages/core/plop/component/index.js index b63eae5644..b945b8ed1c 100644 --- a/packages/core/plop/component/index.js +++ b/packages/core/plop/component/index.js @@ -1,10 +1,10 @@ export default { - description: "New monday component", + description: "New Vibe component", prompts: [ { type: "input", name: "componentName", - message: "What is the name of your component? (use spaces if multi word)" + message: "What is the name of your component? (e.g. ButtonGroup)" } ], actions: [ @@ -27,7 +27,7 @@ export default { { type: "add", path: "src/components/{{properCase componentName}}/__stories__/{{properCase componentName}}.mdx", - templateFile: "plop/general/component-stories-mdx.txt" + templateFile: "plop/component/component-stories-mdx.txt" }, { type: "modify", @@ -38,7 +38,7 @@ export default { { type: "add", path: "src/components/{{properCase componentName}}/__stories__/{{properCase componentName}}.stories.tsx", - templateFile: "plop/general/component-stories-tsx.txt" + templateFile: "plop/component/component-stories-tsx.txt" }, { type: "add", @@ -53,7 +53,7 @@ export default { { type: "add", path: "src/components/{{properCase componentName}}/__tests__/{{properCase componentName}}.test.tsx", - templateFile: "plop/general/component-tests.txt" + templateFile: "plop/component/component-tests.txt" }, { type: "append", diff --git a/packages/core/plop/hooks/hook-story-js.txt b/packages/core/plop/hooks/hook-story-js.txt deleted file mode 100644 index 3ae48b4d87..0000000000 --- a/packages/core/plop/hooks/hook-story-js.txt +++ /dev/null @@ -1,18 +0,0 @@ -import { useRef } from "react"; -import {{camelCase hookName}} from "../index"; -import "../../__stories__/general-hooks-stories.scss"; -import styles from "./{{camelCase hookName}}.stories.module.scss"; - -export default { - title: "Hooks/{{camelCase hookName}}" -}; - -export const Overview = { - render: () => { - const ref = useRef(null); - const { result } = {{camelCase hookName}}({ ref }); - return
Random hook result = {result}
; - }, - - name: "Overview" -}; diff --git a/packages/core/plop/hooks/hook-story-scss.txt b/packages/core/plop/hooks/hook-story-scss.txt deleted file mode 100644 index 595bbbf522..0000000000 --- a/packages/core/plop/hooks/hook-story-scss.txt +++ /dev/null @@ -1,3 +0,0 @@ -.container { - -} \ No newline at end of file diff --git a/packages/core/plop/hooks/hook-story.txt b/packages/core/plop/hooks/hook-story.txt deleted file mode 100644 index 2d313514c0..0000000000 --- a/packages/core/plop/hooks/hook-story.txt +++ /dev/null @@ -1,41 +0,0 @@ -import { FunctionArgument, FunctionArguments } from "vibe-storybook-components"; -import { Canvas, Meta } from "@storybook/addon-docs"; -import * as {{properCase hookName}}Stories from "./{{camelCase hookName}}.stories"; - - - -# {{camelCase hookName}} - -- [Overview](#overview) -- [Arguments](#arguments) -- [Returns](#returns) -- [Usage](#usage) -- [Feedback](#feedback) - -## Overview - -Please write here the component description - - - -## Arguments - - - - - - - - - -## Returns - - - - - - - -## Usage - - diff --git a/packages/core/plop/hooks/hook.txt b/packages/core/plop/hooks/hook.txt deleted file mode 100644 index 0294b2f815..0000000000 --- a/packages/core/plop/hooks/hook.txt +++ /dev/null @@ -1,5 +0,0 @@ -import { RefObject } from "react"; - -export default function {{camelCase hookName}}({ ref }: { ref: RefObject }): number { - return +(Math.random() * 1000).toFixed(0); -} diff --git a/packages/core/plop/hooks/index.js b/packages/core/plop/hooks/index.js deleted file mode 100644 index 02fee8f2bd..0000000000 --- a/packages/core/plop/hooks/index.js +++ /dev/null @@ -1,45 +0,0 @@ -export default { - description: "New hook", - prompts: [ - { - type: "input", - name: "hookName", - message: "What is the name of your hook? (use spaces if multi word)" - } - ], - actions: [ - { - type: "add", - path: "src/hooks/{{camelCase hookName}}/index.ts", - templateFile: "plop/hooks/hook.txt" - }, - { - type: "add", - path: "src/hooks/{{camelCase hookName}}/__stories__/{{camelCase hookName}}.mdx", - templateFile: "plop/hooks/hook-story.txt" - }, - { - type: "modify", - path: "src/hooks/{{camelCase hookName}}/__stories__/{{camelCase hookName}}.mdx", - pattern: /@properCase_hookName@/g, - template: "{{properCase hookName}}" - }, - { - type: "add", - path: "src/hooks/{{camelCase hookName}}/__stories__/{{camelCase hookName}}.stories.tsx", - templateFile: "plop/hooks/hook-story-js.txt" - }, - { - type: "add", - path: "src/hooks/{{camelCase hookName}}/__stories__/{{camelCase hookName}}.stories.module.scss", - templateFile: "plop/hooks/hook-story-scss.txt" - }, - { - type: "append", - path: "src/hooks/index.ts", - pattern: /(\n$)/gm, - separator: "", - template: `export { default as {{camelCase hookName}} } from "./{{camelCase hookName}}";\n` - } - ] -}; diff --git a/packages/core/plop/stories/index.js b/packages/core/plop/stories/index.js deleted file mode 100644 index 7717996b10..0000000000 --- a/packages/core/plop/stories/index.js +++ /dev/null @@ -1,41 +0,0 @@ -import fs from "fs"; - -export default { - description: "New stories files for existing component", - prompts: [ - { - type: "input", - name: "componentName", - message: - "What is the name of your component? (please use pascal case - for example: MultiWords for the component multi word)", - validate(input) { - return fs.existsSync(`./src/components/${input}`) - ? true - : "A component with this name does not exist in our library. Please check if there is a typing error in the name of the component you wrote."; - } - } - ], - actions: [ - { - type: "add", - path: "src/components/{{properCase componentName}}/__stories__/{{properCase componentName}}.mdx", - templateFile: "plop/general/component-stories-mdx.txt" - }, - { - type: "modify", - path: "src/components/{{properCase componentName}}/__stories__/{{properCase componentName}}.mdx", - pattern: /@componentName@/g, - template: "{{properCase componentName}}" - }, - { - type: "add", - path: "src/components/{{properCase componentName}}/__stories__/{{properCase componentName}}.stories.tsx", - templateFile: "plop/general/component-stories-tsx.txt" - }, - { - type: "add", - path: "src/components/{{properCase componentName}}/__stories__/{{properCase componentName}}.stories.module.scss", - templateFile: "plop/general/component-stories-scss.txt" - } - ] -}; diff --git a/packages/core/plop/tests/index.js b/packages/core/plop/tests/index.js deleted file mode 100644 index 16c034f1bc..0000000000 --- a/packages/core/plop/tests/index.js +++ /dev/null @@ -1,30 +0,0 @@ -import fs from "fs"; - -export default { - description: "New tests files for existing component", - prompts: [ - { - type: "input", - name: "componentName", - message: - "What is the name of your component? (please use pascal case - for example: MultiWords for the component multi word)", - validate(input) { - return fs.existsSync(`./src/components/${input}`) - ? true - : "A component with this name does not exist in our library. Please check if there is a typing error in the name of the component you wrote."; - } - } - ], - actions: [ - { - type: "add", - path: "src/components/{{properCase componentName}}/__tests__/{{camelCase componentName}}.snapshot.test.tsx", - templateFile: "plop/general/component-snapshot-tests-test.txt" - }, - { - type: "add", - path: "src/components/{{properCase componentName}}/__tests__/{{camelCase componentName}}.test.tsx", - templateFile: "plop/general/component-tests.txt" - } - ] -}; diff --git a/packages/core/plopfile.js b/packages/core/plopfile.js index dfe9e502cb..8a8eb29bd5 100644 --- a/packages/core/plopfile.js +++ b/packages/core/plopfile.js @@ -1,11 +1,5 @@ import component from "./plop/component/index.js"; -import tests from "./plop/tests/index.js"; -import stories from "./plop/stories/index.js"; -import hooksStory from "./plop/hooks/index.js"; export default function (plop) { plop.setGenerator("Component", component); - plop.setGenerator("Tests", tests); - plop.setGenerator("Stories", stories); - plop.setGenerator("Hooks Story", hooksStory); }