Skip to content

Commit

Permalink
terser for browser builds
Browse files Browse the repository at this point in the history
  • Loading branch information
keichan34 committed Oct 4, 2024
1 parent 306c418 commit 30cfb93
Show file tree
Hide file tree
Showing 5 changed files with 155 additions and 33 deletions.
2 changes: 0 additions & 2 deletions .eslintignore

This file was deleted.

58 changes: 31 additions & 27 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -1,38 +1,42 @@
import tsdoc from "eslint-plugin-tsdoc";
import tsParser from "@typescript-eslint/parser";
import path from "node:path";
import { fileURLToPath } from "node:url";
import js from "@eslint/js";
import { FlatCompat } from "@eslint/eslintrc";
import tsdoc from 'eslint-plugin-tsdoc'
import tsParser from '@typescript-eslint/parser'
import path from 'node:path'
import { fileURLToPath } from 'node:url'
import js from '@eslint/js'
import { FlatCompat } from '@eslint/eslintrc'

const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const __filename = fileURLToPath(import.meta.url)
const __dirname = path.dirname(__filename)
const compat = new FlatCompat({
baseDirectory: __dirname,
recommendedConfig: js.configs.recommended,
allConfig: js.configs.all
});
baseDirectory: __dirname,
recommendedConfig: js.configs.recommended,
allConfig: js.configs.all,
})

export default [{
ignores: ["node_modules/", "dist"],
}, ...compat.extends(
"plugin:@typescript-eslint/recommended",
"plugin:prettier/recommended",
), {
export default [
{
ignores: ['node_modules/', 'dist'],
},
...compat.extends(
'plugin:@typescript-eslint/recommended',
'plugin:prettier/recommended',
),
{
plugins: {
tsdoc,
tsdoc,
},

languageOptions: {
parser: tsParser,
ecmaVersion: 2020,
sourceType: "module",
parser: tsParser,
ecmaVersion: 2020,
sourceType: 'module',
},

rules: {
"@typescript-eslint/explicit-module-boundary-types": 0,
"@typescript-eslint/ban-ts-comment": 0,
"@typescript-eslint/no-var-requires": 0,
"tsdoc/syntax": "error",
'@typescript-eslint/explicit-module-boundary-types': 0,
'@typescript-eslint/ban-ts-comment': 0,
'@typescript-eslint/no-var-requires': 0,
'tsdoc/syntax': 'error',
},
}];
},
]
120 changes: 120 additions & 0 deletions package-lock.json

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

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
"devDependencies": {
"@rollup/plugin-commonjs": "^28.0.0",
"@rollup/plugin-node-resolve": "^15.3.0",
"@rollup/plugin-terser": "^0.4.4",
"@rollup/plugin-typescript": "^12.1.0",
"@types/jest": "^29.5.13",
"@types/node": "^22",
Expand Down
7 changes: 3 additions & 4 deletions rollup.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import typescript from '@rollup/plugin-typescript'
import resolve from '@rollup/plugin-node-resolve'
import commonjs from '@rollup/plugin-commonjs'
import terser from '@rollup/plugin-terser'

export default [
{
Expand All @@ -10,7 +11,7 @@ export default [
name: 'normalize',
format: 'umd',
},
plugins: [typescript(), resolve({ browser: true }), commonjs()],
plugins: [typescript(), resolve({ browser: true }), commonjs(), terser()],
},
{
input: 'src/main-browser.ts',
Expand All @@ -19,7 +20,7 @@ export default [
name: 'normalize',
format: 'esm',
},
plugins: [typescript(), resolve({ browser: true }), commonjs()],
plugins: [typescript(), resolve({ browser: true }), commonjs(), terser()],
},
{
input: 'src/main-node.ts',
Expand All @@ -28,7 +29,6 @@ export default [
'papaparse',
'undici',
'lru-cache',
'unzipper',
'node:fs',
],
output: {
Expand All @@ -44,7 +44,6 @@ export default [
'papaparse',
'undici',
'lru-cache',
'unzipper',
'node:fs',
],
output: {
Expand Down

0 comments on commit 30cfb93

Please sign in to comment.