Skip to content

Commit

Permalink
chore(workspace): automatically publish urql-core to JSR (#3574)
Browse files Browse the repository at this point in the history
  • Loading branch information
JoviDeCroock authored May 29, 2024
1 parent 41303ff commit 6bc39b5
Show file tree
Hide file tree
Showing 29 changed files with 403 additions and 57 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ jobs:
- name: Unit Tests
run: pnpm run test

- name: Check for slow types
run: pnpm jsr:dryrun

react-e2e:
name: React E2E
runs-on: ubuntu-latest
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ on:
push:
branches:
- main

jobs:
release:
name: Release
Expand Down
15 changes: 15 additions & 0 deletions exchanges/auth/jsr.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"name": "@urql/exchange-auth",
"version": "2.1.6",
"exports": {
".": "./src/index.ts"
},
"exclude": [
"node_modules",
"cypress",
"**/*.test.*",
"**/*.spec.*",
"**/*.test.*.snap",
"**/*.spec.*.snap"
]
}
15 changes: 15 additions & 0 deletions exchanges/context/jsr.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"name": "@urql/exchange-context",
"version": "0.2.1",
"exports": {
".": "./src/index.ts"
},
"exclude": [
"node_modules",
"cypress",
"**/*.test.*",
"**/*.spec.*",
"**/*.test.*.snap",
"**/*.spec.*.snap"
]
}
15 changes: 15 additions & 0 deletions exchanges/execute/jsr.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"name": "@urql/exchange-execute",
"version": "2.2.2",
"exports": {
".": "./src/index.ts"
},
"exclude": [
"node_modules",
"cypress",
"**/*.test.*",
"**/*.spec.*",
"**/*.test.*.snap",
"**/*.spec.*.snap"
]
}
17 changes: 17 additions & 0 deletions exchanges/graphcache/jsr.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"name": "@urql/exchange-graphcache",
"version": "7.0.2",
"exports": {
".": "./src/index.ts",
"./extras": "./src/extras/index.ts",
"./default-storage": "./src/default-storage/index.ts"
},
"exclude": [
"node_modules",
"cypress",
"**/*.test.*",
"**/*.spec.*",
"**/*.test.*.snap",
"**/*.spec.*.snap"
]
}
15 changes: 15 additions & 0 deletions exchanges/persisted/jsr.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"name": "@urql/exchange-persisted",
"version": "4.2.0",
"exports": {
".": "./src/index.ts"
},
"exclude": [
"node_modules",
"cypress",
"**/*.test.*",
"**/*.spec.*",
"**/*.test.*.snap",
"**/*.spec.*.snap"
]
}
15 changes: 15 additions & 0 deletions exchanges/populate/jsr.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"name": "@urql/exchange-populate",
"version": "1.1.2",
"exports": {
".": "./src/index.ts"
},
"exclude": [
"node_modules",
"cypress",
"**/*.test.*",
"**/*.spec.*",
"**/*.test.*.snap",
"**/*.spec.*.snap"
]
}
15 changes: 15 additions & 0 deletions exchanges/refocus/jsr.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"name": "@urql/exchange-refocus",
"version": "1.0.2",
"exports": {
".": "./src/index.ts"
},
"exclude": [
"node_modules",
"cypress",
"**/*.test.*",
"**/*.spec.*",
"**/*.test.*.snap",
"**/*.spec.*.snap"
]
}
15 changes: 15 additions & 0 deletions exchanges/request-policy/jsr.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"name": "@urql/exchange-request-policy",
"version": "1.1.0",
"exports": {
".": "./src/index.ts"
},
"exclude": [
"node_modules",
"cypress",
"**/*.test.*",
"**/*.spec.*",
"**/*.test.*.snap",
"**/*.spec.*.snap"
]
}
15 changes: 15 additions & 0 deletions exchanges/retry/jsr.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"name": "@urql/exchange-retry",
"version": "1.2.1",
"exports": {
".": "./src/index.ts"
},
"exclude": [
"node_modules",
"cypress",
"**/*.test.*",
"**/*.spec.*",
"**/*.test.*.snap",
"**/*.spec.*.snap"
]
}
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@
"postinstall": "node ./scripts/prepare/postinstall.js",
"pack": "node ./scripts/actions/pack-all.mjs",
"changeset:version": "node ./scripts/changesets/version.mjs",
"changeset:publish": "changeset publish"
"changeset:publish": "changeset publish && pnpm jsr",
"jsr": "pnpm --filter @urql/core jsr",
"jsr:dryrun": "pnpm --filter @urql/core jsr --dry-run"
},
"eslintConfig": {
"root": true,
Expand Down Expand Up @@ -88,6 +90,7 @@
"husky-v4": "^4.3.8",
"invariant": "^2.2.4",
"jsdom": "^21.1.1",
"jsr": "^0.12.4",
"lint-staged": "^13.2.2",
"npm-packlist": "^7.0.4",
"npm-run-all": "^4.1.5",
Expand Down
16 changes: 16 additions & 0 deletions packages/core/jsr.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"name": "@urql/core",
"version": "5.0.2",
"exports": {
".": "./src/index.ts",
"./internal": "./src/internal/index.ts"
},
"exclude": [
"node_modules",
"cypress",
"**/*.test.*",
"**/*.spec.*",
"**/*.test.*.snap",
"**/*.spec.*.snap"
]
}
3 changes: 2 additions & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@
"lint": "eslint --ext=js,jsx,ts,tsx .",
"build": "rollup -c ../../scripts/rollup/config.mjs",
"prepare": "node ../../scripts/prepare/index.js",
"prepublishOnly": "run-s clean build"
"prepublishOnly": "run-s clean build",
"jsr": "jsr publish"
},
"dependencies": {
"@0no-co/graphql.web": "^1.0.5",
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/utils/error.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ export class CombinedError extends Error {
this.response = input.response;
}

toString() {
toString(): string {
return this.message;
}
}
5 changes: 4 additions & 1 deletion packages/core/src/utils/formatDocument.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,10 @@ const formatNode = <
return node as FormattedNode<T>;
};

