Skip to content

Commit

Permalink
feat: convert to TypeScript
Browse files Browse the repository at this point in the history
  • Loading branch information
johnhooks committed Mar 19, 2023
1 parent f221369 commit db80714
Show file tree
Hide file tree
Showing 8 changed files with 128 additions and 412 deletions.
8 changes: 2 additions & 6 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,12 @@
{
"root": true,
"extends": [
"eslint:recommended",
"prettier",
"plugin:@typescript-eslint/recommended"
],
"extends": ["eslint:recommended", "prettier", "plugin:@typescript-eslint/recommended"],
"plugins": ["prettier"],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 2020,
"sourceType": "module",
"project": [ "./tsconfig.json" ]
"project": ["./tsconfig.json", "./tsconfig.eslint.json"]
},
"env": {
"es6": true,
Expand Down
129 changes: 0 additions & 129 deletions es/index.d.ts

This file was deleted.

74 changes: 74 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"src"
],
"scripts": {
"build:es": "babel src/index.ts --out-dir es",
"build:es": "babel src/ --extensions \".js,.ts,\" --out-dir es",
"build:umd": "rollup -c",
"build:types": "tsc -b",
"build": "npm run build:es && npm run build:umd",
Expand All @@ -42,6 +42,7 @@
"@babel/preset-typescript": "^7.21.0",
"@babel/register": "^7.18.9",
"@rollup/plugin-babel": "^6.0.3",
"@rollup/plugin-node-resolve": "^15.0.1",
"@rollup/plugin-terser": "^0.4.0",
"@typescript-eslint/eslint-plugin": "^5.53.0",
"@typescript-eslint/parser": "^5.53.0",
Expand Down
15 changes: 13 additions & 2 deletions rollup.config.mjs
Original file line number Diff line number Diff line change
@@ -1,32 +1,43 @@
import babel from '@rollup/plugin-babel';
import terser from '@rollup/plugin-terser';
import { nodeResolve } from '@rollup/plugin-node-resolve';

export default [
{
input: 'src/index.js',
input: 'src/index.ts',
output: {
format: 'umd',
name: 'hpq',
file: 'dist/hpq.js',
},
plugins: [
nodeResolve({
extensions: ['.js', '.ts'],
}),
babel({
extensions: ['.js', '.ts'],
babelHelpers: 'bundled',
exclude: 'node_modules/**',
presets: ['@babel/preset-typescript'],
}),
],
},
{
input: 'src/index.js',
input: 'src/index.ts',
output: {
format: 'umd',
name: 'hpq',
file: 'dist/hpq.min.js',
},
plugins: [
nodeResolve({
extensions: ['.js', '.ts'],
}),
babel({
extensions: ['.js', '.ts'],
babelHelpers: 'bundled',
exclude: 'node_modules/**',
presets: ['@babel/preset-typescript'],
}),
terser(),
],
Expand Down
Loading

0 comments on commit db80714

Please sign in to comment.