refactor!: migrate to monorepo (#23)

* refactor!: create monorepo

* chore: prepare release, set up workflows

* refactor: rename `modules` to `src`

* docs: add docs for all packages

* refactor: rename root project file

* chore: bump deps

* build: rename `lint`, add `pack` script

* revert: delete pack script

This will not be useful for development.
This commit is contained in:
richard 2024-10-12 18:29:15 -07:00 • committed by GitHub
parent b038bf1f70
commit 08c7e690d5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
81 changed files with 917 additions and 570 deletions

View file

@ -0,0 +1,46 @@
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Charm = require(ReplicatedStorage.DevPackages.Charm)
local atom = Charm.atom
local ReactCharm = require(ReplicatedStorage.DevPackages.ReactCharm)
local useAtom = ReactCharm.useAtom
local renderHook = require(script.Parent.Parent.utils.renderHook)
return function()
it("tracks atom state", function()
local state = atom(0)
local hook = renderHook(function()
return useAtom(state)
end)
expect(hook.result).to.equal(0)
state(1)
expect(hook.result).to.equal(1)
end)
it("accepts a molecule", function()
local state = atom(0)
local hook = renderHook(function()
return useAtom(function()
return 2 * state()
end)
end)
expect(hook.result).to.equal(0)
state(1)
expect(hook.result).to.equal(2)
end)
it("tracks dependencies", function()
local state = atom(0)
local hook = renderHook(function()
return useAtom(state, { state })
end)
expect(hook.result).to.equal(0)
state(1)
expect(hook.result).to.equal(1)
state = atom(0)
hook.rerender()
expect(hook.result).to.equal(0)
state(1)
expect(hook.result).to.equal(1)
end)
end