-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Summary of changes: * Attempted to spruce up the ModuleLoader class' types for consumers * Bumped Foreman tool versions * Imported Lune scripts from flipbook repo * Setup string requires * Updated GitHub workflows to work with Lune scripts * Renamed all .lua files to .luau * Require statements are auto-sorted with stylua * Tests are run with Jest 3 Closes #20
- Loading branch information
Showing
59 changed files
with
1,445 additions
and
974 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" | ||
] | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,34 @@ | ||
name: Release | ||
|
||
on: | ||
pull_request: | ||
release: | ||
types: [published] | ||
|
||
env: | ||
OUTPUT_NAME: "ModuleLoader.rbxm" | ||
|
||
jobs: | ||
publish: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Install toolchain | ||
uses: Roblox/setup-foreman@v1 | ||
- uses: Roblox/setup-foreman@v1 | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Remove spec files | ||
run: rm -rf **/*.spec.lua | ||
- name: Get model file name | ||
run: | | ||
name=$(jq -r .name default.project.json) | ||
echo "MODEL_FILE=$name.rbxm" >> $GITHUB_ENV | ||
- name: Install packages | ||
run: lune run wally-install | ||
|
||
- name: Build | ||
run: rojo build -o ${{ env.OUTPUT_NAME }} | ||
run: lune run build -- --target prod --output ${{ env.MODEL_FILE }} | ||
|
||
- name: Add model file to release | ||
uses: softprops/action-gh-release@v1 | ||
- uses: softprops/action-gh-release@v1 | ||
if: ${{ github.event.release }} | ||
with: | ||
files: ${{ env.OUTPUT_NAME }} | ||
files: ${{ env.MODEL_FILE }} | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,11 @@ | ||
# Rojo | ||
/*.rbxl* | ||
/*.rbxm* | ||
sourcemap.json | ||
|
||
# Luau | ||
dist/ | ||
sourcemap*.json | ||
globalTypes.d.luau | ||
|
||
# Selene | ||
/roblox.toml | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"aliases": { | ||
"pkg": "./Packages", | ||
"root": "./src" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
local project = require("../project") | ||
local run = require("./lib/run") | ||
|
||
local globalDefsPath = "globalTypes.d.luau" | ||
|
||
run("curl", { | ||
"-s", | ||
"-o", | ||
globalDefsPath, | ||
"-O", | ||
"https://raw.githubusercontent.com/JohnnyMorganz/luau-lsp/master/scripts/globalTypes.d.lua", | ||
}) | ||
|
||
run("rojo", { | ||
"sourcemap", | ||
project.ROJO_ANALYSIS_PROJECT, | ||
"-o", | ||
project.SOURCEMAP_PATH, | ||
}) | ||
|
||
run("luau-lsp", { | ||
"analyze", | ||
`--sourcemap={project.SOURCEMAP_PATH}`, | ||
`--defs={globalDefsPath}`, | ||
"--settings=./.vscode/settings.json", | ||
"--ignore=**/_Index/**", | ||
project.SOURCE_PATH, | ||
project.LUNE_SCRIPTS_PATH, | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
local compile = require("./lib/compile") | ||
local parseArgs = require("./lib/parseArgs") | ||
local process = require("@lune/process") | ||
local project = require("../project") | ||
local run = require("./lib/run") | ||
local watch = require("./lib/watcher/watch") | ||
|
||
local args = parseArgs(process.args) | ||
|
||
local target = if args.target then args.target else "prod" | ||
|
||
local function build() | ||
run("rm", { "-rf", project.BUILD_PATH }) | ||
compile(target) | ||
|
||
if target == "prod" then | ||
run("rm", { "-rf", `{project.BUILD_PATH}/**/*.spec.luau` }) | ||
end | ||
end | ||
|
||
build() | ||
|
||
if args.watch then | ||
watch({ | ||
filePatterns = { | ||
"src/.*%.luau", | ||
"example/.*%.luau", | ||
}, | ||
onChanged = build, | ||
}) | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
local fs = require("@lune/fs") | ||
|
||
local project = require("../../project") | ||
local run = require("./run") | ||
|
||
type Target = "prod" | "dev" | ||
|
||
local function compile(target: Target) | ||
fs.writeDir(project.BUILD_PATH) | ||
|
||
run("rojo", { | ||
"sourcemap", | ||
project.ROJO_BUILD_PROJECT, | ||
"-o", | ||
project.DARKLUA_SOURCEMAP_PATH, | ||
}) | ||
|
||
run("darklua", { | ||
"process", | ||
project.SOURCE_PATH, | ||
project.BUILD_PATH, | ||
}) | ||
|
||
if target == "dev" then | ||
run("darklua", { | ||
"process", | ||
"example", | ||
`{project.BUILD_PATH}/Example`, | ||
}) | ||
end | ||
end | ||
|
||
return compile |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
local run = require("./run") | ||
|
||
local function findClientSettings(os: string) | ||
if os == "macos" then | ||
return "/Applications/RobloxStudio.app/Contents/MacOS/ClientSettings" | ||
elseif os == "windows" then | ||
local robloxStudioPath = run("find", { | ||
"$LOCALAPPDATA/Roblox/Versions", | ||
"-name", | ||
"RobloxStudioBeta.exe", | ||
}) | ||
|
||
local dir = run("dirname", { | ||
robloxStudioPath, | ||
}) | ||
|
||
return `{dir}/ClientSettings` | ||
else | ||
return nil | ||
end | ||
end | ||
|
||
return findClientSettings |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
local fs = require("@lune/fs") | ||
|
||
local function findFilesByPattern(rootPath: string, pattern: string) | ||
local matches = {} | ||
|
||
local function search(path: string) | ||
for _, file in fs.readDir(path) do | ||
local filePath = `{path}/{file}` | ||
|
||
if fs.isDir(filePath) then | ||
search(filePath) | ||
else | ||
if filePath:match(pattern) then | ||
table.insert(matches, filePath) | ||
end | ||
end | ||
end | ||
end | ||
|
||
search(rootPath) | ||
|
||
return matches | ||
end | ||
|
||
return findFilesByPattern |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
local FLAG_PATTERN = "%-%-(%w+)" | ||
local FLAG_ALL_IN_ONE_PATTERN = `{FLAG_PATTERN}=(%w+)` | ||
|
||
local function parseArgs(args: { string }): { [string]: string | boolean | number } | ||
local parsedArgs: { [string]: string } = {} | ||
local skipNextToken = false | ||
|
||
for index, token in args do | ||
-- When `--foo bar` is used, these are both individual tokens that we | ||
-- process at the same time. In those cases, we need to skip the next | ||
-- token (`bar`) since it has already been picked up as a flag value | ||
if skipNextToken then | ||
skipNextToken = false | ||
continue | ||
end | ||
|
||
-- handle `--foo=bar` pattern | ||
local flagName, flagValue = token:match(FLAG_ALL_IN_ONE_PATTERN) | ||
if flagName and flagValue then | ||
parsedArgs[flagName] = flagValue | ||
continue | ||
end | ||
|
||
flagName = token:match(FLAG_PATTERN) | ||
if flagName then | ||
local nextToken = args[index + 1] | ||
|
||
if nextToken then | ||
-- When processing `--foo` in `--foo --bar` treat it like a boolean | ||
if nextToken:match(FLAG_PATTERN) then | ||
flagValue = true | ||
else | ||
flagValue = nextToken | ||
skipNextToken = true | ||
end | ||
else | ||
flagValue = true | ||
end | ||
|
||
parsedArgs[flagName] = flagValue | ||
else | ||
error(`something went wrong: {token}`) | ||
end | ||
end | ||
|
||
return parsedArgs | ||
end | ||
|
||
return parseArgs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
local fs = require("@lune/fs") | ||
|
||
local function rmrf(path: string) | ||
if fs.isDir(path) then | ||
fs.removeDir(path) | ||
else | ||
fs.removeFile(path) | ||
end | ||
end | ||
|
||
return rmrf |
Oops, something went wrong.