Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Darklua for string requires #239

Merged
merged 34 commits into from
Apr 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
b69f17e
Setup darklua building
vocksel Mar 3, 2024
6b4d710
Use string requires
vocksel Mar 3, 2024
cf9488a
Update Selene to support string required
vocksel Mar 3, 2024
5a34a2d
Add settings for luau-lsp
vocksel Mar 3, 2024
e5f97c4
Setup CI with Just commands
vocksel Mar 3, 2024
d4924c6
Fix use of env var
vocksel Mar 3, 2024
a317640
Update example to use string requires
vocksel Mar 3, 2024
473d6d0
Missed a couple
vocksel Mar 21, 2024
f4a8b67
Builds work :)
vocksel Mar 21, 2024
235050c
Merge remote-tracking branch 'origin/main' into darklua
vocksel Apr 12, 2024
e9aaa8d
Fix path
vocksel Apr 12, 2024
77b9acb
Update filterComponentTreeNode with string requires
vocksel Apr 12, 2024
af2c807
Merge remote-tracking branch 'origin/main' into darklua
vocksel Apr 12, 2024
1127dd2
Fix `just init`
vocksel Apr 12, 2024
2607ea1
Merge remote-tracking branch 'origin/main' into darklua
vocksel Apr 16, 2024
b8d6316
Merge branch 'darklua' of https://github.com/flipbook-labs/flipbook i…
vocksel Apr 16, 2024
3e12f67
Consolidate justfiles
vocksel Apr 16, 2024
8c07ddc
Workflow updates
vocksel Apr 16, 2024
9cd965a
Define aliases in .luaurc
vocksel Apr 16, 2024
3328ed8
Revert path change for test runner
vocksel Apr 16, 2024
265b2f7
Fix whitespace in justfile
vocksel Apr 16, 2024
790623c
Get initialization working
vocksel Apr 16, 2024
b656b6d
Update vscode tasks
vocksel Apr 16, 2024
b1e2ef4
Try to fix up CI issues
vocksel Apr 16, 2024
25b3b0a
sh -> bash
vocksel Apr 16, 2024
08e3411
Build here
vocksel Apr 16, 2024
55ba13c
Merge remote-tracking branch 'origin/main' into darklua
vocksel Apr 21, 2024
340ea61
Ignore build dir
vocksel Apr 21, 2024
acd38c7
Merge remote-tracking branch 'origin/main' into darklua
vocksel Apr 22, 2024
a4a81d5
Fix mac tests
vocksel Apr 22, 2024
25336c3
Get all tests running
vocksel Apr 22, 2024
bf985cb
Build production releases
vocksel Apr 22, 2024
f66c384
Set name
vocksel Apr 22, 2024
aacde80
Fix wally-install
vocksel Apr 22, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions .darklua.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"process": [
{
"rule": "convert_require",
"current": {
"name": "path",
"sources": {
"@pkg": "./Packages",
"@root": "./src"
}
},
"target": {
"name": "roblox",
"rojo_sourcemap": "./sourcemap-darklua.json",
"indexing_style": "property"
}
},
"compute_expression",
"remove_unused_if_branch",
"remove_unused_while",
"filter_after_early_return",
"remove_nil_declaration",
"remove_empty_do"
]
}
5 changes: 4 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,11 @@ jobs:
sha=${GITHUB_SHA:0:7}
echo "MODEL_FILE=$name-$sha.rbxm" >> $GITHUB_ENV

- name: Initialize the project
run: just init

- name: Build
run: rojo build -o ${{ env.MODEL_FILE }}
run: just build-here prod ${{ env.MODEL_FILE }}

- uses: actions/upload-artifact@v3
with:
Expand Down
13 changes: 6 additions & 7 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,23 +11,22 @@ jobs:
steps:
- uses: actions/checkout@v3

- uses: extractions/setup-just@v1

- uses: Roblox/setup-foreman@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}

