Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename packages #219

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions examples/react/basic/buf.gen.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
version: v1
plugins:
- name: es
path: ./node_modules/.bin/protoc-gen-es
path: protoc-gen-es
out: src/gen
opt:
- target=ts

- name: connect-query
path: ./node_modules/.bin/protoc-gen-connect-query
path: protoc-gen-connect-react-query
out: src/gen
opt:
- target=ts
Expand Down
6 changes: 3 additions & 3 deletions examples/react/basic/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "@connectrpc/connect-query-example-react-basic",
"name": "@connectrpc/connect-react-query-example-basic",
"version": "0.0.0",
"private": true,
"type": "module",
Expand All @@ -16,10 +16,10 @@
"@bufbuild/protobuf": "^1.3.3",
"@bufbuild/protoc-gen-es": "^1.3.3",
"@connectrpc/connect": "^1.1.2",
"@connectrpc/connect-query": "workspace:*",
"@connectrpc/connect-react-query": "workspace:*",
"@connectrpc/connect-web": "^1.1.2",
"@connectrpc/protoc-gen-connect-es": "^1.1.2",
"@connectrpc/protoc-gen-connect-query": "^0.5.1",
"@connectrpc/protoc-gen-connect-react-query": "workspace:*",
"@tanstack/react-query": "^4.35.7",
"@tanstack/react-query-devtools": "^4.35.7",
"@testing-library/jest-dom": "^6.1.3",
Expand Down
2 changes: 1 addition & 1 deletion examples/react/basic/src/example.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { useQuery } from "@tanstack/react-query";
import type { FC } from "react";

import { Data, Datum } from "./datum";
import { say } from "./gen/eliza-ElizaService_connectquery";
import { say } from "./gen/eliza-ElizaService_connectreactquery";
import { Indicator, Indicators } from "./indicator";
import { Page } from "./page";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import {
createQueryService,
createUnaryHooks,
UnaryFunctionsWithHooks,
} from "@connectrpc/connect-query";
} from "@connectrpc/connect-react-query";

export const typeName = "connectrpc.eliza.v1.BigIntService";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import {
createQueryService,
createUnaryHooks,
UnaryFunctionsWithHooks,
} from "@connectrpc/connect-query";
} from "@connectrpc/connect-react-query";

export const typeName = "connectrpc.eliza.v1.ElizaService";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import {
createQueryService,
createUnaryHooks,
UnaryFunctionsWithHooks,
} from "@connectrpc/connect-query";
} from "@connectrpc/connect-react-query";

export const typeName = "connectrpc.eliza.v1.Haberdasher";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import {
createQueryService,
createUnaryHooks,
UnaryFunctionsWithHooks,
} from "@connectrpc/connect-query";
} from "@connectrpc/connect-react-query";

export const typeName = "connectrpc.eliza.v1.PaginatedService";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import {
createQueryService,
createUnaryHooks,
UnaryFunctionsWithHooks,
} from "@connectrpc/connect-query";
} from "@connectrpc/connect-react-query";

export const typeName = "connectrpc.eliza.v1.SecondService";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import {
createQueryService,
createUnaryHooks,
UnaryFunctionsWithHooks,
} from "@connectrpc/connect-query";
} from "@connectrpc/connect-react-query";

export const typeName = "connectrpc.eliza.v1.Slouch";

Expand Down
2 changes: 1 addition & 1 deletion examples/react/basic/src/main.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import "@testing-library/jest-dom";
import { createRouterTransport } from "@connectrpc/connect";
import { render, screen } from "@testing-library/react";

import { ElizaService } from "./gen/eliza-ElizaService_connectquery";
import { ElizaService } from "./gen/eliza-ElizaService_connectreactquery";
import Main from "./main";

