Skip to content

Commit

Permalink
feat: Update build configuration to use @rollup/plugin-typescript
Browse files Browse the repository at this point in the history
  • Loading branch information
lihqi committed Feb 8, 2025
1 parent d1c3612 commit e0c45b9
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 19 deletions.
6 changes: 2 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
{
"name": "show-key-press",
"version": "1.0.3",
"version": "1.0.4",
"description": "A lightweight key press display tool that shows user keyboard inputs on screen in real-time. Perfect keyboard mapping support for both Mac and Windows systems.",
"main": "./es/index.js",
"files": [
"es"
],
"scripts": {
"postinstall": "node node_modules/esbuild/install.js",
"dev": "pnpm run build && cross-env NODE_ENV=developemnt rollup -m -c rollup.config.js -w",
"start": "pnpm run dev",
"build": "rm -fr dist && cross-env NODE_ENV=production rollup -c rollup.config.js "
Expand Down Expand Up @@ -37,20 +36,19 @@
"@rollup/plugin-eslint": "^8.0.1",
"@rollup/plugin-node-resolve": "^11.2.1",
"@rollup/plugin-terser": "^0.4.4",
"@rollup/plugin-typescript": "^12.1.2",
"@types/node": "^22.10.8",
"@typescript-eslint/eslint-plugin": "^4.15.1",
"@typescript-eslint/parser": "^4.15.1",
"autoprefixer": "^10.4.20",
"cross-env": "^7.0.3",
"esbuild": "^0.11.0",
"eslint": "7.20.0",
"eslint-config-airbnb": "18.2.1",
"eslint-config-alloy": "4.2.0",
"eslint-plugin-import": "2.22.1",
"postcss": "^8.5.1",
"prettier": "^2.3.2",
"rollup": "^2.43.1",
"rollup-plugin-esbuild": "^3.0.2",
"typescript": "^4.2.3"
}
}
16 changes: 4 additions & 12 deletions rollup.config.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import esbuild from "rollup-plugin-esbuild";
import terser from "@rollup/plugin-terser";
import typescript from '@rollup/plugin-typescript';

const ES_OUTPUT_DIR = "es";
const isProd = process.env.NODE_ENV === "production";

export default {
input: "src/index.ts",
Expand All @@ -15,16 +14,9 @@ export default {
},
],
plugins: [
esbuild({
include: /\.[jt]s?$/, // default, inferred from `loaders` option
exclude: /node_modules/, // default
minify: isProd,
target: "es2015", // default, or 'es20XX', 'esnext'
define: {
__VERSION__: '"x.y.z"',
},
tsconfig: "tsconfig.json", // default
typescript({
tsconfig: "tsconfig.json",
}),
terser(),
],
};
};
1 change: 0 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,6 @@ class ShowKeyPress {
if (!this.container) {
this.container = document.createElement("div");
this.container.setAttribute("data-keys", "");
console.log(this.options.el)
const parent = this.options.el || document.body;
parent.appendChild(this.container);
}
Expand Down
3 changes: 1 addition & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"compilerOptions": {
"baseUrl": ".",
"outDir": "./dist",
"outDir": "./es",
"sourceMap": false,
"target": "esnext",
"module": "esnext",
Expand All @@ -16,7 +16,6 @@
"jsx": "react",
"declaration": true,
"declarationMap": false,
"declarationDir": "./dist/types",
"skipLibCheck": true,
"lib": ["esnext", "dom"],
"types": ["node"],
Expand Down

0 comments on commit e0c45b9

Please sign in to comment.