Skip to content

Commit bcac4ed

Browse files
CopilotYunchuWang
andauthored
Remove submodule, add proto file download script (#72)
* Initial plan * Enhance proto generation: Remove submodule, add auto-download script Co-authored-by: YunchuWang <12449837+YunchuWang@users.noreply.github.com> * Improve download-proto.sh: Use jq when available, make commit hash fetch failure explicit Co-authored-by: YunchuWang <12449837+YunchuWang@users.noreply.github.com> * Clarify README documentation about proto file update process Co-authored-by: YunchuWang <12449837+YunchuWang@users.noreply.github.com> * Run proto download script automatically during build Co-authored-by: YunchuWang <12449837+YunchuWang@users.noreply.github.com> * fix * update readme --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: YunchuWang <12449837+YunchuWang@users.noreply.github.com>
1 parent 547bcb7 commit bcac4ed

File tree

15 files changed

+981
-30
lines changed

15 files changed

+981
-30
lines changed

.github/workflows/codeQL.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,6 @@ jobs:
4646
# queries: security-extended,security-and-quality
4747

4848
- uses: actions/checkout@v3
49-
with:
50-
submodules: true
5149

5250
# Autobuild attempts to build any compiled languages (C/C++, C#, Go, or Java).
5351
# If this step fails, then you should remove it and run the build manually (see below)

.gitmodules

Lines changed: 0 additions & 3 deletions
This file was deleted.

.prettierignore

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,4 @@ dist
66
# don't lint nyc coverage output
77
coverage
88
# don't lint proto files and output
9-
proto
10-
# don't lint submodules
11-
submodules
9+
proto

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
## Upcoming
2+
3+
### New
4+
5+
- Add automatic proto file download and commit hash tracking during build ([#XX](https://github.com/microsoft/durabletask-js/pull/XX))
6+
17
## v0.1.0-alpha.2
28

39
### New

README.md

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -145,30 +145,22 @@ See the [examples](./examples) directory for a list of sample orchestrations and
145145

146146
### Generating protobufs
147147

148-
Protobuf definitions are stored in the [./submodules/durabletask-proto](./submodules/durabletask-proto) directory, which is a submodule. To update the submodule, run the following command from the project root:
148+
Protobuf definitions are downloaded from the [durabletask-protobuf](https://github.com/microsoft/durabletask-protobuf) repository. To download the latest proto files, run:
149149

150150
```sh
151-
git submodule update --init
151+
npm run download-proto
152152
```
153153

154-
Once the submodule is available, the corresponding source code can be regenerated using the following command from the project root:
154+
This will download the proto files to `internal/durabletask-protobuf/protos/`.
155+
156+
Once the proto files are available, the corresponding TypeScript source code can be regenerated using the following command from the project root:
155157

156158
```sh
157-
npm install grpc_tools_node_protoc_ts --save-dev
158-
159-
# generate js codes via grpc-tools
160-
grpc_tools_node_protoc \
161-
--js_out=import_style=commonjs,binary:src/proto \
162-
--grpc_out=grpc_js:src/proto \
163-
--plugin=protoc-gen-grpc=`which grpc_tools_node_protoc_plugin` \
164-
-I ./submodules/durabletask-protobuf/protos orchestrator_service.proto
165-
166-
protoc \
167-
--plugin=protoc-gen-ts=./node_modules/.bin/protoc-gen-ts \
168-
--ts_out=grpc_js:src/proto \
169-
-I ./submodules/durabletask-protobuf/protos orchestrator_service.proto
159+
./tools/generate-grpc-javascript.sh ./src/proto
170160
```
171161

162+
Note: You need `grpc-tools` installed globally (`npm install -g grpc-tools`).
163+
172164
### Running unit tests
173165

174166
Unit tests can be run using the following command from the project root. Unit tests _don't_ require a sidecar process to be running.

azure-pipelines.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ pool:
1010

1111
steps:
1212
- checkout: self
13-
submodules: true
1413

1514
- task: NodeTool@0
1615
inputs:

eng/templates/build.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ jobs:
1111
sbomBuildComponentPath: "$(Build.SourcesDirectory)/node_modules"
1212
steps:
1313
- checkout: self
14-
submodules: true
1514
- task: NodeTool@0
1615
inputs:
1716
versionSpec: 20.x
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
026329c53fe6363985655857b9ca848ec7238bd2
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Durable Task Protobuf Files
2+
3+
This directory contains the protocol buffer definitions used by the Durable Task Framework JavaScript SDK. The files in this directory are automatically downloaded and updated during the build process from the [microsoft/durabletask-protobuf](https://github.com/microsoft/durabletask-protobuf) repository.
4+
5+
## Directory Structure
6+
7+
- `protos/` - Contains the proto files
8+
- `PROTO_SOURCE_COMMIT_HASH` - Contains the commit hash of the proto file version
9+
10+
## Auto-Update Process
11+
12+
The proto files are automatically downloaded and updated when running `npm run build`. This is handled by the `scripts/download-proto.sh` script. The script:
13+
14+
1. Downloads the latest version of `orchestrator_service.proto`
15+
2. Saves the current commit hash for tracking purposes
16+
17+
## Manual Update
18+
19+
To manually update the proto files, you can run:
20+
21+
```bash
22+
npm run download-proto
23+
# or
24+
./scripts/download-proto.sh [branch-name]
25+
```

0 commit comments

Comments
 (0)