Skip to content

Commit 74b9f03

Browse files
committed
prepare for npm
1 parent a6ea155 commit 74b9f03

File tree

3 files changed

+11
-8
lines changed

3 files changed

+11
-8
lines changed

README.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,8 @@ Here's a quick walkthrough:
2020
- Create a `gql2ts.ts` script (see `example/gql2ts.ts`).
2121
- Use code completion to explore the possible options.
2222
- Add a `gql2ts` script to your `package.json` (see `example/package.json`).
23-
- The example uses `ts-node` to run the script,
24-
- prettifies it using `prettier`, and
25-
- verifies the result with the TypeScript compiler `tsc`.
23+
- The example uses `ts-node` to run the script, and
24+
- prettifies it using `prettier`.
2625
- Customize to fit your needs.
2726
- Use `npm run gql2ts` to generate TypeScript interfaces for types and resolvers (see `example/src/generated/schema.ts`).
2827
- Implement resolvers using the generated interfaces (see `example/src/resolvers.ts`).

example/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"license": "ISC",
77
"scripts": {
88
"start": "ts-node app.ts",
9-
"gql2ts": "ts-node gql2ts.ts | prettier --parser typescript > src/generated/schema.ts && tsc --noEmit src/generated/schema.ts"
9+
"gql2ts": "ts-node gql2ts.ts | prettier --parser typescript > src/generated/schema.ts"
1010
},
1111
"dependencies": {
1212
"express": "^4.17.1",

package.json

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,22 @@
1111
"Morris Brodersen <mb@morrisbrodersen.de> (http://morrisbrodersen.de)"
1212
],
1313
"license": "ISC",
14-
"main": "src/index.ts",
1514
"module": "src/index.ts",
15+
"main": "dist/index.js",
16+
"types": "dist/index.d.ts",
1617
"files": [
18+
"dist",
1719
"src"
1820
],
1921
"scripts": {
20-
"compile": "tsc --noEmit",
22+
"build": "tsc",
23+
"clean": "rm -rf dist",
2124
"lint": "tslint --project .",
2225
"format": "prettier --single-quote --write */*.ts */**/*.ts *.json",
2326
"test": "nyc mocha test",
24-
"gql2ts": "ts-node example/gql2ts.ts | prettier --parser typescript > example/src/generated/schema.ts && tsc --noEmit example/src/generated/schema.ts",
25-
"example": "ts-node-dev --no-notify example/app.ts"
27+
"gql2ts": "ts-node example/gql2ts.ts | prettier --parser typescript > example/src/generated/schema.ts",
28+
"example": "ts-node-dev --no-notify example/app.ts",
29+
"prepare": "npm run clean && npm run build"
2630
},
2731
"nyc": {
2832
"extension": [

0 commit comments

Comments
 (0)