@forwardimpact/libcodegen 0.1.30 → 0.1.31

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.
@@ -1,4 +1,4 @@
1
- #!/usr/bin/env node
1
+ #!/usr/bin/env bun
2
2
 
3
3
  import fs from "node:fs";
4
4
  import fsAsync from "node:fs/promises";
@@ -63,11 +63,11 @@ function printUsage() {
63
63
  process.stdout.write(
64
64
  [
65
65
  "Usage:",
66
- ` npx fit-codegen --all # Generate all code`,
67
- ` npx fit-codegen --type # Generate protobuf types only`,
68
- ` npx fit-codegen --service # Generate service bases only`,
69
- ` npx fit-codegen --client # Generate clients only`,
70
- ` npx fit-codegen --definition # Generate service definitions only`,
66
+ ` bunx fit-codegen --all # Generate all code`,
67
+ ` bunx fit-codegen --type # Generate protobuf types only`,
68
+ ` bunx fit-codegen --service # Generate service bases only`,
69
+ ` bunx fit-codegen --client # Generate clients only`,
70
+ ` bunx fit-codegen --definition # Generate service definitions only`,
71
71
  ].join("\n") + "\n",
72
72
  );
73
73
  }
@@ -127,16 +127,8 @@ function parseFlags() {
127
127
  */
128
128
  function createCodegen(projectRoot, path, mustache, protoLoader, fs) {
129
129
  const base = new CodegenBase(projectRoot, path, mustache, protoLoader, fs);
130
- const pbjsPath = path.resolve(
131
- __dirname,
132
- "..",
133
- "node_modules",
134
- "protobufjs-cli",
135
- "bin",
136
- "pbjs",
137
- );
138
130
  return {
139
- types: new CodegenTypes(base, pbjsPath),
131
+ types: new CodegenTypes(base),
140
132
  services: new CodegenServices(base),
141
133
  definitions: new CodegenDefinitions(base),
142
134
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@forwardimpact/libcodegen",
3
- "version": "0.1.30",
3
+ "version": "0.1.31",
4
4
  "description": "Protocol Buffer code generation utilities for Guide",
5
5
  "license": "Apache-2.0",
6
6
  "author": "D. Olsson <hi@senzilla.io>",
@@ -10,10 +10,10 @@
10
10
  "fit-codegen": "./bin/fit-codegen.js"
11
11
  },
12
12
  "engines": {
13
- "node": ">=22.0.0"
13
+ "bun": ">=1.2.0"
14
14
  },
15
15
  "scripts": {
16
- "test": "node --test test/*.test.js"
16
+ "test": "bun run node --test test/*.test.js"
17
17
  },
18
18
  "dependencies": {
19
19
  "@grpc/proto-loader": "^0.8.0",
package/types.js CHANGED
@@ -4,17 +4,14 @@
4
4
  */
5
5
  export class CodegenTypes {
6
6
  #base;
7
- #pbjsPath;
8
7
 
9
8
  /**
10
9
  * Creates a new types generator with base functionality
11
10
  * @param {object} base - CodegenBase instance providing shared utilities
12
- * @param {string} [pbjsPath] - Absolute path to the pbjs binary (resolved from protobufjs-cli)
13
11
  */
14
- constructor(base, pbjsPath) {
12
+ constructor(base) {
15
13
  if (!base) throw new Error("CodegenBase instance is required");
16
14
  this.#base = base;
17
- this.#pbjsPath = pbjsPath || null;
18
15
  }
19
16
 
20
17
  /**
@@ -88,14 +85,8 @@ export class CodegenTypes {
88
85
  ...protoFiles,
89
86
  ];
90
87
 
91
- if (this.#pbjsPath) {
92
- await this.#base.run(process.execPath, [this.#pbjsPath, ...args], {
93
- cwd: this.#base.projectRoot,
94
- });
95
- } else {
96
- await this.#base.run("npx", ["pbjs", ...args], {
97
- cwd: this.#base.projectRoot,
98
- });
99
- }
88
+ await this.#base.run("bunx", ["pbjs", ...args], {
89
+ cwd: this.#base.projectRoot,
90
+ });
100
91
  }
101
92
  }