Skip to content

Commit

Permalink
chore(workspace): publish to jsr (#30)
Browse files Browse the repository at this point in the history
* publish to jsr

* fix linting

* add experimental

* add action

* fix types

* change name to have a dash

* fixes
  • Loading branch information
JoviDeCroock committed Apr 25, 2024
1 parent 123f797 commit 7a8ffec
Show file tree
Hide file tree
Showing 7 changed files with 45 additions and 6 deletions.
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
5 changes: 5 additions & 0 deletions jsr.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"name": "@0no-co/graphql-web",
"version": "1.0.7",
"exports": "./src/index.ts"
}
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@
"clean": "rimraf dist node_modules/.cache",
"prepublishOnly": "run-s clean build check test",
"prepare": "node ./scripts/prepare.js",
"changeset:version": "changeset version && pnpm install --lockfile-only",
"changeset:publish": "changeset publish"
"changeset:version": "changeset version && pnpm install --lockfile-only && node ./scripts/jsr.js",
"changeset:publish": "changeset publish && jsr publish"
},
"repository": "https://github.com/0no-co/graphql.web",
"bugs": {
Expand Down Expand Up @@ -95,6 +95,7 @@
"eslint-plugin-prettier": "^5.1.3",
"eslint-plugin-tsdoc": "^0.2.17",
"husky-v4": "^4.3.8",
"jsr": "^0.12.1",
"lint-staged": "^15.2.0",
"npm-run-all": "^4.1.5",
"prettier": "^3.2.4",
Expand Down
20 changes: 20 additions & 0 deletions pnpm-lock.yaml

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

12 changes: 12 additions & 0 deletions scripts/jsr.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
const path = require('path');
const fs = require('fs');

const packageJsonSource = path.resolve(__dirname, '../package.json');
const jsrJsonSource = path.resolve(__dirname, '../jsr.json');

const packageJson = JSON.parse(fs.readFileSync(packageJsonSource, { encoding: 'utf-8' }));
const jsrJson = JSON.parse(fs.readFileSync(jsrJsonSource, { encoding: 'utf-8' }));

jsrJson.version = packageJson.version;

fs.writeFileSync(jsrJsonSource, JSON.stringify(jsrJson, undefined, 2));
4 changes: 2 additions & 2 deletions src/error.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,11 @@ export class GraphQLError extends Error {
return { ...this, message: this.message };
}

toString() {
toString(): string {
return this.message;
}

get [Symbol.toStringTag]() {
get [Symbol.toStringTag](): string {
return 'GraphQLError';
}
}
4 changes: 2 additions & 2 deletions src/printer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@ function mapJoin<T>(value: readonly T[], joiner: string, mapper: (value: T) => s
return out;
}

function printString(string: string) {
function printString(string: string): string {
return JSON.stringify(string);
}

function printBlockString(string: string) {
function printBlockString(string: string): string {
return '"""\n' + string.replace(/"""/g, '\\"""') + '\n"""';
}

Expand Down

0 comments on commit 7a8ffec

Please sign in to comment.