@reboot-dev/reboot 0.40.1 → 0.42.0

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
@@ -2,7 +2,7 @@
2
2
  "dependencies": {
3
3
  "@bufbuild/protoplugin": "1.10.1",
4
4
  "@bufbuild/protoc-gen-es": "1.10.1",
5
- "@reboot-dev/reboot-api": "0.40.1",
5
+ "@reboot-dev/reboot-api": "0.42.0",
6
6
  "chalk": "^4.1.2",
7
7
  "node-addon-api": "^7.0.0",
8
8
  "node-gyp": ">=10.2.0",
@@ -22,7 +22,7 @@
22
22
  },
23
23
  "type": "module",
24
24
  "name": "@reboot-dev/reboot",
25
- "version": "0.40.1",
25
+ "version": "0.42.0",
26
26
  "description": "npm package for Reboot",
27
27
  "scripts": {
28
28
  "preinstall": "node preinstall.cjs",
@@ -41,7 +41,7 @@
41
41
  "bin": {
42
42
  "rbt": "./rbt.js",
43
43
  "rbt-esbuild": "./rbt-esbuild.js",
44
- "rbt-schema-to-proto": "./rbt-schema-to-proto.js",
44
+ "zod-to-proto": "./zod-to-proto.js",
45
45
  "protoc-gen-es": "./protoc-gen-es.js"
46
46
  },
47
47
  "engines": {
@@ -61,8 +61,8 @@
61
61
  "rbt.d.ts",
62
62
  "rbt-esbuild.d.ts",
63
63
  "rbt-esbuild.js",
64
- "rbt-schema-to-proto.d.ts",
65
- "rbt-schema-to-proto.js",
64
+ "zod-to-proto.d.ts",
65
+ "zod-to-proto.js",
66
66
  "rbt.js",
67
67
  "index.d.ts",
68
68
  "index.js",
package/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const REBOOT_VERSION = "0.40.1";
1
+ export declare const REBOOT_VERSION = "0.42.0";
package/version.js CHANGED
@@ -1 +1 @@
1
- export const REBOOT_VERSION = "0.40.1";
1
+ export const REBOOT_VERSION = "0.42.0";
@@ -7,7 +7,7 @@ import * as fs from "node:fs";
7
7
  import * as os from "os";
8
8
  import * as path from "path";
9
9
  import { z } from "zod/v4";
10
- // Expected usage: rbt-schema-to-protoc filesDirectory path/relative/to/filesDirectory/to/file.ts ...
10
+ // Expected usage: zod-to-proto filesDirectory path/relative/to/filesDirectory/to/file.ts ...
11
11
  const args = process.argv.slice(2);
12
12
  const filesDirectory = args[0];
13
13
  const files = args.slice(1);
@@ -448,7 +448,23 @@ const main = async () => {
448
448
  // Including 'rbt/v1alpha1/tasks.proto' preemptively to support
449
449
  // protobuf messages like `TaskId`.
450
450
  proto.write(`import "rbt/v1alpha1/tasks.proto";\n`);
451
- proto.write(`option (rbt.v1alpha1.file).zod = "${path.join(cwd, filesDirectory, file)}";\n`);
451
+ // Determine the zod file path to write to the proto option.
452
+ // When running in Bazel tests, use a relative path because we will
453
+ // invoke that script in the temporary directory on a copy of the
454
+ // input Zod file, saving the original directory structure.
455
+ // NOTE: While generating the proto files for tests in Bazel the
456
+ // generated file will be placed in the same folder as the input
457
+ // Zod file.
458
+ let zodFilePath;
459
+ if (process.env.REBOOT_BAZEL_GENERATED) {
460
+ // In Bazel, use a relative path from `filesDirectory`.
461
+ zodFilePath = path.join(filesDirectory, file);
462
+ }
463
+ else {
464
+ // For CLI usage, use the full absolute path.
465
+ zodFilePath = path.join(cwd, filesDirectory, file);
466
+ }
467
+ proto.write(`option (rbt.v1alpha1.file).zod = "${zodFilePath}";\n`);
452
468
  for (const typeName in api) {
453
469
  // TODO: ensure `typeName` is PascalCase.
454
470
  const result = typeSchema.safeParse(api[typeName]);
File without changes