diff --git a/src/Blocks/UseStorybookCli.php b/src/Blocks/UseStorybookCli.php deleted file mode 100644 index 1d3740da4..000000000 --- a/src/Blocks/UseStorybookCli.php +++ /dev/null @@ -1,117 +0,0 @@ ->|string> - */ - public function getDoc(): array - { - return [ - 'shortdesc' => 'Copy storybook config from our library to your project.', - 'longdesc' => $this->prepareLongDesc(" - ## USAGE - - Used to copy all configuration files to your project needed to run Storybook. - - ## INSTALATION - - After you run the cli command please follow these steps: - {$this->getCommonAfterIntallInstructions()} - - ## EXAMPLES - - # Create Storybook config: - $ wp {$this->commandParentName} {$this->getCommandParentName()} {$this->getCommandName()} - - ## RESOURCES - - Storybook config will be created from this folder: - https://github.com/infinum/eightshift-frontend-libs/tree/develop/blocks/init/storybook - "), - ]; - } - - /* @phpstan-ignore-next-line */ - public function __invoke(array $args, array $assocArgs) - { - $this->getIntroText($assocArgs); - - $groupOutput = $assocArgs['groupOutput'] ?? false; - - $this->moveItems( - \array_merge( - $assocArgs, - [ - 'name' => 'storybook', - ], - ), - Components::getProjectPaths('blocksStorybookSource'), - Components::getProjectPaths('blocksStorybookDestination'), - 'storybook folder', - true - ); - - if (!$groupOutput) { - WP_CLI::log('--------------------------------------------------'); - - $this->cliLog('Please follow these steps to complete your Storybook setup:', 'M'); - $this->cliLog($this->prepareLongDesc($this->getCommonAfterIntallInstructions()), 'M'); - } - } - - /** - * Common instalation steps. - * - * @return string - */ - private function getCommonAfterIntallInstructions(): string - { - return ' - 1. Run `npm install @eightshift/storybook --save-dev` command in the terminal to install the storybook package. - 2. Open package.json. - 3. Add to scripts: `"storybookBuild": "build-storybook -s public -o storybook"` - 4. Add to scripts: `"storybook": "start-storybook -s public"` - 5. Start storybook by running this command `npm run storybook`. - '; - } -} diff --git a/src/Cli/AbstractCli.php b/src/Cli/AbstractCli.php index d0a5f57c9..58f79aa08 100644 --- a/src/Cli/AbstractCli.php +++ b/src/Cli/AbstractCli.php @@ -815,7 +815,6 @@ public function getFullBlocksFiles(string $name): array "{$name}-hooks.js", "{$name}-transforms.js", "{$name}.js", - "docs{$ds}story.js", "components{$ds}{$name}-editor.js", "components{$ds}{$name}-toolbar.js", "components{$ds}{$name}-options.js", diff --git a/src/Cli/Cli.php b/src/Cli/Cli.php index 1812c7304..76c0e6fdc 100644 --- a/src/Cli/Cli.php +++ b/src/Cli/Cli.php @@ -22,7 +22,6 @@ use EightshiftLibs\Blocks\UseAssetsCli; use EightshiftLibs\Blocks\UseGlobalAssetsCli; use EightshiftLibs\Blocks\UseManifestCli; -use EightshiftLibs\Blocks\UseStorybookCli; use EightshiftLibs\Blocks\UseVariationCli; use EightshiftLibs\Blocks\UseWrapperCli; use EightshiftLibs\Cli\ParentGroups\CliBoilerplate; @@ -156,7 +155,6 @@ class Cli UseComponentCli::class, UseGlobalAssetsCli::class, UseManifestCli::class, - UseStorybookCli::class, UseVariationCli::class, UseWrapperCli::class, ]; diff --git a/src/Helpers/Components.php b/src/Helpers/Components.php index 2da28c992..6802c307b 100644 --- a/src/Helpers/Components.php +++ b/src/Helpers/Components.php @@ -76,7 +76,6 @@ class Components 'blocksGlobalAssetsSource', 'blocksAssetsSource', - 'blocksStorybookSource', 'blocksSource', 'blocksSourceCustom', 'blocksSourceComponents', @@ -85,7 +84,6 @@ class Components 'blocksGlobalAssetsDestination', 'blocksAssetsDestination', - 'blocksStorybookDestination', 'blocksDestination', 'blocksDestinationCustom', 'blocksDestinationComponents', @@ -361,7 +359,6 @@ public static function getProjectPaths(string $type = '', string $suffix = '', s $testsDataPath = ["tests", "data"]; $srcPath = "src"; $blocksPath = [$srcPath, "Blocks"]; - $storybookPath = "storybook"; $assetsPath = "assets"; $cliOutputPath = "cliOutput"; @@ -426,13 +423,6 @@ public static function getProjectPaths(string $type = '', string $suffix = '', s $path = self::joinPaths([...$testsDataPath, ...$blocksPath, $assetsPath]); } break; - case 'blocksStorybookSource': - $path = self::joinPaths([...$flibsPath, $storybookPath]); - - if (\getenv('ES_TEST')) { - $path = self::joinPaths([...$testsDataPath, $storybookPath]); - } - break; case 'blocksSource': $path = self::joinPaths([...$flibsPath, ...$blocksPath]); @@ -481,13 +471,6 @@ public static function getProjectPaths(string $type = '', string $suffix = '', s $path = self::joinPaths([$cliOutputPath, ...$blocksPath, $assetsPath]); } break; - case 'blocksStorybookDestination': - $path = self::joinPaths([".{$storybookPath}"]); - - if (\getenv('ES_TEST')) { - $path = self::joinPaths([$cliOutputPath, ".{$storybookPath}"]); - } - break; case 'blocksDestination': $path = self::joinPaths($blocksPath); diff --git a/src/Init/InitBlocksCli.php b/src/Init/InitBlocksCli.php index a342af271..fdc52ec20 100644 --- a/src/Init/InitBlocksCli.php +++ b/src/Init/InitBlocksCli.php @@ -16,7 +16,6 @@ use EightshiftLibs\Blocks\UseComponentCli; use EightshiftLibs\Blocks\UseGlobalAssetsCli; use EightshiftLibs\Blocks\UseManifestCli; -use EightshiftLibs\Blocks\UseStorybookCli; use EightshiftLibs\Blocks\UseVariationCli; use EightshiftLibs\Blocks\UseWrapperCli; use EightshiftLibs\Cli\AbstractCli; @@ -35,7 +34,6 @@ class InitBlocksCli extends AbstractCli public const COMMANDS = [ BlocksCli::class => [], UseAssetsCli::class => [], - UseStorybookCli::class => [], UseGlobalAssetsCli::class => [], UseWrapperCli::class => [], UseManifestCli::class => [], diff --git a/tests/Unit/Blocks/BlocksStorybookCliTest.php b/tests/Unit/Blocks/BlocksStorybookCliTest.php deleted file mode 100644 index c1a59285a..000000000 --- a/tests/Unit/Blocks/BlocksStorybookCliTest.php +++ /dev/null @@ -1,27 +0,0 @@ -mock = new UseStorybookCli('boilerplate'); -}); - -afterEach(function () { - unset($this->mock); -}); - -test('Storybook CLI command will correctly copy the Storybook class with defaults', function () { - $mock = $this->mock; - $mock([], []); - - $output = \file_get_contents(Components::getProjectPaths('blocksStorybookDestination', 'storybook.php')); - - expect($output)->toContain('Storybook example file'); -}); - -test('Storybook CLI documentation is correct', function () { - expect($this->mock->getDoc())->toBeArray(); -}); diff --git a/tests/Unit/Cli/AbstractCliTest.php b/tests/Unit/Cli/AbstractCliTest.php index f181ef386..3894949ec 100644 --- a/tests/Unit/Cli/AbstractCliTest.php +++ b/tests/Unit/Cli/AbstractCliTest.php @@ -130,7 +130,6 @@ public function getCommandName(): string $this->assertTrue(\array_key_exists('button-hooks.js', \array_flip($output)), 'button-hooks.js is missing.'); $this->assertTrue(\array_key_exists('button-transforms.js', \array_flip($output)), 'button-transforms.js is missing.'); $this->assertTrue(\array_key_exists('button.js', \array_flip($output)), 'button.js is missing.'); - $this->assertTrue(\array_key_exists('docs/story.js', \array_flip($output)), 'docs/story.js is missing.'); $this->assertTrue(\array_key_exists('components/button-editor.js', \array_flip($output)), 'components/button-editor.js is missing.'); $this->assertTrue(\array_key_exists('components/button-toolbar.js', \array_flip($output)), 'components/button-toolbar.js is missing.'); $this->assertTrue(\array_key_exists('components/button-options.js', \array_flip($output)), 'components/button-options.js is missing.'); diff --git a/tests/Unit/Cli/CliTest.php b/tests/Unit/Cli/CliTest.php index 0fac57cc3..b9c7b9f7c 100644 --- a/tests/Unit/Cli/CliTest.php +++ b/tests/Unit/Cli/CliTest.php @@ -26,7 +26,7 @@ ->not->toHaveKey(CliShowAll::class) ->and(\count($publicClasses)) ->toBeInt() - ->toBe(53); + ->toBe(52); // Public classes count. }); diff --git a/tests/data/src/Blocks/custom/button/docs/readme.mdx b/tests/data/src/Blocks/custom/button/docs/readme.mdx deleted file mode 100644 index 243e38bbb..000000000 --- a/tests/data/src/Blocks/custom/button/docs/readme.mdx +++ /dev/null @@ -1,16 +0,0 @@ -# Button Block - -Block used to provide button functionality to your project. - -## Dependencies - -1. components/button - -## Implementation - -Open a terminal and type in this command inside your projects root: - -```shell -wp boilerplate use_block --name=button -wp boilerplate use_component --name=button -``` diff --git a/tests/data/src/Blocks/custom/button/docs/story.js b/tests/data/src/Blocks/custom/button/docs/story.js deleted file mode 100644 index 9b4819389..000000000 --- a/tests/data/src/Blocks/custom/button/docs/story.js +++ /dev/null @@ -1,18 +0,0 @@ -import React from 'react'; -import { Gutenberg, blockDetails } from '@eightshift/frontend-libs/scripts/storybook'; -import manifest from './../manifest.json'; -import globalManifest from './../../../manifest.json'; -import readme from './readme.mdx'; - -export default { - title: `Blocks/${manifest.title}`, - parameters: { - docs: { - page: readme - } - }, -}; - -export const block = () => ( - -); diff --git a/tests/data/storybook/storybook.php b/tests/data/storybook/storybook.php deleted file mode 100644 index c6ff23209..000000000 --- a/tests/data/storybook/storybook.php +++ /dev/null @@ -1,2 +0,0 @@ -