- name: Remove spec files
run: rm -rf **/*.spec.luau

- name: Install packages
run: wally install

- name: Get model file name
run: |
name=$(jq -r .name default.project.json)
echo "MODEL_FILE=$name.rbxm" >> $GITHUB_ENV

- name: Initialize the project
run: just init

- name: Build
run: rojo build -o ${{ env.MODEL_FILE }}
run: just build-here prod ${{ env.MODEL_FILE }}

- uses: softprops/action-gh-release@v1
if: ${{ github.event.release }}
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Darklua
build

# Rojo
/*.rbxl*
/*.rbxm*
Expand Down
6 changes: 6 additions & 0 deletions .luaurc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"aliases": {
"pkg": "./Packages",
"root": "./src"
}
}
17 changes: 16 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
{
"luau-lsp.sourcemap.rojoProjectFile": "tests.project.json"
"luau-lsp.sourcemap.rojoProjectFile": "analysis.project.json",
"luau-lsp.types.definitionFiles": [
"testez.d.lua"
],
"luau-lsp.require.mode": "relativeToFile",
"luau-lsp.ignoreGlobs": [
"**/_Index/**",
"**/build/**"
],
"luau-lsp.require.directoryAliases": {
"@pkg": "./Packages",
"@root": "./src"
},
"files.associations": {
"*.luau": "lua"
}
}
37 changes: 18 additions & 19 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,20 @@
"label": "Install packages",
"type": "shell",
"problemMatcher": [],
"command": "./bin/wally-install.sh"
"command": "just",
"args": [
"wally-install"
]
},
{
"label": "Build (Development)",
"type": "shell",
"problemMatcher": [],
"windows": {
"command": "rojo build dev.project.json -o $LOCALAPPDATA/Roblox/Plugins/flipbook.rbxm"
},
"osx": {
"command": "rojo build dev.project.json -o ~/Documents/Roblox/Plugins/flipbook.rbxm"
},
"command": "just",
"args": [
"build",
"dev"
],
"group": {
"kind": "build",
"isDefault": true
Expand All @@ -28,12 +30,11 @@
"label": "Build (Production)",
"type": "shell",
"problemMatcher": [],
"windows": {
"command": "rojo build -o $LOCALAPPDATA/Roblox/Plugins/flipbook.rbxm"
},
"osx": {
"command": "rojo build -o ~/Documents/Roblox/Plugins/flipbook.rbxm"
},
"command": "just",
"args": [
"build",
"prod"
],
"group": {
"kind": "build",
}
Expand All @@ -42,12 +43,10 @@
"label": "Build and watch",
"type": "shell",
"problemMatcher": [],
"windows": {
"command": "rojo build dev.project.json -o $LOCALAPPDATA/Roblox/Plugins/flipbook.rbxm --watch"
},
"osx": {
"command": "rojo build dev.project.json -o ~/Documents/Roblox/Plugins/flipbook.rbxm --watch",
}
"command": "just",
"args": [
"build-watch",
]
},
{
"label": "Serve docs",
Expand Down
12 changes: 12 additions & 0 deletions analysis.project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"name": "flipbook",
"tree": {
"TestRunner": {
"$path": "tests"
},
"Example": {
"$path": "example"
},
"$path": "build.project.json"
}
}
5 changes: 4 additions & 1 deletion dev.project.json → build.project.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
{
"name": "flipbook",
"tree": {
"Packages": {
"$path": "Packages"
},
"Example": {
"$path": "example"
},
"$path": "default.project.json"
"$path": "src"
}
}
4 changes: 2 additions & 2 deletions default.project.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
"Packages": {
"$path": "Packages"
},
"$path": "src"
"$path": "build"
}
}
}
8 changes: 3 additions & 5 deletions example/ArrayControls.story.luau
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
local Example = script:FindFirstAncestor("Example")

local React = require(Example.Parent.Packages.React)
local ReactRoblox = require(Example.Parent.Packages.ReactRoblox)
local Sift = require(Example.Parent.Packages.Sift)
local React = require("@pkg/React")
local ReactRoblox = require("@pkg/ReactRoblox")
local Sift = require("@pkg/Sift")

local fonts = Sift.Array.sort(Enum.Font:GetEnumItems(), function(a: Enum.Font, z: Enum.Font)
return a.Name < z.Name
Expand Down
4 changes: 1 addition & 3 deletions example/Button.luau
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
local Example = script:FindFirstAncestor("Example")

local Roact = require(Example.Parent.Packages.Roact)
local Roact = require("@pkg/Roact")

export type Props = {
text: string,
Expand Down
6 changes: 2 additions & 4 deletions example/Button.story.luau
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
local Example = script:FindFirstAncestor("Example")

local Button = require(script.Parent.Button)
local Roact = require(Example.Parent.Packages.Roact)
local Button = require("./Button")
local Roact = require("@pkg/Roact")

return {
summary = "A generic button component that can be used anywhere",
Expand Down
4 changes: 1 addition & 3 deletions example/ButtonWithControls.luau
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
local Example = script:FindFirstAncestor("Example")

local Roact = require(Example.Parent.Packages.Roact)
local Roact = require("@pkg/Roact")

export type Props = {
text: string,
Expand Down
6 changes: 2 additions & 4 deletions example/ButtonWithControls.story.luau
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
local Example = script:FindFirstAncestor("Example")

local ButtonWithControls = require(script.Parent.ButtonWithControls)
local Roact = require(Example.Parent.Packages.Roact)
local ButtonWithControls = require("./ButtonWithControls")
local Roact = require("@pkg/Roact")

local controls = {
isDisabled = false,
Expand Down
6 changes: 2 additions & 4 deletions example/CanvasTests/AutomaticSize.story.luau
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
local Example = script:FindFirstAncestor("Example")

local React = require(Example.Parent.Packages.React)
local ReactRoblox = require(Example.Parent.Packages.ReactRoblox)
local React = require("@pkg/React")
local ReactRoblox = require("@pkg/ReactRoblox")

return {
summary = "AutoamticSize test for the story preview",
Expand Down
6 changes: 2 additions & 4 deletions example/CanvasTests/AutomaticSizeExceedsBounds.story.luau
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
local Example = script:FindFirstAncestor("Example")

local React = require(Example.Parent.Packages.React)
local ReactRoblox = require(Example.Parent.Packages.ReactRoblox)
local React = require("@pkg/React")
local ReactRoblox = require("@pkg/ReactRoblox")

return {
summary = "AutoamticSize test using a height that exceeds the story preview",
Expand Down
6 changes: 2 additions & 4 deletions example/CanvasTests/Offset.story.luau
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
local Example = script:FindFirstAncestor("Example")

local React = require(Example.Parent.Packages.React)
local ReactRoblox = require(Example.Parent.Packages.ReactRoblox)
local React = require("@pkg/React")
local ReactRoblox = require("@pkg/ReactRoblox")

return {
summary = "Offset test for the story preview",
Expand Down
6 changes: 2 additions & 4 deletions example/CanvasTests/Resizing.story.luau
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
local Example = script:FindFirstAncestor("Example")

local RunService = game:GetService("RunService")

local React = require(Example.Parent.Packages.React)
local ReactRoblox = require(Example.Parent.Packages.ReactRoblox)
local React = require("@pkg/React")
local ReactRoblox = require("@pkg/ReactRoblox")

local RESIZE_DURATIOn = 3 -- seconds
local MAX_SIZE = 2000 -- px
Expand Down
6 changes: 2 additions & 4 deletions example/CanvasTests/Scale.story.luau
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
local Example = script:FindFirstAncestor("Example")

local React = require(Example.Parent.Packages.React)
local ReactRoblox = require(Example.Parent.Packages.ReactRoblox)
local React = require("@pkg/React")
local ReactRoblox = require("@pkg/ReactRoblox")

return {
summary = "Scale test for the story preview",
Expand Down
6 changes: 2 additions & 4 deletions example/CanvasTests/ScrollingFrame.story.luau
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
local Example = script:FindFirstAncestor("Example")

local React = require(Example.Parent.Packages.React)
local ReactRoblox = require(Example.Parent.Packages.ReactRoblox)
local React = require("@pkg/React")
local ReactRoblox = require("@pkg/ReactRoblox")

return {
summary = "ScrollingFrame test for the story preview",
Expand Down
4 changes: 1 addition & 3 deletions example/Counter.luau
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
local Example = script:FindFirstAncestor("Example")

local Roact = require(Example.Parent.Packages.Roact)
local Roact = require("@pkg/Roact")

local Counter = Roact.Component:extend("Counter")

Expand Down
6 changes: 2 additions & 4 deletions example/Counter.story.luau
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
local Example = script:FindFirstAncestor("Example")

local Counter = require(script.Parent.Counter)
local Roact = require(Example.Parent.Packages.Roact)
local Counter = require("./Counter")
local Roact = require("@pkg/Roact")

local controls = {
increment = 1,
Expand Down
4 changes: 1 addition & 3 deletions example/Hoarcekat.story.luau
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
local Example = script:FindFirstAncestor("Example")

local Roact = require(Example.Parent.Packages.Roact)
local Roact = require("@pkg/Roact")

return function(target: Instance)
local root = Roact.createElement("TextLabel", {
Expand Down
4 changes: 1 addition & 3 deletions example/ReactCounter.luau
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
local Example = script:FindFirstAncestor("Example")

local React = require(Example.Parent.Packages.React)
local React = require("@pkg/React")

export type Props = {
increment: number,
Expand Down
8 changes: 3 additions & 5 deletions example/ReactCounter.story.luau
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
local Example = script:FindFirstAncestor("Example")

local React = require(Example.Parent.Packages.React)
local ReactCounter = require(script.Parent.ReactCounter)
local ReactRoblox = require(Example.Parent.Packages.ReactRoblox)
local React = require("@pkg/React")
local ReactCounter = require("./ReactCounter")
local ReactRoblox = require("@pkg/ReactRoblox")

local controls = {
increment = 1,
Expand Down
1 change: 1 addition & 0 deletions foreman.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
[tools]
rojo = { source = "rojo-rbx/rojo", version = "7.2.1" }
darklua = { source = "seaofvoices/darklua", version = "0.12.1" }
run-in-roblox = { source = "rojo-rbx/run-in-roblox", version = "0.3.0" }
selene = { source = "kampfkarren/selene", version = "0.25.0" }
stylua = { source = "JohnnyMorganz/StyLua", version = "0.17.1" }
Expand Down
Loading
Loading