yllaw 1.5.0 → 1.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/package.json +1 -1
- package/src/plugin.js +14 -14
package/README.md
CHANGED
|
@@ -204,7 +204,7 @@ SomePlugin = "https://gitlab.example.com/group/some-plugin.git@1.0.0"
|
|
|
204
204
|
TagEditor = "https://gitlab.example.com/group/tag-editor.git@2.1.0"
|
|
205
205
|
```
|
|
206
206
|
|
|
207
|
-
插件文件(`*.
|
|
207
|
+
插件文件(`*.rbxmx`、`*.server.luau`、`*.server.lua`)会被安装到 `%LOCALAPPDATA%/Roblox/Plugins/`。
|
|
208
208
|
|
|
209
209
|
### 全局插件管理
|
|
210
210
|
|
|
@@ -246,7 +246,7 @@ yllaw plugin update SomePlugin # 更新指定插件
|
|
|
246
246
|
```
|
|
247
247
|
your-plugin/
|
|
248
248
|
├── README.md
|
|
249
|
-
└── YourPlugin.server.luau # 或 .
|
|
249
|
+
└── YourPlugin.server.luau # 或 .rbxmx 文件
|
|
250
250
|
```
|
|
251
251
|
|
|
252
252
|
**文件夹插件(推荐,可包含子模块):**
|
|
@@ -259,7 +259,7 @@ your-plugin/
|
|
|
259
259
|
└── Utils.luau
|
|
260
260
|
```
|
|
261
261
|
|
|
262
|
-
yllaw 会自动查找 `*.
|
|
262
|
+
yllaw 会自动查找 `*.rbxmx`、`*.server.luau`、`*.server.lua` 文件,以及包含 `init.server.luau` / `init.server.lua` 的文件夹。
|
|
263
263
|
|
|
264
264
|
## 与 Wally 的关系
|
|
265
265
|
|
package/package.json
CHANGED
package/src/plugin.js
CHANGED
|
@@ -17,7 +17,7 @@ const log = {
|
|
|
17
17
|
/**
|
|
18
18
|
* Find plugin files in a directory.
|
|
19
19
|
* Supports:
|
|
20
|
-
* - Single file plugins: *.
|
|
20
|
+
* - Single file plugins: *.rbxmx, *.server.luau, *.server.lua
|
|
21
21
|
* - Folder plugins: directories containing init.server.luau or init.server.lua
|
|
22
22
|
*
|
|
23
23
|
* Returns structured results:
|
|
@@ -45,7 +45,7 @@ async function findPluginFiles(dir) {
|
|
|
45
45
|
for (const entry of entries) {
|
|
46
46
|
if (entry.isFile()) {
|
|
47
47
|
const name = entry.name;
|
|
48
|
-
if (name.endsWith('.
|
|
48
|
+
if (name.endsWith('.rbxmx') ||
|
|
49
49
|
name.endsWith('.server.luau') ||
|
|
50
50
|
name.endsWith('.server.lua')) {
|
|
51
51
|
results.push({ type: 'file', path: path.join(searchDir, name), name });
|
|
@@ -70,11 +70,11 @@ async function findPluginFiles(dir) {
|
|
|
70
70
|
}
|
|
71
71
|
|
|
72
72
|
/**
|
|
73
|
-
* Build a plugin entry (.server.lua(u) or folder) to .
|
|
73
|
+
* Build a plugin entry (.server.lua(u) or folder) to .rbxmx using Rojo.
|
|
74
74
|
* Generates a temporary project.json, runs `rojo build`, returns the result.
|
|
75
|
-
* @returns {{
|
|
75
|
+
* @returns {{ rbxmxPath: string, name: string } | null}
|
|
76
76
|
*/
|
|
77
|
-
async function
|
|
77
|
+
async function buildToRbxmx(entry) {
|
|
78
78
|
let pluginName;
|
|
79
79
|
if (entry.type === 'folder') {
|
|
80
80
|
pluginName = entry.name;
|
|
@@ -87,7 +87,7 @@ async function buildToRbxm(entry) {
|
|
|
87
87
|
const parentDir = path.dirname(entry.path);
|
|
88
88
|
const entryBasename = path.basename(entry.path);
|
|
89
89
|
const projectPath = path.join(parentDir, `_yllaw_build.project.json`);
|
|
90
|
-
const
|
|
90
|
+
const rbxmxPath = path.join(parentDir, `${pluginName}.rbxmx`);
|
|
91
91
|
|
|
92
92
|
await fs.writeJson(projectPath, {
|
|
93
93
|
name: pluginName,
|
|
@@ -96,7 +96,7 @@ async function buildToRbxm(entry) {
|
|
|
96
96
|
|
|
97
97
|
try {
|
|
98
98
|
const success = await new Promise((resolve) => {
|
|
99
|
-
const rojo = spawn('rojo', ['build', projectPath, '-o',
|
|
99
|
+
const rojo = spawn('rojo', ['build', projectPath, '-o', rbxmxPath], {
|
|
100
100
|
stdio: 'pipe',
|
|
101
101
|
shell: true,
|
|
102
102
|
});
|
|
@@ -113,7 +113,7 @@ async function buildToRbxm(entry) {
|
|
|
113
113
|
});
|
|
114
114
|
|
|
115
115
|
if (!success) return null;
|
|
116
|
-
return {
|
|
116
|
+
return { rbxmxPath, name: `${pluginName}.rbxmx` };
|
|
117
117
|
} finally {
|
|
118
118
|
await fs.remove(projectPath);
|
|
119
119
|
}
|
|
@@ -121,27 +121,27 @@ async function buildToRbxm(entry) {
|
|
|
121
121
|
|
|
122
122
|
/**
|
|
123
123
|
* Install plugin entries to the plugins directory.
|
|
124
|
-
* For .
|
|
125
|
-
* For .server.lua(u) / folders: build to .
|
|
124
|
+
* For .rbxmx files: copy directly.
|
|
125
|
+
* For .server.lua(u) / folders: build to .rbxmx via Rojo, fallback to direct copy.
|
|
126
126
|
* @returns {Array} installed file records
|
|
127
127
|
*/
|
|
128
128
|
async function installEntries(pluginEntries, pluginsDir, logPrefix = '') {
|
|
129
129
|
const installedFiles = [];
|
|
130
130
|
|
|
131
131
|
for (const entry of pluginEntries) {
|
|
132
|
-
if (entry.type === 'file' && entry.name.endsWith('.
|
|
132
|
+
if (entry.type === 'file' && entry.name.endsWith('.rbxmx')) {
|
|
133
133
|
const dest = path.join(pluginsDir, entry.name);
|
|
134
134
|
await fs.copy(entry.path, dest, { overwrite: true });
|
|
135
135
|
installedFiles.push({ type: 'file', name: entry.name });
|
|
136
136
|
log.ok(`${logPrefix}${entry.name} -> ${pluginsDir}`);
|
|
137
137
|
} else {
|
|
138
|
-
const result = await
|
|
138
|
+
const result = await buildToRbxmx(entry);
|
|
139
139
|
if (result) {
|
|
140
140
|
const dest = path.join(pluginsDir, result.name);
|
|
141
|
-
await fs.copy(result.
|
|
141
|
+
await fs.copy(result.rbxmxPath, dest, { overwrite: true });
|
|
142
142
|
installedFiles.push({ type: 'file', name: result.name });
|
|
143
143
|
log.ok(`${logPrefix}${entry.name} -> ${result.name} -> ${pluginsDir}`);
|
|
144
|
-
await fs.remove(result.
|
|
144
|
+
await fs.remove(result.rbxmxPath);
|
|
145
145
|
} else {
|
|
146
146
|
log.warn(`Rojo build failed for ${entry.name}, copying as-is`);
|
|
147
147
|
if (entry.type === 'folder') {
|