From a401180d4a2ccdeaf8a04540c141807b1bcfab97 Mon Sep 17 00:00:00 2001 From: Nikita Karamov Date: Thu, 10 Feb 2022 21:47:21 +0100 Subject: [PATCH] Remove unneeded dependencies --- package.json | 7 ---- rollup.config.js | 91 ------------------------------------------------ 2 files changed, 98 deletions(-) delete mode 100644 rollup.config.js diff --git a/package.json b/package.json index 1400cf4..b6855e3 100644 --- a/package.json +++ b/package.json @@ -42,12 +42,8 @@ "postversion": "pnpm run build" }, "devDependencies": { - "@rollup/plugin-buble": "^0.21.3", - "@rollup/plugin-strip": "^2.1.0", "@size-limit/preset-small-lib": "^7.0.5", "autoprefixer": "^10.4.2", - "browserslist": "^4.19.1", - "cross-env": "^7.0.3", "cssnano": "^5.0.16", "eslint": "^8.8.0", "eslint-config-airbnb-base": "^15.0.0", @@ -59,9 +55,6 @@ "postcss-cli": "^9.1.0", "postcss-css-variables": "^0.18.0", "prettier": "^2.5.1", - "rollup": "^2.67.0", - "rollup-plugin-postcss": "^4.0.2", - "rollup-plugin-terser": "^7.0.2", "size-limit": "^7.0.5", "vite": "^2.8.0" }, diff --git a/rollup.config.js b/rollup.config.js deleted file mode 100644 index 07f652c..0000000 --- a/rollup.config.js +++ /dev/null @@ -1,91 +0,0 @@ -import { join, resolve } from "path"; - -import buble from "@rollup/plugin-buble"; -import strip from "@rollup/plugin-strip"; -import postcss from "rollup-plugin-postcss"; -import { terser } from "rollup-plugin-terser"; - -const autoprefixer = require("autoprefixer"); -const banner = require("postcss-banner"); -const calc = require("postcss-calc"); -const cssnano = require("cssnano"); -const cssVariables = require("postcss-css-variables"); - -const pkg = require("./package.json"); - -const isDev = - process.env.ROLLUP_WATCH || process.env.NODE_ENV === "development"; -const outputDir = resolve(".", "dist"); -const bannerText = `${pkg.name} v${pkg.version}`; - -const postcssPlugins = [cssVariables, calc]; - -if (!isDev) { - postcssPlugins.push( - cssnano({ - preset: "default", - }), - autoprefixer(), - banner({ - banner: bannerText, - important: true, - inline: true, - }) - ); -} - -const getPlugins = (css) => [ - css && - postcss({ - extract: resolve(join(outputDir, "shareon.min.css")), - plugins: postcssPlugins, - }), - !isDev && - strip({ - debugger: true, - include: ["**/*.js"], - functions: ["console.log", "console.debug", "assert.*"], - sourceMap: false, - }), - !isDev && - buble({ - transforms: { - modules: false, - }, - }), -]; - -const getOutput = (baseDir) => { - const defaultParameters = { - name: pkg.name, - exports: "default", - }; - - return [ - { - ...defaultParameters, - format: "iife", - file: join(baseDir, `${pkg.name}${isDev ? "" : ".min"}.js`), - plugins: isDev ? [] : [terser({ output: { comments: /^!/ } })], - banner: `/*! ${bannerText} */`, - }, - !isDev && { - ...defaultParameters, - format: "cjs", - file: join(baseDir, `${pkg.name}.cjs`), - banner: `/*! ${bannerText} */`, - }, - !isDev && { - ...defaultParameters, - format: "esm", - file: join(baseDir, `${pkg.name}.mjs`), - banner: `/*! ${bannerText} */`, - }, - ]; -}; - -export default { - input: join(__dirname, "src", "index.js"), - output: getOutput(outputDir), - plugins: getPlugins(true), -};