From f38b649632ac8cc4fd43128a0d3cbd9462c4c5ea Mon Sep 17 00:00:00 2001 From: TheoryOfNekomata Date: Fri, 24 Jul 2020 22:26:08 +0800 Subject: [PATCH] Update build config Export declaration files from TypeScript. --- .npmignore | 11 +++++++---- package.json | 9 ++++++--- rollup.config.js | 16 +--------------- tsconfig.json | 4 +++- 4 files changed, 17 insertions(+), 23 deletions(-) diff --git a/.npmignore b/.npmignore index 035c435..b0d6fdf 100644 --- a/.npmignore +++ b/.npmignore @@ -1,14 +1,17 @@ -.storybook/ coverage/ -docs/ lib/ plop/ utilities/ -.babelrc .env .env.example -lib/index.stories.ts +.editorconfig +.prettierrc +doczrc.js +global.d.ts jest.config.js jest.setup.ts plopfile.js rollup.config.js +tsconfig.json +yarn.lock +**/*.test.d.ts diff --git a/package.json b/package.json index 6089d9e..7bead8a 100644 --- a/package.json +++ b/package.json @@ -2,8 +2,10 @@ "name": "@tesseract-design/react-common", "version": "0.0.0", "description": "Common front-end components for Web using the Tesseract design system, written in React.", - "main": "dist/bundle.cjs.js", - "module": "dist/bundle.esm.js", + "directories": { + "lib": "dist" + }, + "main": "dist/index.js", "repository": "https://code.modal.sh/tesseract-design/react-common.git", "author": "TheoryOfNekomata ", "license": "UNLICENSED", @@ -50,5 +52,6 @@ "react-dom": "16.13.1", "react-feather": "2.0.3", "styled-components": "5.1.0" - } + }, + "homepage": "https://make.modal.sh/tesseract/web/react/common" } diff --git a/rollup.config.js b/rollup.config.js index 7ade092..c8c1f16 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -10,7 +10,7 @@ export default [ { input: ENTRY_POINT, output: { - file: pkg.main, + dir: pkg.directories.lib, format: 'cjs', }, plugins: [ @@ -21,18 +21,4 @@ export default [ process.env.NODE_ENV === 'production' && terser(), ], }, - { - input: ENTRY_POINT, - output: { - file: pkg.module, - format: 'esm', - }, - plugins: [ - peerDepsExternal({ - includeDependencies: true, - }), - typescript(), - process.env.NODE_ENV === 'production' && terser(), - ], - }, ] diff --git a/tsconfig.json b/tsconfig.json index 62eadd7..8cbe6a1 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -17,7 +17,9 @@ "resolveJsonModule": true, "isolatedModules": true, "noEmit": true, - "jsx": "react" + "jsx": "react", + "declaration": true, + "declarationDir": "./dist" }, "exclude": [ "node_modules"