From 2a0cbc67c1e4b1b72f53090d2374b384e6cd652d Mon Sep 17 00:00:00 2001 From: Henri Bergius Date: Fri, 5 Sep 2025 21:24:18 -0400 Subject: [PATCH 1/2] Build and publish NPM module --- .github/workflows/publish.yml | 28 +++++++++++++++++++++++++++- .gitignore | 2 ++ packages/ts/package.json | 31 +++++++++++++++++++++++++++++++ 3 files changed, 60 insertions(+), 1 deletion(-) create mode 100755 packages/ts/package.json diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 6858353..75dedd1 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -14,12 +14,14 @@ jobs: - name: Checkout code uses: actions/checkout@v4 - name: debug - run: cat packages/ts/deno.json && cat packages/rust/Cargo.toml + run: cat packages/ts/deno.json && cat packages/rust/Cargo.toml && cat packages/ts/package.json - name: Set Package Versions to current tag # run: sed -i "s/__PACKAGE_VERSION__/$(echo $GITHUB_REF | cut -d '/' -f 3)/g" packages/ts/deno.json \ + # && sed -i "s/__PACKAGE_VERSION__/$(echo $GITHUB_REF | cut -d '/' -f 3)/g" packages/ts/package.json \ # && sed -i "s/__PACKAGE_VERSION__/$(echo $GITHUB_REF | cut -d '/' -f 3)/g" packages/rust/Cargo.toml run: | sed -i "s/__PACKAGE_VERSION__/2.7.0/g" packages/ts/deno.json + sed -i "s/__PACKAGE_VERSION__/2.7.0/g" packages/ts/package.json sed -i "s/__PACKAGE_VERSION__/2.7.0/g" packages/rust/Cargo.toml - name: Setup Buf uses: bufbuild/buf-setup-action@main @@ -67,6 +69,30 @@ jobs: - name: Publish to JSR run: deno publish --unstable-sloppy-imports + publish-npm: + runs-on: ubuntu-24.04 + permissions: + contents: read + id-token: write + steps: + - name: Download TypeScript code + uses: actions/download-artifact@v4 + with: + name: ts_code + - name: Install Node.js + uses: actions/setup-node@v5 + with: + node-version: lts/* + registry-url: https://registry.npmjs.org/ + - name: Install NPM dependencies + run: npm install + - name: Build JavaScript module + run: npm run build + - name: Publish NPM package + run: npm publish + env: + NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} + publish-cargo: runs-on: ubuntu-24.04 needs: codegen diff --git a/.gitignore b/.gitignore index 0f65bb6..9f58609 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,6 @@ packages/ts/lib/* +packages/ts/node_modules/ +packages/ts/package-lock.json packages/rust/src/generated/* packages/rust/target packages/c/* diff --git a/packages/ts/package.json b/packages/ts/package.json new file mode 100755 index 0000000..17d863c --- /dev/null +++ b/packages/ts/package.json @@ -0,0 +1,31 @@ +{ + "name": "@jsr/meshtastic__protobufs", + "version": "__PACKAGE_VERSION__", + "homepage": "https://github.com/meshtastic/protobufs", + "license": "GPLV3", + "publishConfig": { + "access": "public" + }, + "type": "module", + "main": "./dist/mod.mjs", + "module": "./dist/mod.mjs", + "types": "./dist/mod.d.mts", + "dependencies": { + "@bufbuild/protobuf": "^2.2.3" + }, + "devDependencies": { + "tsdown": "^0.13.4", + "typescript": "^5.8.3" + }, + "scripts": { + "build": "tsdown" + }, + "tsdown": { + "entry": "mod.ts", + "dts": true, + "format": [ + "esm" + ], + "splitting": false + } +} From 8c74af05562598f07604bf68c31678eab7006ad9 Mon Sep 17 00:00:00 2001 From: Henri Bergius Date: Fri, 5 Sep 2025 21:28:30 -0400 Subject: [PATCH 2/2] Fix package name and add description --- packages/ts/package.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/ts/package.json b/packages/ts/package.json index 17d863c..c0ff53f 100755 --- a/packages/ts/package.json +++ b/packages/ts/package.json @@ -1,5 +1,6 @@ { - "name": "@jsr/meshtastic__protobufs", + "name": "@meshtastic/protobufs", + "description": "Protobuf definitions for the Meshtastic project", "version": "__PACKAGE_VERSION__", "homepage": "https://github.com/meshtastic/protobufs", "license": "GPLV3",