Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Node with typings #18

Merged
merged 8 commits into from
Nov 3, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ RUN sudo mv /tmp/protoc-gen-grpc-web /usr/local/bin/ && sudo chmod u+x /usr/loca
# deps for node.js
RUN curl -fsSL https://deb.nodesource.com/setup_15.x | bash -
RUN apt-get install -y nodejs
RUN npm install -g grpc-tools
RUN npm install -g protoc-gen-grpc

# compile build tool and put it into path
ADD . /root/cs3apis-build
Expand Down
20 changes: 20 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,22 @@
# cs3apis-build
Docker image to build the CS3APIS

## Development
See the [cs3apis local compiliation instructions](https://github.com/cs3org/cs3apis#local-compilation) and the
[cs3apis Makefile](https://github.com/cs3org/cs3apis/blob/main/Makefile)
for pointers on how to run and test the code in this repo on your local machine.

So for instance:
```sh
git clone https://github.com/cs3org/cs3apis-build
cd cs3apis-build
// make your changes in how e.g. `cs3apis-build -build-js` works
docker build -t cs3apis-build .
cd ..
git clone https://github.com/cs3org/cs3apis
cd cs3apis
docker run -v `pwd`:/root/cs3apis cs3apis-build cs3apis-build -build-js
cd build/js-cs3apis
git status
// see the result
```
19 changes: 9 additions & 10 deletions build.go
Original file line number Diff line number Diff line change
Expand Up @@ -439,21 +439,20 @@ func buildNode() {
checkout(protoBranch, "build/node-cs3apis")
}

nodeProtocPlugin, err := exec.LookPath("grpc_tools_node_protoc_plugin")

if err != nil {
panic(fmt.Sprintf("grpc_tools_node_protoc_plugin binary not found in PATH: %v\n", err))
}

// remove leftovers (existing defs)
os.RemoveAll("build/node-cs3apis/cs3")

files := findProtos()

args := []string{"--js_out=import_style=commonjs,binary:./build/node-cs3apis", "--grpc_out=./build/node-cs3apis/", "--plugin=protoc-gen-grpc=" + nodeProtocPlugin}
args = append(args, files...)
cmd := exec.Command("grpc_tools_node_protoc", args...)
run(cmd)
args1 := []string{"--ts_out=grpc_js:./build/node-cs3apis"} //, "--proto_path ."}
args1 = append(args1, files...)
cmd1 := exec.Command("protoc-gen-grpc-ts", args1...)
run(cmd1)

args2 := []string{"--js_out=import_style=commonjs,binary:./build/node-cs3apis", "--grpc_out=grpc_js:./build/node-cs3apis/"} //, "--proto_path ."}
args2 = append(args2, files...)
cmd2 := exec.Command("protoc-gen-grpc", args2...)
run(cmd2)

// get proto repo commit id
hash := getCommitID(".")
Expand Down