@aptre/common 0.24.0 → 0.26.2

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/.gitignore CHANGED
@@ -1,4 +1,5 @@
1
1
  /node_modules
2
+ .protoc-manifest.json
2
3
  /coverage
3
4
  /build
4
5
  /.log
@@ -24,3 +25,4 @@ debug.test*
24
25
  .vscode/
25
26
  !.vscode/launch.json
26
27
  /vendor/
28
+ .opencode/tool-output
package/README.md CHANGED
@@ -1,21 +1,39 @@
1
- ## Common
1
+ # common
2
2
 
3
- This contains common files like the project Makefile.
3
+ [![GoDoc Widget]][GoDoc] [![Go Report Card Widget]][Go Report Card] [![npm Widget]][npm]
4
4
 
5
- See [template] for a project template that uses this package.
5
+ > Common build tools and utilities for Aperture Robotics Go projects.
6
6
 
7
- [template]: https://github.com/aperturerobotics/template
7
+ [GoDoc]: https://godoc.org/github.com/aperturerobotics/common
8
+ [GoDoc Widget]: https://godoc.org/github.com/aperturerobotics/common?status.svg
9
+ [Go Report Card Widget]: https://goreportcard.com/badge/github.com/aperturerobotics/common
10
+ [Go Report Card]: https://goreportcard.com/report/github.com/aperturerobotics/common
11
+ [npm]: https://www.npmjs.com/package/@aptre/common
12
+ [npm Widget]: https://img.shields.io/npm/v/@aptre/common.svg
8
13
 
9
- See [protobuf-project] for a more extensive example.
14
+ ## Related Projects
10
15
 
