Skip to content

Commit c2dd086

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

15 files changed

+197
-55
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

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

yarn.lock

+43-16
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,48 @@
1-
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
2-
# yarn lockfile v1
1+
# This file is generated by running "yarn install" inside your project.
2+
# Manual changes might be lost - proceed with caution!
33

4+
__metadata:
5+
version: 8
6+
cacheKey: 10c0
47

5-
commander@^11.0.0:
6-
version "11.1.0"
7-
resolved "https://registry.yarnpkg.com/commander/-/commander-11.1.0.tgz#62fdce76006a68e5c1ab3314dc92e800eb83d906"
8-
integrity sha512-yPVavfyCcRhmorC7rWlkHn15b4wDVgVmBA7kV4QVBsF7kv/9TKJAbAXVTxvTnwP8HHKjRCJDClKbciiYS7p0DQ==
8+
"commander@npm:^11.0.0":
9+
version: 11.1.0
10+
resolution: "commander@npm:11.1.0"
11+
checksum: 10c0/13cc6ac875e48780250f723fb81c1c1178d35c5decb1abb1b628b3177af08a8554e76b2c0f29de72d69eef7c864d12613272a71fabef8047922bc622ab75a179
12+
languageName: node
13+
linkType: hard
914

10-
npmluau@^0.1.1:
11-
version "0.1.1"
12-
resolved "https://registry.yarnpkg.com/npmluau/-/npmluau-0.1.1.tgz#0e380f9b8b6a88f2c69b7ccc57019e93459cb030"
13-
integrity sha512-nHY1rR32SPIbDvZRIXWPduxyr+Dp42sT7vIEedHhodvhCsCEYTpxyIDrt6/nr+paTK1uhqUQm8HuzmW5O+38wQ==
15+
"luau-signal@workspace:.":
16+
version: 0.0.0-use.local
17+
resolution: "luau-signal@workspace:."
1418
dependencies:
15-
commander "^11.0.0"
16-
walkdir "^0.4.1"
19+
luau-task: "npm:^1.0.1"
20+
npmluau: "npm:^0.1.1"
21+
languageName: unknown
22+
linkType: soft
1723

18-
walkdir@^0.4.1:
19-
version "0.4.1"
20-
resolved "https://registry.yarnpkg.com/walkdir/-/walkdir-0.4.1.tgz#dc119f83f4421df52e3061e514228a2db20afa39"
21-
integrity sha512-3eBwRyEln6E1MSzcxcVpQIhRG8Q1jLvEqRmCZqS3dsfXEDR/AhOF4d+jHg1qvDCpYaVRZjENPQyrVxAkQqxPgQ==
24+
"luau-task@npm:^1.0.1":
25+
version: 1.0.1
26+
resolution: "luau-task@npm:1.0.1"
27+
checksum: 10c0/d2df6f26d9c5cdc1414c9941561c0dfcfed79cf889297cd245653d2004fe74508666eae704d5c6021fb7163513b7647e7d00608b0841077f410ded3d2dd383a2
28+
languageName: node
29+
linkType: hard
30+
31+
"npmluau@npm:^0.1.1":
32+
version: 0.1.1
33+
resolution: "npmluau@npm:0.1.1"
34+
dependencies:
35+
commander: "npm:^11.0.0"
36+
walkdir: "npm:^0.4.1"
37+
bin:
38+
npmluau: main.js
39+
checksum: 10c0/9ae22c0dcff9e85c90b4da4e8c17bc51e9b567b4a417c9767d355ff68faca4f99a2934b581743ebc8729f6851d1ba5b64597312151747252e040517d1794fbca
40+
languageName: node
41+
linkType: hard
42+
43+
"walkdir@npm:^0.4.1":
44+
version: 0.4.1
45+
resolution: "walkdir@npm:0.4.1"
46+
checksum: 10c0/88e635aa9303e9196e4dc15013d2bd4afca4c8c8b4bb27722ca042bad213bb882d3b9141b3b0cca6bfb274f7889b30cf58d6374844094abec0016f335c5414dc
47+
languageName: node
48+
linkType: hard

0 commit comments

Comments
 (0)