From 6a79ac8f3863c2492ef5f2baa103a5f40ff303a5 Mon Sep 17 00:00:00 2001 From: Kevin Franklin Kim Date: Fri, 8 Nov 2024 14:22:22 +0100 Subject: [PATCH 1/5] fix: string union type --- example/basic/client/src/service-vo.ts | 1 + example/errors/client/src/service-vo.ts | 4 +++- example/nullable/client/src/service-vo.ts | 1 + example/time/client/src/service-client.ts | 1 - example/time/client/src/service-vo-service.ts | 3 +-- example/time/client/src/service-vo-time.ts | 2 +- example/union/client/src/app.ts | 2 +- example/union/client/src/service-vo.ts | 4 +++- typescript.go | 8 +------- 9 files changed, 12 insertions(+), 14 deletions(-) diff --git a/example/basic/client/src/service-vo.ts b/example/basic/client/src/service-vo.ts index 9e0a900..260a987 100644 --- a/example/basic/client/src/service-vo.ts +++ b/example/basic/client/src/service-vo.ts @@ -1,6 +1,7 @@ /* eslint:disable */ // Code generated by gotsrpc https://github.com/foomo/gotsrpc/v2 - DO NOT EDIT. import * as github_com_foomo_gotsrpc_v2_example_basic_service from './service-vo'; // ./client/src/service-vo.ts to ./client/src/service-vo.ts + // github.com/foomo/gotsrpc/v2/example/basic/service.Float32Type export enum Float32Type { Float32AType = 1, diff --git a/example/errors/client/src/service-vo.ts b/example/errors/client/src/service-vo.ts index 7d8988a..bd5fb2d 100644 --- a/example/errors/client/src/service-vo.ts +++ b/example/errors/client/src/service-vo.ts @@ -1,8 +1,10 @@ /* eslint:disable */ // Code generated by gotsrpc https://github.com/foomo/gotsrpc/v2 - DO NOT EDIT. import * as github_com_foomo_gotsrpc_v2_example_errors_service_frontend from './service-vo'; // ./client/src/service-vo.ts to ./client/src/service-vo.ts + // github.com/foomo/gotsrpc/v2/example/errors/service/frontend.ErrMulti -export type ErrMulti = (typeof github_com_foomo_gotsrpc_v2_example_errors_service_frontend.ErrMultiA) & (typeof github_com_foomo_gotsrpc_v2_example_errors_service_frontend.ErrMultiB) +export const ErrMulti = { ...github_com_foomo_gotsrpc_v2_example_errors_service_frontend.ErrMultiA, ...github_com_foomo_gotsrpc_v2_example_errors_service_frontend.ErrMultiB } +export type ErrMulti = typeof ErrMulti // github.com/foomo/gotsrpc/v2/example/errors/service/frontend.ErrMultiA export enum ErrMultiA { One = "one", diff --git a/example/nullable/client/src/service-vo.ts b/example/nullable/client/src/service-vo.ts index 35504d5..70e1b15 100644 --- a/example/nullable/client/src/service-vo.ts +++ b/example/nullable/client/src/service-vo.ts @@ -1,6 +1,7 @@ /* eslint:disable */ // Code generated by gotsrpc https://github.com/foomo/gotsrpc/v2 - DO NOT EDIT. import * as github_com_foomo_gotsrpc_v2_example_nullable_service from './service-vo'; // ./client/src/service-vo.ts to ./client/src/service-vo.ts + // github.com/foomo/gotsrpc/v2/example/nullable/service.ACustomType export enum ACustomType { One = "one", diff --git a/example/time/client/src/service-client.ts b/example/time/client/src/service-client.ts index be01655..2d9f803 100644 --- a/example/time/client/src/service-client.ts +++ b/example/time/client/src/service-client.ts @@ -1,7 +1,6 @@ /* eslint:disable */ // Code generated by gotsrpc https://github.com/foomo/gotsrpc/v2 - DO NOT EDIT. import * as github_com_foomo_gotsrpc_v2_example_time_service from './service-vo-service'; // ./client/src/service-client.ts to ./client/src/service-vo-service.ts -import * as time from './service-vo-time'; // ./client/src/service-client.ts to ./client/src/service-vo-time.ts export class ServiceClient { public static defaultEndpoint = "/service"; diff --git a/example/time/client/src/service-vo-service.ts b/example/time/client/src/service-vo-service.ts index a3fdbde..ac60638 100644 --- a/example/time/client/src/service-vo-service.ts +++ b/example/time/client/src/service-vo-service.ts @@ -1,7 +1,6 @@ /* eslint:disable */ // Code generated by gotsrpc https://github.com/foomo/gotsrpc/v2 - DO NOT EDIT. -import * as github_com_foomo_gotsrpc_v2_example_time_service from './service-vo-service'; // ./client/src/service-vo-service.ts to ./client/src/service-vo-service.ts -import * as time from './service-vo-time'; // ./client/src/service-vo-service.ts to ./client/src/service-vo-time.ts + // github.com/foomo/gotsrpc/v2/example/time/service.TimeStruct export interface TimeStruct { time:number; diff --git a/example/time/client/src/service-vo-time.ts b/example/time/client/src/service-vo-time.ts index e771808..ad43eae 100644 --- a/example/time/client/src/service-vo-time.ts +++ b/example/time/client/src/service-vo-time.ts @@ -1,7 +1,7 @@ /* eslint:disable */ // Code generated by gotsrpc https://github.com/foomo/gotsrpc/v2 - DO NOT EDIT. -import * as github_com_foomo_gotsrpc_v2_example_time_service from './service-vo-service'; // ./client/src/service-vo-time.ts to ./client/src/service-vo-service.ts import * as time from './service-vo-time'; // ./client/src/service-vo-time.ts to ./client/src/service-vo-time.ts + // time.Time export interface Time { } diff --git a/example/union/client/src/app.ts b/example/union/client/src/app.ts index 76db3c4..81cd79d 100644 --- a/example/union/client/src/app.ts +++ b/example/union/client/src/app.ts @@ -47,4 +47,4 @@ function assertExhaustive( message: string = 'msg' ): never { throw new Error(message); -} \ No newline at end of file +} diff --git a/example/union/client/src/service-vo.ts b/example/union/client/src/service-vo.ts index fd268f7..f198091 100644 --- a/example/union/client/src/service-vo.ts +++ b/example/union/client/src/service-vo.ts @@ -1,6 +1,7 @@ /* eslint:disable */ // Code generated by gotsrpc https://github.com/foomo/gotsrpc/v2 - DO NOT EDIT. import * as github_com_foomo_gotsrpc_v2_example_union_service from './service-vo'; // ./client/src/service-vo.ts to ./client/src/service-vo.ts + // github.com/foomo/gotsrpc/v2/example/union/service.InlineStruct export interface InlineStruct extends github_com_foomo_gotsrpc_v2_example_union_service.InlineStructA , github_com_foomo_gotsrpc_v2_example_union_service.InlineStructB { value:string; @@ -19,7 +20,8 @@ export interface InlineStructPtr extends Partial Date: Fri, 8 Nov 2024 14:22:43 +0100 Subject: [PATCH 2/5] chore: add pr checks --- .github/workflows/test.yml | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 5e66408..47efa2b 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -4,9 +4,7 @@ on: push: branches: [ main ] pull_request: - branches: [ main ] merge_group: - branches: [ main ] workflow_dispatch: concurrency: @@ -17,6 +15,11 @@ env: GOFLAGS: -mod=readonly GOPROXY: https://proxy.golang.org +permissions: + contents: read + pull-requests: read + checks: write + jobs: test: runs-on: ubuntu-latest @@ -28,10 +31,18 @@ jobs: check-latest: true go-version-file: go.mod + - name: Run go mod tidy + run: | + make tidy + git diff --exit-code + - uses: golangci/golangci-lint-action@v5 - with: - working-directory: ${{ matrix.gomod }} - name: Run tests - run: go test -v ./... + run: make test + + - name: Make examples + run: | + make examples + git diff --exit-code From 82b98a0908903461eb6897c362a4775a42eb3588 Mon Sep 17 00:00:00 2001 From: Kevin Franklin Kim Date: Fri, 8 Nov 2024 14:24:06 +0100 Subject: [PATCH 3/5] fix: module path --- example/basic/gotsrpc.yml | 4 ++-- example/errors/gotsrpc.yml | 4 ++-- example/monitor/gotsrpc.yml | 4 ++-- example/nullable/gotsrpc.yml | 4 ++-- example/time/gotsrpc.yml | 4 ++-- example/union/gotsrpc.yml | 4 ++-- 6 files changed, 12 insertions(+), 12 deletions(-) diff --git a/example/basic/gotsrpc.yml b/example/basic/gotsrpc.yml index e64a9e5..deb2c3e 100644 --- a/example/basic/gotsrpc.yml +++ b/example/basic/gotsrpc.yml @@ -1,6 +1,6 @@ module: - name: github.com/foomo/gotsrpc/v2/example/basic - path: ./ + name: github.com/foomo/gotsrpc/v2 + path: ../../ targets: basic: diff --git a/example/errors/gotsrpc.yml b/example/errors/gotsrpc.yml index 3f1ebbd..5847e69 100644 --- a/example/errors/gotsrpc.yml +++ b/example/errors/gotsrpc.yml @@ -1,6 +1,6 @@ module: - name: github.com/foomo/gotsrpc/v2/example/errors - path: ./ + name: github.com/foomo/gotsrpc/v2 + path: ../../ targets: frontend: diff --git a/example/monitor/gotsrpc.yml b/example/monitor/gotsrpc.yml index ea4fbcd..cce5401 100644 --- a/example/monitor/gotsrpc.yml +++ b/example/monitor/gotsrpc.yml @@ -1,6 +1,6 @@ module: - name: github.com/foomo/gotsrpc/v2/example/monitor - path: ./ + name: github.com/foomo/gotsrpc/v2 + path: ../../ targets: monitor: diff --git a/example/nullable/gotsrpc.yml b/example/nullable/gotsrpc.yml index 52963ed..309143c 100644 --- a/example/nullable/gotsrpc.yml +++ b/example/nullable/gotsrpc.yml @@ -1,6 +1,6 @@ module: - name: github.com/foomo/gotsrpc/v2/example/nullable - path: ./ + name: github.com/foomo/gotsrpc/v2 + path: ../../ targets: nullable: diff --git a/example/time/gotsrpc.yml b/example/time/gotsrpc.yml index 40e6a7e..9f3bf06 100644 --- a/example/time/gotsrpc.yml +++ b/example/time/gotsrpc.yml @@ -1,6 +1,6 @@ module: - name: github.com/foomo/gotsrpc/v2/example/time - path: ./ + name: github.com/foomo/gotsrpc/v2 + path: ../../ targets: time: diff --git a/example/union/gotsrpc.yml b/example/union/gotsrpc.yml index 0c69713..0fad4f7 100644 --- a/example/union/gotsrpc.yml +++ b/example/union/gotsrpc.yml @@ -1,6 +1,6 @@ module: - name: github.com/foomo/gotsrpc/v2/example/union - path: ./ + name: github.com/foomo/gotsrpc/v2 + path: ../../ targets: union: From 8ee78429aeee80d268c223282b6aeea20d797636 Mon Sep 17 00:00:00 2001 From: Kevin Franklin Kim Date: Fri, 8 Nov 2024 14:32:49 +0100 Subject: [PATCH 4/5] feat: bump typescript --- .github/workflows/test.yml | 6 ++++++ .gitignore | 30 +++++++++++++++++++++++++----- example/package.json | 2 +- example/yarn.lock | 8 ++++---- 4 files changed, 36 insertions(+), 10 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 47efa2b..5e60b98 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -31,6 +31,12 @@ jobs: check-latest: true go-version-file: go.mod + - uses: actions/setup-node@v4 + + - name: Run yarn install + working-directory: examples + run: yarn install + - name: Run go mod tidy run: | make tidy diff --git a/.gitignore b/.gitignore index 76b564e..88561b4 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,27 @@ -!.git* -/vendor/ -dist/ -.idea +.* bin/ +dist/ tmp/ -**/node_modules/ \ No newline at end of file + +## Git ## +!.gitignore +!.gitkeep + +## GitHub ## +!.github/ + +## Node ## +**/node_modules/ + +## TypeScript ### +*.tsbuildinfo + +## Goreleaser ### +!.goreleaser.yaml + +### Go ### +/go.mod +/go.sum +/go.work +/go.work.sum +!.golangci.yaml diff --git a/example/package.json b/example/package.json index defd640..ef508af 100644 --- a/example/package.json +++ b/example/package.json @@ -3,6 +3,6 @@ "version": "0.1.0", "name": "@foomo/gotsrpc-examples", "devDependencies": { - "typescript": "^4.6.2" + "typescript": "5.6.3" } } diff --git a/example/yarn.lock b/example/yarn.lock index 2c8e0c3..94f6166 100644 --- a/example/yarn.lock +++ b/example/yarn.lock @@ -2,7 +2,7 @@ # yarn lockfile v1 -typescript@^4.6.2: - version "4.6.2" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.6.2.tgz#fe12d2727b708f4eef40f51598b3398baa9611d4" - integrity sha512-HM/hFigTBHZhLXshn9sN37H085+hQGeJHJ/X7LpBWLID/fbc2acUMfU+lGD98X81sKP+pFa9f0DZmCwB9GnbAg== +typescript@5.6.3: + version "5.6.3" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.6.3.tgz#5f3449e31c9d94febb17de03cc081dd56d81db5b" + integrity sha512-hjcS1mhfuyi4WW8IWtjP7brDrG2cuDZukyrYrSauoXGNgx0S7zceP07adYkJycEr56BOUTNPzbInooiN3fn1qw== From 805e09801d4498a17003c89d7b729b09a36ff85a Mon Sep 17 00:00:00 2001 From: Kevin Franklin Kim Date: Fri, 8 Nov 2024 14:42:54 +0100 Subject: [PATCH 5/5] fix: dir --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 5e60b98..ba5246b 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -34,7 +34,7 @@ jobs: - uses: actions/setup-node@v4 - name: Run yarn install - working-directory: examples + working-directory: example run: yarn install - name: Run go mod tidy