From ba1764ffc2cdc36003adfa2ededd8b94f5df3514 Mon Sep 17 00:00:00 2001 From: hy2k <17329720+hy2k@users.noreply.github.com> Date: Mon, 8 Apr 2024 03:01:48 +0900 Subject: [PATCH 1/3] Patch for Search Filtering Feature (#237) # Problem This PR is a continuation of the work done in PR #231. It aims to address the incomplete fix I implemented in my previous PR. The problem addressed by this PR pertains to the handling of 'story' nodes in our component tree. In the current implementation, 'story' nodes, which inherently do not have any children, are incorrectly subjected to a descendants check. This results in the `isEmpty` flag always being set to true for 'Story' nodes. # Solution The main changes in this PR include: - Refactoring the search filtering logic into a separate module. - Adding unit tests While the changes introduced in this PR could have been implemented within the existing component, I chose to refactor them into a separate module, so it's easier to test. # Checklist - [x] Ran `./bin/test.sh` locally - [x] Ran `./bin/analyze.sh` locally --------- Co-authored-by: Marin Minnerly --- src/Explorer/Component/init.lua | 20 +---- src/Explorer/filterComponentTreeNode.lua | 27 +++++++ src/Explorer/filterComponentTreeNode.spec.lua | 77 +++++++++++++++++++ src/Explorer/types.lua | 2 +- 4 files changed, 108 insertions(+), 18 deletions(-) create mode 100644 src/Explorer/filterComponentTreeNode.lua create mode 100644 src/Explorer/filterComponentTreeNode.spec.lua diff --git a/src/Explorer/Component/init.lua b/src/Explorer/Component/init.lua index b85b5fbf..03e7a27d 100644 --- a/src/Explorer/Component/init.lua +++ b/src/Explorer/Component/init.lua @@ -5,7 +5,7 @@ local Sift = require(flipbook.Packages.Sift) local Directory = require(script.Directory) local Story = require(script.Story) local types = require(flipbook.Explorer.types) -local getTreeDescendants = require(flipbook.Explorer.getTreeDescendants) +local filterComponentTreeNode = require(flipbook.Explorer.filterComponentTreeNode) local e = React.createElement @@ -60,22 +60,8 @@ local function Component(providedProps: Props) end end - if props.filter then - if props.node.icon == "story" and not props.node.name:lower():match(props.filter:lower()) then - return - end - - local isEmpty = true - for _, descendant in getTreeDescendants(props.node) do - if descendant.name:lower():match(props.filter:lower()) then - isEmpty = false - break - end - end - - if isEmpty then - return - end + if props.filter and filterComponentTreeNode(props.node, props.filter) then + return end return e("Frame", { diff --git a/src/Explorer/filterComponentTreeNode.lua b/src/Explorer/filterComponentTreeNode.lua new file mode 100644 index 00000000..ff3bbc2a --- /dev/null +++ b/src/Explorer/filterComponentTreeNode.lua @@ -0,0 +1,27 @@ +local flipbook = script:FindFirstAncestor("flipbook") + +local types = require(flipbook.Explorer.types) + +local getTreeDescendants = require(script.Parent.getTreeDescendants) + +local function filterComponentTreeNode(node: types.ComponentTreeNode, filter: string): boolean + if node.icon == "story" then + if not node.name:lower():match(filter:lower()) then + return true + end + + return false + end + + local isEmpty = true + for _, descendant in getTreeDescendants(node) do + if descendant.name:lower():match(filter:lower()) then + isEmpty = false + break + end + end + + return isEmpty +end + +return filterComponentTreeNode diff --git a/src/Explorer/filterComponentTreeNode.spec.lua b/src/Explorer/filterComponentTreeNode.spec.lua new file mode 100644 index 00000000..d8edd6e2 --- /dev/null +++ b/src/Explorer/filterComponentTreeNode.spec.lua @@ -0,0 +1,77 @@ +local flipbook = script:FindFirstAncestor("flipbook") + +local types = require(flipbook.Explorer.types) + +return function() + local filterComponentTreeNode = require(script.Parent.filterComponentTreeNode) + + it("should return true when the query does not match the story name", function() + local target: types.ComponentTreeNode = { + children = {}, + name = "test", + icon = "story", + } + local query = "other" + + local result = filterComponentTreeNode(target, query) + expect(result).to.equal(true) + end) + + it("should return false the query matches the story name", function() + local target: types.ComponentTreeNode = { + children = {}, + name = "test", + icon = "story", + } + local query = "tes" + + local result = filterComponentTreeNode(target, query) + expect(result).to.equal(false) + end) + + it("should return true when the filter does not match any of node in tree", function() + local target: types.ComponentTreeNode = { + children = { + { + children = {}, + name = "test", + icon = "story", + }, + { + children = {}, + name = "folder", + icon = "folder", + }, + }, + name = "storybook", + icon = "storybook", + } + local query = "other" + + local result = filterComponentTreeNode(target, query) + expect(result).to.equal(true) + end) + + it("should return false when a filter match at least one of nodes in tree", function() + local target: types.ComponentTreeNode = { + children = { + { + children = {}, + name = "test", + icon = "story", + }, + { + children = {}, + name = "folder", + icon = "folder", + }, + }, + name = "storybook", + icon = "storybook", + } + local query = "tes" + + local result = filterComponentTreeNode(target, query) + expect(result).to.equal(false) + end) +end diff --git a/src/Explorer/types.lua b/src/Explorer/types.lua index 9f22ebe7..706f7ae4 100644 --- a/src/Explorer/types.lua +++ b/src/Explorer/types.lua @@ -6,7 +6,7 @@ type Storybook = storybookTypes.Storybook export type ComponentTreeNode = { name: string, children: { ComponentTreeNode }, - icon: string?, + icon: ("folder" | "story" | "storybook")?, instance: Instance?, storybook: Storybook?, } From 2a742e5386b1d95d20afad3ad7592ef2bc167544 Mon Sep 17 00:00:00 2001 From: vocksel Date: Thu, 11 Apr 2024 09:19:55 -0700 Subject: [PATCH 2/3] Rename all Lua files to Luau (#238) 1. Renamed `.lua` files to `.luau` 2. Updated files that _refer_ to `.lua` files to use `.luau` 3. Added .gitattributes to tell GitHub to use Lua syntax highlighting for Luau files --- .gitattributes | 1 + .github/workflows/ci.yml | 3 +++ .github/workflows/release.yml | 2 +- bin/analyze.sh | 2 +- bin/lint.sh | 11 +++++++++++ bin/test.sh | 2 +- docs/contributing.md | 2 +- docs/migrating.md | 16 ++++++++-------- docs/story-format.md | 12 ++++++------ docs/writing-stories.md | 16 ++++++++-------- ...ntrols.story.lua => ArrayControls.story.luau} | 0 example/{Button.lua => Button.luau} | 0 example/{Button.story.lua => Button.story.luau} | 0 ...nWithControls.lua => ButtonWithControls.luau} | 0 ...s.story.lua => ButtonWithControls.story.luau} | 0 ...icSize.story.lua => AutomaticSize.story.luau} | 0 ...lua => AutomaticSizeExceedsBounds.story.luau} | 0 .../{Offset.story.lua => Offset.story.luau} | 0 .../{Resizing.story.lua => Resizing.story.luau} | 0 .../{Scale.story.lua => Scale.story.luau} | 0 ...Frame.story.lua => ScrollingFrame.story.luau} | 0 example/{Counter.lua => Counter.luau} | 0 .../{Counter.story.lua => Counter.story.luau} | 0 ...mple.storybook.lua => Example.storybook.luau} | 0 ...unctional.story.lua => Functional.story.luau} | 0 ...{Hoarcekat.story.lua => Hoarcekat.story.luau} | 0 example/{ReactCounter.lua => ReactCounter.luau} | 0 ...Counter.story.lua => ReactCounter.story.luau} | 0 src/Common/{Branding.lua => Branding.luau} | 0 .../{Branding.story.lua => Branding.story.luau} | 0 .../{ScrollingFrame.lua => ScrollingFrame.luau} | 0 ...Frame.story.lua => ScrollingFrame.story.luau} | 0 src/Common/{Sprite.lua => Sprite.luau} | 0 .../{Sprite.story.lua => Sprite.story.luau} | 0 src/Common/{mapRanges.lua => mapRanges.luau} | 0 .../{mapRanges.spec.lua => mapRanges.spec.luau} | 0 .../{useDescendants.lua => useDescendants.luau} | 0 ...endants.spec.lua => useDescendants.spec.luau} | 0 src/Common/{useEvent.lua => useEvent.luau} | 0 .../{useEvent.spec.lua => useEvent.spec.luau} | 0 src/Common/{usePrevious.lua => usePrevious.luau} | 0 ...sePrevious.spec.lua => usePrevious.spec.luau} | 0 src/Common/{useTheme.lua => useTheme.luau} | 0 src/Common/{useZoom.lua => useZoom.luau} | 0 .../{useZoom.spec.lua => useZoom.spec.luau} | 0 ...{Component.story.lua => Component.story.luau} | 0 .../Component/{Directory.lua => Directory.luau} | 0 src/Explorer/Component/{Story.lua => Story.luau} | 0 src/Explorer/Component/{init.lua => init.luau} | 0 ...TreeNode.lua => filterComponentTreeNode.luau} | 0 ...pec.lua => filterComponentTreeNode.spec.luau} | 0 ...eeDescendants.lua => getTreeDescendants.luau} | 0 ...nts.spec.lua => getTreeDescendants.spec.luau} | 0 src/Explorer/{init.lua => init.luau} | 0 src/Explorer/{types.lua => types.luau} | 0 src/Forms/{Button.lua => Button.luau} | 0 .../{Button.story.lua => Button.story.luau} | 0 src/Forms/{Checkbox.lua => Checkbox.luau} | 0 .../{Checkbox.story.lua => Checkbox.story.luau} | 0 src/Forms/{Dropdown.lua => Dropdown.luau} | 0 .../{Dropdown.story.lua => Dropdown.story.luau} | 0 src/Forms/{InputField.lua => InputField.luau} | 0 ...nputField.story.lua => InputField.story.luau} | 0 src/Forms/{Searchbar.lua => Searchbar.luau} | 0 ...{Searchbar.story.lua => Searchbar.story.luau} | 0 ...bleTextLabel.lua => SelectableTextLabel.luau} | 0 ....story.lua => SelectableTextLabel.story.luau} | 0 src/Navigation/{Divider.lua => Divider.luau} | 0 src/Navigation/{Element.lua => Element.luau} | 0 src/Navigation/{Item.lua => Item.luau} | 0 src/Navigation/{Items.lua => Items.luau} | 0 src/Navigation/{init.lua => init.luau} | 0 src/Panels/{DragHandle.lua => DragHandle.luau} | 0 .../{ResizablePanel.lua => ResizablePanel.luau} | 0 ...Panel.story.lua => ResizablePanel.story.luau} | 0 src/Panels/{Sidebar.lua => Sidebar.luau} | 0 .../{Sidebar.story.lua => Sidebar.story.luau} | 0 src/Panels/{types.lua => types.luau} | 0 src/Plugin/{PluginApp.lua => PluginApp.luau} | 0 ...{PluginApp.story.lua => PluginApp.story.luau} | 0 .../{PluginContext.lua => PluginContext.luau} | 0 ...eToggleButton.lua => createToggleButton.luau} | 0 .../{createWidget.lua => createWidget.luau} | 0 ...{NoStorySelected.lua => NoStorySelected.luau} | 0 ...cted.story.lua => NoStorySelected.story.luau} | 0 .../{StoryCanvas.lua => StoryCanvas.luau} | 0 .../{StoryControls.lua => StoryControls.luau} | 0 ...ntrols.story.lua => StoryControls.story.luau} | 0 .../{StoryError.lua => StoryError.luau} | 0 ...toryError.story.lua => StoryError.story.luau} | 0 src/Storybook/{StoryMeta.lua => StoryMeta.luau} | 0 ...{StoryMeta.story.lua => StoryMeta.story.luau} | 0 .../{StoryPreview.lua => StoryPreview.luau} | 0 src/Storybook/{StoryView.lua => StoryView.luau} | 0 ...{StoryViewNavbar.lua => StoryViewNavbar.luau} | 0 ...reateStoryNodes.lua => createStoryNodes.luau} | 0 ...Nodes.spec.lua => createStoryNodes.spec.luau} | 0 .../{isStoryModule.lua => isStoryModule.luau} | 0 ...ryModule.spec.lua => isStoryModule.spec.luau} | 0 ...torybookModule.lua => isStorybookModule.luau} | 0 ...dule.spec.lua => isStorybookModule.spec.luau} | 0 ...{loadStoryModule.lua => loadStoryModule.luau} | 0 .../{mountStory.lua => mountStory.luau} | 0 src/Storybook/{types.lua => types.luau} | 0 src/Storybook/{useStory.lua => useStory.luau} | 0 .../{useStorybooks.lua => useStorybooks.luau} | 0 src/Testing/{newFolder.lua => newFolder.luau} | 0 .../{newFolder.spec.lua => newFolder.spec.luau} | 0 src/{assets.lua => assets.luau} | 0 src/{constants.lua => constants.luau} | 0 src/{init.server.lua => init.server.luau} | 0 src/{init.storybook.lua => init.storybook.luau} | 0 src/{stories.spec.lua => stories.spec.luau} | 0 src/{tailwind.lua => tailwind.luau} | 0 src/{themes.lua => themes.luau} | 0 tarmac.toml | 2 +- testez.d.lua => testez.d.luau | 0 tests/{init.server.lua => init.server.luau} | 0 118 files changed, 42 insertions(+), 27 deletions(-) create mode 100644 .gitattributes create mode 100755 bin/lint.sh rename example/{ArrayControls.story.lua => ArrayControls.story.luau} (100%) rename example/{Button.lua => Button.luau} (100%) rename example/{Button.story.lua => Button.story.luau} (100%) rename example/{ButtonWithControls.lua => ButtonWithControls.luau} (100%) rename example/{ButtonWithControls.story.lua => ButtonWithControls.story.luau} (100%) rename example/CanvasTests/{AutomaticSize.story.lua => AutomaticSize.story.luau} (100%) rename example/CanvasTests/{AutomaticSizeExceedsBounds.story.lua => AutomaticSizeExceedsBounds.story.luau} (100%) rename example/CanvasTests/{Offset.story.lua => Offset.story.luau} (100%) rename example/CanvasTests/{Resizing.story.lua => Resizing.story.luau} (100%) rename example/CanvasTests/{Scale.story.lua => Scale.story.luau} (100%) rename example/CanvasTests/{ScrollingFrame.story.lua => ScrollingFrame.story.luau} (100%) rename example/{Counter.lua => Counter.luau} (100%) rename example/{Counter.story.lua => Counter.story.luau} (100%) rename example/{Example.storybook.lua => Example.storybook.luau} (100%) rename example/{Functional.story.lua => Functional.story.luau} (100%) rename example/{Hoarcekat.story.lua => Hoarcekat.story.luau} (100%) rename example/{ReactCounter.lua => ReactCounter.luau} (100%) rename example/{ReactCounter.story.lua => ReactCounter.story.luau} (100%) rename src/Common/{Branding.lua => Branding.luau} (100%) rename src/Common/{Branding.story.lua => Branding.story.luau} (100%) rename src/Common/{ScrollingFrame.lua => ScrollingFrame.luau} (100%) rename src/Common/{ScrollingFrame.story.lua => ScrollingFrame.story.luau} (100%) rename src/Common/{Sprite.lua => Sprite.luau} (100%) rename src/Common/{Sprite.story.lua => Sprite.story.luau} (100%) rename src/Common/{mapRanges.lua => mapRanges.luau} (100%) rename src/Common/{mapRanges.spec.lua => mapRanges.spec.luau} (100%) rename src/Common/{useDescendants.lua => useDescendants.luau} (100%) rename src/Common/{useDescendants.spec.lua => useDescendants.spec.luau} (100%) rename src/Common/{useEvent.lua => useEvent.luau} (100%) rename src/Common/{useEvent.spec.lua => useEvent.spec.luau} (100%) rename src/Common/{usePrevious.lua => usePrevious.luau} (100%) rename src/Common/{usePrevious.spec.lua => usePrevious.spec.luau} (100%) rename src/Common/{useTheme.lua => useTheme.luau} (100%) rename src/Common/{useZoom.lua => useZoom.luau} (100%) rename src/Common/{useZoom.spec.lua => useZoom.spec.luau} (100%) rename src/Explorer/{Component.story.lua => Component.story.luau} (100%) rename src/Explorer/Component/{Directory.lua => Directory.luau} (100%) rename src/Explorer/Component/{Story.lua => Story.luau} (100%) rename src/Explorer/Component/{init.lua => init.luau} (100%) rename src/Explorer/{filterComponentTreeNode.lua => filterComponentTreeNode.luau} (100%) rename src/Explorer/{filterComponentTreeNode.spec.lua => filterComponentTreeNode.spec.luau} (100%) rename src/Explorer/{getTreeDescendants.lua => getTreeDescendants.luau} (100%) rename src/Explorer/{getTreeDescendants.spec.lua => getTreeDescendants.spec.luau} (100%) rename src/Explorer/{init.lua => init.luau} (100%) rename src/Explorer/{types.lua => types.luau} (100%) rename src/Forms/{Button.lua => Button.luau} (100%) rename src/Forms/{Button.story.lua => Button.story.luau} (100%) rename src/Forms/{Checkbox.lua => Checkbox.luau} (100%) rename src/Forms/{Checkbox.story.lua => Checkbox.story.luau} (100%) rename src/Forms/{Dropdown.lua => Dropdown.luau} (100%) rename src/Forms/{Dropdown.story.lua => Dropdown.story.luau} (100%) rename src/Forms/{InputField.lua => InputField.luau} (100%) rename src/Forms/{InputField.story.lua => InputField.story.luau} (100%) rename src/Forms/{Searchbar.lua => Searchbar.luau} (100%) rename src/Forms/{Searchbar.story.lua => Searchbar.story.luau} (100%) rename src/Forms/{SelectableTextLabel.lua => SelectableTextLabel.luau} (100%) rename src/Forms/{SelectableTextLabel.story.lua => SelectableTextLabel.story.luau} (100%) rename src/Navigation/{Divider.lua => Divider.luau} (100%) rename src/Navigation/{Element.lua => Element.luau} (100%) rename src/Navigation/{Item.lua => Item.luau} (100%) rename src/Navigation/{Items.lua => Items.luau} (100%) rename src/Navigation/{init.lua => init.luau} (100%) rename src/Panels/{DragHandle.lua => DragHandle.luau} (100%) rename src/Panels/{ResizablePanel.lua => ResizablePanel.luau} (100%) rename src/Panels/{ResizablePanel.story.lua => ResizablePanel.story.luau} (100%) rename src/Panels/{Sidebar.lua => Sidebar.luau} (100%) rename src/Panels/{Sidebar.story.lua => Sidebar.story.luau} (100%) rename src/Panels/{types.lua => types.luau} (100%) rename src/Plugin/{PluginApp.lua => PluginApp.luau} (100%) rename src/Plugin/{PluginApp.story.lua => PluginApp.story.luau} (100%) rename src/Plugin/{PluginContext.lua => PluginContext.luau} (100%) rename src/Plugin/{createToggleButton.lua => createToggleButton.luau} (100%) rename src/Plugin/{createWidget.lua => createWidget.luau} (100%) rename src/Storybook/{NoStorySelected.lua => NoStorySelected.luau} (100%) rename src/Storybook/{NoStorySelected.story.lua => NoStorySelected.story.luau} (100%) rename src/Storybook/{StoryCanvas.lua => StoryCanvas.luau} (100%) rename src/Storybook/{StoryControls.lua => StoryControls.luau} (100%) rename src/Storybook/{StoryControls.story.lua => StoryControls.story.luau} (100%) rename src/Storybook/{StoryError.lua => StoryError.luau} (100%) rename src/Storybook/{StoryError.story.lua => StoryError.story.luau} (100%) rename src/Storybook/{StoryMeta.lua => StoryMeta.luau} (100%) rename src/Storybook/{StoryMeta.story.lua => StoryMeta.story.luau} (100%) rename src/Storybook/{StoryPreview.lua => StoryPreview.luau} (100%) rename src/Storybook/{StoryView.lua => StoryView.luau} (100%) rename src/Storybook/{StoryViewNavbar.lua => StoryViewNavbar.luau} (100%) rename src/Storybook/{createStoryNodes.lua => createStoryNodes.luau} (100%) rename src/Storybook/{createStoryNodes.spec.lua => createStoryNodes.spec.luau} (100%) rename src/Storybook/{isStoryModule.lua => isStoryModule.luau} (100%) rename src/Storybook/{isStoryModule.spec.lua => isStoryModule.spec.luau} (100%) rename src/Storybook/{isStorybookModule.lua => isStorybookModule.luau} (100%) rename src/Storybook/{isStorybookModule.spec.lua => isStorybookModule.spec.luau} (100%) rename src/Storybook/{loadStoryModule.lua => loadStoryModule.luau} (100%) rename src/Storybook/{mountStory.lua => mountStory.luau} (100%) rename src/Storybook/{types.lua => types.luau} (100%) rename src/Storybook/{useStory.lua => useStory.luau} (100%) rename src/Storybook/{useStorybooks.lua => useStorybooks.luau} (100%) rename src/Testing/{newFolder.lua => newFolder.luau} (100%) rename src/Testing/{newFolder.spec.lua => newFolder.spec.luau} (100%) rename src/{assets.lua => assets.luau} (100%) rename src/{constants.lua => constants.luau} (100%) rename src/{init.server.lua => init.server.luau} (100%) rename src/{init.storybook.lua => init.storybook.luau} (100%) rename src/{stories.spec.lua => stories.spec.luau} (100%) rename src/{tailwind.lua => tailwind.luau} (100%) rename src/{themes.lua => themes.luau} (100%) rename testez.d.lua => testez.d.luau (100%) rename tests/{init.server.lua => init.server.luau} (100%) diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 00000000..876fbd3c --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +*.luau linguist-language=Lua diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 59189268..f52ea618 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -24,6 +24,9 @@ jobs: - name: Format run: stylua --check src/ + - name: Lint file extensions + run: ./bin/lint.sh + - name: Install dependencies run: wally install diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c9f347f0..0f7d5d67 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -16,7 +16,7 @@ jobs: token: ${{ secrets.GITHUB_TOKEN }} - name: Remove spec files - run: rm -rf **/*.spec.lua + run: rm -rf **/*.spec.luau - name: Install packages run: wally install diff --git a/bin/analyze.sh b/bin/analyze.sh index 27d530d4..e452e6d5 100755 --- a/bin/analyze.sh +++ b/bin/analyze.sh @@ -4,7 +4,7 @@ curl -s -O https://raw.githubusercontent.com/JohnnyMorganz/luau-lsp/master/scrip rojo sourcemap tests.project.json -o sourcemap.json -luau-lsp analyze --sourcemap=sourcemap.json --defs=globalTypes.d.lua --defs=testez.d.lua --ignore=**/_Index/** src/ +luau-lsp analyze --sourcemap=sourcemap.json --defs=globalTypes.d.lua --defs=testez.d.luau --ignore=**/_Index/** src/ exit_code=$? rm globalTypes.d.lua diff --git a/bin/lint.sh b/bin/lint.sh new file mode 100755 index 00000000..1ee55d8c --- /dev/null +++ b/bin/lint.sh @@ -0,0 +1,11 @@ +#!/usr/bin/env bash + +set -euo pipefail + +echo "Lint file extensions" +files=$(find src example -iname "*.lua") +if [[ -n "$files" ]]; then + echo "Error: one or more files are using the '.lua' extension. Please update these to '.luau' and try again" + echo "$files" + exit 1 +fi diff --git a/bin/test.sh b/bin/test.sh index 8f7a9ed8..6d48bf3b 100755 --- a/bin/test.sh +++ b/bin/test.sh @@ -1,3 +1,3 @@ rojo build tests.project.json -o tests.rbxl -run-in-roblox --place tests.rbxl --script tests/init.server.lua +run-in-roblox --place tests.rbxl --script tests/init.server.luau rm tests.rbxl diff --git a/docs/contributing.md b/docs/contributing.md index 47657f2b..0dfc0aca 100644 --- a/docs/contributing.md +++ b/docs/contributing.md @@ -73,7 +73,7 @@ Then load a new Baseplate and open the flipbook plugin. Its storybook should now ## Testing -While developing, you should also be writing unit tests. Unit tests are written in `.spec.lua` files. You can see examples of this throughout the repository's codebase. +While developing, you should also be writing unit tests. Unit tests are written in `.spec.luau` files. You can see examples of this throughout the repository's codebase. To run tests, simply start the experience in Studio. You will see in the output if tests are passing or failing. diff --git a/docs/migrating.md b/docs/migrating.md index 3c0a9d28..cd5926be 100644 --- a/docs/migrating.md +++ b/docs/migrating.md @@ -15,15 +15,15 @@ This guide assumes you are using [Rojo](https://github.com/rojo-rbx/rojo/) to ma The main difference in how flipbook and Hoarcekat handle stories is that flipbook requires a "storybook" file to know where your stories are. As such, to migrate over from Hoarcekat the first thing you should do is create a storybook for your project. -To do this, create a new `ProjectName.storybook.lua` file at the root of your project with the following contents: +To do this, create a new `ProjectName.storybook.luau` file at the root of your project with the following contents: ```lua --- Make sure to adjust the path to Roact if needed +-- Make sure to adjust the path to Roact if needed local Roact = require(script.Parent.Parent.Roact) return { roact = Roact, - storyRoots = { + storyRoots = { script.Parent.Components } } @@ -38,13 +38,13 @@ To fully benefit from the features flipbook has to offer, this section will guid We will use the following component and story as an example: ```lua --- HelloWorld.lua +-- HelloWorld.luau type Props = { name: string? } local function HelloWorld(props: Props) - local name = props.name or "World" + local name = props.name or "World" return Roact.createElement("TextLabel", { Text = ("Hello %s!"):format(name), @@ -60,7 +60,7 @@ return HelloWorld ``` ```lua --- HelloWorld.story.lua +-- HelloWorld.story.luau local Roact = require(script.Parent.Parent.Roact) local HelloWorld = require(script.Parent.HelloWorld) @@ -82,7 +82,7 @@ end Converting a Hoarcekat story like this into one compatible with flipbook is quite easy. In fact, all that's needed from the above story is the call to `Roact.createElement`: ```lua --- HelloWorld.story.lua +-- HelloWorld.story.luau local Roact = require(script.Parent.Parent.Roact) local HelloWorld = require(script.Parent.HelloWorld) @@ -137,4 +137,4 @@ You are now equipped to migrate your other Hoarcekat stories over to flipbook! ## Further Reading - [Writing Stories](writing-stories.md) -- [Story Format](story-format.md) \ No newline at end of file +- [Story Format](story-format.md) diff --git a/docs/story-format.md b/docs/story-format.md index 48ba562d..d6836425 100644 --- a/docs/story-format.md +++ b/docs/story-format.md @@ -23,7 +23,7 @@ The only required prop is the `storyRoots` array, which tells flipbook which Ins Example: ```lua --- example/Example.storybook.lua +-- example/Example.storybook.luau return { name = "Example Storybook", storyRoots = { @@ -47,7 +47,7 @@ Support for Roblox's [Roact](https://github.com/Roblox/roact) library is built i Example: ```lua --- example/Button.story.lua +-- example/Button.story.luau local Example = script:FindFirstAncestor("Example") local Roact = require(Example.Parent.Packages.Roact) @@ -68,7 +68,7 @@ return { Example with controls: ```lua --- example/ButtonWithControls.story.lua +-- example/ButtonWithControls.story.luau local Example = script:FindFirstAncestor("Example") local Roact = require(Example.Parent.Packages.Roact) @@ -116,7 +116,7 @@ You can find React and ReactRoblox as part of the [CorePackages](https://github. Example: ```lua --- example/ReactCounter.story.lua +-- example/ReactCounter.story.luau local Example = script:FindFirstAncestor("Example") local React = require(Example.Parent.Packages.React) @@ -160,7 +160,7 @@ A Functional story uses a function to create and mount UI. This is the most flex Example: ```lua --- example/Functional.story.lua +-- example/Functional.story.luau local controls = { text = "Functional Story", } @@ -206,7 +206,7 @@ See the [migration guide](migrating.md) for more info. Example: ```lua --- example/Hoarcekat.story.lua +-- example/Hoarcekat.story.luau local Example = script:FindFirstAncestor("Example") local Roact = require(Example.Parent.Packages.Roact) diff --git a/docs/writing-stories.md b/docs/writing-stories.md index 8b8ff709..3703f2f5 100644 --- a/docs/writing-stories.md +++ b/docs/writing-stories.md @@ -8,17 +8,17 @@ flipbook uses the concept of "storybooks" and "stories." A storybook is used to ## Storybook -Every project needs a storybook, so to get started you will create a new `ProjectName.storybook.lua` file at the root of your project with the following contents: +Every project needs a storybook, so to get started you will create a new `ProjectName.storybook.luau` file at the root of your project with the following contents: ```lua --- src/ProjectName.storybook.lua +-- src/ProjectName.storybook.luau --- Make sure to adjust the path to Roact if needed +-- Make sure to adjust the path to Roact if needed local Roact = require(path.to.Roact) return { roact = Roact, - storyRoots = { + storyRoots = { script.Parent.Components } } @@ -30,10 +30,10 @@ Right now you should see a single entry in flipbook's sidebar for this storybook ## Story -A story and its associated component should be in two separate files. Both files should share the same name, however the story will end with `.story`. To get started, let's create `Button.lua` and `Button.story.lua`: +A story and its associated component should be in two separate files. Both files should share the same name, however the story will end with `.story`. To get started, let's create `Button.luau` and `Button.story.luau`: ```lua --- src/Components/Button.lua +-- src/Components/Button.luau local Roact = require(path.to.Roact) @@ -68,7 +68,7 @@ return Button And now let's write the story to mount the Button component: ```lua --- src/Components/Button.story.lua +-- src/Components/Button.story.luau local Roact = require(path.to.Roact) local Button = require(script.Parent.Button) @@ -185,4 +185,4 @@ With this change, a new "Controls" panel will appear where you can toggle the `i You have just been given an example of how to create a storybook and a story for a Button component that makes use of flipbook's controls feature. This document outlines the biggest features of flipbook, but there are other options you can play around with. -Check out [Story Format](story-format.md) next to learn about all the options you have available. \ No newline at end of file +Check out [Story Format](story-format.md) next to learn about all the options you have available. diff --git a/example/ArrayControls.story.lua b/example/ArrayControls.story.luau similarity index 100% rename from example/ArrayControls.story.lua rename to example/ArrayControls.story.luau diff --git a/example/Button.lua b/example/Button.luau similarity index 100% rename from example/Button.lua rename to example/Button.luau diff --git a/example/Button.story.lua b/example/Button.story.luau similarity index 100% rename from example/Button.story.lua rename to example/Button.story.luau diff --git a/example/ButtonWithControls.lua b/example/ButtonWithControls.luau similarity index 100% rename from example/ButtonWithControls.lua rename to example/ButtonWithControls.luau diff --git a/example/ButtonWithControls.story.lua b/example/ButtonWithControls.story.luau similarity index 100% rename from example/ButtonWithControls.story.lua rename to example/ButtonWithControls.story.luau diff --git a/example/CanvasTests/AutomaticSize.story.lua b/example/CanvasTests/AutomaticSize.story.luau similarity index 100% rename from example/CanvasTests/AutomaticSize.story.lua rename to example/CanvasTests/AutomaticSize.story.luau diff --git a/example/CanvasTests/AutomaticSizeExceedsBounds.story.lua b/example/CanvasTests/AutomaticSizeExceedsBounds.story.luau similarity index 100% rename from example/CanvasTests/AutomaticSizeExceedsBounds.story.lua rename to example/CanvasTests/AutomaticSizeExceedsBounds.story.luau diff --git a/example/CanvasTests/Offset.story.lua b/example/CanvasTests/Offset.story.luau similarity index 100% rename from example/CanvasTests/Offset.story.lua rename to example/CanvasTests/Offset.story.luau diff --git a/example/CanvasTests/Resizing.story.lua b/example/CanvasTests/Resizing.story.luau similarity index 100% rename from example/CanvasTests/Resizing.story.lua rename to example/CanvasTests/Resizing.story.luau diff --git a/example/CanvasTests/Scale.story.lua b/example/CanvasTests/Scale.story.luau similarity index 100% rename from example/CanvasTests/Scale.story.lua rename to example/CanvasTests/Scale.story.luau diff --git a/example/CanvasTests/ScrollingFrame.story.lua b/example/CanvasTests/ScrollingFrame.story.luau similarity index 100% rename from example/CanvasTests/ScrollingFrame.story.lua rename to example/CanvasTests/ScrollingFrame.story.luau diff --git a/example/Counter.lua b/example/Counter.luau similarity index 100% rename from example/Counter.lua rename to example/Counter.luau diff --git a/example/Counter.story.lua b/example/Counter.story.luau similarity index 100% rename from example/Counter.story.lua rename to example/Counter.story.luau diff --git a/example/Example.storybook.lua b/example/Example.storybook.luau similarity index 100% rename from example/Example.storybook.lua rename to example/Example.storybook.luau diff --git a/example/Functional.story.lua b/example/Functional.story.luau similarity index 100% rename from example/Functional.story.lua rename to example/Functional.story.luau diff --git a/example/Hoarcekat.story.lua b/example/Hoarcekat.story.luau similarity index 100% rename from example/Hoarcekat.story.lua rename to example/Hoarcekat.story.luau diff --git a/example/ReactCounter.lua b/example/ReactCounter.luau similarity index 100% rename from example/ReactCounter.lua rename to example/ReactCounter.luau diff --git a/example/ReactCounter.story.lua b/example/ReactCounter.story.luau similarity index 100% rename from example/ReactCounter.story.lua rename to example/ReactCounter.story.luau diff --git a/src/Common/Branding.lua b/src/Common/Branding.luau similarity index 100% rename from src/Common/Branding.lua rename to src/Common/Branding.luau diff --git a/src/Common/Branding.story.lua b/src/Common/Branding.story.luau similarity index 100% rename from src/Common/Branding.story.lua rename to src/Common/Branding.story.luau diff --git a/src/Common/ScrollingFrame.lua b/src/Common/ScrollingFrame.luau similarity index 100% rename from src/Common/ScrollingFrame.lua rename to src/Common/ScrollingFrame.luau diff --git a/src/Common/ScrollingFrame.story.lua b/src/Common/ScrollingFrame.story.luau similarity index 100% rename from src/Common/ScrollingFrame.story.lua rename to src/Common/ScrollingFrame.story.luau diff --git a/src/Common/Sprite.lua b/src/Common/Sprite.luau similarity index 100% rename from src/Common/Sprite.lua rename to src/Common/Sprite.luau diff --git a/src/Common/Sprite.story.lua b/src/Common/Sprite.story.luau similarity index 100% rename from src/Common/Sprite.story.lua rename to src/Common/Sprite.story.luau diff --git a/src/Common/mapRanges.lua b/src/Common/mapRanges.luau similarity index 100% rename from src/Common/mapRanges.lua rename to src/Common/mapRanges.luau diff --git a/src/Common/mapRanges.spec.lua b/src/Common/mapRanges.spec.luau similarity index 100% rename from src/Common/mapRanges.spec.lua rename to src/Common/mapRanges.spec.luau diff --git a/src/Common/useDescendants.lua b/src/Common/useDescendants.luau similarity index 100% rename from src/Common/useDescendants.lua rename to src/Common/useDescendants.luau diff --git a/src/Common/useDescendants.spec.lua b/src/Common/useDescendants.spec.luau similarity index 100% rename from src/Common/useDescendants.spec.lua rename to src/Common/useDescendants.spec.luau diff --git a/src/Common/useEvent.lua b/src/Common/useEvent.luau similarity index 100% rename from src/Common/useEvent.lua rename to src/Common/useEvent.luau diff --git a/src/Common/useEvent.spec.lua b/src/Common/useEvent.spec.luau similarity index 100% rename from src/Common/useEvent.spec.lua rename to src/Common/useEvent.spec.luau diff --git a/src/Common/usePrevious.lua b/src/Common/usePrevious.luau similarity index 100% rename from src/Common/usePrevious.lua rename to src/Common/usePrevious.luau diff --git a/src/Common/usePrevious.spec.lua b/src/Common/usePrevious.spec.luau similarity index 100% rename from src/Common/usePrevious.spec.lua rename to src/Common/usePrevious.spec.luau diff --git a/src/Common/useTheme.lua b/src/Common/useTheme.luau similarity index 100% rename from src/Common/useTheme.lua rename to src/Common/useTheme.luau diff --git a/src/Common/useZoom.lua b/src/Common/useZoom.luau similarity index 100% rename from src/Common/useZoom.lua rename to src/Common/useZoom.luau diff --git a/src/Common/useZoom.spec.lua b/src/Common/useZoom.spec.luau similarity index 100% rename from src/Common/useZoom.spec.lua rename to src/Common/useZoom.spec.luau diff --git a/src/Explorer/Component.story.lua b/src/Explorer/Component.story.luau similarity index 100% rename from src/Explorer/Component.story.lua rename to src/Explorer/Component.story.luau diff --git a/src/Explorer/Component/Directory.lua b/src/Explorer/Component/Directory.luau similarity index 100% rename from src/Explorer/Component/Directory.lua rename to src/Explorer/Component/Directory.luau diff --git a/src/Explorer/Component/Story.lua b/src/Explorer/Component/Story.luau similarity index 100% rename from src/Explorer/Component/Story.lua rename to src/Explorer/Component/Story.luau diff --git a/src/Explorer/Component/init.lua b/src/Explorer/Component/init.luau similarity index 100% rename from src/Explorer/Component/init.lua rename to src/Explorer/Component/init.luau diff --git a/src/Explorer/filterComponentTreeNode.lua b/src/Explorer/filterComponentTreeNode.luau similarity index 100% rename from src/Explorer/filterComponentTreeNode.lua rename to src/Explorer/filterComponentTreeNode.luau diff --git a/src/Explorer/filterComponentTreeNode.spec.lua b/src/Explorer/filterComponentTreeNode.spec.luau similarity index 100% rename from src/Explorer/filterComponentTreeNode.spec.lua rename to src/Explorer/filterComponentTreeNode.spec.luau diff --git a/src/Explorer/getTreeDescendants.lua b/src/Explorer/getTreeDescendants.luau similarity index 100% rename from src/Explorer/getTreeDescendants.lua rename to src/Explorer/getTreeDescendants.luau diff --git a/src/Explorer/getTreeDescendants.spec.lua b/src/Explorer/getTreeDescendants.spec.luau similarity index 100% rename from src/Explorer/getTreeDescendants.spec.lua rename to src/Explorer/getTreeDescendants.spec.luau diff --git a/src/Explorer/init.lua b/src/Explorer/init.luau similarity index 100% rename from src/Explorer/init.lua rename to src/Explorer/init.luau diff --git a/src/Explorer/types.lua b/src/Explorer/types.luau similarity index 100% rename from src/Explorer/types.lua rename to src/Explorer/types.luau diff --git a/src/Forms/Button.lua b/src/Forms/Button.luau similarity index 100% rename from src/Forms/Button.lua rename to src/Forms/Button.luau diff --git a/src/Forms/Button.story.lua b/src/Forms/Button.story.luau similarity index 100% rename from src/Forms/Button.story.lua rename to src/Forms/Button.story.luau diff --git a/src/Forms/Checkbox.lua b/src/Forms/Checkbox.luau similarity index 100% rename from src/Forms/Checkbox.lua rename to src/Forms/Checkbox.luau diff --git a/src/Forms/Checkbox.story.lua b/src/Forms/Checkbox.story.luau similarity index 100% rename from src/Forms/Checkbox.story.lua rename to src/Forms/Checkbox.story.luau diff --git a/src/Forms/Dropdown.lua b/src/Forms/Dropdown.luau similarity index 100% rename from src/Forms/Dropdown.lua rename to src/Forms/Dropdown.luau diff --git a/src/Forms/Dropdown.story.lua b/src/Forms/Dropdown.story.luau similarity index 100% rename from src/Forms/Dropdown.story.lua rename to src/Forms/Dropdown.story.luau diff --git a/src/Forms/InputField.lua b/src/Forms/InputField.luau similarity index 100% rename from src/Forms/InputField.lua rename to src/Forms/InputField.luau diff --git a/src/Forms/InputField.story.lua b/src/Forms/InputField.story.luau similarity index 100% rename from src/Forms/InputField.story.lua rename to src/Forms/InputField.story.luau diff --git a/src/Forms/Searchbar.lua b/src/Forms/Searchbar.luau similarity index 100% rename from src/Forms/Searchbar.lua rename to src/Forms/Searchbar.luau diff --git a/src/Forms/Searchbar.story.lua b/src/Forms/Searchbar.story.luau similarity index 100% rename from src/Forms/Searchbar.story.lua rename to src/Forms/Searchbar.story.luau diff --git a/src/Forms/SelectableTextLabel.lua b/src/Forms/SelectableTextLabel.luau similarity index 100% rename from src/Forms/SelectableTextLabel.lua rename to src/Forms/SelectableTextLabel.luau diff --git a/src/Forms/SelectableTextLabel.story.lua b/src/Forms/SelectableTextLabel.story.luau similarity index 100% rename from src/Forms/SelectableTextLabel.story.lua rename to src/Forms/SelectableTextLabel.story.luau diff --git a/src/Navigation/Divider.lua b/src/Navigation/Divider.luau similarity index 100% rename from src/Navigation/Divider.lua rename to src/Navigation/Divider.luau diff --git a/src/Navigation/Element.lua b/src/Navigation/Element.luau similarity index 100% rename from src/Navigation/Element.lua rename to src/Navigation/Element.luau diff --git a/src/Navigation/Item.lua b/src/Navigation/Item.luau similarity index 100% rename from src/Navigation/Item.lua rename to src/Navigation/Item.luau diff --git a/src/Navigation/Items.lua b/src/Navigation/Items.luau similarity index 100% rename from src/Navigation/Items.lua rename to src/Navigation/Items.luau diff --git a/src/Navigation/init.lua b/src/Navigation/init.luau similarity index 100% rename from src/Navigation/init.lua rename to src/Navigation/init.luau diff --git a/src/Panels/DragHandle.lua b/src/Panels/DragHandle.luau similarity index 100% rename from src/Panels/DragHandle.lua rename to src/Panels/DragHandle.luau diff --git a/src/Panels/ResizablePanel.lua b/src/Panels/ResizablePanel.luau similarity index 100% rename from src/Panels/ResizablePanel.lua rename to src/Panels/ResizablePanel.luau diff --git a/src/Panels/ResizablePanel.story.lua b/src/Panels/ResizablePanel.story.luau similarity index 100% rename from src/Panels/ResizablePanel.story.lua rename to src/Panels/ResizablePanel.story.luau diff --git a/src/Panels/Sidebar.lua b/src/Panels/Sidebar.luau similarity index 100% rename from src/Panels/Sidebar.lua rename to src/Panels/Sidebar.luau diff --git a/src/Panels/Sidebar.story.lua b/src/Panels/Sidebar.story.luau similarity index 100% rename from src/Panels/Sidebar.story.lua rename to src/Panels/Sidebar.story.luau diff --git a/src/Panels/types.lua b/src/Panels/types.luau similarity index 100% rename from src/Panels/types.lua rename to src/Panels/types.luau diff --git a/src/Plugin/PluginApp.lua b/src/Plugin/PluginApp.luau similarity index 100% rename from src/Plugin/PluginApp.lua rename to src/Plugin/PluginApp.luau diff --git a/src/Plugin/PluginApp.story.lua b/src/Plugin/PluginApp.story.luau similarity index 100% rename from src/Plugin/PluginApp.story.lua rename to src/Plugin/PluginApp.story.luau diff --git a/src/Plugin/PluginContext.lua b/src/Plugin/PluginContext.luau similarity index 100% rename from src/Plugin/PluginContext.lua rename to src/Plugin/PluginContext.luau diff --git a/src/Plugin/createToggleButton.lua b/src/Plugin/createToggleButton.luau similarity index 100% rename from src/Plugin/createToggleButton.lua rename to src/Plugin/createToggleButton.luau diff --git a/src/Plugin/createWidget.lua b/src/Plugin/createWidget.luau similarity index 100% rename from src/Plugin/createWidget.lua rename to src/Plugin/createWidget.luau diff --git a/src/Storybook/NoStorySelected.lua b/src/Storybook/NoStorySelected.luau similarity index 100% rename from src/Storybook/NoStorySelected.lua rename to src/Storybook/NoStorySelected.luau diff --git a/src/Storybook/NoStorySelected.story.lua b/src/Storybook/NoStorySelected.story.luau similarity index 100% rename from src/Storybook/NoStorySelected.story.lua rename to src/Storybook/NoStorySelected.story.luau diff --git a/src/Storybook/StoryCanvas.lua b/src/Storybook/StoryCanvas.luau similarity index 100% rename from src/Storybook/StoryCanvas.lua rename to src/Storybook/StoryCanvas.luau diff --git a/src/Storybook/StoryControls.lua b/src/Storybook/StoryControls.luau similarity index 100% rename from src/Storybook/StoryControls.lua rename to src/Storybook/StoryControls.luau diff --git a/src/Storybook/StoryControls.story.lua b/src/Storybook/StoryControls.story.luau similarity index 100% rename from src/Storybook/StoryControls.story.lua rename to src/Storybook/StoryControls.story.luau diff --git a/src/Storybook/StoryError.lua b/src/Storybook/StoryError.luau similarity index 100% rename from src/Storybook/StoryError.lua rename to src/Storybook/StoryError.luau diff --git a/src/Storybook/StoryError.story.lua b/src/Storybook/StoryError.story.luau similarity index 100% rename from src/Storybook/StoryError.story.lua rename to src/Storybook/StoryError.story.luau diff --git a/src/Storybook/StoryMeta.lua b/src/Storybook/StoryMeta.luau similarity index 100% rename from src/Storybook/StoryMeta.lua rename to src/Storybook/StoryMeta.luau diff --git a/src/Storybook/StoryMeta.story.lua b/src/Storybook/StoryMeta.story.luau similarity index 100% rename from src/Storybook/StoryMeta.story.lua rename to src/Storybook/StoryMeta.story.luau diff --git a/src/Storybook/StoryPreview.lua b/src/Storybook/StoryPreview.luau similarity index 100% rename from src/Storybook/StoryPreview.lua rename to src/Storybook/StoryPreview.luau diff --git a/src/Storybook/StoryView.lua b/src/Storybook/StoryView.luau similarity index 100% rename from src/Storybook/StoryView.lua rename to src/Storybook/StoryView.luau diff --git a/src/Storybook/StoryViewNavbar.lua b/src/Storybook/StoryViewNavbar.luau similarity index 100% rename from src/Storybook/StoryViewNavbar.lua rename to src/Storybook/StoryViewNavbar.luau diff --git a/src/Storybook/createStoryNodes.lua b/src/Storybook/createStoryNodes.luau similarity index 100% rename from src/Storybook/createStoryNodes.lua rename to src/Storybook/createStoryNodes.luau diff --git a/src/Storybook/createStoryNodes.spec.lua b/src/Storybook/createStoryNodes.spec.luau similarity index 100% rename from src/Storybook/createStoryNodes.spec.lua rename to src/Storybook/createStoryNodes.spec.luau diff --git a/src/Storybook/isStoryModule.lua b/src/Storybook/isStoryModule.luau similarity index 100% rename from src/Storybook/isStoryModule.lua rename to src/Storybook/isStoryModule.luau diff --git a/src/Storybook/isStoryModule.spec.lua b/src/Storybook/isStoryModule.spec.luau similarity index 100% rename from src/Storybook/isStoryModule.spec.lua rename to src/Storybook/isStoryModule.spec.luau diff --git a/src/Storybook/isStorybookModule.lua b/src/Storybook/isStorybookModule.luau similarity index 100% rename from src/Storybook/isStorybookModule.lua rename to src/Storybook/isStorybookModule.luau diff --git a/src/Storybook/isStorybookModule.spec.lua b/src/Storybook/isStorybookModule.spec.luau similarity index 100% rename from src/Storybook/isStorybookModule.spec.lua rename to src/Storybook/isStorybookModule.spec.luau diff --git a/src/Storybook/loadStoryModule.lua b/src/Storybook/loadStoryModule.luau similarity index 100% rename from src/Storybook/loadStoryModule.lua rename to src/Storybook/loadStoryModule.luau diff --git a/src/Storybook/mountStory.lua b/src/Storybook/mountStory.luau similarity index 100% rename from src/Storybook/mountStory.lua rename to src/Storybook/mountStory.luau diff --git a/src/Storybook/types.lua b/src/Storybook/types.luau similarity index 100% rename from src/Storybook/types.lua rename to src/Storybook/types.luau diff --git a/src/Storybook/useStory.lua b/src/Storybook/useStory.luau similarity index 100% rename from src/Storybook/useStory.lua rename to src/Storybook/useStory.luau diff --git a/src/Storybook/useStorybooks.lua b/src/Storybook/useStorybooks.luau similarity index 100% rename from src/Storybook/useStorybooks.lua rename to src/Storybook/useStorybooks.luau diff --git a/src/Testing/newFolder.lua b/src/Testing/newFolder.luau similarity index 100% rename from src/Testing/newFolder.lua rename to src/Testing/newFolder.luau diff --git a/src/Testing/newFolder.spec.lua b/src/Testing/newFolder.spec.luau similarity index 100% rename from src/Testing/newFolder.spec.lua rename to src/Testing/newFolder.spec.luau diff --git a/src/assets.lua b/src/assets.luau similarity index 100% rename from src/assets.lua rename to src/assets.luau diff --git a/src/constants.lua b/src/constants.luau similarity index 100% rename from src/constants.lua rename to src/constants.luau diff --git a/src/init.server.lua b/src/init.server.luau similarity index 100% rename from src/init.server.lua rename to src/init.server.luau diff --git a/src/init.storybook.lua b/src/init.storybook.luau similarity index 100% rename from src/init.storybook.lua rename to src/init.storybook.luau diff --git a/src/stories.spec.lua b/src/stories.spec.luau similarity index 100% rename from src/stories.spec.lua rename to src/stories.spec.luau diff --git a/src/tailwind.lua b/src/tailwind.luau similarity index 100% rename from src/tailwind.lua rename to src/tailwind.luau diff --git a/src/themes.lua b/src/themes.luau similarity index 100% rename from src/themes.lua rename to src/themes.luau diff --git a/tarmac.toml b/tarmac.toml index 481a184b..8fc90ad4 100644 --- a/tarmac.toml +++ b/tarmac.toml @@ -3,6 +3,6 @@ name = "flipbook" [[inputs]] glob = "img/**/*.png" codegen = true -codegen-path = "src/assets.lua" +codegen-path = "src/assets.luau" codegen-base-path = "img" packable = true diff --git a/testez.d.lua b/testez.d.luau similarity index 100% rename from testez.d.lua rename to testez.d.luau diff --git a/tests/init.server.lua b/tests/init.server.luau similarity index 100% rename from tests/init.server.lua rename to tests/init.server.luau From 06836c3ca1779c4a15fffe49b2360ec91c0c19a8 Mon Sep 17 00:00:00 2001 From: vocksel Date: Fri, 12 Apr 2024 15:30:53 -0700 Subject: [PATCH 3/3] Sort requires (#243) # Problem Arbitrarily sorting requires by hand is annoying # Solution Enable StyLua's `sort_requires` feature to handle it for us. # Checklist - [ ] Ran `./bin/test.sh` locally before merging --- example/Button.story.luau | 2 +- example/ButtonWithControls.story.luau | 2 +- example/Counter.story.luau | 2 +- example/ReactCounter.story.luau | 2 +- src/Common/Branding.luau | 2 +- src/Common/Branding.story.luau | 2 +- src/Common/ScrollingFrame.luau | 2 +- src/Common/Sprite.story.luau | 2 +- src/Explorer/Component/Directory.luau | 4 ++-- src/Explorer/Component/Story.luau | 4 ++-- src/Explorer/Component/init.luau | 4 ++-- src/Explorer/init.luau | 2 +- src/Forms/Button.story.luau | 2 +- src/Forms/Checkbox.story.luau | 2 +- src/Forms/Dropdown.story.luau | 2 +- src/Forms/InputField.story.luau | 2 +- src/Forms/Searchbar.luau | 6 +++--- src/Panels/DragHandle.luau | 4 ++-- src/Panels/ResizablePanel.luau | 2 +- src/Panels/Sidebar.luau | 12 ++++++------ src/Panels/Sidebar.story.luau | 2 +- src/Plugin/PluginApp.luau | 8 ++++---- src/Plugin/PluginApp.story.luau | 2 +- src/Storybook/NoStorySelected.luau | 2 +- src/Storybook/NoStorySelected.story.luau | 2 +- src/Storybook/StoryCanvas.luau | 4 ++-- src/Storybook/StoryControls.luau | 4 ++-- src/Storybook/StoryPreview.luau | 4 ++-- src/Storybook/StoryView.luau | 18 +++++++++--------- src/Storybook/StoryViewNavbar.luau | 4 ++-- src/Storybook/createStoryNodes.luau | 2 +- src/Storybook/useStory.luau | 2 +- src/Storybook/useStorybooks.luau | 2 +- src/init.server.luau | 6 +++--- stylua.toml | 2 ++ 35 files changed, 64 insertions(+), 62 deletions(-) create mode 100644 stylua.toml diff --git a/example/Button.story.luau b/example/Button.story.luau index 4f23b032..6fc5c2d1 100644 --- a/example/Button.story.luau +++ b/example/Button.story.luau @@ -1,7 +1,7 @@ local Example = script:FindFirstAncestor("Example") -local Roact = require(Example.Parent.Packages.Roact) local Button = require(script.Parent.Button) +local Roact = require(Example.Parent.Packages.Roact) return { summary = "A generic button component that can be used anywhere", diff --git a/example/ButtonWithControls.story.luau b/example/ButtonWithControls.story.luau index 3d0aad70..ffdef006 100644 --- a/example/ButtonWithControls.story.luau +++ b/example/ButtonWithControls.story.luau @@ -1,7 +1,7 @@ local Example = script:FindFirstAncestor("Example") -local Roact = require(Example.Parent.Packages.Roact) local ButtonWithControls = require(script.Parent.ButtonWithControls) +local Roact = require(Example.Parent.Packages.Roact) local controls = { isDisabled = false, diff --git a/example/Counter.story.luau b/example/Counter.story.luau index 4c2b5f41..fb5ce18e 100644 --- a/example/Counter.story.luau +++ b/example/Counter.story.luau @@ -1,7 +1,7 @@ local Example = script:FindFirstAncestor("Example") -local Roact = require(Example.Parent.Packages.Roact) local Counter = require(script.Parent.Counter) +local Roact = require(Example.Parent.Packages.Roact) local controls = { increment = 1, diff --git a/example/ReactCounter.story.luau b/example/ReactCounter.story.luau index d43b6237..417bb6c3 100644 --- a/example/ReactCounter.story.luau +++ b/example/ReactCounter.story.luau @@ -1,8 +1,8 @@ local Example = script:FindFirstAncestor("Example") local React = require(Example.Parent.Packages.React) -local ReactRoblox = require(Example.Parent.Packages.ReactRoblox) local ReactCounter = require(script.Parent.ReactCounter) +local ReactRoblox = require(Example.Parent.Packages.ReactRoblox) local controls = { increment = 1, diff --git a/src/Common/Branding.luau b/src/Common/Branding.luau index 19675c80..678138d5 100644 --- a/src/Common/Branding.luau +++ b/src/Common/Branding.luau @@ -1,9 +1,9 @@ local flipbook = script:FindFirstAncestor("flipbook") local React = require(flipbook.Packages.React) +local Sprite = require(flipbook.Common.Sprite) local assets = require(flipbook.assets) local useTheme = require(flipbook.Common.useTheme) -local Sprite = require(flipbook.Common.Sprite) local e = React.createElement diff --git a/src/Common/Branding.story.luau b/src/Common/Branding.story.luau index cdf11ec6..13813e8e 100644 --- a/src/Common/Branding.story.luau +++ b/src/Common/Branding.story.luau @@ -1,7 +1,7 @@ local flipbook = script:FindFirstAncestor("flipbook") -local React = require(flipbook.Packages.React) local Branding = require(script.Parent.Branding) +local React = require(flipbook.Packages.React) return { summary = "Icon and Typography for flipbook", diff --git a/src/Common/ScrollingFrame.luau b/src/Common/ScrollingFrame.luau index 9c9f5021..1c5bc677 100644 --- a/src/Common/ScrollingFrame.luau +++ b/src/Common/ScrollingFrame.luau @@ -1,7 +1,7 @@ local flipbook = script:FindFirstAncestor("flipbook") -local Sift = require(flipbook.Packages.Sift) local React = require(flipbook.Packages.React) +local Sift = require(flipbook.Packages.Sift) local useTheme = require(flipbook.Common.useTheme) export type Props = { diff --git a/src/Common/Sprite.story.luau b/src/Common/Sprite.story.luau index 2bea94b8..954bedb0 100644 --- a/src/Common/Sprite.story.luau +++ b/src/Common/Sprite.story.luau @@ -1,8 +1,8 @@ local flipbook = script:FindFirstAncestor("flipbook") local React = require(flipbook.Packages.React) -local assets = require(flipbook.assets) local Sprite = require(script.Parent.Sprite) +local assets = require(flipbook.assets) return { story = React.createElement("Folder", {}, { diff --git a/src/Explorer/Component/Directory.luau b/src/Explorer/Component/Directory.luau index 9d660088..9eb70191 100644 --- a/src/Explorer/Component/Directory.luau +++ b/src/Explorer/Component/Directory.luau @@ -2,11 +2,11 @@ local flipbook = script:FindFirstAncestor("flipbook") local React = require(flipbook.Packages.React) local ReactSpring = require(flipbook.Packages.ReactSpring) +local Sprite = require(flipbook.Common.Sprite) local assets = require(flipbook.assets) local constants = require(flipbook.constants) -local useTheme = require(flipbook.Common.useTheme) -local Sprite = require(flipbook.Common.Sprite) local types = require(flipbook.Explorer.types) +local useTheme = require(flipbook.Common.useTheme) local e = React.createElement diff --git a/src/Explorer/Component/Story.luau b/src/Explorer/Component/Story.luau index ff3c2960..832575ef 100644 --- a/src/Explorer/Component/Story.luau +++ b/src/Explorer/Component/Story.luau @@ -2,11 +2,11 @@ local flipbook = script:FindFirstAncestor("flipbook") local React = require(flipbook.Packages.React) local ReactSpring = require(flipbook.Packages.ReactSpring) +local Sprite = require(flipbook.Common.Sprite) local assets = require(flipbook.assets) local constants = require(flipbook.constants) -local useTheme = require(flipbook.Common.useTheme) -local Sprite = require(flipbook.Common.Sprite) local types = require(flipbook.Explorer.types) +local useTheme = require(flipbook.Common.useTheme) local e = React.createElement diff --git a/src/Explorer/Component/init.luau b/src/Explorer/Component/init.luau index 03e7a27d..31c6a215 100644 --- a/src/Explorer/Component/init.luau +++ b/src/Explorer/Component/init.luau @@ -1,11 +1,11 @@ local flipbook = script:FindFirstAncestor("flipbook") +local Directory = require(script.Directory) local React = require(flipbook.Packages.React) local Sift = require(flipbook.Packages.Sift) -local Directory = require(script.Directory) local Story = require(script.Story) -local types = require(flipbook.Explorer.types) local filterComponentTreeNode = require(flipbook.Explorer.filterComponentTreeNode) +local types = require(flipbook.Explorer.types) local e = React.createElement diff --git a/src/Explorer/init.luau b/src/Explorer/init.luau index 1438525b..6e84c9e4 100644 --- a/src/Explorer/init.luau +++ b/src/Explorer/init.luau @@ -1,7 +1,7 @@ local flipbook = script:FindFirstAncestor("flipbook") -local React = require(flipbook.Packages.React) local Component = require(script.Component) +local React = require(flipbook.Packages.React) local types = require(script.types) local e = React.createElement diff --git a/src/Forms/Button.story.luau b/src/Forms/Button.story.luau index 9bd6acb3..4588385c 100644 --- a/src/Forms/Button.story.luau +++ b/src/Forms/Button.story.luau @@ -1,7 +1,7 @@ local flipbook = script:FindFirstAncestor("flipbook") -local React = require(flipbook.Packages.React) local Button = require(script.Parent.Button) +local React = require(flipbook.Packages.React) local controls = { text = "Click me", diff --git a/src/Forms/Checkbox.story.luau b/src/Forms/Checkbox.story.luau index a8ef8dba..36c708c3 100644 --- a/src/Forms/Checkbox.story.luau +++ b/src/Forms/Checkbox.story.luau @@ -1,7 +1,7 @@ local flipbook = script:FindFirstAncestor("flipbook") -local React = require(flipbook.Packages.React) local Checkbox = require(script.Parent.Checkbox) +local React = require(flipbook.Packages.React) return { summary = "Generic checkbox used for story controls", diff --git a/src/Forms/Dropdown.story.luau b/src/Forms/Dropdown.story.luau index 7c87fa85..2e4821c1 100644 --- a/src/Forms/Dropdown.story.luau +++ b/src/Forms/Dropdown.story.luau @@ -1,7 +1,7 @@ local flipbook = script:FindFirstAncestor("flipbook") -local React = require(flipbook.Packages.React) local Dropdown = require(flipbook.Forms.Dropdown) +local React = require(flipbook.Packages.React) local controls = { useDefault = true, diff --git a/src/Forms/InputField.story.luau b/src/Forms/InputField.story.luau index c100e0bb..0c7ce07e 100644 --- a/src/Forms/InputField.story.luau +++ b/src/Forms/InputField.story.luau @@ -1,7 +1,7 @@ local flipbook = script:FindFirstAncestor("flipbook") -local React = require(flipbook.Packages.React) local InputField = require(script.Parent.InputField) +local React = require(flipbook.Packages.React) return { story = React.createElement(InputField, { diff --git a/src/Forms/Searchbar.luau b/src/Forms/Searchbar.luau index f14ecc29..7e24fd9e 100644 --- a/src/Forms/Searchbar.luau +++ b/src/Forms/Searchbar.luau @@ -1,14 +1,14 @@ local flipbook = script:FindFirstAncestor("flipbook") +local InputField = require(flipbook.Forms.InputField) local React = require(flipbook.Packages.React) local ReactSpring = require(flipbook.Packages.ReactSpring) local Sift = require(flipbook.Packages.Sift) +local Sprite = require(flipbook.Common.Sprite) local assets = require(flipbook.assets) local constants = require(flipbook.constants) -local useTheme = require(flipbook.Common.useTheme) local mapRanges = require(flipbook.Common.mapRanges) -local InputField = require(flipbook.Forms.InputField) -local Sprite = require(flipbook.Common.Sprite) +local useTheme = require(flipbook.Common.useTheme) local e = React.createElement diff --git a/src/Panels/DragHandle.luau b/src/Panels/DragHandle.luau index c3e6f02c..6476d80d 100644 --- a/src/Panels/DragHandle.luau +++ b/src/Panels/DragHandle.luau @@ -2,9 +2,9 @@ local flipbook = script:FindFirstAncestor("flipbook") local RunService = game:GetService("RunService") -local Sift = require(flipbook.Packages.Sift) -local React = require(flipbook.Packages.React) local PluginContext = require(flipbook.Plugin.PluginContext) +local React = require(flipbook.Packages.React) +local Sift = require(flipbook.Packages.Sift) local types = require(flipbook.Panels.types) local defaultProps = { diff --git a/src/Panels/ResizablePanel.luau b/src/Panels/ResizablePanel.luau index ac5441d4..21d5a4ba 100644 --- a/src/Panels/ResizablePanel.luau +++ b/src/Panels/ResizablePanel.luau @@ -1,8 +1,8 @@ local flipbook = script:FindFirstAncestor("flipbook") +local DragHandle = require(flipbook.Panels.DragHandle) local React = require(flipbook.Packages.React) local Sift = require(flipbook.Packages.Sift) -local DragHandle = require(flipbook.Panels.DragHandle) local types = require(flipbook.Panels.types) local defaultProps = { diff --git a/src/Panels/Sidebar.luau b/src/Panels/Sidebar.luau index 408e5016..255e1eeb 100644 --- a/src/Panels/Sidebar.luau +++ b/src/Panels/Sidebar.luau @@ -1,15 +1,15 @@ local flipbook = script:FindFirstAncestor("flipbook") -local React = require(flipbook.Packages.React) -local constants = require(flipbook.constants) -local createStoryNodes = require(flipbook.Storybook.createStoryNodes) local Branding = require(flipbook.Common.Branding) local ComponentTree = require(flipbook.Explorer) -local Searchbar = require(flipbook.Forms.Searchbar) +local React = require(flipbook.Packages.React) local ScrollingFrame = require(flipbook.Common.ScrollingFrame) -local useTheme = require(flipbook.Common.useTheme) -local storybookTypes = require(flipbook.Storybook.types) +local Searchbar = require(flipbook.Forms.Searchbar) +local constants = require(flipbook.constants) +local createStoryNodes = require(flipbook.Storybook.createStoryNodes) local explorerTypes = require(flipbook.Explorer.types) +local storybookTypes = require(flipbook.Storybook.types) +local useTheme = require(flipbook.Common.useTheme) type Storybook = storybookTypes.Storybook type ComponentTreeNode = explorerTypes.ComponentTreeNode diff --git a/src/Panels/Sidebar.story.luau b/src/Panels/Sidebar.story.luau index b332bb49..b4ca2a09 100644 --- a/src/Panels/Sidebar.story.luau +++ b/src/Panels/Sidebar.story.luau @@ -1,8 +1,8 @@ local flipbook = script:FindFirstAncestor("flipbook") local React = require(flipbook.Packages.React) -local internalStorybook = require(flipbook["init.storybook"]) local Sidebar = require(script.Parent.Sidebar) +local internalStorybook = require(flipbook["init.storybook"]) return { summary = "Sidebar containing brand, searchbar, and component tree", diff --git a/src/Plugin/PluginApp.luau b/src/Plugin/PluginApp.luau index ae341fe1..6f4abc74 100644 --- a/src/Plugin/PluginApp.luau +++ b/src/Plugin/PluginApp.luau @@ -1,13 +1,13 @@ local flipbook = script:FindFirstAncestor("flipbook") +local PluginContext = require(flipbook.Plugin.PluginContext) local React = require(flipbook.Packages.React) +local ResizablePanel = require(flipbook.Panels.ResizablePanel) +local Sidebar = require(flipbook.Panels.Sidebar) +local StoryCanvas = require(flipbook.Storybook.StoryCanvas) local constants = require(flipbook.constants) local useStorybooks = require(flipbook.Storybook.useStorybooks) local useTheme = require(flipbook.Common.useTheme) -local PluginContext = require(flipbook.Plugin.PluginContext) -local ResizablePanel = require(flipbook.Panels.ResizablePanel) -local StoryCanvas = require(flipbook.Storybook.StoryCanvas) -local Sidebar = require(flipbook.Panels.Sidebar) export type Props = { plugin: Plugin, diff --git a/src/Plugin/PluginApp.story.luau b/src/Plugin/PluginApp.story.luau index 32aef06e..5d1efe65 100644 --- a/src/Plugin/PluginApp.story.luau +++ b/src/Plugin/PluginApp.story.luau @@ -1,8 +1,8 @@ local flipbook = script:FindFirstAncestor("flipbook") -local React = require(flipbook.Packages.React) local ModuleLoader = require(flipbook.Packages.ModuleLoader) local PluginApp = require(script.Parent.PluginApp) +local React = require(flipbook.Packages.React) return { summary = "The main component that handles the entire plugin", diff --git a/src/Storybook/NoStorySelected.luau b/src/Storybook/NoStorySelected.luau index b59a48e7..78849b05 100644 --- a/src/Storybook/NoStorySelected.luau +++ b/src/Storybook/NoStorySelected.luau @@ -1,9 +1,9 @@ local flipbook = script:FindFirstAncestor("flipbook") local React = require(flipbook.Packages.React) +local Sprite = require(flipbook.Common.Sprite) local assets = require(flipbook.assets) local useTheme = require(flipbook.Common.useTheme) -local Sprite = require(flipbook.Common.Sprite) local e = React.createElement diff --git a/src/Storybook/NoStorySelected.story.luau b/src/Storybook/NoStorySelected.story.luau index f47cdbe8..ecd6f764 100644 --- a/src/Storybook/NoStorySelected.story.luau +++ b/src/Storybook/NoStorySelected.story.luau @@ -1,7 +1,7 @@ local flipbook = script:FindFirstAncestor("flipbook") -local React = require(flipbook.Packages.React) local NoStorySelected = require(script.Parent.NoStorySelected) +local React = require(flipbook.Packages.React) return { story = React.createElement(NoStorySelected), diff --git a/src/Storybook/StoryCanvas.luau b/src/Storybook/StoryCanvas.luau index 18dc5f84..f91dff6b 100644 --- a/src/Storybook/StoryCanvas.luau +++ b/src/Storybook/StoryCanvas.luau @@ -1,9 +1,9 @@ local flipbook = script:FindFirstAncestor("flipbook") -local React = require(flipbook.Packages.React) -local types = require(flipbook.Storybook.types) local NoStorySelected = require(flipbook.Storybook.NoStorySelected) +local React = require(flipbook.Packages.React) local StoryView = require(flipbook.Storybook.StoryView) +local types = require(flipbook.Storybook.types) local useTheme = require(flipbook.Common.useTheme) local e = React.createElement diff --git a/src/Storybook/StoryControls.luau b/src/Storybook/StoryControls.luau index b0d55ce1..bed36eab 100644 --- a/src/Storybook/StoryControls.luau +++ b/src/Storybook/StoryControls.luau @@ -2,10 +2,10 @@ local flipbook = script:FindFirstAncestor("flipbook") local React = require(flipbook.Packages.React) -local useTheme = require(flipbook.Common.useTheme) -local InputField = require(flipbook.Forms.InputField) local Checkbox = require(flipbook.Forms.Checkbox) local Dropdown = require(flipbook.Forms.Dropdown) +local InputField = require(flipbook.Forms.InputField) +local useTheme = require(flipbook.Common.useTheme) local e = React.createElement diff --git a/src/Storybook/StoryPreview.luau b/src/Storybook/StoryPreview.luau index 86e709e8..a4a704d8 100644 --- a/src/Storybook/StoryPreview.luau +++ b/src/Storybook/StoryPreview.luau @@ -4,11 +4,11 @@ local flipbook = script:FindFirstAncestor("flipbook") local React = require(flipbook.Packages.React) local ReactRoblox = require(flipbook.Packages.ReactRoblox) +local ScrollingFrame = require(flipbook.Common.ScrollingFrame) local Sift = require(flipbook.Packages.Sift) local StoryError = require(flipbook.Storybook.StoryError) -local ScrollingFrame = require(flipbook.Common.ScrollingFrame) -local types = require(flipbook.Storybook.types) local mountStory = require(flipbook.Storybook.mountStory) +local types = require(flipbook.Storybook.types) local e = React.createElement diff --git a/src/Storybook/StoryView.luau b/src/Storybook/StoryView.luau index b54b63fb..608daa7e 100644 --- a/src/Storybook/StoryView.luau +++ b/src/Storybook/StoryView.luau @@ -2,21 +2,21 @@ local flipbook = script:FindFirstAncestor("flipbook") local Selection = game:GetService("Selection") -local Sift = require(flipbook.Packages.Sift) +local PluginContext = require(flipbook.Plugin.PluginContext) local React = require(flipbook.Packages.React) +local ResizablePanel = require(flipbook.Panels.ResizablePanel) +local ScrollingFrame = require(flipbook.Common.ScrollingFrame) +local Sift = require(flipbook.Packages.Sift) +local StoryControls = require(flipbook.Storybook.StoryControls) +local StoryError = require(flipbook.Storybook.StoryError) +local StoryMeta = require(flipbook.Storybook.StoryMeta) +local StoryPreview = require(flipbook.Storybook.StoryPreview) +local StoryViewNavbar = require(flipbook.Storybook.StoryViewNavbar) local constants = require(flipbook.constants) local types = require(flipbook.Storybook.types) local useStory = require(flipbook.Storybook.useStory) local useTheme = require(flipbook.Common.useTheme) local useZoom = require(flipbook.Common.useZoom) -local StoryViewNavbar = require(flipbook.Storybook.StoryViewNavbar) -local StoryControls = require(flipbook.Storybook.StoryControls) -local StoryMeta = require(flipbook.Storybook.StoryMeta) -local StoryPreview = require(flipbook.Storybook.StoryPreview) -local StoryError = require(flipbook.Storybook.StoryError) -local ResizablePanel = require(flipbook.Panels.ResizablePanel) -local ScrollingFrame = require(flipbook.Common.ScrollingFrame) -local PluginContext = require(flipbook.Plugin.PluginContext) local e = React.createElement diff --git a/src/Storybook/StoryViewNavbar.luau b/src/Storybook/StoryViewNavbar.luau index d56acc81..0516a62b 100644 --- a/src/Storybook/StoryViewNavbar.luau +++ b/src/Storybook/StoryViewNavbar.luau @@ -1,9 +1,9 @@ local flipbook = script:FindFirstAncestor("flipbook") -local React = require(flipbook.Packages.React) -local assets = require(flipbook.assets) local Navigation = require(flipbook.Navigation) +local React = require(flipbook.Packages.React) local Sprite = require(flipbook.Common.Sprite) +local assets = require(flipbook.assets) local useTheme = require(flipbook.Common.useTheme) local e = React.createElement diff --git a/src/Storybook/createStoryNodes.luau b/src/Storybook/createStoryNodes.luau index 83cf7dee..ce38c8f7 100644 --- a/src/Storybook/createStoryNodes.luau +++ b/src/Storybook/createStoryNodes.luau @@ -1,8 +1,8 @@ local flipbook = script:FindFirstAncestor("flipbook") +local explorerTypes = require(flipbook.Explorer.types) local isStoryModule = require(flipbook.Storybook.isStoryModule) local storybookTypes = require(flipbook.Storybook.types) -local explorerTypes = require(flipbook.Explorer.types) type Storybook = storybookTypes.Storybook type ComponentTreeNode = explorerTypes.ComponentTreeNode diff --git a/src/Storybook/useStory.luau b/src/Storybook/useStory.luau index e1da0929..f209e4bf 100644 --- a/src/Storybook/useStory.luau +++ b/src/Storybook/useStory.luau @@ -1,8 +1,8 @@ local flipbook = script:FindFirstAncestor("flipbook") local React = require(flipbook.Packages.React) -local types = require(flipbook.Storybook.types) local loadStoryModule = require(flipbook.Storybook.loadStoryModule) +local types = require(flipbook.Storybook.types) local function useStory(module: ModuleScript, storybook: types.Storybook, loader: any): (types.Story?, string?) local state, setState = React.useState({ diff --git a/src/Storybook/useStorybooks.luau b/src/Storybook/useStorybooks.luau index 6aad1426..af94ecc6 100644 --- a/src/Storybook/useStorybooks.luau +++ b/src/Storybook/useStorybooks.luau @@ -2,8 +2,8 @@ local flipbook = script:FindFirstAncestor("flipbook") local React = require(flipbook.Packages.React) local constants = require(flipbook.constants) -local types = require(flipbook.Storybook.types) local isStorybookModule = require(flipbook.Storybook.isStorybookModule) +local types = require(flipbook.Storybook.types) local useDescendants = require(flipbook.Common.useDescendants) local function hasPermission(instance: Instance) diff --git a/src/init.server.luau b/src/init.server.luau index 17fc85bf..7f945180 100644 --- a/src/init.server.luau +++ b/src/init.server.luau @@ -7,12 +7,12 @@ if RunService:IsRunning() or not RunService:IsEdit() then end local ModuleLoader = require(flipbook.Packages.ModuleLoader) +local PluginApp = require(flipbook.Plugin.PluginApp) local React = require(flipbook.Packages.React) local ReactRoblox = require(flipbook.Packages.ReactRoblox) -local createWidget = require(flipbook.Plugin.createWidget) -local createToggleButton = require(flipbook.Plugin.createToggleButton) -local PluginApp = require(flipbook.Plugin.PluginApp) local constants = require(flipbook.constants) +local createToggleButton = require(flipbook.Plugin.createToggleButton) +local createWidget = require(flipbook.Plugin.createWidget) local PLUGIN_NAME = "flipbook" diff --git a/stylua.toml b/stylua.toml new file mode 100644 index 00000000..ed2de717 --- /dev/null +++ b/stylua.toml @@ -0,0 +1,2 @@ +[sort_requires] +enabled = true