Skip to content

Commit

Permalink
Refactor project to a rotriever workspace (#146)
Browse files Browse the repository at this point in the history
  • Loading branch information
RoFlection Bot committed Aug 29, 2022
1 parent f589f1f commit a4c66a9
Show file tree
Hide file tree
Showing 190 changed files with 661 additions and 360 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ Packages/_Workspace/*
# Local IDE settings
.vscode
.idea/
sourcemap.json

# Code coverage data files
**/luacov.*
Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

## Unreleased

* Refactor structure to a rotriever workspace

## 1.0.0

* add `indexOf` method to `String` type
Expand Down
6 changes: 3 additions & 3 deletions bin/ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ find Packages/Dev -name "*.robloxrc" | xargs rm -f
find Packages/_Index -name "*.robloxrc" | xargs rm -f
echo "Run static analysis"
roblox-cli analyze test-model.project.json
selene src
stylua -c src
selene modules
stylua -c modules
echo "Run tests in DEV"
roblox-cli run --load.model test-model.project.json --run bin/spec.lua --lua.globals=__DEV__=true
echo "Run tests in release"
roblox-cli run --load.model model.rbxmx --run bin/spec.lua
roblox-cli run --load.model model.rbxmx --run bin/spec.lua
7 changes: 2 additions & 5 deletions bin/spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,10 @@ local Root = script.Parent.LuauPolyfillTestModel

local Packages = Root.Packages
-- Load JestRoblox source into Packages folder so it's next to Roact as expected
local TestEZ= require(Root.Packages.Dev.TestEZ)
local TestEZ = require(Packages._Workspace:FindFirstChild("TestEZ", true))

-- Run all tests, collect results, and report to stdout.
local result = TestEZ.TestBootstrap:run(
{ Packages.LuauPolyfill },
TestEZ.Reporters.TextReporterQuiet
)
local result = TestEZ.TestBootstrap:run({ Packages._Workspace }, TestEZ.Reporters.TextReporterQuiet)

if result.failureCount == 0 and #result.errors == 0 then
ProcessService:ExitAsync(0)
Expand Down
2 changes: 1 addition & 1 deletion default.project.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "RobloxLuauPolyfill",
"tree": {
"$path": "src"
"$path": "modules"
}
}
6 changes: 6 additions & 0 deletions modules/boolean/default.project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"name": "Boolean",
"tree": {
"$path": "src"
}
}
12 changes: 12 additions & 0 deletions modules/boolean/rotriever.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[package]
name = "Boolean"
version = { workspace = true }
authors = { workspace = true }
content_root = "src"
files = ["*", "!**/__tests__/**"]

[dependencies]
Number = { path = "../number" }

[dev_dependencies]
JestGlobals = { workspace = true }
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ return function()
local Boolean = script.Parent.Parent
local toJSBoolean = require(Boolean.toJSBoolean)

local LuauPolyfill = Boolean.Parent
local Packages = LuauPolyfill.Parent
local Packages = Boolean.Parent
local JestGlobals = require(Packages.Dev.JestGlobals)
local jestExpect = JestGlobals.expect

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
* limitations under the License.
]]
--!strict
local Polyfills = script.Parent.Parent
local Number = require(Polyfills.Number)
local Packages = script.Parent.Parent
local Number = require(Packages.Number)

-- https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean
return function(val: any): boolean
Expand Down
15 changes: 15 additions & 0 deletions modules/collections/rotriever.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
[package]
name = "Collections"
version = { workspace = true }
authors = { workspace = true }
content_root = "src"
files = ["*", "!**/__tests__/**"]

[dependencies]
InstanceOf = { path = "../instance-of" }
ES7Types = { path = "../es7-types" }

[dev_dependencies]
Number = { path = "../number" }
JestGlobals = { workspace = true }
Promise = { workspace = true }
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@
-- https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/concat
return function()
local Array = script.Parent.Parent
local LuauPolyfill = Array.Parent
local concat = require(Array.concat)
local types = require(LuauPolyfill.types)
type Array<T> = types.Array<T>
local Packages = Array.Parent.Parent

