Skip to content

Commit

Permalink
Generate typescript types on build.
Browse files Browse the repository at this point in the history
  • Loading branch information
novagen committed Nov 16, 2021
1 parent f37470d commit 53d96d5
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 4 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ yarn.lock
/dist
/lib
/es
/types
/*.tgz

# Editor specifics
Expand Down
11 changes: 7 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"version": "2.3.1-alpha.0",
"description": "Resgate client implementing the RES-Client Protocol.",
"main": "lib/index.js",
"types": "types/index.d.ts",
"module": "es/index.js",
"jsnext:main": "es/index.js",
"files": [
Expand All @@ -11,8 +12,8 @@
"es"
],
"scripts": {
"clean": "rimraf lib dist es coverage",
"build": "npm run clean && npm run build:commonjs && npm run build:es && npm run build:umd && npm run build:umd:min && npm run build:docs",
"clean": "rimraf lib dist es coverage types",
"build": "npm run clean && npm run types && npm run build:commonjs && npm run build:es && npm run build:umd && npm run build:umd:min && npm run build:docs",
"build:commonjs": "cross-env BABEL_ENV=commonjs babel src --out-dir lib",
"build:es": "cross-env BABEL_ENV=es babel src --out-dir es",
"build:umd": "cross-env BABEL_ENV=es NODE_ENV=development node_modules/.bin/rollup src/index.js --config --sourcemap --file dist/resclient.js",
Expand All @@ -21,7 +22,8 @@
"eslint": "eslint src/**/*.js",
"jest": "jest src --coverage",
"test": "npm run eslint && npm run jest",
"coveralls": "jest --coverage --coverageReporters=text-lcov | coveralls"
"coveralls": "jest --coverage --coverageReporters=text-lcov | coveralls",
"types": "npx -p typescript tsc src/index.js --declaration --allowJs --emitDeclarationOnly --outDir types"
},
"repository": {
"type": "git",
Expand Down Expand Up @@ -49,7 +51,8 @@
"mock-socket": "^7.1.0",
"rimraf": "^3.0.2",
"rollup": "^2.33.1",
"rollup-plugin-terser": "^6.1.0"
"rollup-plugin-terser": "^6.1.0",
"typescript": "^4.4.4"
},
"dependencies": {
"modapp-eventbus": "^1.7.0",
Expand Down
15 changes: 15 additions & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"compilerOptions": {
"allowJs": true,
"declaration": true,
"emitDeclarationOnly": true,
"outDir": "dist"
},
"include": [
"src/**/*"
],
"exclude": [
"node_modules",
"**/*.test.js"
]
}

0 comments on commit 53d96d5

Please sign in to comment.