From 91a60fe4a70957f171b348a69928fd70c5d7c954 Mon Sep 17 00:00:00 2001 From: "Daniel A.C. Martin" Date: Fri, 30 Aug 2024 19:20:21 +0100 Subject: [PATCH] chore: replace esbuild with tsc --- package.json | 15 +++++++-------- tsconfig.build.json | 14 ++++++++++++++ tsconfig.cjs.json | 9 +++++++++ tsconfig.esm.json | 9 +++++++++ 4 files changed, 39 insertions(+), 8 deletions(-) create mode 100644 tsconfig.build.json create mode 100644 tsconfig.cjs.json create mode 100644 tsconfig.esm.json diff --git a/package.json b/package.json index abdeb947..f913c61a 100644 --- a/package.json +++ b/package.json @@ -3,9 +3,9 @@ "version": "2.0.4", "description": "Thread-safe Helmet for React 16+ and friends", "sideEffects": false, - "main": "./lib/index.js", - "module": "./lib/index.esm.js", - "typings": "./lib/index.d.ts", + "main": "./lib/cjs/index.js", + "module": "./lib/esm/index.js", + "typings": "./lib/esm/index.d.ts", "repository": "http://github.com/staylor/react-helmet-async", "author": "Scott Taylor ", "license": "Apache-2.0", @@ -29,7 +29,6 @@ "@types/react": "18.2.39", "@types/shallowequal": "1.1.5", "@vitejs/plugin-react": "4.2.0", - "esbuild": "0.19.8", "eslint": "8.54.0", "eslint-config-prettier": "9.0.0", "eslint-plugin-prettier": "5.0.1", @@ -40,7 +39,6 @@ "react": "18.2.0", "react-dom": "18.2.0", "rimraf": "5.0.5", - "tsx": "4.6.1", "typescript": "5.2.2", "vite": "4.5.0", "vitest": "0.34.6" @@ -55,8 +53,9 @@ "test": "vitest run", "test-watch": "yarn test --watch", "test-update": "yarn test -u", - "compile": "yarn run clean && NODE_ENV=production tsx build.ts && yarn types", - "prepare": "yarn compile && husky install", - "types": "tsc src/index.tsx --jsx react --declaration --esModuleInterop --allowJs --emitDeclarationOnly --outDir lib" + "compile": "yarn run clean && yarn run compile:cjs && yarn run compile:esm", + "compile:cjs": "tsc -p ./tsconfig.cjs.json", + "compile:esm": "tsc -p ./tsconfig.esm.json", + "prepare": "yarn compile && husky install" } } diff --git a/tsconfig.build.json b/tsconfig.build.json new file mode 100644 index 00000000..683a3943 --- /dev/null +++ b/tsconfig.build.json @@ -0,0 +1,14 @@ +{ + "extends": "./tsconfig.json", + "exclude": [ + "__tests__", + "lib", + "node_modules" + ], + "include": ["src"], + "compilerOptions": { + "declaration": true, + "noEmit": false, + "rootDir": "src" + } +} diff --git a/tsconfig.cjs.json b/tsconfig.cjs.json new file mode 100644 index 00000000..285ea583 --- /dev/null +++ b/tsconfig.cjs.json @@ -0,0 +1,9 @@ +{ + "extends": "./tsconfig.build.json", + "compilerOptions": { + "module": "CommonJS", + "moduleResolution": "node", + "target": "ESNext", + "outDir": "lib/cjs" + } +} diff --git a/tsconfig.esm.json b/tsconfig.esm.json new file mode 100644 index 00000000..e6b35ce9 --- /dev/null +++ b/tsconfig.esm.json @@ -0,0 +1,9 @@ +{ + "extends": "./tsconfig.build.json", + "compilerOptions": { + "module": "ES6", + "moduleResolution": "node", + "target": "ESNext", + "outDir": "lib/esm" + } +}