diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 5e66408..ba5246b 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,24 @@ jobs: check-latest: true go-version-file: go.mod + - uses: actions/setup-node@v4 + + - name: Run yarn install + working-directory: example + run: yarn install + + - 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 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/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/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/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/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/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/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/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/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/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/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