@pipelab/plugin-itch 1.0.0-beta.1 → 1.0.0-beta.4

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/package.json CHANGED
@@ -1,12 +1,15 @@
1
1
  {
2
2
  "name": "@pipelab/plugin-itch",
3
- "version": "1.0.0-beta.1",
3
+ "version": "1.0.0-beta.4",
4
4
  "license": "FSL-1.1-MIT",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "https://github.com/CynToolkit/pipelab.git",
8
8
  "directory": "plugins/plugin-itch"
9
9
  },
10
+ "files": [
11
+ "dist"
12
+ ],
10
13
  "type": "module",
11
14
  "main": "./dist/index.cjs",
12
15
  "module": "./dist/index.mjs",
@@ -16,13 +19,13 @@
16
19
  },
17
20
  "dependencies": {
18
21
  "node-stream-zip": "1.15.0",
19
- "@pipelab/plugin-core": "1.0.0-beta.1"
22
+ "@pipelab/plugin-core": "1.0.0-beta.4"
20
23
  },
21
24
  "devDependencies": {
22
25
  "@types/node": "24",
23
26
  "tsdown": "0.21.2",
24
27
  "typescript": "5.9.3",
25
- "@pipelab/tsconfig": "1.0.0-beta.0"
28
+ "@pipelab/tsconfig": "1.0.0-beta.2"
26
29
  },
