From a5a4c9bf748fc29659837023100bdb5c266f3c52 Mon Sep 17 00:00:00 2001 From: torki Date: Sat, 26 Dec 2020 15:02:03 +0330 Subject: [PATCH] feat: Upgraded rollup and packages version --- .gitignore | 4 +--- package.json | 43 +++++++++++++++++++++++-------------------- rollup.config.js | 27 ++++++++++++++++++++++++--- 3 files changed, 48 insertions(+), 26 deletions(-) diff --git a/.gitignore b/.gitignore index 5073c066..68944e48 100644 --- a/.gitignore +++ b/.gitignore @@ -8,10 +8,8 @@ npm-debug.log* node_modules jspm_packages -package-lock.json - dist coverage -.idea \ No newline at end of file +.idea diff --git a/package.json b/package.json index 7d62e359..b79a2e55 100755 --- a/package.json +++ b/package.json @@ -45,40 +45,43 @@ }, "homepage": "https://github.com/ali-master/persian-tools#readme", "devDependencies": { - "@rollup/plugin-commonjs": "^15.1.0", - "@rollup/plugin-node-resolve": "^9.0.0", - "@types/jest": "^26.0.14", - "@typescript-eslint/eslint-plugin": "^4.2.0", - "@typescript-eslint/parser": "^4.2.0", - "eslint": "^7.10.0", - "eslint-config-standard": "^14.1.1", + "@rollup/plugin-commonjs": "^17.0.0", + "@rollup/plugin-node-resolve": "^11.0.1", + "@types/jest": "^26.0.19", + "@typescript-eslint/eslint-plugin": "^4.11.0", + "@typescript-eslint/parser": "^4.11.0", + "eslint": "^7.16.0", + "eslint-config-standard": "^16.0.2", "eslint-friendly-formatter": "^4.0.1", - "eslint-plugin-import": "^2.22.0", + "eslint-plugin-import": "^2.22.1", "eslint-plugin-node": "^11.1.0", - "eslint-plugin-prettier": "^3.1.4", + "eslint-plugin-prettier": "^3.3.0", "eslint-plugin-promise": "^4.2.1", "eslint-plugin-security": "^1.4.0", - "eslint-plugin-standard": "^4.0.1", - "jest": "^26.4.2", - "jest-cli": "^26.4.2", - "prettier": "^2.1.2", - "prettier-eslint": "^11.0.0", + "eslint-plugin-standard": "^4.1.0", + "jest": "^26.6.3", + "jest-cli": "^26.6.3", + "prettier": "^2.2.1", + "prettier-eslint": "^12.0.0", "rimraf": "^3.0.2", - "rollup": "^2.28.2", + "rollup": "^2.35.1", "rollup-plugin-json": "^4.0.0", "rollup-plugin-node-resolve": "^5.2.0", "rollup-plugin-progress": "^1.1.2", + "rollup-plugin-replace": "^2.2.0", + "rollup-plugin-sourcemaps": "^0.6.3", "rollup-plugin-terser": "^7.0.2", - "rollup-plugin-typescript2": "^0.27.3", + "rollup-plugin-typescript2": "^0.29.0", "rollup-plugin-uglify": "^6.0.4", "standard-version": "^9.0.0", - "ts-jest": "^26.4.0", - "ts-node": "^9.0.0", + "ts-jest": "^26.4.4", + "ts-node": "^9.1.1", "typedoc": "^0.19.2", - "typescript": "^4.0.3", + "typescript": "^4.1.3", "uglify-es": "^3.3.9" }, "dependencies": { - "fuse.js": "^6.4.1" + "fastest-levenshtein": "^1.0.12", + "fuse.js": "^6.4.3" } } diff --git a/rollup.config.js b/rollup.config.js index 6ca4022c..a42156fb 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -1,9 +1,11 @@ import fs from "fs"; import path from "path"; import json from "rollup-plugin-json"; +import replace from "rollup-plugin-replace"; import node from "rollup-plugin-node-resolve"; import progress from "rollup-plugin-progress"; import { terser } from "rollup-plugin-terser"; +import sourceMaps from "rollup-plugin-sourcemaps"; import typescript from "rollup-plugin-typescript2"; import resolve from "@rollup/plugin-node-resolve"; import commonjs from "@rollup/plugin-commonjs"; @@ -31,23 +33,42 @@ module.exports = { { file: pkg.module, format: "es", + sourcemap: true, }, { file: pkg.browser, format: "umd", name: "PersianTools", + sourcemap: true, }, ], + watch: { + include: "src/**", + }, plugins: [ typescript({ - typescript: require("typescript"), + useTsconfigDeclarationDir: true, }), json(), - resolve({ browser: true, preferBuiltins: true }), + resolve({ jsnext: true, main: true, browser: true, preferBuiltins: false }), commonjs(), node(), progress(), - terser(), + terser({ + compress: { + unused: false, + collapse_vars: false, + }, + output: { + comments: false, + }, + }), + // Resolve source maps to the original source + sourceMaps(), + replace({ + exclude: "node_modules/**", + ENV: JSON.stringify(process.env.NODE_ENV || "development"), + }), ], external: [...Object.keys(pkg.dependencies || {})], onwarn: (warning) => {