@pipelab/plugin-poki 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-poki",
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-poki"
9
9
  },
10
+ "files": [
11
+ "dist"
12
+ ],
10
13
  "type": "module",
11
14
  "main": "./dist/index.cjs",
12
15
  "module": "./dist/index.mjs",
@@ -15,7 +18,7 @@
15
18
  "access": "public"
16
19
  },
17
20
  "dependencies": {
18
- "@pipelab/plugin-core": "1.0.0-beta.1"
21
+ "@pipelab/plugin-core": "1.0.0-beta.4"
19
22
  },
20
23
  "devDependencies": {
21
24
  "@types/node": "24",
@@ -24,8 +27,8 @@
24
27
  "tsdown": "0.21.2",
25
28
  "typescript": "5.9.3",
26
29
  "vitest": "3.1.4",
27
- "@pipelab/test-utils": "1.0.0-beta.1",
28
- "@pipelab/tsconfig": "1.0.0-beta.0"
30
+ "@pipelab/test-utils": "1.0.0-beta.4",
31
+ "@pipelab/tsconfig": "1.0.0-beta.2"
29
32
  },
30
33
  "scripts": {
31
34
  "format": "oxfmt .",
package/CHANGELOG.md DELETED
@@ -1,18 +0,0 @@
1
- # @pipelab/plugin-poki
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
@@ -1,66 +0,0 @@
1
- import { expect, test, describe, afterEach } from "vitest";
2
- import { uploadToPokiRunner } from "./export.js";
3
- import { mkdir, writeFile, readFile, access } from "node:fs/promises";
4
- import { join, resolve, dirname } from "node:path";
5
- import { fileURLToPath } from "node:url";
6
- import { createSandbox, runAction } from "@pipelab/test-utils";
7
-
8
- const __filename = fileURLToPath(import.meta.url);
9
- const __dirname = dirname(__filename);
10
-
11
- describe("End-to-End: Poki Upload Action", () => {
12
- let sandbox: Awaited<ReturnType<typeof createSandbox>>;
13
-
14
- afterEach(async () => {
15
- if (sandbox) {
16
- await sandbox.remove();
17
- }
18
- });
19
-
20
- test("should upload to poki using mocked CLI", async () => {
21
- // 1. Setup Sandbox
22
- sandbox = await createSandbox("poki-e2e");
23
- const { paths } = sandbox;
24
-
25
- // Seed dummy input assets
26
- await writeFile(join(paths.input, "index.html"), "<html><body>Test</body></html>");
27
-
28
- // 2. Pre-seed a mock Poki CLI to avoid downloads and network issues
29
- // Path matches new flat fetchPackage structure
30
- const relativePokiBin = join("user-data", "packages", "@poki/cli", "0.1.19", "bin", "index.js");
31
- await sandbox.mockBinary(
32
- relativePokiBin,
33
- "console.log('Mock Poki CLI execution'); process.exit(0);",
34
- );
35
- // Pre-seed node_modules and package.json to skip installation or allow pnpm to run
36
- const pokiDir = join(sandbox.path, "user-data", "packages", "@poki/cli", "0.1.19");
37
- await mkdir(pokiDir, { recursive: true });
38
- await writeFile(join(pokiDir, "package.json"), JSON.stringify({ name: "@poki/cli", version: "0.1.19" }));
39
- await mkdir(join(pokiDir, "node_modules"), { recursive: true });
40
- await writeFile(join(pokiDir, "node_modules", ".keep"), "");
41
-
42
- // 3. Run Pipeline
43
- try {
44
- await runAction(uploadToPokiRunner, {
45
- inputs: {
46
- "input-folder": paths.input,
47
- project: "poki-game-123",
48
- name: "release-v1",
49
- notes: "E2E test notes",
50
- },
51
- sandboxPath: sandbox.path,
52
- });
53
- } catch (e: any) {
54
- console.error("Execution failed:", e.message);
55
- throw e;
56
- }
57
-
58
- // 4. Verification
59
- const pokiJsonPath = join(sandbox.path, "poki.json");
60
- console.log("pokiJsonPath test", pokiJsonPath);
61
- await expect(access(pokiJsonPath)).resolves.not.toThrow();
62
-
63
- const pokiJsonContent = JSON.parse(await readFile(pokiJsonPath, "utf-8"));
64
- expect(pokiJsonContent.game_id).toBe("poki-game-123");
65
- }, 5 * 60 * 1000); // 5 minutes timeout for real environment setup
66
- });
package/src/export.ts DELETED
@@ -1,125 +0,0 @@
1
- import {
2
- createAction,
3
- createActionRunner,
4
- createPathParam,
5
- createStringParam,
6
- fetchPackage,
7
- runWithLiveLogs,
8
- } from "@pipelab/plugin-core";
9
- import { dirname, join, delimiter } from "node:path";
10
- import { writeFile, cp, mkdir } from "node:fs/promises";
11
- import { homedir } from "node:os";
12
-
13
- export const ID = "poki-upload";
14
-
15
- export const uploadToPoki = createAction({
16
- id: ID,
17
- name: "Upload to Poki.io",
18
- description: "",
19
- icon: "",
20
- displayString:
21
- "`Upload ${fmt.param(params['input-folder'], 'primary', 'No path selected')} to ${fmt.param(params['project'], 'primary', 'No project')} poki game (${fmt.param(params['name'], 'primary', 'No version name')})`",
22
- meta: {},
23
- params: {
24
- "input-folder": createPathParam("", {
25
- required: true,
26
- label: "Folder to Upload",
27
- control: {
28
- type: "path",
29
- options: {
30
- properties: ["openDirectory"],
31
- },
32
- },
33
- }),
34
- project: createStringParam("", {
35
- required: true,
36
- label: "Project",
37
- description: "This is you Poki game id",
38
- }),
39
- name: createStringParam("", {
40
- required: true,
41
- label: "Version name",
42
- description: "This is the name of the version",
43
- }),
44
- notes: createStringParam("", {
45
- required: true,
46
- label: "Version notes",
47
- description: "These are notes you want to specify with your version",
48
- }),
49
- },
50
- outputs: {},
51
- });
52
-
53
- export const uploadToPokiRunner = createActionRunner<typeof uploadToPoki>(
54
- async ({ log, inputs, paths, abortSignal, cwd, context }) => {
55
- const { node, thirdparty, pnpm } = paths;
56
- const { packageDir: pokiDir } = await fetchPackage("@poki/cli", "0.1.19", {
57
- context,
58
- installDeps: true,
59
- });
60
- const poki = join(pokiDir, "bin", "index.js");
61
-
62
- const dist = join(cwd, "dist");
63
-
64
- await mkdir(dist, { recursive: true });
65
- await cp(inputs["input-folder"] as string, dist, {
66
- recursive: true,
67
- });
68
-
69
- const pokiJsonPath = join(cwd, "poki.json");
70
-
71
- console.log("pokiJsonPath", pokiJsonPath);
72
-
73
- // create file at the same place the folder to upload
74
- await writeFile(
75
- pokiJsonPath,
76
- JSON.stringify(
77
- {
78
- game_id: inputs.project,
79
- build_dir: "dist",
80
- },
81
- undefined,
82
- 2,
83
- ),
84
- "utf-8",
85
- );
86
-
87
- // TODO: needs auth
88
-
89
- log("process.env.MSW_BRIDGE_PORT", process.env.MSW_BRIDGE_PORT);
90
- log("process.env.NODE_OPTIONS", process.env.NODE_OPTIONS);
91
-
92
- await runWithLiveLogs(
93
- node,
94
- [poki, "upload", "--name", inputs.name as string, "--notes", inputs.notes as string],
95
- {
96
- cwd,
97
- env: {
98
- ...process.env,
99
- // DEBUG: '*',
100
- PATH: `${dirname(node)}${delimiter}${process.env.PATH}`,
101
- },
102
- cancelSignal: abortSignal,
103
- },
104
- log,
105
- {
106
- onStderr(data, subprocess) {
107
- log(data);
108
- },
109
- onStdout(data, subprocess) {
110
- log(data);
111
- },
112
- },
113
- );
114
-
115
- /*
116
- {
117
- "game_id": "c7bfd2ba-e23b-486f-9504-a6f196cb44df",
118
- "build_dir": "dist"
119
- }
120
- npx @poki/cli upload --name "$(git rev-parse --short HEAD)" --notes "$(git log -1 --pretty=%B)"
121
- */
122
-
123
- log("Uploaded to poki");
124
- },
125
- );
package/src/index.ts DELETED
@@ -1,21 +0,0 @@
1
- import { uploadToPoki, uploadToPokiRunner } from "./export";
2
-
3
- import { createNodeDefinition } from "@pipelab/plugin-core";
4
- const icon = new URL("./assets/poki-icon.webp", import.meta.url).href;
5
-
6
- export default createNodeDefinition({
7
- description: "Poki",
8
- name: "Poki",
9
- id: "poki",
10
- icon: {
11
- type: "image",
12
- image: icon,
13
- },
14
- nodes: [
15
- // make and package
16
- {
17
- node: uploadToPoki,
18
- runner: uploadToPokiRunner,
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
- });