11
- [protobuf-project]: https://github.com/aperturerobotics/protobuf-project
16
+ - [template](https://github.com/aperturerobotics/template) - Project template using this package
17
+ - [protobuf-project](https://github.com/aperturerobotics/protobuf-project) - More extensive example
18
+
19
+ ## Installation
20
+
21
+ The `aptre` CLI tool replaces Make for building Go projects with protobuf support.
22
+
23
+ ```bash
24
+ # Run directly
25
+ go run github.com/aperturerobotics/common/cmd/aptre@latest <command>
26
+
27
+ # Or install globally
28
+ go install github.com/aperturerobotics/common/cmd/aptre@latest
29
+ ```
12
30
 
13
31
  ## Usage
14
32
 
15
33
  Start by downloading the dependencies:
16
34
 
17
35
  ```bash
18
- yarn
36
+ bun i
19
37
  ```
20
38
 
21
39
  Protobuf imports use Go paths and package names:
@@ -37,63 +55,84 @@ message GetBusInfoResponse {
37
55
  To generate the protobuf files:
38
56
 
39
57
  ```bash
40
- $ git add -A
41
- $ yarn gen
58
+ git add -A
59
+ go run ./cmd/aptre generate
60
+ # or with bun
61
+ bun run gen
42
62
  ```
43
63
 
44
- The Makefile will download the tools using Go to a bin dir.
45
-
46
- ## Makefile
47
-
48
- The available make targets are:
49
-
50
- - `gen`: Generate protobuf files.
51
- - `test`: Run go tests.
52
- - `test-browser`: Run go tests in a web browser with WebAssembly.
53
- - `lint`: Run golangci-lint on the project.
54
- - `fix`: Run golangci-lint with --fix on the project.
55
- - `format`: Format Go and TypeScript code.
56
- - `release`: Create a new release using goreleaser.
57
- - `release-bundle`: Create a bundled snapshot release using goreleaser.
58
- - `release-build`: Build a snapshot release using goreleaser.
59
- - `release-check`: Run goreleaser checks.
64
+ ## Commands
65
+
66
+ The `aptre` CLI provides the following commands:
67
+
68
+ | Command | Description |
69
+ | ---------------- | -------------------------------------------- |
70
+ | `generate` | Generate protobuf code (Go, TypeScript, C++) |
71
+ | `clean` | Remove generated files and cache |
72
+ | `deps` | Ensure all dependencies are installed |
73
+ | `lint` | Run golangci-lint |
74
+ | `fix` | Run golangci-lint with --fix |
75
+ | `test` | Run go test |
76
+ | `test --browser` | Run tests in browser with WebAssembly |
77
+ | `format` | Format Go code with gofumpt |
78
+ | `goimports` | Run goimports |
79
+ | `outdated` | Show outdated dependencies |
80
+ | `release run` | Create a release using goreleaser |
81
+ | `release bundle` | Create a bundled snapshot release |
82
+ | `release build` | Build a snapshot release |
83
+ | `release check` | Run goreleaser checks |
84
+
85
+ ### Examples
60
86
 
61
- To generate the TypeScript and Go code:
87
+ ```bash
88
+ # Generate protobuf files
89
+ go run ./cmd/aptre generate
62
90
 
63
- - `yarn gen`
91
+ # Force regeneration (ignore cache)
92
+ go run ./cmd/aptre generate --force
64
93
 
65
- To format the Go and TypeScript files:
94
+ # Run tests
95
+ go run ./cmd/aptre test
66
96
 
67
- - `yarn format`
97
+ # Run browser/WASM tests
98
+ go run ./cmd/aptre test --browser
68
99
 
69
- ## Eject
100
+ # Lint code
101
+ go run ./cmd/aptre lint
70
102
 
71
- You can "eject" and copy all the project files directly to your repo:
103
+ # Format code
104
+ go run ./cmd/aptre format
72
105
 
73
- ```
74
- # NOTE: not a full list of files
75
- cp ./vendor/github.com/aperturerobotics/common/{Makefile,.eslintrc.js,.eslintignore} ./
106
+ # Check for outdated dependencies
107
+ go run ./cmd/aptre outdated
76
108
  ```
77
109
 
78
- While not implemented yet, "make eject" will do this for you.
110
+ ## C++ Support
79
111
 
80
- ## Developing on MacOS
112
+ C++ protobuf files (`.pb.cc` and `.pb.h`) are generated alongside the `.pb.go`
113
+ files. Add `vendor/` to your include path and create a symlink for your project:
81
114
 
82
- On MacOS, some homebrew packages are required for `yarn gen`:
115
+ ```cmake
116
+ # CMakeLists.txt
117
+ set(VENDOR_LINK_DIR "${CMAKE_CURRENT_SOURCE_DIR}/vendor/github.com/yourorg")
118
+ if(NOT EXISTS "${VENDOR_LINK_DIR}/yourproject")
119
+ file(CREATE_LINK "${CMAKE_CURRENT_SOURCE_DIR}" "${VENDOR_LINK_DIR}/yourproject" SYMBOLIC)
120
+ endif()
83
121
 
122
+ include_directories(${PROJECT_SOURCE_DIR}/vendor)
84
123
  ```
85
- brew install bash make coreutils gnu-sed findutils protobuf
86
- brew link --overwrite protobuf
124
+
125
+ ```cpp
126
+ #include "github.com/yourorg/yourproject/example/example.pb.h"
87
127
  ```
88
128
 
89
- Add to your .bashrc or .zshrc:
129
+ ## Embedded Protoc
90
130
 
91
- ```
92
- export PATH="/opt/homebrew/opt/coreutils/libexec/gnubin:$PATH"
93
- export PATH="/opt/homebrew/opt/gnu-sed/libexec/gnubin:$PATH"
94
- export PATH="/opt/homebrew/opt/findutils/libexec/gnubin:$PATH"
95
- export PATH="/opt/homebrew/opt/make/libexec/gnubin:$PATH"
96
- ```
131
+ The `aptre` tool uses an embedded WebAssembly version of protoc via [go-protoc-wasi].
132
+ This means you don't need to install protoc separately - it works on any platform
133
+ that supports Go.
134
+
135
+ [go-protoc-wasi]: https://github.com/aperturerobotics/go-protoc-wasi
97
136
 
98
137
  ## Support
99
138
 
@@ -103,8 +142,8 @@ Please open a [GitHub issue] with any questions / issues.
103
142
 
104
143
  ... or feel free to reach out on [Matrix Chat] or [Discord].
105
144
 
106
- [Discord]: https://discord.gg/KJutMESRsT
107
145
  [Matrix Chat]: https://matrix.to/#/#aperturerobotics:matrix.org
146
+ [Discord]: https://discord.gg/KJutMESRsT
108
147
 
109
148
  ## License
110
149
 
package/go.mod CHANGED
@@ -7,6 +7,17 @@ replace github.com/libp2p/go-libp2p => github.com/aperturerobotics/go-libp2p v0.
7
7
 
8
8
  replace github.com/ipfs/go-log/v2 => github.com/paralin/ipfs-go-logrus v0.0.0-20240410105224-e24cb05f9e98 // master
9
9
 
10
- require github.com/aperturerobotics/protobuf-go-lite v0.11.0 // latest
10
+ require (
11
+ github.com/aperturerobotics/abseil-cpp v0.0.0-20260130220554-305ed0ea7006
12
+ github.com/aperturerobotics/cli v1.1.0
13
+ github.com/aperturerobotics/go-protoc-wasi v0.0.0-20260131033208-273d2014699f
14
+ github.com/aperturerobotics/protobuf v0.0.0-20260131031545-7265127e58f9
15
+ github.com/aperturerobotics/protobuf-go-lite v0.12.0 // latest
16
+ github.com/tetratelabs/wazero v1.8.2
17
+ golang.org/x/mod v0.22.0
18
+ )
11
19
 
12
- require github.com/aperturerobotics/json-iterator-lite v1.0.1-0.20240713111131-be6bf89c3008 // indirect
20
+ require (
21
+ github.com/aperturerobotics/json-iterator-lite v1.0.1-0.20240713111131-be6bf89c3008 // indirect
22
+ github.com/xrash/smetrics v0.0.0-20250705151800-55b8f293f342 // indirect
23
+ )