local Packages = LuauPolyfill.Parent
local concat = require(Array.concat)
local types = require(Packages.ES7Types)
local JestGlobals = require(Packages.Dev.JestGlobals)
local jestExpect = JestGlobals.expect

type Array<T> = types.Array<T>

it("concatenate arrays with single values", function()
jestExpect(concat({ 1 })).toEqual({ 1 })
jestExpect(concat({ 1 }, { 2 })).toEqual({ 1, 2 })
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,9 @@
-- https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/every
return function()
local Array = script.Parent.Parent
local LuauPolyfill = Array.Parent
local every = require(Array.every)
local Packages = Array.Parent.Parent

local Packages = LuauPolyfill.Parent
local every = require(Array.every)
local JestGlobals = require(Packages.Dev.JestGlobals)
local jestExpect = JestGlobals.expect

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,16 @@

return function()
local Array = script.Parent.Parent
local LuauPolyfill = Array.Parent
local types = require(LuauPolyfill.types)
type Array<T> = types.Array<T>
local filter = require(Array.filter)
local isFinite = require(LuauPolyfill.Number.isFinite)
local Packages = Array.Parent.Parent

local Packages = LuauPolyfill.Parent
local types = require(Packages.ES7Types)
local filter = require(Array.filter)
local isFinite = require(Packages.Dev.Number).isFinite
local JestGlobals = require(Packages.Dev.JestGlobals)
local jestExpect = JestGlobals.expect

type Array<T> = types.Array<T>

it("Filtering out all small values", function()
local isBigEnough = function(value)
return value >= 10
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@
]]
return function()
local Array = script.Parent.Parent
local LuauPolyfill = Array.Parent
local types = require(LuauPolyfill.types)
type Array<T> = types.Array<T>
local find = require(Array.find)
local Packages = Array.Parent.Parent

local Packages = LuauPolyfill.Parent
local find = require(Array.find)
local types = require(Packages.ES7Types)
local JestGlobals = require(Packages.Dev.JestGlobals)
local jestExpect = JestGlobals.expect

type Array<T> = types.Array<T>

local function returnTrue()
return true
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@
]]
return function()
local Array = script.Parent.Parent
local LuauPolyfill = Array.Parent
local types = require(LuauPolyfill.types)
type Array<T> = types.Array<T>
local findIndex = require(Array.findIndex)
local Packages = Array.Parent.Parent

local Packages = LuauPolyfill.Parent
local findIndex = require(Array.findIndex)
local types = require(Packages.ES7Types)
local JestGlobals = require(Packages.Dev.JestGlobals)
local jestExpect = JestGlobals.expect

type Array<T> = types.Array<T>

local function returnTrue()
return true
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,16 @@
-- https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach
return function()
local Array = script.Parent.Parent
type Array<T> = { [number]: T }
local LuauPolyfill = Array.Parent
local Packages = Array.Parent.Parent

local forEach = require(Array.forEach)
local isArray = require(Array.isArray)
local types = require(Packages.ES7Types)
local JestGlobals = require(Packages.Dev.JestGlobals)
local jestExpect = JestGlobals.expect
local jest = JestGlobals.jest

local Packages = LuauPolyfill.Parent
local JestModule = require(Packages.Dev.JestGlobals)
local jestExpect = JestModule.expect
local jest = JestModule.jest
type Array<T> = types.Array<T>

