Skip to content

Commit

Permalink
fix duration and timestamp json serialization
Browse files Browse the repository at this point in the history
  • Loading branch information
tatethurston committed Jan 3, 2025
1 parent 2bf20ca commit 0d75fb6
Show file tree
Hide file tree
Showing 7 changed files with 65 additions and 51 deletions.
65 changes: 22 additions & 43 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,63 +5,42 @@ on:
- main
pull_request:
jobs:
lint_test:
build-package:
name: Build Package
runs-on: ubuntu-latest
outputs:
package: ${{ steps.publish-local-package.outputs.package }}
steps:
- uses: tatethurston/github-actions/publish-local-package@main
id: publish-local-package
with:
path: packages/twirpscript
ci:
name: Lint and Test
runs-on: ubuntu-latest
steps:
# Install protoc for e2e:setup
- uses: arduino/setup-protoc@v2
with:
version: "23.4"
- uses: bufbuild/buf-setup-action@v1.25.0
version: "29.2"
- uses: tatethurston/github-actions/test@main
with:
codecov_token: ${{ secrets.CODECOV_TOKEN }}
- name: Check for uncommited changes to generated files
run: |
pnpm regen
if git diff --quiet; then
echo "No changes detected."
else
echo "Changes detected:"
git diff --name-only
git diff
echo "Failing build."
exit 1
fi
build_package:
name: Build Package
runs-on: ubuntu-latest
outputs:
package-name: package-${{ github.event.pull_request.number }}
steps:
- uses: tatethurston/github-actions/build@main
- name: NPM Pack
run: |
cd packages/twirpscript
pnpm pack
mv *.tgz twirpscript.tgz
- uses: actions/upload-artifact@v4
- uses: bufbuild/buf-setup-action@v1.25.0
- uses: tatethurston/github-actions/check-generated-files@main
with:
name: package-${{ github.event.pull_request.number }}
path: packages/twirpscript/*.tgz
if-no-files-found: error
retention-days: 1
overwrite: true
check_windows:
name: Windows CI Check
cmd: pnpm regen
ci-windows:
name: Windows CI
runs-on: windows-latest
needs: build_package
needs: build-package
steps:
- uses: arduino/setup-protoc@v2
- uses: tatethurston/github-actions/install-local-package@main
with:
version: "23.4"
- uses: actions/download-artifact@v4
name: ${{ needs.build-package.outputs.package }}
- uses: arduino/setup-protoc@v2
with:
name: ${{ needs.build_package.outputs.package-name }}
- uses: actions/setup-node@v3
version: "29.2"
- name: Bin Check
run: |
npm install twirpscript.tgz
touch dummy.proto
npx --no twirpscript
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
types: [published]
workflow_dispatch:
jobs:
build:
publish:
runs-on: ubuntu-latest
steps:
- uses: tatethurston/github-actions/publish@main
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@ todo.txt
coverage
node_modules
tsconfig.tsbuildinfo
packages/twirpscript/LICENSE
packages/twirpscript/README.md
3 changes: 0 additions & 3 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

(cd packages/twirpscript && pnpm run package:build)
pnpm run regen
pnpm run lint:fix
pnpm run typecheck
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## v0.0.71

- Fix Timestamp and Duration JSON serialization. Previously, when either seconds or nanos were 0, the Timestamp / Duration was omitted from the serialized json. Thanks @martynchamberlin!

## v0.0.70

- Fix compiler path on Windows. Thanks @l1b3r!
Expand Down
4 changes: 2 additions & 2 deletions packages/twirpscript/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "twirpscript",
"version": "0.0.70",
"version": "0.0.71",
"description": "Protobuf RPC framework for JavaScript and TypeScript",
"license": "MIT",
"author": "Tate <tatethurston@gmail.com>",
Expand All @@ -25,7 +25,7 @@
"sideEffects": false,
"types": "dist/index.d.ts",
"dependencies": {
"protoscript": "0.0.20"
"protoscript": "0.0.22"
},
"keywords": [
"protobuf",
Expand Down
36 changes: 34 additions & 2 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 0d75fb6

Please sign in to comment.