Skip to content

Commit

Permalink
Improve cjs and esm build (#7)
Browse files Browse the repository at this point in the history
* improve cjs and esm build

* add react 17 as peer dependency and use correct types

* improve tsconfig for build and add tsconfig for tests
  • Loading branch information
lukasvice authored Nov 2, 2022
1 parent c000af2 commit 3b239bb
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 32 deletions.
17 changes: 10 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,20 @@
"name": "@aboutbits/react-ui-integrations",
"version": "1.0.0",
"description": "Webpack and Tailwind integration for ReactUI",
"main": "dist/index.js",
"main": "dist/cjs/index.js",
"module": "dist/esm/index.js",
"types": "dist/cjs/index.d.ts",
"engines": {
"node": "^16",
"npm": "^8"
},
"scripts": {
"build": "npm run build:node && npm run build:esm",
"build:node": "tsc",
"build:esm": "tsc --project tsconfig.esnext.json",
"build": "npm run build:cjs && npm run build:esm",
"build:cjs": "tsc --project tsconfig.build.cjs.json",
"build:esm": "tsc --project tsconfig.build.esm.json",
"lint": "eslint --ext js,ts,tsx src",
"lint:fix": "npm run lint -- --fix",
"typecheck": "tsc --noEmit",
"typecheck": "tsc --project tsconfig.build.esm.json --noEmit",
"test": "jest --verbose --passWithNoTests",
"prepare": "npm run build",
"prepublishOnly": "npm run test && npm run lint",
Expand Down Expand Up @@ -46,14 +48,15 @@
"peerDependencies": {
"@aboutbits/react-ui": "~0.1.0 || ~0.2.0 || ~0.3.0 || ~1.0.0",
"next": "^12",
"react": "^17",
"tailwindcss": "^3.1",
"webpack": "^5"
},
"devDependencies": {
"@types/jest": "^28.1.3",
"@types/lodash.mergewith": "^4.6.7",
"@types/react": "^18.0.14",
"@types/react-dom": "^18.0.5",
"@types/react": "^17.0.0",
"@types/react-dom": "^17.0.0",
"@typescript-eslint/eslint-plugin": "^5.30.0",
"@typescript-eslint/parser": "^5.30.0",
"eslint": "^8.18.0",
Expand Down
13 changes: 13 additions & 0 deletions tsconfig.build.cjs.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"compilerOptions": {
"strict": true,
"target": "ES5",
"esModuleInterop": true,
"moduleResolution": "node",
"outDir": "./dist/cjs",
"declaration": true,
"importHelpers": true
},
"exclude": ["**/__test__/*", "**/__tests__/*"],
"include": ["src"]
}
14 changes: 14 additions & 0 deletions tsconfig.build.esm.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"compilerOptions": {
"strict": true,
"target": "ES6",
"esModuleInterop": true,
"moduleResolution": "node",
"allowSyntheticDefaultImports": true,
"outDir": "./dist/esm",
"declaration": true,
"importHelpers": true
},
"exclude": ["**/__test__/*", "**/__tests__/*"],
"include": ["src"]
}
15 changes: 0 additions & 15 deletions tsconfig.esnext.json

This file was deleted.

12 changes: 2 additions & 10 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,5 @@
{
"compilerOptions": {
"target": "es5",
"esModuleInterop": true,
"outDir": "./dist",
"declaration": true,
"strict": true,
"sourceMap": true,
"skipLibCheck": true
},
"include": ["src"],
"exclude": ["node_modules", "**/__test__/*", "**/__tests__/*"]
"esModuleInterop": true
}
}

0 comments on commit 3b239bb

Please sign in to comment.