Skip to content

Commit

Permalink
Add ESM wrapper to avoid dual package hazard (connectrpc#180)
Browse files Browse the repository at this point in the history
  • Loading branch information
timostamm authored Oct 6, 2023
1 parent b653680 commit d61b857
Show file tree
Hide file tree
Showing 13 changed files with 231 additions and 346 deletions.
1 change: 1 addition & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,5 +47,6 @@ jobs:
echo "No changed files detected."
else
echo "::error::Formatting resulted in changed files. Please make sure this branch is up to date and run 'pnpm format'. Verify the changes are what you want and commit them."
git diff
exit 1
fi
1 change: 0 additions & 1 deletion cspell.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
"tanstack",
"todos",
"tsdoc",
"tsup",
"corepack",
"printables",
"arethetypeswrong"
Expand Down
13 changes: 6 additions & 7 deletions examples/react/basic/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,21 @@
"private": true,
"type": "module",
"scripts": {
"clean": "rm -rf src/gen",
"dev": "vite",
"generate": "buf generate --path eliza.proto",
"generate": "rm -rf src/gen && buf generate --path eliza.proto",
"license-header": "license-header",
"preview": "vite preview",
"test": "jest",
"format": "prettier . --write && eslint . --fix && license-header"
},
"dependencies": {
"@bufbuild/buf": "1.27.0",
"@bufbuild/protobuf": "^1.3.2",
"@bufbuild/protoc-gen-es": "^1.3.2",
"@connectrpc/connect": "^1.1.0",
"@bufbuild/protobuf": "^1.3.3",
"@bufbuild/protoc-gen-es": "^1.3.3",
"@connectrpc/connect": "^1.1.2",
"@connectrpc/connect-query": "workspace:*",
"@connectrpc/connect-web": "^1.1.0",
"@connectrpc/protoc-gen-connect-es": "^1.1.0",
"@connectrpc/connect-web": "^1.1.2",
"@connectrpc/protoc-gen-connect-es": "^1.1.2",
"@connectrpc/protoc-gen-connect-query": "workspace:*",
"@tanstack/react-query": "^4.35.7",
"@tanstack/react-query-devtools": "^4.35.7",
Expand Down
2 changes: 1 addition & 1 deletion examples/react/basic/src/gen/eliza_pb.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

// @generated by protoc-gen-es v1.3.2 with parameter "target=ts"
// @generated by protoc-gen-es v1.3.3 with parameter "target=ts"
// @generated from file eliza.proto (package connectrpc.eliza.v1, syntax proto3)
/* eslint-disable */
// @ts-nocheck
Expand Down
53 changes: 28 additions & 25 deletions packages/connect-query/package.json
Original file line number Diff line number Diff line change
@@ -1,59 +1,62 @@
{
"name": "@connectrpc/connect-query",
"version": "0.5.1",
"description": "TypeScript-first expansion pack for TanStack Query that gives you Protobuf superpowers.",
"license": "Apache-2.0",
"repository": {
"type": "git",
"url": "https://github.com/connectrpc/connect-query-es.git",
"directory": "packages/connect-query"
},
"license": "Apache-2.0",
"sideEffects": false,
"type": "module",
"exports": {
".": {
"module": "./dist/index.js",
"require": "./dist/index.cjs",
"import": "./dist/index.js"
}
},
"main": "./dist/index.cjs",
"files": [
"dist/**"
],
"scripts": {
"build": "tsup",
"clean": "rm -rf dist",
"clean": "rm -rf ./dist/*",
"build": "npm run build:cjs && npm run build:esm && npm run build:proxy",
"build:cjs": "tsc --project tsconfig.build.json --module commonjs --outDir ./dist/cjs --declaration --declarationDir ./dist/cjs && echo >./dist/cjs/package.json '{\"type\":\"commonjs\"}'",
"build:esm": "tsc --project tsconfig.build.json --module ES2015 --verbatimModuleSyntax --outDir ./dist/esm --declaration --declarationDir ./dist/esm",
"build:proxy": "node ../../scripts/gen-esm-proxy.mjs .",
"generate": "buf generate --path eliza.proto",
"test": "jest",
"format": "prettier . --write --ignore-path ./.eslintignore && eslint . --fix && license-header",
"attw": "attw --pack"
},
"type": "module",
"sideEffects": false,
"main": "./dist/cjs/index.js",
"exports": {
".": {
"module": "./dist/esm/index.js",
"require": "./dist/cjs/index.js",
"import": "./dist/proxy/index.js"
}
},
"dependencies": {
"stable-hash": "^0.0.3"
},
"devDependencies": {
"@arethetypeswrong/cli": "^0.11.0",
"@bufbuild/buf": "1.27.0",
"@bufbuild/jest-environment-jsdom": "^0.1.1",
"@bufbuild/protobuf": "^1.3.2",
"@bufbuild/protoc-gen-es": "^1.3.2",
"@connectrpc/connect": "^1.1.0",
"@connectrpc/connect-web": "^1.1.0",
"@connectrpc/protoc-gen-connect-es": "^1.1.0",
"@bufbuild/protobuf": "^1.3.3",
"@bufbuild/protoc-gen-es": "^1.3.3",
"@connectrpc/connect": "^1.1.2",
"@connectrpc/connect-web": "^1.1.2",
"@connectrpc/protoc-gen-connect-es": "^1.1.2",
"@tanstack/react-query": "^4.35.7",
"@testing-library/react": "^14.0.0",
"@types/react": "^18.2.25",
"@types/react-dom": "^18.2.10",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"tsup": "^7.2.0",
"typescript": "^5.2.2"
},
"peerDependencies": {
"@bufbuild/protobuf": "^1.3.0",
"@connectrpc/connect": "^1.0.0",
"@bufbuild/protobuf": "^1.3.3",
"@connectrpc/connect": "^1.1.2",
"@tanstack/react-query": "4.x",
"react": "^18.2.0",
"react-dom": "^18.2.0"
}
},
"files": [
"dist/**"
]
}
2 changes: 1 addition & 1 deletion packages/connect-query/src/gen/eliza_connect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

// @generated by protoc-gen-connect-es v1.1.0 with parameter "target=ts"
// @generated by protoc-gen-connect-es v1.1.2 with parameter "target=ts"
// @generated from file eliza.proto (package connectrpc.eliza.v1, syntax proto3)
/* eslint-disable */
// @ts-nocheck
Expand Down
2 changes: 1 addition & 1 deletion packages/connect-query/src/gen/eliza_pb.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

// @generated by protoc-gen-es v1.3.2 with parameter "target=ts"
// @generated by protoc-gen-es v1.3.3 with parameter "target=ts"
// @generated from file eliza.proto (package connectrpc.eliza.v1, syntax proto3)
/* eslint-disable */
// @ts-nocheck
Expand Down
24 changes: 0 additions & 24 deletions packages/connect-query/tsup.config.ts

This file was deleted.

8 changes: 4 additions & 4 deletions packages/protoc-gen-connect-query/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@
"preferUnplugged": true,
"devDependencies": {
"@bufbuild/buf": "1.27.0",
"@bufbuild/protoc-gen-es": "^1.3.2",
"@connectrpc/protoc-gen-connect-es": "^1.1.0",
"@bufbuild/protoc-gen-es": "^1.3.3",
"@connectrpc/protoc-gen-connect-es": "^1.1.2",
"typescript": "^5.2.2"
},
"dependencies": {
"@bufbuild/protobuf": "^1.3.2",
"@bufbuild/protoplugin": "^1.3.2"
"@bufbuild/protobuf": "^1.3.3",
"@bufbuild/protoplugin": "^1.3.3"
},
"peerDependencies": {
"@bufbuild/protoc-gen-es": "1.x"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

// @generated by protoc-gen-es v1.3.2 with parameter "target=ts"
// @generated by protoc-gen-es v1.3.3 with parameter "target=ts"
// @generated from file connectrpc/eliza/v1/eliza.proto (package connectrpc.eliza.v1, syntax proto3)
/* eslint-disable */
// @ts-nocheck
Expand Down
Loading

0 comments on commit d61b857

Please sign in to comment.