@pipelab/plugin-steam 0.0.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/LICENSE +110 -0
- package/README.md +3 -0
- package/dist/index.cjs +273 -0
- package/dist/index.d.cts +4 -0
- package/dist/index.d.cts.map +1 -0
- package/dist/index.d.mts +5 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +275 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +51 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
# Functional Source License, Version 1.1, MIT Future License
|
|
2
|
+
|
|
3
|
+
## Abbreviation
|
|
4
|
+
|
|
5
|
+
FSL-1.1-MIT
|
|
6
|
+
|
|
7
|
+
## Notice
|
|
8
|
+
|
|
9
|
+
Copyright 2026 CynToolkit
|
|
10
|
+
|
|
11
|
+
## Terms and Conditions
|
|
12
|
+
|
|
13
|
+
### Licensor ("We")
|
|
14
|
+
|
|
15
|
+
The party offering the Software under these Terms and Conditions.
|
|
16
|
+
|
|
17
|
+
### The Software
|
|
18
|
+
|
|
19
|
+
The "Software" is each version of the software that we make available under
|
|
20
|
+
these Terms and Conditions, as indicated by our inclusion of these Terms and
|
|
21
|
+
Conditions with the Software.
|
|
22
|
+
|
|
23
|
+
### License Grant
|
|
24
|
+
|
|
25
|
+
Subject to your compliance with this License Grant and the Patents,
|
|
26
|
+
Redistribution and Trademark clauses below, we hereby grant you the right to
|
|
27
|
+
use, copy, modify, create derivative works, publicly perform, publicly display
|
|
28
|
+
and redistribute the Software for any Permitted Purpose identified below.
|
|
29
|
+
|
|
30
|
+
### Permitted Purpose
|
|
31
|
+
|
|
32
|
+
A Permitted Purpose is any purpose other than a Competing Use. A Competing Use
|
|
33
|
+
means making the Software available to others in a commercial product or
|
|
34
|
+
service that:
|
|
35
|
+
|
|
36
|
+
1. substitutes for the Software;
|
|
37
|
+
|
|
38
|
+
2. substitutes for any other product or service we offer using the Software
|
|
39
|
+
that exists as of the date we make the Software available; or
|
|
40
|
+
|
|
41
|
+
3. offers the same or substantially similar functionality as the Software.
|
|
42
|
+
|
|
43
|
+
Permitted Purposes specifically include using the Software:
|
|
44
|
+
|
|
45
|
+
1. for your internal use and access;
|
|
46
|
+
|
|
47
|
+
2. for non-commercial education;
|
|
48
|
+
|
|
49
|
+
3. for non-commercial research; and
|
|
50
|
+
|
|
51
|
+
4. in connection with professional services that you provide to a licensee
|
|
52
|
+
using the Software in accordance with these Terms and Conditions.
|
|
53
|
+
|
|
54
|
+
### Patents
|
|
55
|
+
|
|
56
|
+
To the extent your use for a Permitted Purpose would necessarily infringe our
|
|
57
|
+
patents, the license grant above includes a license under our patents. If you
|
|
58
|
+
make a claim against any party that the Software infringes or contributes to
|
|
59
|
+
the infringement of any patent, then your patent license to the Software ends
|
|
60
|
+
immediately.
|
|
61
|
+
|
|
62
|
+
### Redistribution
|
|
63
|
+
|
|
64
|
+
The Terms and Conditions apply to all copies, modifications and derivatives of
|
|
65
|
+
the Software.
|
|
66
|
+
|
|
67
|
+
If you redistribute any copies, modifications or derivatives of the Software,
|
|
68
|
+
you must include a copy of or a link to these Terms and Conditions and not
|
|
69
|
+
remove any copyright notices provided in or with the Software.
|
|
70
|
+
|
|
71
|
+
### Disclaimer
|
|
72
|
+
|
|
73
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND WITHOUT WARRANTIES OF ANY KIND, EXPRESS OR
|
|
74
|
+
IMPLIED, INCLUDING WITHOUT LIMITATION WARRANTIES OF FITNESS FOR A PARTICULAR
|
|
75
|
+
PURPOSE, MERCHANTABILITY, TITLE OR NON-INFRINGEMENT.
|
|
76
|
+
|
|
77
|
+
IN NO EVENT WILL WE HAVE ANY LIABILITY TO YOU ARISING OUT OF OR RELATED TO THE
|
|
78
|
+
SOFTWARE, INCLUDING INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES,
|
|
79
|
+
EVEN IF WE HAVE BEEN INFORMED OF THEIR POSSIBILITY IN ADVANCE.
|
|
80
|
+
|
|
81
|
+
### Trademarks
|
|
82
|
+
|
|
83
|
+
Except for displaying the License Details and identifying us as the origin of
|
|
84
|
+
the Software, you have no right under these Terms and Conditions to use our
|
|
85
|
+
trademarks, trade names, service marks or product names.
|
|
86
|
+
|
|
87
|
+
## Grant of Future License
|
|
88
|
+
|
|
89
|
+
We hereby irrevocably grant you an additional license to use the Software under
|
|
90
|
+
the MIT license that is effective on the second anniversary of the date we make
|
|
91
|
+
the Software available. On or after that date, you may use the Software under
|
|
92
|
+
the MIT license, in which case the following will apply:
|
|
93
|
+
|
|
94
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
95
|
+
this software and associated documentation files (the "Software"), to deal in
|
|
96
|
+
the Software without restriction, including without limitation the rights to
|
|
97
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
|
98
|
+
of the Software, and to permit persons to whom the Software is furnished to do
|
|
99
|
+
so, subject to the following conditions:
|
|
100
|
+
|
|
101
|
+
The above copyright notice and this permission notice shall be included in all
|
|
102
|
+
copies or substantial portions of the Software.
|
|
103
|
+
|
|
104
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
105
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
106
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
107
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
108
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
109
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
110
|
+
SOFTWARE.
|
package/README.md
ADDED
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,273 @@
|
|
|
1
|
+
let node_path = require("node:path");
|
|
2
|
+
let node_os = require("node:os");
|
|
3
|
+
let node_fs_promises = require("node:fs/promises");
|
|
4
|
+
let _pipelab_plugin_core = require("@pipelab/plugin-core");
|
|
5
|
+
let execa = require("execa");
|
|
6
|
+
//#region src/utils.ts
|
|
7
|
+
const checkSteamAuth = async (options) => {
|
|
8
|
+
let error = void 0;
|
|
9
|
+
try {
|
|
10
|
+
await (0, _pipelab_plugin_core.runWithLiveLogs)(options.steamcmdPath, [
|
|
11
|
+
"+login",
|
|
12
|
+
options.username,
|
|
13
|
+
"+quit"
|
|
14
|
+
], { shell: process.platform === "win32" }, options.context.log, { onStdout: (data, subprocess) => {
|
|
15
|
+
options.context.log("[Steam Cmd]", data);
|
|
16
|
+
if (data.includes("Cached credentials not found")) {
|
|
17
|
+
error = "LOGGED_OUT";
|
|
18
|
+
subprocess.kill();
|
|
19
|
+
}
|
|
20
|
+
} }, options.context.abortSignal);
|
|
21
|
+
} catch (e) {
|
|
22
|
+
console.error("e", e);
|
|
23
|
+
if (!error) error = "UNKNOWN";
|
|
24
|
+
}
|
|
25
|
+
if (error) return {
|
|
26
|
+
success: false,
|
|
27
|
+
error
|
|
28
|
+
};
|
|
29
|
+
return { success: true };
|
|
30
|
+
};
|
|
31
|
+
const openExternalTerminal = async (command, args = [], options = {}, keepOpen = false) => {
|
|
32
|
+
const platform = process.platform;
|
|
33
|
+
if (platform === "darwin") {
|
|
34
|
+
const escapedShellCommand = `${command} ${args.join(" ")}; echo "You can now close this window"`.replace(/\\/g, "\\\\").replace(/"/g, "\\\"");
|
|
35
|
+
let osaScript;
|
|
36
|
+
if (keepOpen) osaScript = `tell application "Terminal"\nactivate\ndo script "${escapedShellCommand}"\nend tell`;
|
|
37
|
+
else osaScript = `tell application "Terminal"
|
|
38
|
+
activate
|
|
39
|
+
set targetTab to do script "${escapedShellCommand}"
|
|
40
|
+
-- Wait for the command to complete by checking the 'busy' status of the tab
|
|
41
|
+
delay 0.5 -- Initial delay to allow the process to start and tab to become busy
|
|
42
|
+
repeat while busy of targetTab
|
|
43
|
+
delay 0.5 -- Check every 0.5 seconds
|
|
44
|
+
end repeat
|
|
45
|
+
end tell`;
|
|
46
|
+
return (0, execa.execa)("osascript", ["-e", osaScript], options);
|
|
47
|
+
} else if (platform === "linux") return (0, execa.execa)(process.env.TERMINAL ?? process.env.TERM ?? "xterm", [
|
|
48
|
+
"-e",
|
|
49
|
+
command,
|
|
50
|
+
...args
|
|
51
|
+
], options);
|
|
52
|
+
else if (platform === "win32") return (0, execa.execa)("cmd.exe", [
|
|
53
|
+
keepOpen ? "/k" : "/c",
|
|
54
|
+
"start",
|
|
55
|
+
"cmd.exe",
|
|
56
|
+
"/c",
|
|
57
|
+
command,
|
|
58
|
+
...args
|
|
59
|
+
], options);
|
|
60
|
+
else throw new Error("Unsupported platform: " + platform);
|
|
61
|
+
};
|
|
62
|
+
const uploadToSteam = (0, _pipelab_plugin_core.createAction)({
|
|
63
|
+
id: "steam-upload",
|
|
64
|
+
name: "Upload to Steam",
|
|
65
|
+
description: "Upload a folder to Steam",
|
|
66
|
+
icon: "",
|
|
67
|
+
displayString: "`Upload ${fmt.param(params['folder'], 'primary')} to steam`",
|
|
68
|
+
meta: {},
|
|
69
|
+
params: {
|
|
70
|
+
sdk: (0, _pipelab_plugin_core.createPathParam)("", {
|
|
71
|
+
required: true,
|
|
72
|
+
label: "Steam Sdk path",
|
|
73
|
+
control: {
|
|
74
|
+
type: "path",
|
|
75
|
+
options: { properties: ["openDirectory"] }
|
|
76
|
+
}
|
|
77
|
+
}),
|
|
78
|
+
username: (0, _pipelab_plugin_core.createStringParam)("", {
|
|
79
|
+
required: true,
|
|
80
|
+
label: "Steam username"
|
|
81
|
+
}),
|
|
82
|
+
appId: (0, _pipelab_plugin_core.createStringParam)("", {
|
|
83
|
+
required: true,
|
|
84
|
+
label: "App Id"
|
|
85
|
+
}),
|
|
86
|
+
depotId: (0, _pipelab_plugin_core.createStringParam)("", {
|
|
87
|
+
required: true,
|
|
88
|
+
label: "Depot Id"
|
|
89
|
+
}),
|
|
90
|
+
description: (0, _pipelab_plugin_core.createStringParam)("", {
|
|
91
|
+
required: true,
|
|
92
|
+
label: "Description"
|
|
93
|
+
}),
|
|
94
|
+
folder: (0, _pipelab_plugin_core.createPathParam)("", {
|
|
95
|
+
required: true,
|
|
96
|
+
label: "Folder to upload",
|
|
97
|
+
control: {
|
|
98
|
+
type: "path",
|
|
99
|
+
options: { properties: ["openDirectory"] }
|
|
100
|
+
}
|
|
101
|
+
})
|
|
102
|
+
},
|
|
103
|
+
outputs: {
|
|
104
|
+
"script-path": {
|
|
105
|
+
label: "Script path",
|
|
106
|
+
value: ""
|
|
107
|
+
},
|
|
108
|
+
"output-folder": {
|
|
109
|
+
label: "Output folder",
|
|
110
|
+
value: ""
|
|
111
|
+
},
|
|
112
|
+
status: {
|
|
113
|
+
label: "Status",
|
|
114
|
+
value: ""
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
});
|
|
118
|
+
const uploadToSteamRunner = (0, _pipelab_plugin_core.createActionRunner)(async ({ log, inputs, cwd, abortSignal, setOutput }) => {
|
|
119
|
+
const folder = inputs.folder;
|
|
120
|
+
const appId = inputs.appId;
|
|
121
|
+
const sdk = inputs.sdk;
|
|
122
|
+
const depotId = inputs.depotId;
|
|
123
|
+
const username = inputs.username;
|
|
124
|
+
const description = inputs.description;
|
|
125
|
+
log(`uploading "${folder}" to steam`);
|
|
126
|
+
const errorMap = { 6: `No connection to content server. Your depot id (${depotId}) may be invalid` };
|
|
127
|
+
if (!await (0, _pipelab_plugin_core.fileExists)(sdk)) throw new Error(`You must enter a valid path to the Steam SDK`);
|
|
128
|
+
let builderFolder = "builder";
|
|
129
|
+
if ((0, node_os.platform)() === "linux") builderFolder += "_linux";
|
|
130
|
+
else if ((0, node_os.platform)() === "darwin") builderFolder += "_osx";
|
|
131
|
+
const cmd = "steamcmd";
|
|
132
|
+
const extensions = (0, node_os.platform)() === "win32" ? [
|
|
133
|
+
".exe",
|
|
134
|
+
".cmd",
|
|
135
|
+
".bat"
|
|
136
|
+
] : [".sh"];
|
|
137
|
+
let cmdFinal = "";
|
|
138
|
+
let steamcmdPath = "";
|
|
139
|
+
for (const ext of extensions) {
|
|
140
|
+
const p = (0, node_path.join)(sdk, "tools", "ContentBuilder", builderFolder, cmd + ext);
|
|
141
|
+
if (await (0, _pipelab_plugin_core.fileExists)(p)) {
|
|
142
|
+
steamcmdPath = p;
|
|
143
|
+
cmdFinal = cmd + ext;
|
|
144
|
+
break;
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
if (!steamcmdPath) {
|
|
148
|
+
if ((0, node_os.platform)() === "linux" || (0, node_os.platform)() === "darwin") cmdFinal = "steamcmd.sh";
|
|
149
|
+
else if ((0, node_os.platform)() === "win32") cmdFinal = "steamcmd.exe";
|
|
150
|
+
steamcmdPath = (0, node_path.join)(sdk, "tools", "ContentBuilder", builderFolder, cmdFinal);
|
|
151
|
+
}
|
|
152
|
+
console.log("steamcmdPath", steamcmdPath);
|
|
153
|
+
if ((0, node_os.platform)() === "linux" || (0, node_os.platform)() === "darwin") {
|
|
154
|
+
if ((0, node_os.platform)() === "linux") {
|
|
155
|
+
log("Adding \"execute\" permissions to linux binary");
|
|
156
|
+
await (0, node_fs_promises.chmod)((0, node_path.join)(sdk, "tools", "ContentBuilder", builderFolder, "linux32", cmd), 493);
|
|
157
|
+
await (0, node_fs_promises.chmod)((0, node_path.join)(sdk, "tools", "ContentBuilder", builderFolder, "linux32", "steamerrorreporter"), 493);
|
|
158
|
+
}
|
|
159
|
+
if ((0, node_os.platform)() === "darwin") {
|
|
160
|
+
const steamcmdBinaryPath = (0, node_path.join)(sdk, "tools", "ContentBuilder", builderFolder, cmd);
|
|
161
|
+
log("Adding \"execute\" permissions to darwin binary");
|
|
162
|
+
await (0, node_fs_promises.chmod)(steamcmdBinaryPath, 493);
|
|
163
|
+
}
|
|
164
|
+
log("Adding \"execute\" permissions to binary");
|
|
165
|
+
await (0, node_fs_promises.chmod)(steamcmdPath, 493);
|
|
166
|
+
}
|
|
167
|
+
const buildOutput = (0, node_path.join)(cwd, "steam", "output");
|
|
168
|
+
const scriptPath = (0, node_path.join)(cwd, "steam", "script.vdf");
|
|
169
|
+
setOutput("script-path", scriptPath);
|
|
170
|
+
setOutput("output-folder", buildOutput);
|
|
171
|
+
await (0, node_fs_promises.mkdir)(buildOutput, { recursive: true });
|
|
172
|
+
await (0, node_fs_promises.mkdir)((0, node_path.dirname)(scriptPath), { recursive: true });
|
|
173
|
+
const script = `"AppBuild"
|
|
174
|
+
{
|
|
175
|
+
"AppID" "${appId}" // your AppID
|
|
176
|
+
"Desc" "${description}" // internal description for this build
|
|
177
|
+
|
|
178
|
+
"ContentRoot" "${folder}" // root content folder, relative to location of this file
|
|
179
|
+
"BuildOutput" "${buildOutput}" // build output folder for build logs and build cache files
|
|
180
|
+
|
|
181
|
+
"Depots"
|
|
182
|
+
{
|
|
183
|
+
"${depotId}" // your DepotID
|
|
184
|
+
{
|
|
185
|
+
"FileMapping"
|
|
186
|
+
{
|
|
187
|
+
"LocalPath" "*" // all files from contentroot folder
|
|
188
|
+
"DepotPath" "." // mapped into the root of the depot
|
|
189
|
+
"recursive" "1" // include all subfolders
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
}`;
|
|
194
|
+
console.log("script", script);
|
|
195
|
+
const isAuthenticated = await checkSteamAuth({
|
|
196
|
+
context: {
|
|
197
|
+
log,
|
|
198
|
+
abortSignal
|
|
199
|
+
},
|
|
200
|
+
scriptPath,
|
|
201
|
+
steamcmdPath,
|
|
202
|
+
username
|
|
203
|
+
});
|
|
204
|
+
log("isAuthenticated", JSON.stringify(isAuthenticated));
|
|
205
|
+
if (isAuthenticated.success === false) {
|
|
206
|
+
log("Opening terminal with interactive login");
|
|
207
|
+
await openExternalTerminal(steamcmdPath, [
|
|
208
|
+
"+login",
|
|
209
|
+
username,
|
|
210
|
+
"+quit"
|
|
211
|
+
], { cancelSignal: abortSignal });
|
|
212
|
+
if ((await checkSteamAuth({
|
|
213
|
+
context: {
|
|
214
|
+
log,
|
|
215
|
+
abortSignal
|
|
216
|
+
},
|
|
217
|
+
scriptPath,
|
|
218
|
+
steamcmdPath,
|
|
219
|
+
username
|
|
220
|
+
})).success === false) throw new Error("Not authenticated");
|
|
221
|
+
}
|
|
222
|
+
log("Writing script");
|
|
223
|
+
await (0, node_fs_promises.writeFile)(scriptPath, script, {
|
|
224
|
+
encoding: "utf8",
|
|
225
|
+
signal: abortSignal
|
|
226
|
+
});
|
|
227
|
+
log("Executing steamcmd");
|
|
228
|
+
try {
|
|
229
|
+
await (0, _pipelab_plugin_core.runWithLiveLogs)(steamcmdPath, [
|
|
230
|
+
"+login",
|
|
231
|
+
username,
|
|
232
|
+
"+run_app_build",
|
|
233
|
+
scriptPath,
|
|
234
|
+
"+quit"
|
|
235
|
+
], { shell: (0, node_os.platform)() === "win32" }, log, {
|
|
236
|
+
onStdout: (data) => {
|
|
237
|
+
log("[steamcmd]", data);
|
|
238
|
+
},
|
|
239
|
+
onStderr: (data) => {
|
|
240
|
+
log("[steamcmd]", data);
|
|
241
|
+
}
|
|
242
|
+
}, abortSignal);
|
|
243
|
+
} catch (e) {
|
|
244
|
+
if (e instanceof _pipelab_plugin_core.ExternalCommandError) {
|
|
245
|
+
const code = e.code;
|
|
246
|
+
const message = code in errorMap ? errorMap[code] : "SteamCmd error:" + e.code + " " + e.message;
|
|
247
|
+
throw new Error(message);
|
|
248
|
+
} else if (e instanceof Error) {
|
|
249
|
+
console.error(e);
|
|
250
|
+
throw new Error("Error:" + e.message);
|
|
251
|
+
} else throw new Error("unknwon error");
|
|
252
|
+
}
|
|
253
|
+
setOutput("status", "success");
|
|
254
|
+
log("Done uploading");
|
|
255
|
+
});
|
|
256
|
+
//#endregion
|
|
257
|
+
//#region src/index.ts
|
|
258
|
+
const icon = new URL("./steam.webp", require("url").pathToFileURL(__filename).href).href;
|
|
259
|
+
var src_default = (0, _pipelab_plugin_core.createNodeDefinition)({
|
|
260
|
+
description: "Steam",
|
|
261
|
+
id: "steam",
|
|
262
|
+
name: "Steam",
|
|
263
|
+
icon: {
|
|
264
|
+
type: "image",
|
|
265
|
+
image: icon
|
|
266
|
+
},
|
|
267
|
+
nodes: [{
|
|
268
|
+
node: uploadToSteam,
|
|
269
|
+
runner: uploadToSteamRunner
|
|
270
|
+
}]
|
|
271
|
+
});
|
|
272
|
+
//#endregion
|
|
273
|
+
module.exports = src_default;
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/index.ts"],"mappings":""}
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/index.ts"],"mappings":""}
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,275 @@
|
|
|
1
|
+
import { dirname, join } from "node:path";
|
|
2
|
+
import { platform } from "node:os";
|
|
3
|
+
import { chmod, mkdir, writeFile } from "node:fs/promises";
|
|
4
|
+
import { ExternalCommandError, createAction, createActionRunner, createNodeDefinition, createPathParam, createStringParam, fileExists, runWithLiveLogs } from "@pipelab/plugin-core";
|
|
5
|
+
import { execa } from "execa";
|
|
6
|
+
//#region src/utils.ts
|
|
7
|
+
const checkSteamAuth = async (options) => {
|
|
8
|
+
let error = void 0;
|
|
9
|
+
try {
|
|
10
|
+
await runWithLiveLogs(options.steamcmdPath, [
|
|
11
|
+
"+login",
|
|
12
|
+
options.username,
|
|
13
|
+
"+quit"
|
|
14
|
+
], { shell: process.platform === "win32" }, options.context.log, { onStdout: (data, subprocess) => {
|
|
15
|
+
options.context.log("[Steam Cmd]", data);
|
|
16
|
+
if (data.includes("Cached credentials not found")) {
|
|
17
|
+
error = "LOGGED_OUT";
|
|
18
|
+
subprocess.kill();
|
|
19
|
+
}
|
|
20
|
+
} }, options.context.abortSignal);
|
|
21
|
+
} catch (e) {
|
|
22
|
+
console.error("e", e);
|
|
23
|
+
if (!error) error = "UNKNOWN";
|
|
24
|
+
}
|
|
25
|
+
if (error) return {
|
|
26
|
+
success: false,
|
|
27
|
+
error
|
|
28
|
+
};
|
|
29
|
+
return { success: true };
|
|
30
|
+
};
|
|
31
|
+
const openExternalTerminal = async (command, args = [], options = {}, keepOpen = false) => {
|
|
32
|
+
const platform = process.platform;
|
|
33
|
+
if (platform === "darwin") {
|
|
34
|
+
const escapedShellCommand = `${command} ${args.join(" ")}; echo "You can now close this window"`.replace(/\\/g, "\\\\").replace(/"/g, "\\\"");
|
|
35
|
+
let osaScript;
|
|
36
|
+
if (keepOpen) osaScript = `tell application "Terminal"\nactivate\ndo script "${escapedShellCommand}"\nend tell`;
|
|
37
|
+
else osaScript = `tell application "Terminal"
|
|
38
|
+
activate
|
|
39
|
+
set targetTab to do script "${escapedShellCommand}"
|
|
40
|
+
-- Wait for the command to complete by checking the 'busy' status of the tab
|
|
41
|
+
delay 0.5 -- Initial delay to allow the process to start and tab to become busy
|
|
42
|
+
repeat while busy of targetTab
|
|
43
|
+
delay 0.5 -- Check every 0.5 seconds
|
|
44
|
+
end repeat
|
|
45
|
+
end tell`;
|
|
46
|
+
return execa("osascript", ["-e", osaScript], options);
|
|
47
|
+
} else if (platform === "linux") return execa(process.env.TERMINAL ?? process.env.TERM ?? "xterm", [
|
|
48
|
+
"-e",
|
|
49
|
+
command,
|
|
50
|
+
...args
|
|
51
|
+
], options);
|
|
52
|
+
else if (platform === "win32") return execa("cmd.exe", [
|
|
53
|
+
keepOpen ? "/k" : "/c",
|
|
54
|
+
"start",
|
|
55
|
+
"cmd.exe",
|
|
56
|
+
"/c",
|
|
57
|
+
command,
|
|
58
|
+
...args
|
|
59
|
+
], options);
|
|
60
|
+
else throw new Error("Unsupported platform: " + platform);
|
|
61
|
+
};
|
|
62
|
+
const uploadToSteam = createAction({
|
|
63
|
+
id: "steam-upload",
|
|
64
|
+
name: "Upload to Steam",
|
|
65
|
+
description: "Upload a folder to Steam",
|
|
66
|
+
icon: "",
|
|
67
|
+
displayString: "`Upload ${fmt.param(params['folder'], 'primary')} to steam`",
|
|
68
|
+
meta: {},
|
|
69
|
+
params: {
|
|
70
|
+
sdk: createPathParam("", {
|
|
71
|
+
required: true,
|
|
72
|
+
label: "Steam Sdk path",
|
|
73
|
+
control: {
|
|
74
|
+
type: "path",
|
|
75
|
+
options: { properties: ["openDirectory"] }
|
|
76
|
+
}
|
|
77
|
+
}),
|
|
78
|
+
username: createStringParam("", {
|
|
79
|
+
required: true,
|
|
80
|
+
label: "Steam username"
|
|
81
|
+
}),
|
|
82
|
+
appId: createStringParam("", {
|
|
83
|
+
required: true,
|
|
84
|
+
label: "App Id"
|
|
85
|
+
}),
|
|
86
|
+
depotId: createStringParam("", {
|
|
87
|
+
required: true,
|
|
88
|
+
label: "Depot Id"
|
|
89
|
+
}),
|
|
90
|
+
description: createStringParam("", {
|
|
91
|
+
required: true,
|
|
92
|
+
label: "Description"
|
|
93
|
+
}),
|
|
94
|
+
folder: createPathParam("", {
|
|
95
|
+
required: true,
|
|
96
|
+
label: "Folder to upload",
|
|
97
|
+
control: {
|
|
98
|
+
type: "path",
|
|
99
|
+
options: { properties: ["openDirectory"] }
|
|
100
|
+
}
|
|
101
|
+
})
|
|
102
|
+
},
|
|
103
|
+
outputs: {
|
|
104
|
+
"script-path": {
|
|
105
|
+
label: "Script path",
|
|
106
|
+
value: ""
|
|
107
|
+
},
|
|
108
|
+
"output-folder": {
|
|
109
|
+
label: "Output folder",
|
|
110
|
+
value: ""
|
|
111
|
+
},
|
|
112
|
+
status: {
|
|
113
|
+
label: "Status",
|
|
114
|
+
value: ""
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
});
|
|
118
|
+
const uploadToSteamRunner = createActionRunner(async ({ log, inputs, cwd, abortSignal, setOutput }) => {
|
|
119
|
+
const folder = inputs.folder;
|
|
120
|
+
const appId = inputs.appId;
|
|
121
|
+
const sdk = inputs.sdk;
|
|
122
|
+
const depotId = inputs.depotId;
|
|
123
|
+
const username = inputs.username;
|
|
124
|
+
const description = inputs.description;
|
|
125
|
+
log(`uploading "${folder}" to steam`);
|
|
126
|
+
const errorMap = { 6: `No connection to content server. Your depot id (${depotId}) may be invalid` };
|
|
127
|
+
if (!await fileExists(sdk)) throw new Error(`You must enter a valid path to the Steam SDK`);
|
|
128
|
+
let builderFolder = "builder";
|
|
129
|
+
if (platform() === "linux") builderFolder += "_linux";
|
|
130
|
+
else if (platform() === "darwin") builderFolder += "_osx";
|
|
131
|
+
const cmd = "steamcmd";
|
|
132
|
+
const extensions = platform() === "win32" ? [
|
|
133
|
+
".exe",
|
|
134
|
+
".cmd",
|
|
135
|
+
".bat"
|
|
136
|
+
] : [".sh"];
|
|
137
|
+
let cmdFinal = "";
|
|
138
|
+
let steamcmdPath = "";
|
|
139
|
+
for (const ext of extensions) {
|
|
140
|
+
const p = join(sdk, "tools", "ContentBuilder", builderFolder, cmd + ext);
|
|
141
|
+
if (await fileExists(p)) {
|
|
142
|
+
steamcmdPath = p;
|
|
143
|
+
cmdFinal = cmd + ext;
|
|
144
|
+
break;
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
if (!steamcmdPath) {
|
|
148
|
+
if (platform() === "linux" || platform() === "darwin") cmdFinal = "steamcmd.sh";
|
|
149
|
+
else if (platform() === "win32") cmdFinal = "steamcmd.exe";
|
|
150
|
+
steamcmdPath = join(sdk, "tools", "ContentBuilder", builderFolder, cmdFinal);
|
|
151
|
+
}
|
|
152
|
+
console.log("steamcmdPath", steamcmdPath);
|
|
153
|
+
if (platform() === "linux" || platform() === "darwin") {
|
|
154
|
+
if (platform() === "linux") {
|
|
155
|
+
log("Adding \"execute\" permissions to linux binary");
|
|
156
|
+
await chmod(join(sdk, "tools", "ContentBuilder", builderFolder, "linux32", cmd), 493);
|
|
157
|
+
await chmod(join(sdk, "tools", "ContentBuilder", builderFolder, "linux32", "steamerrorreporter"), 493);
|
|
158
|
+
}
|
|
159
|
+
if (platform() === "darwin") {
|
|
160
|
+
const steamcmdBinaryPath = join(sdk, "tools", "ContentBuilder", builderFolder, cmd);
|
|
161
|
+
log("Adding \"execute\" permissions to darwin binary");
|
|
162
|
+
await chmod(steamcmdBinaryPath, 493);
|
|
163
|
+
}
|
|
164
|
+
log("Adding \"execute\" permissions to binary");
|
|
165
|
+
await chmod(steamcmdPath, 493);
|
|
166
|
+
}
|
|
167
|
+
const buildOutput = join(cwd, "steam", "output");
|
|
168
|
+
const scriptPath = join(cwd, "steam", "script.vdf");
|
|
169
|
+
setOutput("script-path", scriptPath);
|
|
170
|
+
setOutput("output-folder", buildOutput);
|
|
171
|
+
await mkdir(buildOutput, { recursive: true });
|
|
172
|
+
await mkdir(dirname(scriptPath), { recursive: true });
|
|
173
|
+
const script = `"AppBuild"
|
|
174
|
+
{
|
|
175
|
+
"AppID" "${appId}" // your AppID
|
|
176
|
+
"Desc" "${description}" // internal description for this build
|
|
177
|
+
|
|
178
|
+
"ContentRoot" "${folder}" // root content folder, relative to location of this file
|
|
179
|
+
"BuildOutput" "${buildOutput}" // build output folder for build logs and build cache files
|
|
180
|
+
|
|
181
|
+
"Depots"
|
|
182
|
+
{
|
|
183
|
+
"${depotId}" // your DepotID
|
|
184
|
+
{
|
|
185
|
+
"FileMapping"
|
|
186
|
+
{
|
|
187
|
+
"LocalPath" "*" // all files from contentroot folder
|
|
188
|
+
"DepotPath" "." // mapped into the root of the depot
|
|
189
|
+
"recursive" "1" // include all subfolders
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
}`;
|
|
194
|
+
console.log("script", script);
|
|
195
|
+
const isAuthenticated = await checkSteamAuth({
|
|
196
|
+
context: {
|
|
197
|
+
log,
|
|
198
|
+
abortSignal
|
|
199
|
+
},
|
|
200
|
+
scriptPath,
|
|
201
|
+
steamcmdPath,
|
|
202
|
+
username
|
|
203
|
+
});
|
|
204
|
+
log("isAuthenticated", JSON.stringify(isAuthenticated));
|
|
205
|
+
if (isAuthenticated.success === false) {
|
|
206
|
+
log("Opening terminal with interactive login");
|
|
207
|
+
await openExternalTerminal(steamcmdPath, [
|
|
208
|
+
"+login",
|
|
209
|
+
username,
|
|
210
|
+
"+quit"
|
|
211
|
+
], { cancelSignal: abortSignal });
|
|
212
|
+
if ((await checkSteamAuth({
|
|
213
|
+
context: {
|
|
214
|
+
log,
|
|
215
|
+
abortSignal
|
|
216
|
+
},
|
|
217
|
+
scriptPath,
|
|
218
|
+
steamcmdPath,
|
|
219
|
+
username
|
|
220
|
+
})).success === false) throw new Error("Not authenticated");
|
|
221
|
+
}
|
|
222
|
+
log("Writing script");
|
|
223
|
+
await writeFile(scriptPath, script, {
|
|
224
|
+
encoding: "utf8",
|
|
225
|
+
signal: abortSignal
|
|
226
|
+
});
|
|
227
|
+
log("Executing steamcmd");
|
|
228
|
+
try {
|
|
229
|
+
await runWithLiveLogs(steamcmdPath, [
|
|
230
|
+
"+login",
|
|
231
|
+
username,
|
|
232
|
+
"+run_app_build",
|
|
233
|
+
scriptPath,
|
|
234
|
+
"+quit"
|
|
235
|
+
], { shell: platform() === "win32" }, log, {
|
|
236
|
+
onStdout: (data) => {
|
|
237
|
+
log("[steamcmd]", data);
|
|
238
|
+
},
|
|
239
|
+
onStderr: (data) => {
|
|
240
|
+
log("[steamcmd]", data);
|
|
241
|
+
}
|
|
242
|
+
}, abortSignal);
|
|
243
|
+
} catch (e) {
|
|
244
|
+
if (e instanceof ExternalCommandError) {
|
|
245
|
+
const code = e.code;
|
|
246
|
+
const message = code in errorMap ? errorMap[code] : "SteamCmd error:" + e.code + " " + e.message;
|
|
247
|
+
throw new Error(message);
|
|
248
|
+
} else if (e instanceof Error) {
|
|
249
|
+
console.error(e);
|
|
250
|
+
throw new Error("Error:" + e.message);
|
|
251
|
+
} else throw new Error("unknwon error");
|
|
252
|
+
}
|
|
253
|
+
setOutput("status", "success");
|
|
254
|
+
log("Done uploading");
|
|
255
|
+
});
|
|
256
|
+
//#endregion
|
|
257
|
+
//#region src/index.ts
|
|
258
|
+
const icon = new URL("./steam.webp", import.meta.url).href;
|
|
259
|
+
var src_default = createNodeDefinition({
|
|
260
|
+
description: "Steam",
|
|
261
|
+
id: "steam",
|
|
262
|
+
name: "Steam",
|
|
263
|
+
icon: {
|
|
264
|
+
type: "image",
|
|
265
|
+
image: icon
|
|
266
|
+
},
|
|
267
|
+
nodes: [{
|
|
268
|
+
node: uploadToSteam,
|
|
269
|
+
runner: uploadToSteamRunner
|
|
270
|
+
}]
|
|
271
|
+
});
|
|
272
|
+
//#endregion
|
|
273
|
+
export { src_default as default };
|
|
274
|
+
|
|
275
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../src/utils.ts","../src/upload-to-steam.ts","../src/index.ts"],"sourcesContent":["import { runWithLiveLogs } from \"@pipelab/plugin-core\";\nimport { execa, Options as ExecaOptions } from \"execa\";\nimport os from \"node:os\";\n\nexport type Options = {\n steamcmdPath: string;\n username: string;\n scriptPath: string;\n context: {\n log: typeof console.log;\n abortSignal: AbortSignal;\n };\n};\n\nexport const checkSteamAuth = async (options: Options) => {\n let error: \"LOGGED_OUT\" | \"UNKNOWN\" | undefined = undefined;\n\n try {\n await runWithLiveLogs(\n options.steamcmdPath,\n [\"+login\", options.username, \"+quit\"],\n {\n shell: process.platform === \"win32\",\n },\n options.context.log,\n {\n onStdout: (data, subprocess) => {\n options.context.log(\"[Steam Cmd]\", data);\n // TODO: handle password input dynamically\n if (data.includes(\"Cached credentials not found\")) {\n error = \"LOGGED_OUT\";\n\n subprocess.kill();\n }\n },\n },\n options.context.abortSignal,\n );\n } catch (e) {\n console.error(\"e\", e);\n if (!error) {\n error = \"UNKNOWN\";\n }\n }\n\n if (error) {\n return {\n success: false,\n error,\n };\n }\n\n return {\n success: true,\n };\n};\n\nexport const openExternalTerminal = async (\n command: string,\n args: string[] = [],\n options: ExecaOptions = {},\n keepOpen = false,\n) => {\n const platform = process.platform;\n\n if (platform === \"darwin\") {\n // macOS: open in Terminal.app\n const shellCommand = `${command} ${args.join(\" \")}; echo \"You can now close this window\"`;\n // Escape for AppleScript string literal\n const escapedShellCommand = shellCommand\n .replace(/\\\\/g, \"\\\\\\\\\") // Must escape backslashes first\n .replace(/\"/g, '\\\\\"'); // Then escape double quotes\n\n let osaScript: string;\n if (keepOpen) {\n // If keepOpen is true, just run the command and leave the terminal open.\n // Added activate to bring Terminal to front.\n osaScript = `tell application \"Terminal\"\\nactivate\\ndo script \"${escapedShellCommand}\"\\nend tell`;\n } else {\n // If keepOpen is false (default), run the command, wait for it to finish, then close the tab.\n osaScript = `tell application \"Terminal\"\n activate\n set targetTab to do script \"${escapedShellCommand}\"\n -- Wait for the command to complete by checking the 'busy' status of the tab\n delay 0.5 -- Initial delay to allow the process to start and tab to become busy\n repeat while busy of targetTab\n delay 0.5 -- Check every 0.5 seconds\n end repeat\nend tell`;\n }\n\n return execa(\"osascript\", [\"-e\", osaScript], options);\n } else if (platform === \"linux\") {\n // Linux: use $TERMINAL, $TERM, or fallback to xterm\n const terminal = process.env.TERMINAL ?? process.env.TERM ?? \"xterm\";\n return execa(terminal, [\"-e\", command, ...args], options);\n } else if (platform === \"win32\") {\n // Windows: try PowerShell by default, fallback to CMD if needed\n // try {\n // console.log('verifying')\n // // Try a harmless PowerShell command. We ignore stdio.\n // await execa(\n // 'powershell.exe',\n // ['-Command', 'Write-Output \"PowerShell available\"; exit'],\n // {\n // all: true\n // }\n // )\n // return execa(\n // 'cmd.exe',\n // [keepOpen ? '/k' : '/c', 'start', 'powershell.exe', '-Command', command, ...args],\n // options\n // )\n // } catch (error) {\n // Oops! No PowerShell? Fallback to CMD.\n return execa(\n \"cmd.exe\",\n [keepOpen ? \"/k\" : \"/c\", \"start\", \"cmd.exe\", \"/c\", command, ...args],\n options,\n );\n // }\n } else {\n throw new Error(\"Unsupported platform: \" + platform);\n }\n};\n","import { join, dirname, basename } from \"node:path\";\nimport { platform } from \"node:os\";\nimport { chmod, mkdir, writeFile, cp } from \"node:fs/promises\";\nimport {\n createAction,\n createActionRunner,\n createPathParam,\n createStringParam,\n fileExists,\n runWithLiveLogs,\n} from \"@pipelab/plugin-core\";\nimport { checkSteamAuth, openExternalTerminal } from \"./utils\";\nimport { ExternalCommandError } from \"@pipelab/plugin-core\";\n\n// https://github.com/ztgasdf/steampkg?tab=readme-ov-file#account-management\n\n// How to login\n// Do it at least once\n// sdk/tools/ContentBuilder/builder_linux/steamcmd.sh +login User +quit\n\nexport const ID = \"steam-upload\";\n\nexport const uploadToSteam = createAction({\n id: ID,\n name: \"Upload to Steam\",\n description: \"Upload a folder to Steam\",\n icon: \"\",\n displayString: \"`Upload ${fmt.param(params['folder'], 'primary')} to steam`\",\n meta: {},\n params: {\n sdk: createPathParam(\"\", {\n required: true,\n label: \"Steam Sdk path\",\n control: {\n type: \"path\",\n options: {\n properties: [\"openDirectory\"],\n },\n },\n }),\n username: createStringParam(\"\", {\n required: true,\n label: \"Steam username\",\n }),\n appId: createStringParam(\"\", {\n required: true,\n label: \"App Id\",\n }),\n depotId: createStringParam(\"\", {\n required: true,\n label: \"Depot Id\",\n }),\n description: createStringParam(\"\", {\n required: true,\n label: \"Description\",\n }),\n folder: createPathParam(\"\", {\n required: true,\n label: \"Folder to upload\",\n control: {\n type: \"path\",\n options: {\n properties: [\"openDirectory\"],\n },\n },\n }),\n // enableDRM: {\n // value: false,\n // label: 'Enable DRM',\n // control: {\n // type: 'boolean'\n // }\n // },\n // binaryToPatch: createPathParam('', {\n // label: 'Binary to patch',\n // control: {\n // type: 'path',\n // options: {\n // properties: ['openFile']\n // }\n // }\n // })\n },\n outputs: {\n \"script-path\": {\n label: \"Script path\",\n value: \"\",\n },\n \"output-folder\": {\n label: \"Output folder\",\n value: \"\",\n },\n status: {\n label: \"Status\",\n value: \"\",\n },\n },\n});\n\nexport const uploadToSteamRunner = createActionRunner<typeof uploadToSteam>(\n async ({ log, inputs, cwd, abortSignal, setOutput }) => {\n const folder = inputs.folder as string;\n const appId = inputs.appId as string;\n const sdk = inputs.sdk as string;\n const depotId = inputs.depotId as string;\n const username = inputs.username as string;\n const description = inputs.description as string;\n\n log(`uploading \"${folder}\" to steam`);\n\n const errorMap = {\n 6: `No connection to content server. Your depot id (${depotId}) may be invalid`,\n };\n\n const isSDKExisting = await fileExists(sdk);\n if (!isSDKExisting) {\n throw new Error(`You must enter a valid path to the Steam SDK`);\n }\n\n let builderFolder = \"builder\";\n if (platform() === \"linux\") {\n builderFolder += \"_linux\";\n } else if (platform() === \"darwin\") {\n builderFolder += \"_osx\";\n }\n\n const cmd = \"steamcmd\";\n const extensions = platform() === \"win32\" ? [\".exe\", \".cmd\", \".bat\"] : [\".sh\"];\n\n let cmdFinal = \"\";\n let steamcmdPath = \"\";\n\n for (const ext of extensions) {\n const p = join(sdk as string, \"tools\", \"ContentBuilder\", builderFolder, cmd + ext);\n if (await fileExists(p)) {\n steamcmdPath = p;\n cmdFinal = cmd + ext;\n break;\n }\n }\n\n // Fallback if none found (to maintain previous behavior of joining default)\n if (!steamcmdPath) {\n if (platform() === \"linux\" || platform() === \"darwin\") {\n cmdFinal = \"steamcmd.sh\";\n } else if (platform() === \"win32\") {\n cmdFinal = \"steamcmd.exe\";\n }\n steamcmdPath = join(sdk as string, \"tools\", \"ContentBuilder\", builderFolder, cmdFinal);\n }\n\n console.log(\"steamcmdPath\", steamcmdPath);\n\n if (platform() === \"linux\" || platform() === \"darwin\") {\n if (platform() === \"linux\") {\n log('Adding \"execute\" permissions to linux binary');\n const steamcmdBinaryPath = join(\n sdk,\n \"tools\",\n \"ContentBuilder\",\n builderFolder,\n \"linux32\",\n cmd,\n );\n await chmod(steamcmdBinaryPath, 0o755);\n const steamcmdBinaryErrorReporterPath = join(\n sdk,\n \"tools\",\n \"ContentBuilder\",\n builderFolder,\n \"linux32\",\n \"steamerrorreporter\",\n );\n await chmod(steamcmdBinaryErrorReporterPath, 0o755);\n }\n\n if (platform() === \"darwin\") {\n const steamcmdBinaryPath = join(sdk, \"tools\", \"ContentBuilder\", builderFolder, cmd);\n log('Adding \"execute\" permissions to darwin binary');\n await chmod(steamcmdBinaryPath, 0o755);\n }\n\n log('Adding \"execute\" permissions to binary');\n await chmod(steamcmdPath, 0o755);\n }\n\n const buildOutput = join(cwd, \"steam\", \"output\");\n const scriptPath = join(cwd, \"steam\", \"script.vdf\");\n\n setOutput(\"script-path\", scriptPath);\n setOutput(\"output-folder\", buildOutput);\n\n await mkdir(buildOutput, {\n recursive: true,\n });\n\n await mkdir(dirname(scriptPath), {\n recursive: true,\n });\n\n const script = `\"AppBuild\"\n{\n\t\"AppID\" \"${appId}\" // your AppID\n\t\"Desc\" \"${description}\" // internal description for this build\n\n\t\"ContentRoot\" \"${folder}\" // root content folder, relative to location of this file\n\t\"BuildOutput\" \"${buildOutput}\" // build output folder for build logs and build cache files\n\n\t\"Depots\"\n\t{\n\t\t\"${depotId}\" // your DepotID\n\t\t{\n\t\t\t\"FileMapping\"\n\t\t\t{\n\t\t\t\t\"LocalPath\" \"*\" // all files from contentroot folder\n\t\t\t\t\"DepotPath\" \".\" // mapped into the root of the depot\n\t\t\t\t\"recursive\" \"1\" // include all subfolders\n\t\t\t}\n\t\t}\n\t}\n}`;\n\n console.log(\"script\", script);\n const isAuthenticated = await checkSteamAuth({\n context: {\n log,\n abortSignal,\n },\n scriptPath,\n steamcmdPath,\n username,\n });\n\n log(\"isAuthenticated\", JSON.stringify(isAuthenticated));\n\n if (isAuthenticated.success === false) {\n log(\"Opening terminal with interactive login\");\n await openExternalTerminal(steamcmdPath, [\"+login\", username, \"+quit\"], {\n cancelSignal: abortSignal,\n });\n const isAuthenticatedNow = await checkSteamAuth({\n context: {\n log,\n abortSignal,\n },\n scriptPath,\n steamcmdPath,\n username,\n });\n if (isAuthenticatedNow.success === false) {\n throw new Error(\"Not authenticated\");\n }\n }\n\n log(\"Writing script\");\n await writeFile(scriptPath, script, {\n encoding: \"utf8\",\n signal: abortSignal,\n });\n\n log(\"Executing steamcmd\");\n\n // Should be authed here\n try {\n await runWithLiveLogs(\n steamcmdPath,\n [\"+login\", username, \"+run_app_build\", scriptPath, \"+quit\"],\n {\n shell: platform() === \"win32\",\n },\n log,\n {\n onStdout: (data) => {\n log(\"[steamcmd]\", data);\n },\n onStderr: (data) => {\n log(\"[steamcmd]\", data);\n },\n },\n abortSignal,\n );\n } catch (e) {\n if (e instanceof ExternalCommandError) {\n const code = e.code as keyof typeof errorMap;\n const message =\n code in errorMap ? errorMap[code] : \"SteamCmd error:\" + e.code + \" \" + e.message;\n throw new Error(message);\n } else if (e instanceof Error) {\n console.error(e);\n throw new Error(\"Error:\" + e.message);\n } else {\n throw new Error(\"unknwon error\");\n }\n }\n\n setOutput(\"status\", \"success\");\n log(\"Done uploading\");\n },\n);\n","import { uploadToSteam, uploadToSteamRunner } from \"./upload-to-steam\";\nimport { createNodeDefinition } from \"@pipelab/plugin-core\";\nconst icon = new URL(\"./steam.webp\", import.meta.url).href;\n\nexport default createNodeDefinition({\n description: \"Steam\",\n id: \"steam\",\n name: \"Steam\",\n icon: {\n type: \"image\",\n image: icon,\n },\n nodes: [\n {\n node: uploadToSteam,\n runner: uploadToSteamRunner,\n },\n ],\n});\n"],"mappings":";;;;;;AAcA,MAAa,iBAAiB,OAAO,YAAqB;CACxD,IAAI,QAA8C,KAAA;AAElD,KAAI;AACF,QAAM,gBACJ,QAAQ,cACR;GAAC;GAAU,QAAQ;GAAU;GAAQ,EACrC,EACE,OAAO,QAAQ,aAAa,SAC7B,EACD,QAAQ,QAAQ,KAChB,EACE,WAAW,MAAM,eAAe;AAC9B,WAAQ,QAAQ,IAAI,eAAe,KAAK;AAExC,OAAI,KAAK,SAAS,+BAA+B,EAAE;AACjD,YAAQ;AAER,eAAW,MAAM;;KAGtB,EACD,QAAQ,QAAQ,YACjB;UACM,GAAG;AACV,UAAQ,MAAM,KAAK,EAAE;AACrB,MAAI,CAAC,MACH,SAAQ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BAAiB;AACrB,OAAM,UAAU,YAAY,QAAQ;EAClC,UAAU;EACV,QAAQ;EACT,CAAC;AAEF,KAAI,qBAAqB;AAGzB,KAAI;AACF,QAAM,gBACJ,cACA;GAAC;GAAU;GAAU;GAAkB;GAAY;GAAQ,EAC3D,EACE,OAAO,UAAU,KAAK,SACvB,EACD,KACA;GACE,WAAW,SAAS;AAClB,QAAI,cAAc,KAAK;;GAEzB,WAAW,SAAS;AAClB,QAAI,cAAc,KAAK;;GAE1B,EACD,YACD;UACM,GAAG;AACV,MAAI,aAAa,sBAAsB;GACrC,MAAM,OAAO,EAAE;GACf,MAAM,UACJ,QAAQ,WAAW,SAAS,QAAQ,oBAAoB,EAAE,OAAO,MAAM,EAAE;AAC3E,SAAM,IAAI,MAAM,QAAQ;aACf,aAAa,OAAO;AAC7B,WAAQ,MAAM,EAAE;AAChB,SAAM,IAAI,MAAM,WAAW,EAAE,QAAQ;QAErC,OAAM,IAAI,MAAM,gBAAgB;;AAIpC,WAAU,UAAU,UAAU;AAC9B,KAAI,iBAAiB;EAExB;;;ACxSD,MAAM,OAAO,IAAI,IAAI,gBAAgB,OAAO,KAAK,IAAI,CAAC;AAEtD,IAAA,cAAe,qBAAqB;CAClC,aAAa;CACb,IAAI;CACJ,MAAM;CACN,MAAM;EACJ,MAAM;EACN,OAAO;EACR;CACD,OAAO,CACL;EACE,MAAM;EACN,QAAQ;EACT,CACF;CACF,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@pipelab/plugin-steam",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"license": "FSL-1.1-MIT",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "https://github.com/CynToolkit/pipelab.git",
|
|
8
|
+
"directory": "plugins/plugin-steam"
|
|
9
|
+
},
|
|
10
|
+
"files": [
|
|
11
|
+
"dist"
|
|
12
|
+
],
|
|
13
|
+
"type": "module",
|
|
14
|
+
"main": "./dist/index.cjs",
|
|
15
|
+
"module": "./dist/index.mjs",
|
|
16
|
+
"types": "./dist/index.d.mts",
|
|
17
|
+
"publishConfig": {
|
|
18
|
+
"access": "public"
|
|
19
|
+
},
|
|
20
|
+
"dependencies": {
|
|
21
|
+
"@types/node": "^24.12.2",
|
|
22
|
+
"execa": "9.4.1",
|
|
23
|
+
"@pipelab/plugin-core": "0.0.1"
|
|
24
|
+
},
|
|
25
|
+
"devDependencies": {
|
|
26
|
+
"tsdown": "0.21.2",
|
|
27
|
+
"typescript": "5.9.3",
|
|
28
|
+
"vitest": "3.1.4",
|
|
29
|
+
"@pipelab/tsconfig": "0.0.1",
|
|
30
|
+
"@pipelab/test-utils": "0.0.1"
|
|
31
|
+
},
|
|
32
|
+
"test": {
|
|
33
|
+
"env": {
|
|
34
|
+
"NODE_ENV": "development"
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
"scripts": {
|
|
38
|
+
"format": "oxfmt .",
|
|
39
|
+
"lint": "oxlint .",
|
|
40
|
+
"build": "tsdown",
|
|
41
|
+
"test": "vitest run -c tests/e2e/vitest.config.mts"
|
|
42
|
+
},
|
|
43
|
+
"exports": {
|
|
44
|
+
".": {
|
|
45
|
+
"types": "./dist/index.d.mts",
|
|
46
|
+
"import": "./dist/index.mjs",
|
|
47
|
+
"require": "./dist/index.cjs",
|
|
48
|
+
"default": "./dist/index.mjs"
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|