From 33acfe035d22d3fc8f344d13ce3d5149b752956c Mon Sep 17 00:00:00 2001 From: Maciej Barelkowski Date: Mon, 17 Jan 2022 17:01:25 +0100 Subject: [PATCH] wip: generate type declarations Closes #65 --- package-lock.json | 6 ++++++ package.json | 7 +++++-- tsconfig.json | 29 +++++++++++++++++++++++++++++ 3 files changed, 40 insertions(+), 2 deletions(-) create mode 100644 tsconfig.json diff --git a/package-lock.json b/package-lock.json index 2a33a2ab..d7581c07 100644 --- a/package-lock.json +++ b/package-lock.json @@ -8351,6 +8351,12 @@ "mime-types": "~2.1.24" } }, + "typescript": { + "version": "4.5.4", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.5.4.tgz", + "integrity": "sha512-VgYs2A2QIRuGphtzFV7aQJduJ2gyfTljngLzjpfW9FoYZF6xuw1W0vW9ghCKLfcWrCFxK81CSGRAvS1pn4fIUg==", + "dev": true + }, "ua-parser-js": { "version": "0.7.28", "resolved": "https://registry.npmjs.org/ua-parser-js/-/ua-parser-js-0.7.28.tgz", diff --git a/package.json b/package.json index ef02140f..6372539a 100644 --- a/package.json +++ b/package.json @@ -4,6 +4,7 @@ "description": "Library for creating bpmn-io properties panels.", "main": "dist/index.js", "module": "dist/index.esm.js", + "types": "dist/types/index.d.ts", "files": [ "dist", "assets", @@ -11,13 +12,14 @@ ], "scripts": { "all": "run-s lint build test", - "build": "del-cli preact dist && rollup -c", + "build": "del-cli preact dist && rollup -c && npm run generate-types", "build:watch": "rollup -c --watch", "lint": "eslint .", "dev": "npm test -- --auto-watch --no-single-run", "test": "karma start karma.config.js", "prepublishOnly": "run-s build", - "prepare": "run-s build" + "prepare": "run-s build", + "generate-types": "tsc" }, "repository": { "type": "git", @@ -82,6 +84,7 @@ "sinon": "^11.1.1", "sinon-chai": "^3.7.0", "sirv-cli": "^1.0.12", + "typescript": "^4.5.4", "webpack": "^5.38.1" } } diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 00000000..380eefb8 --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,29 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es2019", + "dom" + ], + "target": "es2019", + "allowJs": true, + "checkJs": true, + "rootDir": ".", + "strict": false, + "skipLibCheck": true, + "esModuleInterop": true, + "resolveJsonModule": true, + "jsx": "react-jsx", + "jsxImportSource": "preact", + "outDir": "./dist/types", + "declaration": true, + "emitDeclarationOnly": true, + "removeComments": false + }, + "include": [ + "src/index.js" + ], + "exclude": [ + "node_modules" + ] +}