-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit f73582a
Showing
56 changed files
with
1,800 additions
and
0 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,24 @@ | ||
{ | ||
"process": [ | ||
{ | ||
"rule": "convert_require", | ||
"current": { | ||
"name": "path", | ||
"sources": { | ||
"@pkg": "node_modules/.luau-aliases" | ||
} | ||
}, | ||
"target": { | ||
"name": "roblox", | ||
"rojo_sourcemap": "./sourcemap.json", | ||
"indexing_style": "wait_for_child" | ||
} | ||
}, | ||
"compute_expression", | ||
"remove_unused_if_branch", | ||
"remove_unused_while", | ||
"filter_after_early_return", | ||
"remove_nil_declaration", | ||
"remove_empty_do" | ||
] | ||
} |
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 @@ | ||
* text eol=lf | ||
|
||
*.gif binary | ||
*.ico binary | ||
*.jpg binary | ||
*.png binary |
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,35 @@ | ||
name: Release | ||
|
||
on: workflow_dispatch | ||
|
||
jobs: | ||
publish-package: | ||
name: Publish package | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Enable corepack | ||
run: corepack enable | ||
|
||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: latest | ||
cache: yarn | ||
cache-dependency-path: yarn.lock | ||
|
||
- name: Install packages | ||
run: yarn install --immutable | ||
|
||
- name: Run npmluau | ||
run: yarn run prepare | ||
|
||
- name: Authenticate yarn | ||
run: |- | ||
yarn config set npmAlwaysAuth true | ||
yarn config set npmAuthToken $NPM_AUTH_TOKEN | ||
env: | ||
NPM_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
|
||
- name: Publish to npm | ||
run: yarn workspaces foreach --all --no-private npm publish --access public --tolerate-republish |
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,42 @@ | ||
name: Tests | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
test: | ||
name: Run tests | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- uses: Roblox/setup-foreman@v1 | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Enable Corepack | ||
run: corepack enable | ||
|
||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: "latest" | ||
cache: "yarn" | ||
cache-dependency-path: "yarn.lock" | ||
|
||
- name: Install packages | ||
run: yarn install --immutable | ||
|
||
- name: Run npmluau | ||
run: yarn run prepare | ||
|
||
- name: Run linter | ||
run: yarn run lint:selene | ||
|
||
- name: Verify code style | ||
run: yarn run style-check |
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,20 @@ | ||
/site | ||
/*.rbxl | ||
/*.rbxlx | ||
/*.rbxl.lock | ||
/*.rbxlx.lock | ||
/*.rbxm | ||
/*.rbxmx | ||
|
||
/jest.lua | ||
/roblox | ||
/node_modules | ||
|
||
/.yarn | ||
|
||
build/ | ||
test-places/ | ||
|
||
/globalTypes.d.lua | ||
|
||
**/sourcemap.json |
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 @@ | ||
{ | ||
"luau-lsp.require.mode": "relativeToFile", | ||
"luau-lsp.require.directoryAliases": { | ||
"@pkg": "node_modules/.luau-aliases" | ||
} | ||
} |
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,8 @@ | ||
{ | ||
"languageMode": "strict", | ||
"lintErrors": true, | ||
"lint": { | ||
"*": true, | ||
"LocalShadow": false | ||
} | ||
} |
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,36 @@ | ||
/.github/ | ||
/.vscode/ | ||
/scripts/ | ||
/docs/ | ||
|
||
/roblox | ||
/build | ||
|
||
.gitattributes | ||
CHANGELOG.md | ||
|
||
.yarn | ||
|
||
.darklua* | ||
.luau-analyze.json | ||
.luaurc | ||
foreman.toml | ||
selene.toml | ||
selene_definitions.yml | ||
stylua.toml | ||
.styluaignore | ||
|
||
/globalTypes.d.lua | ||
**/sourcemap.json | ||
*.project.json | ||
|
||
**/__tests__ | ||
**/*.test.lua | ||
**/jest.config.lua | ||
|
||
**/*.rbxl | ||
**/*.rbxlx | ||
**/*.rbxl.lock | ||
**/*.rbxlx.lock | ||
**/*.rbxm | ||
**/*.rbxmx |
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,4 @@ | ||
/node_modules | ||
/roblox | ||
|
||
**/*.d.lua |
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,5 @@ | ||
{ | ||
"luau-lsp.require.directoryAliases": { | ||
"@pkg": "node_modules/.luau-aliases" | ||
} | ||
} |
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 @@ | ||
nodeLinker: node-modules |
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,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2024 Sea of Voices | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
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,51 @@ | ||
# React Lua Hooks | ||
|
||
This project consists of two main packages that contains [react-lua](https://github.com/jsdotlua/react-lua) hooks. | ||
|
||
- [Lua hooks](packages/react-lua-hooks/README.md#content): general-purpose collection of hooks for [react-lua](https://github.com/jsdotlua/react-lua) | ||
- [Roblox hooks](packages/react-roblox-hooks/README.md#content): hooks specifically made for Roblox development | ||
|
||
# Installation | ||
|
||
Add these packages to your dependencies: | ||
|
||
```bash | ||
yarn add @seaofvoices/react-lua-hooks | ||
yarn add @seaofvoices/react-roblox-hooks | ||
``` | ||
|
||
Or if you are using `npm`: | ||
|
||
```bash | ||
npm install @seaofvoices/react-lua-hooks | ||
npm install @seaofvoices/react-roblox-hooks | ||
``` | ||
|
||
# Content | ||
|
||
- [Lua hooks](packages/react-lua-hooks/README.md#content) | ||
- [useDefaultState](packages/react-lua-hooks/README.md#usedefaultstate) | ||
- [usePrevious](packages/react-lua-hooks/README.md#useprevious) | ||
- [usePreviousDistinct](packages/react-lua-hooks/README.md#usepreviousdistinct) | ||
- [useToggle](packages/react-lua-hooks/README.md#usetoggle) | ||
- [useUnmount](packages/react-lua-hooks/README.md#useunmount) | ||
- [useDebouncedState](packages/react-lua-hooks/README.md#usedebouncedstate) | ||
- [useThrottledState](packages/react-lua-hooks/README.md#usethrottledstate) | ||
- [Roblox hooks](packages/react-roblox-hooks/README.md#content) | ||
- [useService](packages/react-roblox-hooks/README.md#useservice) | ||
- [useCamera](packages/react-roblox-hooks/README.md#usecamera) | ||
- [useCameraCFrame](packages/react-roblox-hooks/README.md#usecameracframe) | ||
- [useEvent](packages/react-roblox-hooks/README.md#useevent) | ||
- [useGuiObjectSizeBinding](packages/react-roblox-hooks/README.md#useguiobjectsizebinding) | ||
- [useLocalPlayer](packages/react-roblox-hooks/README.md#uselocalplayer) | ||
- [useObjectLocation](packages/react-roblox-hooks/README.md#useobjectlocation) | ||
- [usePropertyChange](packages/react-roblox-hooks/README.md#usepropertychange) | ||
- [useTaggedInstances](packages/react-roblox-hooks/README.md#usetaggedinstances) | ||
- [useTextSize](packages/react-roblox-hooks/README.md#usetextsize) | ||
- [useViewportSize](packages/react-roblox-hooks/README.md#useviewportsize) | ||
|
||
# Other Lua Environments Support | ||
|
||
If you would like to use this library on a Lua environment where it is currently incompatible, open an issue (or comment on an existing one) to request the appropriate modifications. | ||
|
||
The library uses [darklua](https://github.com/seaofvoices/darklua) to process its code. |
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,7 @@ | ||
[tools] | ||
rojo = { github = "rojo-rbx/rojo", version = "=7.3.0" } | ||
selene = { github = "Kampfkarren/selene", version = "=0.25.0" } | ||
stylua = { github = "JohnnyMorganz/styLua", version = "=0.18.2" } | ||
darklua = { github = "seaofvoices/darklua", version = "=0.11.3" } | ||
luau-lsp = { github = "JohnnyMorganz/luau-lsp", version = "=1.27.0" } | ||
run-in-roblox = { github = "rojo-rbx/run-in-roblox", version = "=0.3.0" } |
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,21 @@ | ||
{ | ||
"name": "workspace", | ||
"private": true, | ||
"workspaces": [ | ||
"packages/*" | ||
], | ||
"scripts": { | ||
"prepare": "npmluau", | ||
"lint": "sh ./scripts/analyze.sh && selene packages", | ||
"lint:luau": "sh ./scripts/analyze.sh", | ||
"lint:selene": "selene packages", | ||
"format": "stylua .", | ||
"style-check": "stylua . --check", | ||
"verify-pack": "yarn workspaces foreach -A --no-private pack --dry-run", | ||
"clean": "rm -rf node_modules" | ||
}, | ||
"devDependencies": { | ||
"npmluau": "^0.1.1" | ||
}, | ||
"packageManager": "[email protected]" | ||
} |
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,5 @@ | ||
# Changelog | ||
|
||
## 0.1.0 | ||
|
||
* Initial version |
Oops, something went wrong.