27
30
  "scripts": {
28
31
  "format": "oxfmt .",
package/CHANGELOG.md DELETED
@@ -1,18 +0,0 @@
1
- # @pipelab/plugin-itch
2
-
3
- ## 1.0.0-beta.1
4
-
5
- ### Patch Changes
6
-
7
- - @pipelab/plugin-core@1.0.0-beta.1
8
-
9
- ## 1.0.0-beta.0
10
-
11
- ### Major Changes
12
-
13
- - e1befbf: initial release
14
-
15
- ### Patch Changes
16
-
17
- - Updated dependencies [e1befbf]
18
- - @pipelab/plugin-core@1.0.0-beta.0
Binary file
package/src/ensure.ts DELETED
@@ -1,62 +0,0 @@
1
- import { join } from "node:path";
2
- import { access, mkdir, chmod, rm } from "node:fs/promises";
3
- import { constants } from "node:fs";
4
- import { downloadFile, extractZip, generateTempFolder } from "@pipelab/plugin-core";
5
-
6
- /**
7
- * Installs itch.io butler CLI if not already present.
8
- * @param thirdpartyDir The directory where third-party tools are stored.
9
- * @param version The version of butler to install.
10
- * @returns A Promise that resolves to the path of the butler executable.
11
- */
12
- export const ensureButler = async (thirdpartyDir: string, version = "LATEST") => {
13
- const butlerDir = join(thirdpartyDir, "butler", version);
14
- const isWindows = process.platform === "win32";
15
- const executableName = isWindows ? "butler.exe" : "butler";
16
- const finalButlerPath = join(butlerDir, executableName);
17
-
18
- try {
19
- await access(finalButlerPath, constants.X_OK);
20
- return finalButlerPath;
21
- } catch (e) {
22
- console.log(`Butler not found at ${finalButlerPath}, installing...`);
23
- }
24
-
25
- const localOs = process.platform;
26
- const localArch = process.arch;
27
-
28
- let butlerName = "";
29
- if (localOs === "darwin") {
30
- butlerName += "darwin";
31
- } else if (localOs === "linux") {
32
- butlerName += "linux";
33
- } else if (localOs === "win32") {
34
- butlerName += "windows";
35
- }
36
-
37
- butlerName += "-";
38
-
39
- if (localArch === "x64" || localArch === "arm64") {
40
- butlerName += "amd64";
41
- } else {
42
- throw new Error(`Unsupported architecture for butler: ${localArch}`);
43
- }
44
-
45
- const downloadUrl = `https://broth.itch.zone/butler/${butlerName}/${version}/archive/default`;
46
- const tempDir = await generateTempFolder(join(thirdpartyDir, ".tmp"));
47
- const archivePath = join(tempDir, "butler.zip");
48
-
49
- console.log(`Downloading butler from ${downloadUrl}...`);
50
- await downloadFile(downloadUrl, archivePath);
51
-
52
- console.log(`Extracting butler to ${butlerDir}...`);
53
- await mkdir(butlerDir, { recursive: true });
54
- await extractZip(archivePath, butlerDir);
55
-
56
- if (!isWindows) {
57
- await chmod(finalButlerPath, 0o755);
58
- }
59
-
60
- await rm(tempDir, { recursive: true, force: true });
61
- return finalButlerPath;
62
- };
package/src/export.ts DELETED
@@ -1,116 +0,0 @@
1
- import { join, dirname, delimiter } from "node:path";
2
- import { ensureButler } from "./ensure.js";
3
- import { extractZip } from "@pipelab/plugin-core";
4
- import {
5
- createAction,
6
- createActionRunner,
7
- createPathParam,
8
- createStringParam,
9
- downloadFile,
10
- runWithLiveLogs,
11
- } from "@pipelab/plugin-core";
12
-
13
- export const ID = "itch-upload";
14
-
15
- export interface ButlerJSONOutputLog {
16
- level: "info";
17
- message: string;
18
- time: number;
19
- type: "log";
20
- }
21
-
22
- export interface ButlerJSONOutputProgress {
23
- bps: number;
24
- eta: number;
25
- progress: number;
26
- time: 1736873335;
27
- type: "progress";
28
- }
29
-
30
- export type ButlerJSONOutput = ButlerJSONOutputLog | ButlerJSONOutputProgress;
31
-
32
- export const uploadToItch = createAction({
33
- id: ID,
34
- name: "Upload to Itch.io",
35
- description: "",
36
- icon: "",
37
- displayString:
38
- "`Upload ${fmt.param(params['input-folder'], 'primary', 'No path selected')} to ${fmt.param(params['user'], 'primary', 'No project')}/${fmt.param(params['project'], 'primary', 'No project')}:${fmt.param(params['channel'], 'primary', 'No channel')}`",
39
- meta: {},
40
- params: {
41
- "input-folder": createPathParam("", {
42
- required: true,
43
- label: "Folder to Upload",
44
- control: {
45
- type: "path",
46
- options: {
47
- properties: ["openDirectory"],
48
- },
49
- },
50
- }),
51
- user: createStringParam("", {
52
- required: true,
53
- label: "User",
54
- }),
55
- project: createStringParam("", {
56
- required: true,
57
- label: "Project",
58
- }),
59
- channel: createStringParam("", {
60
- required: true,
61
- label: "Channel",
62
- }),
63
- "api-key": createStringParam("", {
64
- required: true,
65
- label: "API key",
66
- }),
67
- },
68
- outputs: {},
69
- });
70
-
71
- export const uploadToItchRunner = createActionRunner<typeof uploadToItch>(
72
- async ({ log, inputs, cwd, abortSignal, paths }) => {
73
- const { node, thirdparty } = paths;
74
- const butlerPath = await ensureButler(thirdparty);
75
-
76
- log("Uploading to itch");
77
-
78
- await runWithLiveLogs(
79
- butlerPath,
80
- [
81
- "push",
82
- inputs["input-folder"] as string,
83
- `${inputs.user as string}/${inputs.project as string}:${inputs.channel as string}`,
84
- "--json",
85
- ],
86
- {
87
- env: {
88
- ...process.env,
89
- // DEBUG: '*',
90
- PATH: `${dirname(node)}${delimiter}${process.env.PATH}`,
91
- BUTLER_API_KEY: inputs["api-key"] as string,
92
- },
93
- cancelSignal: abortSignal,
94
- },
95
- log,
96
- {
97
- onStdout(data, subprocess) {
98
- const jsons = data.trim().split("\n");
99
- for (const jsonData of jsons) {
100
- const json = JSON.parse(jsonData) as ButlerJSONOutput;
101
- switch (json.type) {
102
- case "log":
103
- log(json.message);
104
- break;
105
- case "progress":
106
- log(`${json.progress}% - ETA: ${json.eta}s`);
107
- break;
108
- }
109
- }
110
- },
111
- },
112
- );
113
-
114
- log("Uploaded to itch");
115
- },
116
- );
package/src/index.ts DELETED
@@ -1,21 +0,0 @@
1
- import { uploadToItch, uploadToItchRunner } from "./export";
2
-
3
- import { createNodeDefinition } from "@pipelab/plugin-core";
4
- const icon = new URL("./assets/itch-icon.webp", import.meta.url).href;
5
-
6
- export default createNodeDefinition({
7
- description: "Itch.io",
8
- name: "Itch.io",
9
- id: "itch.io",
10
- icon: {
11
- type: "image",
12
- image: icon,
13
- },
14
- nodes: [
15
- // make and package
16
- {
17
- node: uploadToItch,
18
- runner: uploadToItchRunner,
19
- },
20
- ],
21
- });
package/tsconfig.json DELETED
@@ -1,10 +0,0 @@
1
- {
2
- "extends": "@pipelab/tsconfig/vue.json",
3
- "compilerOptions": {
4
- "outDir": "dist",
5
- "rootDir": "src",
6
- "types": ["node"],
7
- "skipLibCheck": true
8
- },
9
- "include": ["src"]
10
- }
package/tsdown.config.ts DELETED
@@ -1,15 +0,0 @@
1
- import { defineConfig } from "tsdown";
2
-
3
- export default defineConfig({
4
- entry: ["src/index.ts"],
5
- format: ["esm", "cjs"],
6
- dts: true,
7
- clean: true,
8
- loader: {
9
- ".webp": "dataurl",
10
- ".png": "dataurl",
11
- ".jpg": "dataurl",
12
- ".jpeg": "dataurl",
13
- ".svg": "dataurl",
14
- },
15
- });