From bf94386cc56a284c5e8408988e322e56d0b3e2f0 Mon Sep 17 00:00:00 2001 From: Matt Triff Date: Sun, 26 Dec 2021 16:37:23 -0500 Subject: [PATCH] Update configuration to output types --- package.json | 2 +- src/index.ts | 7 +++++++ tsconfig.json | 4 ++++ webpack.config.base.js | 2 +- 4 files changed, 13 insertions(+), 2 deletions(-) create mode 100644 src/index.ts diff --git a/package.json b/package.json index f45c18c..2f3f40a 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "version": "9.1.0", "description": "A vanilla JS customisable text input/select box plugin", "main": "./public/assets/scripts/choices.js", - "types": "./types/index.d.ts", + "types": "./public/types/src/index.d.ts", "scripts": { "start": "run-p js:watch css:watch", "build": "run-p js:build css:build", diff --git a/src/index.ts b/src/index.ts new file mode 100644 index 0000000..245c09d --- /dev/null +++ b/src/index.ts @@ -0,0 +1,7 @@ +import Choices from './scripts/choices'; + +export * from './scripts/constants'; +export * from './scripts/defaults'; +export { default as templates } from './scripts/templates'; + +export default Choices; diff --git a/tsconfig.json b/tsconfig.json index fa16413..dbba1f4 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -3,8 +3,12 @@ "baseUrl": "/", "outDir": "./dist/", "allowJs": true, + "declaration": true, + "declarationDir": "./public/types/", + "declarationMap": true, "sourceMap": true, "module": "commonjs", + "moduleResolution": "node", "esModuleInterop": true, "target": "es5", "lib": ["es2017", "dom"], diff --git a/webpack.config.base.js b/webpack.config.base.js index c89dab7..ac35494 100644 --- a/webpack.config.base.js +++ b/webpack.config.base.js @@ -8,7 +8,7 @@ const exclude = /node_modules/; * @type {import('webpack').Configuration} */ module.exports = { - entry: ['./src/scripts/choices'], + entry: ['./src/index'], module: { rules: [ {