Skip to content

Commit

Permalink
fix: executable issue on windows (#87)
Browse files Browse the repository at this point in the history
fixes #51 #86
  • Loading branch information
thesayyn authored Dec 1, 2021
1 parent ce7dd99 commit f5de14e
Show file tree
Hide file tree
Showing 18 changed files with 310 additions and 228 deletions.
16 changes: 11 additions & 5 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,22 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
os: [ubuntu-latest, macos-latest, windows-latest]
node_version: [14.x, 16.x]
protoc_version: [3.x]
steps:
- uses: actions/checkout@v2
with:
submodules: true
- name: Setup node 12
uses: actions/setup-node@v2
- uses: actions/setup-node@v2
with:
node-version: 12.x
node-version: ${{matrix.node_version}}
- uses: arduino/setup-protoc@v1
with:
version: ${{matrix.protoc_version}}
repo-token: ${{ secrets.GITHUB_TOKEN }}

- run: yarn --frozen-lockfile
- run: yarn codegen
- run: yarn test
- run: yarn test --test_tag_filters=-no-${{ matrix.os }}
- run: cd examples/pure && yarn --frozen-lockfile && yarn test
15 changes: 15 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
third-party
test
docs
examples
scripts
.*
.tgz
# ignore everything that is typescript or proto file
src/**/*.ts
src/**/*.proto
# bazel stuff
BUILD.bazel
WORKSPACE
bazel-*

3 changes: 1 addition & 2 deletions BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ pkg_npm(
name = "package",
package_name = "protoc-gen-ts",
srcs = [
"//bin:protoc-gen-ts",
"//bin:protoc-gen-ts.cmd",
"//bin:protoc-gen-ts.js",
"index.bzl",
"package.json",
"README.md",
Expand Down
11 changes: 6 additions & 5 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
# Setup NodeJS toolchain
http_archive(
name = "build_bazel_rules_nodejs",
sha256 = "5c40083120eadec50a3497084f99bc75a85400ea727e82e0b2f422720573130f",
urls = ["https://github.com/bazelbuild/rules_nodejs/releases/download/4.0.0-beta.0/rules_nodejs-4.0.0-beta.0.tar.gz"],
sha256 = "b32a4713b45095e9e1921a7fcb1adf584bc05959f3336e7351bcf77f015a2d7c",
urls = ["https://github.com/bazelbuild/rules_nodejs/releases/download/4.1.0/rules_nodejs-4.1.0.tar.gz"],
)

load("@build_bazel_rules_nodejs//:index.bzl", "node_repositories", "yarn_install")
Expand All @@ -29,10 +29,11 @@ yarn_install(
# Setup Protocol Buffers toolchain
http_archive(
name = "rules_proto",
sha256 = "57001a3b33ec690a175cdf0698243431ef27233017b9bed23f96d44b9c98242f",
strip_prefix = "rules_proto-9cd4f8f1ede19d81c6d48910429fe96776e567b1",
sha256 = "66bfdf8782796239d3875d37e7de19b1d94301e8972b3cbd2446b332429b4df1",
strip_prefix = "rules_proto-4.0.0",
urls = [
"https://github.com/bazelbuild/rules_proto/archive/9cd4f8f1ede19d81c6d48910429fe96776e567b1.tar.gz",
"https://mirror.bazel.build/github.com/bazelbuild/rules_proto/archive/refs/tags/4.0.0.tar.gz",
"https://github.com/bazelbuild/rules_proto/archive/refs/tags/4.0.0.tar.gz",
],
)

Expand Down
6 changes: 3 additions & 3 deletions bin/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ package(default_visibility = ["//visibility:public"])

nodejs_binary(
name = "bin",
entry_point = ":protoc-gen-ts",
entry_point = ":protoc-gen-ts.js",
data = [
"//src",
":protoc-gen-ts"
":protoc-gen-ts.js"
],
# See: https://github.com/bazelbuild/rules_nodejs/issues/2600
templated_args = ["--bazel_patch_module_resolver"],
)

exports_files(["protoc-gen-ts", "protoc-gen-ts.cmd"])
exports_files(["protoc-gen-ts.js"])
14 changes: 0 additions & 14 deletions bin/protoc-gen-ts.cmd

This file was deleted.

1 change: 0 additions & 1 deletion bin/protoc-gen-ts → bin/protoc-gen-ts.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
#!/usr/bin/env node

require('../src/index')
5 changes: 2 additions & 3 deletions examples/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,12 @@
"grpc:client": "bazel run //grpc:client",
"grpc:server": "bazel run //grpc:server",
"pretest": "bazel build //grpc:type //bazel:message && node ../scripts/sync_generated_protos.js grpc && node ../scripts/sync_generated_protos.js bazel",
"test": "bazel run //bazel:bin",
"preinstall": "cd ../ && bazel build :package"
"test": "bazel run //bazel:bin"
},
"dependencies": {
"@grpc/grpc-js": "^1.2.12",
"google-protobuf": "^3.15.8",
"protoc-gen-ts": "file:../bazel-bin/package"
"protoc-gen-ts": "file:../"
},
"devDependencies": {
"@bazel/bazelisk": "^1.7.5",
Expand Down
1 change: 0 additions & 1 deletion examples/pure/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
"name": "example",
"scripts": {
"preinstall": "cd ../.. && yarn bazel build :package",
"postinstall": "./scripts/download_protoc.sh",
"test": "protoc -I=src --ts_out=src test.proto && tsc && node ./dist/index"
},
"dependencies": {
Expand Down
18 changes: 0 additions & 18 deletions examples/pure/scripts/download_protoc.sh

This file was deleted.

53 changes: 0 additions & 53 deletions examples/pure/scripts/pick_asset.js

This file was deleted.

Loading

0 comments on commit f5de14e

Please sign in to comment.