Skip to content

Commit 37032b2

Browse files
committed
TypeScript setup
1 parent 268797b commit 37032b2

File tree

7 files changed

+219
-7
lines changed

7 files changed

+219
-7
lines changed

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,9 @@
22
/test/data/babylon
33
/test/data/babel-parser
44
/test/data/graphql-tools-src
5+
6+
# Ignore TypeScript-emitted files
7+
*.js
8+
*.d.ts
9+
# Except...
10+
!/types/**/*.d.ts

.npmignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
11
/node_modules
22
/test
3+
/types
34
yarn.lock
5+
6+
*.ts
7+
!*.d.ts

package-lock.json

Lines changed: 161 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,22 @@
2020
},
2121
"license": "MIT",
2222
"main": "main.js",
23+
"types": "main.d.ts",
2324
"scripts": {
24-
"test": "test/run.sh",
25-
"debug": "test/run.sh --inspect-brk"
25+
"tsc": "tsc --noEmit",
26+
"mocha": "test/run.sh",
27+
"debug": "test/run.sh --inspect-brk",
28+
"test": "npm run tsc && npm run mocha",
29+
"build": "tsc && ts-add-module-exports",
30+
"clean": "ts-emit-clean",
31+
"prepack": "npm run clean && npm run build",
32+
"postpack": "npm run clean"
2633
},
2734
"browser": {
2835
"fs": false
2936
},
3037
"dependencies": {
31-
"ast-types": "0.11.7",
38+
"ast-types": "0.12.0",
3239
"esprima": "~4.0.0",
3340
"private": "~0.1.5",
3441
"source-map": "~0.6.1"
@@ -37,11 +44,19 @@
3744
"@babel/core": "^7.0.0-beta.54",
3845
"@babel/parser": "^7.0.0-beta.54",
3946
"@babel/preset-env": "^7.0.0-beta.54",
47+
"@types/esprima": "^4.0.2",
48+
"@types/glob": "^7.1.1",
49+
"@types/mocha": "^5.2.5",
50+
"@types/node": "^10.12.9",
4051
"esprima-fb": "^15001.1001.0-dev-harmony-fb",
4152
"flow-parser": "^0.83.0",
4253
"glob": "^7.1.2",
4354
"mocha": "~5.2.0",
44-
"reify": "^0.18.0"
55+
"reify": "^0.18.0",
56+
"ts-add-module-exports": "^1.0.0",
57+
"ts-emit-clean": "^1.0.0",
58+
"ts-node": "^7.0.1",
59+
"typescript": "^3.1.6"
4560
},
4661
"engines": {
4762
"node": ">= 4"

tsconfig.json

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"compilerOptions": {
3+
"target": "es5",
4+
"lib": ["es2015"],
5+
"module": "commonjs",
6+
"declaration": true,
7+
"rootDir": ".",
8+
"strict": true,
9+
"noUnusedLocals": true,
10+
"noUnusedParameters": true,
11+
"noImplicitReturns": true,
12+
"moduleResolution": "node",
13+
"esModuleInterop": true,
14+
"stripInternal": true
15+
},
16+
"exclude": [
17+
"node_modules",
18+
"test/data"
19+
]
20+
}

types/esprima.d.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import * as ESTree from "estree";
2+
3+
/**
4+
* "esprima" module augmentations.
5+
*/
6+
declare module "esprima" {
7+
export function parse(input: string, config?: ParseOptions, delegate?: (node: ESTree.Node, meta: any) => void): Program;
8+
}

types/modules.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
declare module "private";

0 commit comments

Comments
 (0)