it("Invalid argument", function()
-- roblox-cli analyze fails because forEach is called with an
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,18 @@
-- https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/from
return function()
local Array = script.Parent.Parent
local LuauPolyfill = Array.Parent
local types = require(LuauPolyfill.types)
type Array<T> = types.Array<T>
local from = require(Array.from)
local Set = require(LuauPolyfill).Set
local Map = require(LuauPolyfill).Map
local Collections = Array.Parent
local Packages = Collections.Parent

local Packages = LuauPolyfill.Parent
local types = require(Packages.ES7Types)
local from = require(Array.from)
local Set = require(Collections.Set)
local Map = require(Collections.Map.Map)
local JestGlobals = require(Packages.Dev.JestGlobals)
local jestExpect = JestGlobals.expect

type Array<T> = types.Array<T>

it("creates a array of characters given a string", function()
jestExpect(from("bar")).toEqual({ "b", "a", "r" })
end)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@
-- https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/includes
return function()
local Array = script.Parent.Parent
local LuauPolyfill = Array.Parent
local Packages = Array.Parent.Parent

local includes = require(Array.includes)

local Packages = LuauPolyfill.Parent
local JestGlobals = require(Packages.Dev.JestGlobals)
local jestExpect = JestGlobals.expect

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@
-- https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/indexOf
return function()
local Array = script.Parent.Parent
local LuauPolyfill = Array.Parent
local Packages = Array.Parent.Parent

local indexOf = require(Array.indexOf)

local Packages = LuauPolyfill.Parent
local JestGlobals = require(Packages.Dev.JestGlobals)
local jestExpect = JestGlobals.expect

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@
-- https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/isArray
return function()
local Array = script.Parent.Parent
local LuauPolyfill = Array.Parent
local types = require(LuauPolyfill.types)
local Packages = Array.Parent.Parent

local types = require(Packages.ES7Types)
type Array<T> = types.Array<T>
local isArray = require(Array.isArray)

local Packages = LuauPolyfill.Parent
local JestGlobals = require(Packages.Dev.JestGlobals)
local jestExpect = JestGlobals.expect

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,12 @@
]]
return function()
local Array = script.Parent.Parent
local LuauPolyfill = Array.Parent
local Collections = Array.Parent
local Packages = Collections.Parent

local join = require(Array.join)
local Set = require(LuauPolyfill.Set)
local Set = require(Collections.Set)

local Packages = LuauPolyfill.Parent
local JestGlobals = require(Packages.Dev.JestGlobals)
local jestExpect = JestGlobals.expect

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@
-- https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map
return function()
local Array = script.Parent.Parent
local LuauPolyfill = Array.Parent
local Packages = Array.Parent.Parent

local map = require(Array.map)

local Packages = LuauPolyfill.Parent
local JestGlobals = require(Packages.Dev.JestGlobals)
local jestExpect = JestGlobals.expect

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@
-- https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reduce
return function()
local Array = script.Parent.Parent
local LuauPolyfill = Array.Parent
local types = require(LuauPolyfill.types)
local Packages = Array.Parent.Parent

local types = require(Packages.ES7Types)
type Array<T> = types.Array<T>
local reduce = require(Array.reduce)

local Packages = LuauPolyfill.Parent
local JestGlobals = require(Packages.Dev.JestGlobals)
local jestExpect = JestGlobals.expect

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@
]]
return function()
local Array = script.Parent.Parent
local LuauPolyfill = Array.Parent
local Packages = Array.Parent.Parent

local reverse = require(Array.reverse)

local Packages = LuauPolyfill.Parent
local JestGlobals = require(Packages.Dev.JestGlobals)
local jestExpect = JestGlobals.expect

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@
-- https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/shift
return function()
local Array = script.Parent.Parent
local LuauPolyfill = Array.Parent
local Packages = Array.Parent.Parent

local shift = require(Array.shift)

local Packages = LuauPolyfill.Parent
local JestGlobals = require(Packages.Dev.JestGlobals)
local jestExpect = JestGlobals.expect

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@
-- https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/slice
return function()
local Array = script.Parent.Parent
local LuauPolyfill = Array.Parent
local types = require(LuauPolyfill.types)
local Packages = Array.Parent.Parent

local types = require(Packages.ES7Types)
type Array<T> = types.Array<T>
local slice = require(Array.slice)

local Packages = LuauPolyfill.Parent
local JestGlobals = require(Packages.Dev.JestGlobals)
local jestExpect = JestGlobals.expect

Expand Down
Loading

0 comments on commit a4c66a9

Please sign in to comment.