@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 +2 -0
- package/README.md +86 -47
- package/go.mod +13 -2
- package/go.mod.tools +186 -179
- package/go.sum +18 -4
- package/go.sum.tools +450 -424
- package/package.json +11 -10
- package/tsconfig.json +1 -1
- package/Makefile +0 -227
package/.gitignore
CHANGED
package/README.md
CHANGED
|
@@ -1,21 +1,39 @@
|
|
|
1
|
-
|
|
1
|
+
# common
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[![GoDoc Widget]][GoDoc] [![Go Report Card Widget]][Go Report Card] [![npm Widget]][npm]
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
> Common build tools and utilities for Aperture Robotics Go projects.
|
|
6
6
|
|
|
7
|
-
[
|
|
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
|
-
|
|
14
|
+
## Related Projects
|
|
10
15
|
|
|
11
|
-
[
|
|
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
|
-
|
|
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
|
-
|
|
41
|
-
|
|
58
|
+
git add -A
|
|
59
|
+
go run ./cmd/aptre generate
|
|
60
|
+
# or with bun
|
|
61
|
+
bun run gen
|
|
42
62
|
```
|
|
43
63
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
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
|
-
|
|
87
|
+
```bash
|
|
88
|
+
# Generate protobuf files
|
|
89
|
+
go run ./cmd/aptre generate
|
|
62
90
|
|
|
63
|
-
|
|
91
|
+
# Force regeneration (ignore cache)
|
|
92
|
+
go run ./cmd/aptre generate --force
|
|
64
93
|
|
|
65
|
-
|
|
94
|
+
# Run tests
|
|
95
|
+
go run ./cmd/aptre test
|
|
66
96
|
|
|
67
|
-
|
|
97
|
+
# Run browser/WASM tests
|
|
98
|
+
go run ./cmd/aptre test --browser
|
|
68
99
|
|
|
69
|
-
|
|
100
|
+
# Lint code
|
|
101
|
+
go run ./cmd/aptre lint
|
|
70
102
|
|
|
71
|
-
|
|
103
|
+
# Format code
|
|
104
|
+
go run ./cmd/aptre format
|
|
72
105
|
|
|
73
|
-
|
|
74
|
-
|
|
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
|
-
|
|
110
|
+
## C++ Support
|
|
79
111
|
|
|
80
|
-
|
|
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
|
-
|
|
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
|
-
|
|
86
|
-
|
|
124
|
+
|
|
125
|
+
```cpp
|
|
126
|
+
#include "github.com/yourorg/yourproject/example/example.pb.h"
|
|
87
127
|
```
|
|
88
128
|
|
|
89
|
-
|
|
129
|
+
## Embedded Protoc
|
|
90
130
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
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
|
|
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
|
|
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
|
+
)
|