Skip to content

Commit 33834d5

Browse files
committed
Add node project files to repo
1 parent 82141b1 commit 33834d5

File tree

5 files changed

+137
-56
lines changed

5 files changed

+137
-56
lines changed

.github/workflows/ci-typescript.yaml

Lines changed: 18 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -13,87 +13,50 @@ jobs:
1313
- name: Checkout source
1414
uses: actions/checkout@v4
1515

16+
- name: Install pnpm
17+
uses: pnpm/action-setup@v4
18+
with:
19+
version: 10
20+
run_install: false
21+
1622
- name: Setup Node.js
1723
uses: actions/setup-node@v4
1824
with:
1925
node-version: "latest"
26+
cache: "pnpm"
2027
registry-url: "https://registry.npmjs.org/"
2128
scope: "@blueyerobotics"
2229

23-
- name: Create tsconfig
24-
run: |
25-
cd protobuf_definitions
26-
echo '{
27-
"compilerOptions": {
28-
"target": "ES2020",
29-
"module": "CommonJS",
30-
"declaration": true,
31-
"outDir": "dist",
32-
"strict": true,
33-
"esModuleInterop": true
34-
},
35-
"include": ["./**/*.ts"]
36-
}' > tsconfig.json
37-
38-
- name: Create package
39-
run: |
40-
cd protobuf_definitions
41-
SHORT_SHA=${GITHUB_SHA::8}
42-
echo '{
43-
"name": "@blueyerobotics/protocol-definitions",
44-
"version": "3.2.0-'${SHORT_SHA}'",
45-
"license": "LGPL-3.0-only",
46-
"description": "TypeScript definitions for Blueye Robotics protocols",
47-
"repository": {
48-
"type": "git",
49-
"url": "https://github.com/BluEye-Robotics/ProtocolDefinitions.git"
50-
},
51-
"main": "dist/index.js",
52-
"types": "dist/index.d.ts",
53-
"files": ["dist"],
54-
"scripts": {
55-
"build": "tsc"
56-
},
57-
"dependencies": {
58-
"@bufbuild/protobuf": "^2.5.2"
59-
},
60-
"devDependencies": {
61-
"ts-proto": "^2.7.5",
62-
"typescript": "^5.8.3"
63-
}
64-
}' > package.json
65-
6630
- name: Install dependencies
6731
run: |
6832
sudo apt-get update
6933
sudo apt-get install -y protobuf-compiler
70-
cd protobuf_definitions
71-
npm install
34+
pnpm install
7235
7336
- name: Generate
7437
run: |
75-
cd protobuf_definitions
7638
mkdir -p ./out/ &&
77-
protoc *.proto --plugin=./node_modules/.bin/protoc-gen-ts_proto --ts_proto_out=./out \
39+
protoc protobuf_definitions/*.proto \
40+
--plugin=./node_modules/.bin/protoc-gen-ts_proto \
41+
--ts_proto_out=./out \
7842
--ts_proto_opt=outputIndex=true \
7943
--ts_proto_opt=globalThisPolyfill=true \
8044
--ts_proto_opt=useExactTypes=false
8145
8246
- name: Compile
83-
run: |
84-
cd protobuf_definitions
85-
npm run build
47+
run: pnpm run build
8648

8749
- name: Publish to npm
8850
run: |
89-
cp README.npm.md protobuf_definitions/README.md
90-
cd protobuf_definitions
91-
npm publish --access public --tag latest
51+
cp README.npm.md README.md
52+
VERSION=$(pnpm pkg get version | tr -d '"')
53+
SHORT_SHA=${GITHUB_SHA::8}
54+
pnpm version --no-git-tag-version "${VERSION}-${SHORT_SHA}"
55+
pnpm publish --access public --tag latest
9256
env:
9357
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
9458

9559
- name: Check npm pack contents
9660
run: |
97-
cd protobuf_definitions
98-
npm pack
61+
pnpm pack
9962
tar -tzf *.tgz

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ out
3131
build
3232
build_imx
3333
build_*
34+
node_modules
3435

3536
# Rider directories
36-
.idea
37+
.idea

package.json

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
"name": "@blueyerobotics/protocol-definitions",
3+
"version": "3.2.0",
4+
"license": "LGPL-3.0-only",
5+
"description": "TypeScript definitions for Blueye Robotics protocols",
6+
"repository": {
7+
"type": "git",
8+
"url": "https://github.com/BluEye-Robotics/ProtocolDefinitions.git"
9+
},
10+
"main": "dist/index.js",
11+
"types": "dist/index.d.ts",
12+
"files": [
13+
"dist"
14+
],
15+
"scripts": {
16+
"build": "tsc"
17+
},
18+
"dependencies": {
19+
"@bufbuild/protobuf": "^2.5.2"
20+
},
21+
"devDependencies": {
22+
"ts-proto": "^2.7.5",
23+
"typescript": "^5.8.3"
24+
}
25+
}

pnpm-lock.yaml

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

tsconfig.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"compilerOptions": {
3+
"target": "ES2020",
4+
"module": "CommonJS",
5+
"declaration": true,
6+
"outDir": "dist",
7+
"strict": true,
8+
"esModuleInterop": true
9+
},
10+
"include": ["./**/*.ts"]
11+
}

0 commit comments

Comments
 (0)