Skip to content

Commit 87b1ccf

Browse files
Use luau-task to make Signal compatible with Lune (#1)
Update project setup to also publish the package on Wally
1 parent d9d0aa4 commit 87b1ccf

16 files changed

+200
-56
lines changed

.darklua-bundle-dev.json

+8-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,14 @@
11
{
22
"bundle": {
3-
"require_mode": "path"
3+
"require_mode": {
4+
"name": "path",
5+
"sources": {
6+
"@pkg": "node_modules/.luau-aliases"
7+
}
8+
},
9+
"excludes": ["@lune/**"]
410
},
5-
"process": [
11+
"rules": [
612
{
713
"rule": "inject_global_value",
814
"identifier": "LUA_ENV",

.darklua-bundle.json

+8-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,14 @@
11
{
22
"bundle": {
3-
"require_mode": "path"
3+
"require_mode": {
4+
"name": "path",
5+
"sources": {
6+
"@pkg": "node_modules/.luau-aliases"
7+
}
8+
},
9+
"excludes": ["@lune/**"]
410
},
5-
"process": [
11+
"rules": [
612
{
713
"rule": "inject_global_value",
814
"identifier": "LUA_ENV",

.darklua-dev.json

+13-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"process": [
2+
"rules": [
33
{
44
"rule": "inject_global_value",
55
"identifier": "LUA_ENV",
@@ -10,13 +10,22 @@
1010
"identifier": "__DEV__",
1111
"value": true
1212
},
13+
"remove_unused_if_branch",
1314
{
1415
"rule": "convert_require",
15-
"current": "path",
16-
"target": "roblox"
16+
"current": {
17+
"name": "path",
18+
"sources": {
19+
"@pkg": "node_modules/.luau-aliases"
20+
}
21+
},
22+
"target": {
23+
"name": "roblox",
24+
"rojo_sourcemap": "sourcemap.json",
25+
"indexing_style": "wait_for_child"
26+
}
1727
},
1828
"compute_expression",
19-
"remove_unused_if_branch",
2029
"remove_unused_while",
2130
"filter_after_early_return",
2231
"remove_nil_declaration",

.darklua.json

+13-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"process": [
2+
"rules": [
33
{
44
"rule": "inject_global_value",
55
"identifier": "LUA_ENV",
@@ -10,13 +10,22 @@
1010
"identifier": "__DEV__",
1111
"value": false
1212
},
13+
"remove_unused_if_branch",
1314
{
1415
"rule": "convert_require",
15-
"current": "path",
16-
"target": "roblox"
16+
"current": {
17+
"name": "path",
18+
"sources": {
19+
"@pkg": "node_modules/.luau-aliases"
20+
}
21+
},
22+
"target": {
23+
"name": "roblox",
24+
"rojo_sourcemap": "sourcemap.json",
25+
"indexing_style": "wait_for_child"
26+
}
1727
},
1828
"compute_expression",
19-
"remove_unused_if_branch",
2029
"remove_unused_while",
2130
"filter_after_early_return",
2231
"remove_nil_declaration",

.github/workflows/release.yml

+63-9
Original file line numberDiff line numberDiff line change
@@ -24,19 +24,66 @@ jobs:
2424
steps:
2525
- uses: actions/checkout@v4
2626

27+
- name: Enable corepack
28+
run: corepack enable
29+
2730
- uses: actions/setup-node@v3
2831
with:
29-
node-version: "latest"
30-
cache: "yarn"
31-
cache-dependency-path: "yarn.lock"
32+
node-version: latest
33+
registry-url: https://registry.npmjs.org
34+
cache: yarn
35+
cache-dependency-path: yarn.lock
3236

3337
- name: Install packages
34-
run: yarn install --frozen-lockfile
38+
run: yarn install --immutable
39+
40+
- name: Run npmluau
41+
run: yarn run prepare
3542

36-
- run: yarn publish
43+
- name: Authenticate yarn
44+
run: |-
45+
yarn config set npmAlwaysAuth true
46+
yarn config set npmAuthToken $NPM_AUTH_TOKEN
3747
env:
3848
NPM_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
3949

50+
- name: Publish to npm
51+
run: yarn npm publish --access public
52+
53+
publish-wally-package:
54+
needs: publish-package
55+
56+
name: Publish wally package
57+
runs-on: ubuntu-latest
58+
59+
steps:
60+
- uses: actions/checkout@v4
61+
62+
- name: Enable corepack
63+
run: corepack enable
64+
65+
- uses: actions/setup-node@v3
66+
with:
67+
node-version: latest
68+
registry-url: https://registry.npmjs.org
69+
cache: yarn
70+
cache-dependency-path: yarn.lock
71+
72+
- name: Install packages
73+
run: yarn install --immutable
74+
75+
- name: Run npmluau
76+
run: yarn run prepare
77+
78+
- name: Convert package to wally
79+
run: yarn dlx npmwally convert --output build/wally
80+
81+
- name: Login to wally
82+
run: wally login --project-path build/wally --token ${{ secrets.WALLY_ACCESS_TOKEN }}
83+
84+
- name: Publish to wally
85+
run: wally publish --project-path build/wally
86+
4087
create-release:
4188
needs: publish-package
4289

@@ -96,18 +143,25 @@ jobs:
96143
steps:
97144
- uses: actions/checkout@v4
98145

146+
- name: Enable corepack
147+
run: corepack enable
148+
99149
- uses: Roblox/setup-foreman@v1
100150
with:
101151
token: ${{ secrets.GITHUB_TOKEN }}
102152

103153
- uses: actions/setup-node@v3
104154
with:
105-
node-version: "latest"
106-
cache: "yarn"
107-
cache-dependency-path: "yarn.lock"
155+
node-version: latest
156+
registry-url: https://registry.npmjs.org
157+
cache: yarn
158+
cache-dependency-path: yarn.lock
108159

109160
- name: Install packages
110-
run: yarn install --frozen-lockfile
161+
run: yarn install --immutable
162+
163+
- name: Run npmluau
164+
run: yarn run prepare
111165

112166
- name: Build assets
113167
run: yarn run build

.github/workflows/test.yml

+11-4
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,25 @@ jobs:
1616
steps:
1717
- uses: actions/checkout@v4
1818

19+
- name: Enable corepack
20+
run: corepack enable
21+
1922
- uses: Roblox/setup-foreman@v1
2023
with:
2124
token: ${{ secrets.GITHUB_TOKEN }}
2225

2326
- uses: actions/setup-node@v3
2427
with:
25-
node-version: "latest"
26-
cache: "yarn"
27-
cache-dependency-path: "yarn.lock"
28+
node-version: latest
29+
registry-url: https://registry.npmjs.org
30+
cache: yarn
31+
cache-dependency-path: yarn.lock
2832

2933
- name: Install packages
30-
run: yarn install --frozen-lockfile
34+
run: yarn install --immutable
35+
36+
- name: Run npmluau
37+
run: yarn run prepare
3138

3239
- name: Run linter
3340
run: yarn run lint

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,6 @@
1111
/build
1212

1313
/globalTypes.d.lua
14+
.yarn
1415

1516
**/sourcemap.json

.luaurc

+10-7
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
{
2-
"languageMode": "strict",
3-
"lintErrors": true,
4-
"lint": {
5-
"*": true,
6-
"LocalShadow": false
7-
}
8-
}
2+
"languageMode": "strict",
3+
"lintErrors": true,
4+
"lint": {
5+
"*": true,
6+
"LocalShadow": false
7+
},
8+
"aliases": {
9+
"pkg": "./node_modules/.luau-aliases"
10+
}
11+
}

.yarnrc.yml

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
nodeLinker: node-modules

CHANGELOG.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# Changelog
22

3+
- use `luau-task` package to make Signal compatible with [Lune](https://github.com/lune-org/lune) ([#1](https://github.com/seaofvoices/luau-signal/pull/1))
4+
35
## 0.1.0
46

5-
* Initial version
7+
- Initial version

foreman.toml

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tools]
2-
rojo = { github = "rojo-rbx/rojo", version = "=7.3.0" }
3-
selene = { github = "Kampfkarren/selene", version = "=0.26.1" }
2+
rojo = { github = "rojo-rbx/rojo", version = "=7.4.4"}
3+
selene = { github = "Kampfkarren/selene", version = "=0.27.1"}
44
stylua = { github = "JohnnyMorganz/styLua", version = "=0.19.1" }
5-
darklua = { github = "seaofvoices/darklua", version = "=0.12.1" }
6-
luau-lsp = { github = "JohnnyMorganz/luau-lsp", version = "=1.27.0" }
5+
darklua = { github = "seaofvoices/darklua", version = "=0.13.1"}
6+
luau-lsp = { github = "JohnnyMorganz/luau-lsp", version = "=1.32.4"}

library.project.json

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
{
22
"name": "Signal",
33
"tree": {
4-
"$path": "./src"
4+
"$path": "src",
5+
"node_modules": {
6+
"$path": "node_modules"
7+
}
58
}
69
}

package.json

+11-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,12 @@
22
"name": "luau-signal",
33
"version": "0.1.0",
44
"description": "A simple signal utility",
5-
"keywords": ["lua", "luau", "roblox", "signal"],
5+
"keywords": [
6+
"lua",
7+
"luau",
8+
"roblox",
9+
"signal"
10+
],
611
"author": "jeparlefrancais <jeparlefrancais21@gmail.com>",
712
"repository": {
813
"type": "git",
@@ -19,7 +24,11 @@
1924
"style-check": "stylua . --check",
2025
"clean": "rm -rf node_modules roblox build"
2126
},
27+
"dependencies": {
28+
"luau-task": "^1.0.1"
29+
},
2230
"devDependencies": {
2331
"npmluau": "^0.1.1"
24-
}
32+
},
33+
"packageManager": "yarn@4.5.0"
2534
}

scripts/build-roblox-asset.sh

+5
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,13 @@ if [ ! -d node_modules ]; then
1111
yarn prepare
1212
fi
1313

14+
rojo sourcemap library.project.json --output sourcemap.json
15+
1416
rm -rf $CODE_OUTPUT/src
17+
rm -rf $CODE_OUTPUT/node_modules
18+
1519
darklua process --config $DARKLUA_CONFIG src $CODE_OUTPUT/src
20+
darklua process --config $DARKLUA_CONFIG node_modules $CODE_OUTPUT/node_modules
1621

1722
cp -r library.project.json $CODE_OUTPUT/
1823

src/Signal.lua

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
local task = require('@pkg/luau-task')
2+
13
local Connection = require('./Connection')
24
export type Connection = Connection.Connection
35

0 commit comments

Comments
 (0)