Simplify Rollup config
- replace rollup-plugin-license with Rollup's own output.banner - use path.join to join pathspull/30/head
parent
47ece2215d
commit
fbec8b0cff
|
@ -61,7 +61,6 @@
|
|||
"postcss-css-variables": "^0.17.0",
|
||||
"postcss-mixins": "^6.2.3",
|
||||
"rollup": "^2.23.0",
|
||||
"rollup-plugin-license": "^2.1.0",
|
||||
"rollup-plugin-terser": "^6.1.0",
|
||||
"size-limit": "^4.5.5"
|
||||
},
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import { join } from 'path';
|
||||
|
||||
import buble from '@rollup/plugin-buble';
|
||||
import consts from '@nickkaramoff/rollup-plugin-consts';
|
||||
import license from 'rollup-plugin-license';
|
||||
import strip from '@rollup/plugin-strip';
|
||||
import { terser } from 'rollup-plugin-terser';
|
||||
|
||||
|
@ -10,9 +11,9 @@ const isDev = process.env.ROLLUP_WATCH || process.env.NODE_ENV === 'development'
|
|||
|
||||
const pkg = require('./package.json');
|
||||
|
||||
const outputDir = isDev ? './dev/' : './dist/';
|
||||
const outputDir = join(__dirname, 'dist');
|
||||
|
||||
const bannerText = `${pkg.name} v${pkg.version} by Nikita Karamov\n${pkg.homepage}`;
|
||||
const banner = `/*! ${pkg.name} v${pkg.version} */`;
|
||||
|
||||
const plugins = [
|
||||
consts({
|
||||
|
@ -24,13 +25,11 @@ const plugins = [
|
|||
functions: ['console.log', 'console.debug', 'assert.*'],
|
||||
sourceMap: false,
|
||||
}),
|
||||
(!isDev) && license({
|
||||
banner: {
|
||||
commentStyle: 'ignored',
|
||||
content: bannerText,
|
||||
(!isDev) && buble({
|
||||
transforms: {
|
||||
modules: false,
|
||||
},
|
||||
}),
|
||||
(!isDev) && buble({ transforms: { modules: false } }),
|
||||
];
|
||||
|
||||
const getOutput = (baseDir) => {
|
||||
|
@ -43,33 +42,34 @@ const getOutput = (baseDir) => {
|
|||
{
|
||||
...defaultParameters,
|
||||
format: 'iife',
|
||||
file: `${baseDir}${pkg.name}${isDev ? '' : '.min'}.js`,
|
||||
plugins: isDev ? [] : [terser({ output: { comments: false } })],
|
||||
file: join(baseDir, `${pkg.name}${isDev ? '' : '.min'}.js`),
|
||||
plugins: isDev ? [] : [terser({ output: { comments: /^!/ } })],
|
||||
banner,
|
||||
},
|
||||
(!isDev) && {
|
||||
...defaultParameters,
|
||||
format: 'cjs',
|
||||
file: `${baseDir}${pkg.name}.cjs`,
|
||||
file: join(baseDir, `${pkg.name}.cjs`),
|
||||
banner,
|
||||
},
|
||||
(!isDev) && {
|
||||
...defaultParameters,
|
||||
format: 'esm',
|
||||
file: `${baseDir}${pkg.name}.mjs`,
|
||||
file: join(baseDir, `${pkg.name}.mjs`),
|
||||
banner,
|
||||
},
|
||||
];
|
||||
};
|
||||
|
||||
const config = [
|
||||
export default [
|
||||
{
|
||||
input: './src/autoinit.js',
|
||||
output: getOutput(`${outputDir}`),
|
||||
input: join(__dirname, 'src', 'autoinit.js'),
|
||||
output: getOutput(outputDir),
|
||||
plugins,
|
||||
},
|
||||
{
|
||||
input: './src/shareon.js',
|
||||
output: getOutput(`${outputDir}noinit/`),
|
||||
input: join(__dirname, 'src', 'autoinit.js'),
|
||||
output: getOutput(join(outputDir, 'noinit')),
|
||||
plugins,
|
||||
},
|
||||
];
|
||||
|
||||
export default config;
|
||||
|
|
82
yarn.lock
82
yarn.lock
|
@ -654,11 +654,6 @@ array-each@^1.0.0, array-each@^1.0.1:
|
|||
resolved "https://registry.npmjs.org/array-each/-/array-each-1.0.1.tgz#a794af0c05ab1752846ee753a1f211a05ba0c44f"
|
||||
integrity sha1-p5SvDAWrF1KEbudTofIRoFugxE8=
|
||||
|
||||
array-find-index@^1.0.2:
|
||||
version "1.0.2"
|
||||
resolved "https://registry.npmjs.org/array-find-index/-/array-find-index-1.0.2.tgz#df010aa1287e164bbda6f9723b0a96a1ec4187a1"
|
||||
integrity sha1-3wEKoSh+Fku9pvlyOwqWoexBh6E=
|
||||
|
||||
array-flatten@1.1.1:
|
||||
version "1.1.1"
|
||||
resolved "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz#9a5f699051b1e7073328f2a008968b64ea2955d2"
|
||||
|
@ -1564,11 +1559,6 @@ commander@^2.18.0, commander@^2.20.0:
|
|||
resolved "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz#fd485e84c03eb4881c20722ba48035e8531aeb33"
|
||||
integrity sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==
|
||||
|
||||
commenting@1.1.0:
|
||||
version "1.1.0"
|
||||
resolved "https://registry.npmjs.org/commenting/-/commenting-1.1.0.tgz#fae14345c6437b8554f30bc6aa6c1e1633033590"
|
||||
integrity sha512-YeNK4tavZwtH7jEgK1ZINXzLKm6DZdEMfsaaieOsCAN0S8vsY7UeuO3Q7d/M018EFgE+IeUAuBOKkFccBZsUZA==
|
||||
|
||||
commondir@^1.0.1:
|
||||
version "1.0.1"
|
||||
resolved "https://registry.npmjs.org/commondir/-/commondir-1.0.1.tgz#ddd800da0c66127393cca5950ea968a3aaf1253b"
|
||||
|
@ -3126,7 +3116,7 @@ glob-watcher@^5.0.3:
|
|||
normalize-path "^3.0.0"
|
||||
object.defaults "^1.1.0"
|
||||
|
||||
glob@7.1.6, glob@^7.0.3, glob@^7.1.1, glob@^7.1.2, glob@^7.1.3, glob@^7.1.4:
|
||||
glob@^7.0.3, glob@^7.1.1, glob@^7.1.2, glob@^7.1.3, glob@^7.1.4:
|
||||
version "7.1.6"
|
||||
resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.6.tgz#141f33b81a7c2492e125594307480c46679278a6"
|
||||
integrity sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==
|
||||
|
@ -4433,11 +4423,6 @@ lodash.zip@^4.2.0:
|
|||
resolved "https://registry.npmjs.org/lodash.zip/-/lodash.zip-4.2.0.tgz#ec6662e4896408ed4ab6c542a3990b72cc080020"
|
||||
integrity sha1-7GZi5IlkCO1KtsVCo5kLcswIACA=
|
||||
|
||||
lodash@4.17.19:
|
||||
version "4.17.19"
|
||||
resolved "https://registry.npmjs.org/lodash/-/lodash-4.17.19.tgz#e48ddedbe30b3321783c5b4301fbd353bc1e4a4b"
|
||||
integrity sha512-JNvd8XER9GQX0v2qJgsaN/mzFCNA5BRe/j8JN9d+tWyGLSodKQHKFicdwNYzWwI3wjRnaKPsGj1XkBjx/F96DQ==
|
||||
|
||||
lodash@^4.17.12, lodash@^4.17.19, lodash@^4.17.20, lodash@^4.17.5:
|
||||
version "4.17.20"
|
||||
resolved "https://registry.npmjs.org/lodash/-/lodash-4.17.20.tgz#b44a9b6297bcb698f1c51a3545a2b3b368d59c52"
|
||||
|
@ -4497,7 +4482,7 @@ lru-cache@^6.0.0:
|
|||
dependencies:
|
||||
yallist "^4.0.0"
|
||||
|
||||
magic-string@0.25.7, magic-string@^0.25.0, magic-string@^0.25.5, magic-string@^0.25.7:
|
||||
magic-string@^0.25.0, magic-string@^0.25.5, magic-string@^0.25.7:
|
||||
version "0.25.7"
|
||||
resolved "https://registry.npmjs.org/magic-string/-/magic-string-0.25.7.tgz#3f497d6fd34c669c6798dcb821f2ef31f5445051"
|
||||
integrity sha512-4CrMT5DOHTDk4HYDlzmwu4FVCcIYI8gauveasrdCu2IKIFOJ3f0v/8MDGJCDL9oD2ppz/Av1b0Nj345H9M+XIA==
|
||||
|
@ -4783,11 +4768,6 @@ mixin-deep@^1.2.0:
|
|||
for-in "^1.0.2"
|
||||
is-extendable "^1.0.1"
|
||||
|
||||
mkdirp@1.0.4, mkdirp@^1.0.4:
|
||||
version "1.0.4"
|
||||
resolved "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz#3eb5ed62622756d79a5f0e2a221dfebad75c2f7e"
|
||||
integrity sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==
|
||||
|
||||
mkdirp@^0.5.1, mkdirp@^0.5.3, mkdirp@~0.5.1:
|
||||
version "0.5.5"
|
||||
resolved "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.5.tgz#d91cefd62d1436ca0f41620e251288d420099def"
|
||||
|
@ -4795,10 +4775,10 @@ mkdirp@^0.5.1, mkdirp@^0.5.3, mkdirp@~0.5.1:
|
|||
dependencies:
|
||||
minimist "^1.2.5"
|
||||
|
||||
moment@2.27.0:
|
||||
version "2.27.0"
|
||||
resolved "https://registry.npmjs.org/moment/-/moment-2.27.0.tgz#8bff4e3e26a236220dfe3e36de756b6ebaa0105d"
|
||||
integrity sha512-al0MUK7cpIcglMv3YF13qSgdAIqxHTO7brRtaz3DlSULbqfazqkc5kEjNrLDOM7fsjshoFIihnU8snrP7zUvhQ==
|
||||
mkdirp@^1.0.4:
|
||||
version "1.0.4"
|
||||
resolved "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz#3eb5ed62622756d79a5f0e2a221dfebad75c2f7e"
|
||||
integrity sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==
|
||||
|
||||
move-concurrently@^1.0.1:
|
||||
version "1.0.1"
|
||||
|
@ -5381,11 +5361,6 @@ package-json@^6.3.0:
|
|||
registry-url "^5.0.0"
|
||||
semver "^6.2.0"
|
||||
|
||||
package-name-regex@1.0.8:
|
||||
version "1.0.8"
|
||||
resolved "https://registry.npmjs.org/package-name-regex/-/package-name-regex-1.0.8.tgz#4b8388cace6cc415f462ab4a269583d9a2d9f131"
|
||||
integrity sha512-g3vB2J62dLqf4m50VM4tJUC4sixw3JB+Igd0cF3P/gJhAvmvsmFEV2eWZTeLbwfkKEWTf3+gwQ2C6JFFRxWHEQ==
|
||||
|
||||
pako@~1.0.5:
|
||||
version "1.0.11"
|
||||
resolved "https://registry.npmjs.org/pako/-/pako-1.0.11.tgz#6c9599d340d54dfd3946380252a35705a6b992bf"
|
||||
|
@ -6544,21 +6519,6 @@ ripemd160@^2.0.0, ripemd160@^2.0.1:
|
|||
hash-base "^3.0.0"
|
||||
inherits "^2.0.1"
|
||||
|
||||
rollup-plugin-license@^2.1.0:
|
||||
version "2.2.0"
|
||||
resolved "https://registry.npmjs.org/rollup-plugin-license/-/rollup-plugin-license-2.2.0.tgz#0d19139bbe44dda500fbf15530af07c91949e348"
|
||||
integrity sha512-xXb1vviEwlJMX+VGUSsglcMA/Rh9d2QzEm94awy4FlnsPqGrXoTYYGOR3UXR6gYIxiJFkr7qmkKF/NXfre/y8g==
|
||||
dependencies:
|
||||
commenting "1.1.0"
|
||||
glob "7.1.6"
|
||||
lodash "4.17.19"
|
||||
magic-string "0.25.7"
|
||||
mkdirp "1.0.4"
|
||||
moment "2.27.0"
|
||||
package-name-regex "1.0.8"
|
||||
spdx-expression-validate "2.0.0"
|
||||
spdx-satisfies "5.0.0"
|
||||
|
||||
rollup-plugin-terser@^6.1.0:
|
||||
version "6.1.0"
|
||||
resolved "https://registry.npmjs.org/rollup-plugin-terser/-/rollup-plugin-terser-6.1.0.tgz#071866585aea104bfbb9dd1019ac523e63c81e45"
|
||||
|
@ -6898,15 +6858,6 @@ sparkles@^1.0.0:
|
|||
resolved "https://registry.npmjs.org/sparkles/-/sparkles-1.0.1.tgz#008db65edce6c50eec0c5e228e1945061dd0437c"
|
||||
integrity sha512-dSO0DDYUahUt/0/pD/Is3VIm5TGJjludZ0HVymmhYF6eNA53PVLhnUk0znSYbH8IYBuJdCE+1luR22jNLMaQdw==
|
||||
|
||||
spdx-compare@^1.0.0:
|
||||
version "1.0.0"
|
||||
resolved "https://registry.npmjs.org/spdx-compare/-/spdx-compare-1.0.0.tgz#2c55f117362078d7409e6d7b08ce70a857cd3ed7"
|
||||
integrity sha512-C1mDZOX0hnu0ep9dfmuoi03+eOdDoz2yvK79RxbcrVEG1NO1Ph35yW102DHWKN4pk80nwCgeMmSY5L25VE4D9A==
|
||||
dependencies:
|
||||
array-find-index "^1.0.2"
|
||||
spdx-expression-parse "^3.0.0"
|
||||
spdx-ranges "^2.0.0"
|
||||
|
||||
spdx-correct@^3.0.0:
|
||||
version "3.1.1"
|
||||
resolved "https://registry.npmjs.org/spdx-correct/-/spdx-correct-3.1.1.tgz#dece81ac9c1e6713e5f7d1b6f17d468fa53d89a9"
|
||||
|
@ -6928,32 +6879,11 @@ spdx-expression-parse@^3.0.0:
|
|||
spdx-exceptions "^2.1.0"
|
||||
spdx-license-ids "^3.0.0"
|
||||
|
||||
spdx-expression-validate@2.0.0:
|
||||
version "2.0.0"
|
||||
resolved "https://registry.npmjs.org/spdx-expression-validate/-/spdx-expression-validate-2.0.0.tgz#25c9408e1c63fad94fff5517bb7101ffcd23350b"
|
||||
integrity sha512-b3wydZLM+Tc6CFvaRDBOF9d76oGIHNCLYFeHbftFXUWjnfZWganmDmvtM5sm1cRwJc/VDBMLyGGrsLFd1vOxbg==
|
||||
dependencies:
|
||||
spdx-expression-parse "^3.0.0"
|
||||
|
||||
spdx-license-ids@^3.0.0:
|
||||
version "3.0.7"
|
||||
resolved "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.7.tgz#e9c18a410e5ed7e12442a549fbd8afa767038d65"
|
||||
integrity sha512-U+MTEOO0AiDzxwFvoa4JVnMV6mZlJKk2sBLt90s7G0Gd0Mlknc7kxEn3nuDPNZRta7O2uy8oLcZLVT+4sqNZHQ==
|
||||
|
||||
spdx-ranges@^2.0.0:
|
||||
version "2.1.1"
|
||||
resolved "https://registry.npmjs.org/spdx-ranges/-/spdx-ranges-2.1.1.tgz#87573927ba51e92b3f4550ab60bfc83dd07bac20"
|
||||
integrity sha512-mcdpQFV7UDAgLpXEE/jOMqvK4LBoO0uTQg0uvXUewmEFhpiZx5yJSZITHB8w1ZahKdhfZqP5GPEOKLyEq5p8XA==
|
||||
|
||||
spdx-satisfies@5.0.0:
|
||||
version "5.0.0"
|
||||
resolved "https://registry.npmjs.org/spdx-satisfies/-/spdx-satisfies-5.0.0.tgz#d740b8f14caeada36fb307629dee87146970a256"
|
||||
integrity sha512-/hGhwh20BeGmkA+P/lm06RvXD94JduwNxtx/oX3B5ClPt1/u/m5MCaDNo1tV3Y9laLkQr/NRde63b9lLMhlNfw==
|
||||
dependencies:
|
||||
spdx-compare "^1.0.0"
|
||||
spdx-expression-parse "^3.0.0"
|
||||
spdx-ranges "^2.0.0"
|
||||
|
||||
split-string@^3.0.1, split-string@^3.0.2:
|
||||
version "3.1.0"
|
||||
resolved "https://registry.npmjs.org/split-string/-/split-string-3.1.0.tgz#7cb09dda3a86585705c64b39a6466038682e8fe2"
|
||||
|
|
Loading…
Reference in New Issue