describe("Application", () => {
Expand Down
2 changes: 1 addition & 1 deletion examples/react/basic/src/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import "./index.css";

import type { Transport } from "@connectrpc/connect";
import { TransportProvider } from "@connectrpc/connect-query";
import { TransportProvider } from "@connectrpc/connect-react-query";
import { createConnectTransport } from "@connectrpc/connect-web";
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
import { ReactQueryDevtools } from "@tanstack/react-query-devtools";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "@connectrpc/connect-query",
"name": "@connectrpc/connect-react-query",
"version": "0.5.3",
"description": "TypeScript-first expansion pack for TanStack Query that gives you Protobuf superpowers.",
"license": "Apache-2.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export const useTransport = () => useContext(transportContext);
*
* @example
* import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
* import { TransportProvider } from "@connectrpc/connect-query";
* import { TransportProvider } from "@connectrpc/connect-react-query";
*
* const queryClient = new QueryClient();
*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
{
"name": "@connectrpc/protoc-gen-connect-query",
"name": "@connectrpc/protoc-gen-connect-react-query",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't we rename the npm binary as well?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah right, yeah, good catch.

"version": "0.5.3",
"description": "Code generator for connect-query",
"license": "Apache-2.0",
"sideEffects": false,
"repository": {
"type": "git",
"url": "https://github.com/connectrpc/connect-query-es.git",
"directory": "packages/protoc-gen-connect-query"
"directory": "packages/protoc-gen-connect-react-query"
},
"files": [
"dist/**"
],
"bin": {
"protoc-gen-connect-query": "bin/protoc-gen-connect-query"
"protoc-gen-connect-react-query": "bin/protoc-gen-connect-react-query"
},
"engines": {
"node": ">=16"
Expand All @@ -30,7 +30,7 @@
"@bufbuild/buf": "1.27.0",
"@bufbuild/protoc-gen-es": "^1.3.3",
"@connectrpc/connect": "^1.1.2",
"@connectrpc/connect-query": "workspace:*",
"@connectrpc/connect-react-query": "workspace:*",
"@connectrpc/protoc-gen-connect-es": "^1.1.2",
"@tanstack/react-query": "^4.35.7",
"typescript": "^5.2.2"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ plugins:
- target=ts

- plugin: connect-query
path: ../bin/protoc-gen-connect-query
path: ../bin/protoc-gen-connect-react-query
out: gen
opt:
- target=ts+dts+js
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import {
SayResponse,
} from "./eliza_pb";
import { MethodKind } from "@bufbuild/protobuf";
import { UnaryFunctionsWithHooks } from "@connectrpc/connect-query";
import { UnaryFunctionsWithHooks } from "@connectrpc/connect-react-query";

/**
* ElizaService provides a way to talk to Eliza, a port of the DOCTOR script
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import { MethodKind } from "@bufbuild/protobuf";
import {
createQueryService,
createUnaryHooks,
} from "@connectrpc/connect-query";
} from "@connectrpc/connect-react-query";

export const typeName = "connectrpc.eliza.v1.ElizaService";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import {
createQueryService,
createUnaryHooks,
UnaryFunctionsWithHooks,
} from "@connectrpc/connect-query";
} from "@connectrpc/connect-react-query";

export const typeName = "connectrpc.eliza.v1.ElizaService";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ const generateServiceFile =
f.print("};");
f.print();

const unaryFunctionsWithHooks = f.import('UnaryFunctionsWithHooks', '@connectrpc/connect-query');
const unaryFunctionsWithHooks = f.import('UnaryFunctionsWithHooks', '@connectrpc/connect-react-query');

service.methods.forEach((method) => {
switch (method.methodKind) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const generateServiceFile =
(service: DescService) => {
const isTs = extension === "ts";
const f = schema.generateFile(
`${protoFile.name}-${localName(service)}_connectquery.${extension}`,
`${protoFile.name}-${localName(service)}_connectreactquery.${extension}`,
);
f.preamble(protoFile);

Expand Down Expand Up @@ -68,7 +68,7 @@ const generateServiceFile =
f.print();

f.print(`const $queryService = `,
f.import('createQueryService', '@connectrpc/connect-query'),
f.import('createQueryService', '@connectrpc/connect-react-query'),
`({`,
` service: `, localName(service), `,`,
`});`
Expand All @@ -81,14 +81,14 @@ const generateServiceFile =
f.print(makeJsDoc(method));
const methodTsType = [
": ",
f.import('UnaryFunctionsWithHooks', '@connectrpc/connect-query'),
f.import('UnaryFunctionsWithHooks', '@connectrpc/connect-react-query'),
`<${method.input.name}, ${method.output.name}>`
]

f.print(
`export const ${safeIdentifier(localName(method))}`, ...(isTs ? methodTsType : []), ` = { `,
` ...$queryService.${localName(method)},`,
` ...`, f.import('createUnaryHooks', '@connectrpc/connect-query'),`($queryService.${localName(method)})`,
` ...`, f.import('createUnaryHooks', '@connectrpc/connect-react-query'),`($queryService.${localName(method)})`,
`};`
);

Expand Down
18 changes: 9 additions & 9 deletions pnpm-lock.yaml

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