@ag-ui/proto 0.0.53 → 0.0.55

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,7 +1,11 @@
1
1
  {
2
2
  "name": "@ag-ui/proto",
3
3
  "author": "Markus Ecker <markus.ecker@gmail.com>",
4
- "version": "0.0.53",
4
+ "version": "0.0.55",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "https://github.com/ag-ui-protocol/ag-ui.git"
8
+ },
5
9
  "private": false,
6
10
  "publishConfig": {
7
11
  "access": "public"
@@ -12,7 +16,7 @@
12
16
  "dependencies": {
13
17
  "@bufbuild/protobuf": "^2.2.5",
14
18
  "@protobuf-ts/protoc": "^2.11.1",
15
- "@ag-ui/core": "0.0.53"
19
+ "@ag-ui/core": "0.0.55"
16
20
  },
17
21
  "devDependencies": {
18
22
  "@vitest/coverage-istanbul": "^4.0.18",
@@ -39,7 +43,7 @@
39
43
  "test:coverage": "vitest run --coverage",
40
44
  "test:watch": "vitest",
41
45
  "test:exports": "publint --strict && attw --pack",
42
- "generate": "mkdir -p ./src/generated && npx protoc --plugin=./node_modules/.bin/protoc-gen-ts_proto.CMD --ts_proto_out=./src/generated --ts_proto_opt=esModuleInterop=true,outputJsonMethods=false,outputClientImpl=false -I ./src/proto ./src/proto/*.proto",
46
+ "generate": "node ./scripts/generate.mjs",
43
47
  "link:global": "pnpm link --global",
44
48
  "unlink:global": "pnpm unlink --global"
45
49
  }
@@ -0,0 +1,44 @@
1
+ import { spawnSync } from "node:child_process";
2
+ import { mkdirSync, readdirSync } from "node:fs";
3
+ import { dirname, join } from "node:path";
4
+ import { fileURLToPath } from "node:url";
5
+
6
+ const packageDir = dirname(dirname(fileURLToPath(import.meta.url)));
7
+ const generatedDir = "src/generated";
8
+ const protoDir = "src/proto";
9
+ const binDir = join(packageDir, "node_modules", ".bin");
10
+ const plugin = join(
11
+ binDir,
12
+ process.platform === "win32" ? "protoc-gen-ts_proto.CMD" : "protoc-gen-ts_proto",
13
+ );
14
+ const protoc = join(packageDir, "node_modules", "@protobuf-ts", "protoc", "protoc.js");
15
+
16
+ mkdirSync(join(packageDir, generatedDir), { recursive: true });
17
+
18
+ const protoFiles = readdirSync(join(packageDir, protoDir))
19
+ .filter((file) => file.endsWith(".proto"))
20
+ .sort()
21
+ .map((file) => join(protoDir, file));
22
+
23
+ const result = spawnSync(
24
+ process.execPath,
25
+ [
26
+ protoc,
27
+ `--plugin=protoc-gen-ts_proto=${plugin}`,
28
+ `--ts_proto_out=${generatedDir}`,
29
+ "--ts_proto_opt=esModuleInterop=true,outputJsonMethods=false,outputClientImpl=false",
30
+ "-I",
31
+ protoDir,
32
+ ...protoFiles,
33
+ ],
34
+ {
35
+ cwd: packageDir,
36
+ stdio: "inherit",
37
+ },
38
+ );
39
+
40
+ if (result.error) {
41
+ console.error(result.error.message);
42
+ }
43
+
44
+ process.exit(result.status ?? 1);