Skip to content

Commit 88cabb9

Browse files
authored
Merge pull request #141 from code0-tech/138-add-typescript
Add typescript support
2 parents a260358 + ab4d601 commit 88cabb9

File tree

8 files changed

+250
-2
lines changed

8 files changed

+250
-2
lines changed

.github/workflows/build.yml

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ jobs:
1313
working-directory: build/ruby
1414

1515
steps:
16-
# Set up
1716
- uses: actions/checkout@v5
1817
- name: Set up Ruby
1918
uses: ruby/setup-ruby@v1
@@ -37,7 +36,6 @@ jobs:
3736
working-directory: build/rust
3837

3938
steps:
40-
# Set up
4139
- uses: actions/checkout@v5
4240
- name: Setup rust
4341
run: rustup update --no-self-update stable
@@ -53,3 +51,24 @@ jobs:
5351
RUST_BACKTRACE: 'full'
5452
- name: Package crate
5553
run: cargo package --allow-dirty
54+
55+
npm:
56+
runs-on: ubuntu-latest
57+
58+
defaults:
59+
run:
60+
shell: bash
61+
working-directory: build/ts
62+
63+
steps:
64+
- uses: actions/checkout@v5
65+
- name: Set up Node
66+
uses: actions/setup-node@v4
67+
with:
68+
node-version: '24.x'
69+
registry-url: 'https://registry.npmjs.org'
70+
- name: Install dependencies
71+
run: npm ci
72+
- name: Generate ts
73+
run: npm run generate
74+

.github/workflows/publish.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,3 +68,32 @@ jobs:
6868
# Release
6969
- name: Publish crate
7070
run: cargo publish --allow-dirty
71+
72+
npm:
73+
runs-on: ubuntu-latest
74+
75+
environment: packages
76+
77+
permissions:
78+
id-token: write
79+
80+
defaults:
81+
run:
82+
shell: bash
83+
working-directory: build/ts
84+
85+
steps:
86+
- uses: actions/checkout@v5
87+
- name: Set up Node
88+
uses: actions/setup-node@v4
89+
with:
90+
node-version: '24.x'
91+
registry-url: 'https://registry.npmjs.org'
92+
- name: Install dependencies
93+
run: npm ci
94+
- name: Generate ts
95+
run: npm run generate
96+
- name: Set version
97+
run: npm version ${{ github.ref_name }} --git-tag-version=false
98+
- name: Publish package
99+
run: npm publish

build/ts/.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
node_modules/
2+
pb/*
3+
!pb/.gitkeep

build/ts/.tool-versions

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
node 24.8.0

build/ts/index.js

Whitespace-only changes.

build/ts/package-lock.json

Lines changed: 161 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build/ts/package.json

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
{
2+
"name": "@code0-tech/tucana",
3+
"version": "0.0.0",
4+
"description": "Code0 GRPC Protocol",
5+
"homepage": "https://github.com/code0-tech/tucana#readme",
6+
"bugs": {
7+
"url": "https://github.com/code0-tech/tucana/issues"
8+
},
9+
"repository": {
10+
"type": "git",
11+
"url": "git+https://github.com/code0-tech/tucana.git"
12+
},
13+
"license": "Apache-2.0",
14+
"author": "",
15+
"type": "module",
16+
"main": "index.js",
17+
"scripts": {
18+
"generate:aquila": "protoc --ts_opt=add_pb_suffix --ts_out=pb --proto_path=../../proto/aquila --proto_path=../../proto/shared ../../proto/aquila/*.proto",
19+
"generate:sagittarius": "protoc --ts_opt=add_pb_suffix --ts_out=pb --proto_path=../../proto/sagittarius --proto_path=../../proto/shared ../../proto/sagittarius/*.proto",
20+
"generate:shared": "protoc --ts_opt=add_pb_suffix --ts_out=pb --proto_path=../../proto/shared ../../proto/shared/*.proto",
21+
"generate": "npm run generate:shared && npm run generate:sagittarius && npm run generate:aquila"
22+
},
23+
"devDependencies": {
24+
"@protobuf-ts/plugin": "^2.11.1",
25+
"protoc": "^33.0.0"
26+
},
27+
"files": [
28+
"pb/*.ts",
29+
"index.js",
30+
"package.json"
31+
],
32+
"publishConfig": {
33+
"access": "public"
34+
}
35+
}

build/ts/pb/.gitkeep

Whitespace-only changes.

0 commit comments

Comments
 (0)