From a6b8c99e54e153362a519a53a0a2755a69efa32a Mon Sep 17 00:00:00 2001 From: Tate Thurston Date: Sat, 28 Dec 2024 20:07:48 +0000 Subject: [PATCH] fix windows cmd path --- .github/workflows/ci.yml | 58 ++++++++++++++----- .github/workflows/publish.yml | 17 ++---- CHANGELOG.md | 4 ++ package.json | 4 +- packages/protoscript/package.json | 2 +- packages/protoscript/src/compiler.cmd | 2 +- .../src/runtime/well-known-types/any.pb.ts | 3 +- 7 files changed, 57 insertions(+), 33 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 99f42c7..d1ce3da 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -5,28 +5,18 @@ on: - main pull_request: jobs: - ci: - name: "Lint and Test" + lint_test: + name: Lint and Test runs-on: ubuntu-latest steps: # Install protoc for e2e:setup - uses: arduino/setup-protoc@v2 with: - version: "24.4" - - uses: actions/checkout@v3 - - uses: pnpm/action-setup@v2 - - uses: actions/setup-node@v3 + version: "23.4" + - uses: bufbuild/buf-setup-action@v1.25.0 + - uses: tatethurston/github-actions/test@main with: - node-version-file: ".nvmrc" - cache: "pnpm" - - run: pnpm install --frozen-lockfile - - run: (cd packages/protoscript && pnpm package:build) - # run again to link bin that is now available after package:build - - run: pnpm install --frozen-lockfile - - run: pnpm lint - - run: pnpm test:ci && pnpm codecov --token=$CODECOV_TOKEN - env: - CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} + codecov_token: ${{ secrets.CODECOV_TOKEN }} - name: Check for uncommited changes to generated files run: | pnpm regen @@ -39,3 +29,39 @@ jobs: 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/protoscript + pnpm pack + mv *.tgz protoscript.tgz + - uses: actions/upload-artifact@v4 + with: + name: package-${{ github.event.pull_request.number }} + path: packages/protoscript/*.tgz + if-no-files-found: error + retention-days: 1 + overwrite: true + check_windows: + name: Windows CI Check + runs-on: windows-latest + needs: build_package + steps: + - uses: arduino/setup-protoc@v2 + with: + version: "23.4" + - uses: actions/download-artifact@v4 + with: + name: ${{ needs.build_package.outputs.package-name }} + - uses: actions/setup-node@v3 + - name: Bin Check + run: | + npm install protoscript.tgz + touch dummy.proto + npx --no protoscript diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index c44b335..305daeb 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -1,20 +1,13 @@ name: Publish NPM Package on: release: - types: [created] + types: [published] + workflow_dispatch: jobs: build: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - uses: pnpm/action-setup@v2 - - uses: actions/setup-node@v3 + - uses: tatethurston/github-actions/publish@main with: - node-version-file: ".nvmrc" - cache: "pnpm" - registry-url: "https://registry.npmjs.org" - - run: pnpm install --frozen-lockfile - - run: cp README.md LICENSE CHANGELOG.md packages/protoscript - - run: cd packages/protoscript && pnpm package:build && npm publish - env: - NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + package_directory: packages/protoscript + npm_token: ${{ secrets.NPM_TOKEN }} diff --git a/CHANGELOG.md b/CHANGELOG.md index 9c07cdc..b118210 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## v0.0.21 + +- Fix compiler path on Windows. + ## v0.0.20 - Preserve protoscript import when well known types are imported. This corrects a regression in 0.0.19. diff --git a/package.json b/package.json index a76d78d..eced704 100644 --- a/package.json +++ b/package.json @@ -15,6 +15,7 @@ } }, "scripts": { + "build": "(pnpm package:copy:files && cd packages/protoscript && pnpm package:build)", "build:wellknowntypes": "(cd ./packages/well-known-types && GENERATE_KNOWN_TYPES=1 pnpm protoscript && cp google/protobuf/* ../protoscript/src/runtime/well-known-types/)", "e2e:build": "pnpm --filter './e2e/*' run build", "e2e:protoscript": "pnpm --filter './e2e/*' exec protoscript", @@ -22,10 +23,11 @@ "examples:regen": "pnpm --filter './examples/*' exec protoscript", "lint": "pnpm typecheck && prettier --check . && prettier-package-json --list-different '{,e2e/*,examples/*,packages/*,}package.json' && eslint .", "lint:fix": "prettier --write . && prettier-package-json --write '{,e2e/*,examples/*,packages/*}package.json' && eslint --fix .", + "package:copy:files": "cp ./LICENSE ./README.md packages/protoscript", "prepare": "husky install", "regen": "pnpm build:wellknowntypes && pnpm examples:regen && pnpm e2e:protoscript", "test": "jest", - "test:ci": "pnpm run e2e:setup && pnpm run test --coverage", + "test:ci": "pnpm install --frozen-lockfile && pnpm run e2e:setup && pnpm run test --coverage", "typecheck": "pnpm --recursive run typecheck" }, "dependencies": { diff --git a/packages/protoscript/package.json b/packages/protoscript/package.json index 6f1e5d4..a339dbb 100644 --- a/packages/protoscript/package.json +++ b/packages/protoscript/package.json @@ -1,6 +1,6 @@ { "name": "protoscript", - "version": "0.0.20", + "version": "0.0.21", "description": "A Protobuf runtime and code generation tool for JavaScript and TypeScript", "license": "MIT", "author": "Tate ", diff --git a/packages/protoscript/src/compiler.cmd b/packages/protoscript/src/compiler.cmd index 541af61..6d00eda 100644 --- a/packages/protoscript/src/compiler.cmd +++ b/packages/protoscript/src/compiler.cmd @@ -1,2 +1,2 @@ @echo off -node .\node_modules\protoscript\compiler.js %* +node .\node_modules\protoscript\dist\compiler.js %* diff --git a/packages/protoscript/src/runtime/well-known-types/any.pb.ts b/packages/protoscript/src/runtime/well-known-types/any.pb.ts index 493e548..e9abba9 100644 --- a/packages/protoscript/src/runtime/well-known-types/any.pb.ts +++ b/packages/protoscript/src/runtime/well-known-types/any.pb.ts @@ -122,8 +122,7 @@ export interface Any { * * Note: this functionality is not currently available in the official * protobuf release, and it is not used for type URLs beginning with - * type.googleapis.com. As of May 2023, there are no widely used type server - * implementations and no plans to implement one. + * type.googleapis.com. * * Schemes other than `http`, `https` (or the empty scheme) might be * used with implementation specific semantics.