const formattedDocs = new Map<number, KeyedDocumentNode>();
const formattedDocs: Map<number, KeyedDocumentNode> = new Map<
number,
KeyedDocumentNode
>();

/** Formats a GraphQL document to add `__typename` fields and process client-side directives.
*
Expand Down
12 changes: 9 additions & 3 deletions packages/core/src/utils/request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,21 @@ const SOURCE_NAME = 'gql';
const GRAPHQL_STRING_RE = /("{3}[\s\S]*"{3}|"(?:\\.|[^"])*")/g;
const REPLACE_CHAR_RE = /(?:#[^\n\r]+)?(?:[\r\n]+|$)/g;

const replaceOutsideStrings = (str: string, idx: number) =>
const replaceOutsideStrings = (str: string, idx: number): string =>
idx % 2 === 0 ? str.replace(REPLACE_CHAR_RE, '\n') : str;

/** Sanitizes a GraphQL document string by replacing comments and redundant newlines in it. */
const sanitizeDocument = (node: string): string =>
node.split(GRAPHQL_STRING_RE).map(replaceOutsideStrings).join('').trim();

const prints = new Map<DocumentNode | DefinitionNode, string>();
const docs = new Map<HashValue, KeyedDocumentNode>();
const prints: Map<DocumentNode | DefinitionNode, string> = new Map<
DocumentNode | DefinitionNode,
string
>();
const docs: Map<HashValue, KeyedDocumentNode> = new Map<
HashValue,
KeyedDocumentNode
>();

/** A cached printing function for GraphQL documents.
*
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/utils/result.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export const makeResult = (
};
};

const deepMerge = (target: any, source: any) => {
const deepMerge = (target: any, source: any): any => {
if (typeof target === 'object' && target != null) {
if (
!target.constructor ||
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/utils/variables.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
export type FileMap = Map<string, File | Blob>;

const seen = new Set();
const cache = new WeakMap();
const seen: Set<any> = new Set();
const cache: WeakMap<any, any> = new WeakMap();

const stringify = (x: any): string => {
if (x === null || seen.has(x)) {
Expand Down
15 changes: 15 additions & 0 deletions packages/introspection/jsr.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"name": "@urql/introspection",
"version": "1.0.3",
"exports": {
".": "./src/index.ts"
},
"exclude": [
"node_modules",
"cypress",
"**/*.test.*",
"**/*.spec.*",
"**/*.test.*.snap",
"**/*.spec.*.snap"
]
}
16 changes: 16 additions & 0 deletions packages/next-urql/jsr.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"name": "@urql/next",
"version": "1.1.1",
"exports": {
".": "./src/index.ts",
"./rsc": "./src/rsc.ts"
},
"exclude": [
"node_modules",
"cypress",
"**/*.test.*",
"**/*.spec.*",
"**/*.test.*.snap",
"**/*.spec.*.snap"
]
}
15 changes: 15 additions & 0 deletions packages/preact-urql/jsr.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"name": "@urql/preact",
"version": "4.0.5",
"exports": {
".": "./src/index.ts"
},
"exclude": [
"node_modules",
"cypress",
"**/*.test.*",
"**/*.spec.*",
"**/*.test.*.snap",
"**/*.spec.*.snap"
]
}
13 changes: 13 additions & 0 deletions packages/react-urql/jsr.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"name": "urql",
"version": "4.0.7",
"exports": "src/index.ts",
"exclude": [
"node_modules",
"cypress",
"**/*.test.*",
"**/*.spec.*",
"**/*.test.*.snap",
"**/*.spec.*.snap"
]
}
15 changes: 15 additions & 0 deletions packages/storage-rn/jsr.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"name": "@urql/storage-rn",
"version": "1.1.0",
"exports": {
".": "./src/index.ts"
},
"exclude": [
"node_modules",
"cypress",
"**/*.test.*",
"**/*.spec.*",
"**/*.test.*.snap",
"**/*.spec.*.snap"
]
}
15 changes: 15 additions & 0 deletions packages/svelte-urql/jsr.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"name": "@urql/svelte",
"version": "4.1.1",
"exports": {
".": "./src/index.ts"
},
"exclude": [
"node_modules",
"cypress",
"**/*.test.*",
"**/*.spec.*",
"**/*.test.*.snap",
"**/*.spec.*.snap"
]
}
Loading

0 comments on commit 6bc39b5

Please sign in to comment.