Remove unneeded dependencies
parent
50d9e900f2
commit
a401180d4a
|
@ -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"
|
||||
},
|
||||
|
|
|
@ -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),
|
||||
};
|
Loading…
Reference in New Issue