Add banner

pull/1/head
Nikita Karamov 2020-03-25 19:09:56 +01:00
parent 8574dc0d51
commit c43c7e2170
No known key found for this signature in database
GPG Key ID: E40DFE6E993540FF
4 changed files with 38 additions and 3 deletions

View File

@ -38,6 +38,7 @@
"np": "^6.2.0", "np": "^6.2.0",
"npm-run-all": "^4.1.5", "npm-run-all": "^4.1.5",
"rollup": "^1.32.1", "rollup": "^1.32.1",
"rollup-plugin-banner": "^0.2.1",
"rollup-plugin-postcss": "^2.5.0", "rollup-plugin-postcss": "^2.5.0",
"rollup-plugin-terser": "^5.3.0", "rollup-plugin-terser": "^5.3.0",
"typescript": "^3.8.3" "typescript": "^3.8.3"

View File

@ -1,9 +1,14 @@
import postcssPluginCssnano from 'cssnano'; import postcssPluginCssnano from 'cssnano';
import rollupPluginBanner from 'rollup-plugin-banner';
import rollupPluginPostcss from 'rollup-plugin-postcss'; import rollupPluginPostcss from 'rollup-plugin-postcss';
import rollupPluginStrip from '@rollup/plugin-strip'; import rollupPluginStrip from '@rollup/plugin-strip';
import { terser as rollupPluginTerser } from 'rollup-plugin-terser'; import { terser as rollupPluginTerser } from 'rollup-plugin-terser';
import rollupPluginTypescript from '@rollup/plugin-typescript'; import rollupPluginTypescript from '@rollup/plugin-typescript';
export const banner = () => rollupPluginBanner(
'<%= pkg.name %> v<%= pkg.version %> by Nikita Karamov\nInspired by Likely (https://ilyabirman.net/projects/likely/)'
)
export const postcss = (file, minify) => rollupPluginPostcss({ export const postcss = (file, minify) => rollupPluginPostcss({
extract: file || true, extract: file || true,
plugins: [ plugins: [
@ -15,7 +20,8 @@ export const postcss = (file, minify) => rollupPluginPostcss({
export const strip = () => rollupPluginStrip({ export const strip = () => rollupPluginStrip({
debugger: true, debugger: true,
functions: ['console.log', 'console.debug'], include: ['**/*.js', '**/*.ts'],
functions: ['console.log', 'console.debug', 'assert.*'],
sourceMap: false, sourceMap: false,
}); });

View File

@ -1,4 +1,4 @@
import { postcss, strip, terser, typescript } from './plugins'; import { banner, postcss, strip, terser, typescript } from './plugins';
const input = './src/index.ts'; const input = './src/index.ts';
const name = 'shareon'; const name = 'shareon';
@ -27,7 +27,8 @@ export default {
], ],
plugins: [ plugins: [
typescript(), typescript(),
postcss(`${outputDir}${name}.css`, true),
strip(), strip(),
postcss(`${outputDir}${name}.css`, true),
banner()
], ],
}; };

View File

@ -2436,6 +2436,11 @@ locate-path@^5.0.0:
dependencies: dependencies:
p-locate "^4.1.0" p-locate "^4.1.0"
lodash._reinterpolate@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/lodash._reinterpolate/-/lodash._reinterpolate-3.0.0.tgz#0ccf2d89166af03b3663c796538b75ac6e114d9d"
integrity sha1-DM8tiRZq8Ds2Y8eWU4t1rG4RTZ0=
lodash.camelcase@^4.3.0: lodash.camelcase@^4.3.0:
version "4.3.0" version "4.3.0"
resolved "https://registry.yarnpkg.com/lodash.camelcase/-/lodash.camelcase-4.3.0.tgz#b28aa6288a2b9fc651035c7711f65ab6190331a6" resolved "https://registry.yarnpkg.com/lodash.camelcase/-/lodash.camelcase-4.3.0.tgz#b28aa6288a2b9fc651035c7711f65ab6190331a6"
@ -2446,6 +2451,21 @@ lodash.memoize@^4.1.2:
resolved "https://registry.yarnpkg.com/lodash.memoize/-/lodash.memoize-4.1.2.tgz#bcc6c49a42a2840ed997f323eada5ecd182e0bfe" resolved "https://registry.yarnpkg.com/lodash.memoize/-/lodash.memoize-4.1.2.tgz#bcc6c49a42a2840ed997f323eada5ecd182e0bfe"
integrity sha1-vMbEmkKihA7Zl/Mj6tpezRguC/4= integrity sha1-vMbEmkKihA7Zl/Mj6tpezRguC/4=
lodash.template@^4.4.0:
version "4.5.0"
resolved "https://registry.yarnpkg.com/lodash.template/-/lodash.template-4.5.0.tgz#f976195cf3f347d0d5f52483569fe8031ccce8ab"
integrity sha512-84vYFxIkmidUiFxidA/KjjH9pAycqW+h980j7Fuz5qxRtO9pgB7MDFTdys1N7A5mcucRiDyEq4fusljItR1T/A==
dependencies:
lodash._reinterpolate "^3.0.0"
lodash.templatesettings "^4.0.0"
lodash.templatesettings@^4.0.0:
version "4.2.0"
resolved "https://registry.yarnpkg.com/lodash.templatesettings/-/lodash.templatesettings-4.2.0.tgz#e481310f049d3cf6d47e912ad09313b154f0fb33"
integrity sha512-stgLz+i3Aa9mZgnjr/O+v9ruKZsPsndy7qPZOchbqk2cnTU1ZaldKK+v7m54WoKIyxiuMZTKT2H81F8BeAc3ZQ==
dependencies:
lodash._reinterpolate "^3.0.0"
lodash.uniq@^4.5.0: lodash.uniq@^4.5.0:
version "4.5.0" version "4.5.0"
resolved "https://registry.yarnpkg.com/lodash.uniq/-/lodash.uniq-4.5.0.tgz#d0225373aeb652adc1bc82e4945339a842754773" resolved "https://registry.yarnpkg.com/lodash.uniq/-/lodash.uniq-4.5.0.tgz#d0225373aeb652adc1bc82e4945339a842754773"
@ -3970,6 +3990,13 @@ rimraf@2.6.3:
dependencies: dependencies:
glob "^7.1.3" glob "^7.1.3"
rollup-plugin-banner@^0.2.1:
version "0.2.1"
resolved "https://registry.yarnpkg.com/rollup-plugin-banner/-/rollup-plugin-banner-0.2.1.tgz#f62f26c468530ecea16263da83175079625f9c6f"
integrity sha512-Bs1uIPCsGpKIkNOwmBsCqn+dJ/xaojWk9PNlvd+1MEScddr1yUQlO6McAXi72wJyNWYL+9u9EI2JAZMpLRH92w==
dependencies:
lodash.template "^4.4.0"
rollup-plugin-postcss@^2.5.0: rollup-plugin-postcss@^2.5.0:
version "2.5.0" version "2.5.0"
resolved "https://registry.yarnpkg.com/rollup-plugin-postcss/-/rollup-plugin-postcss-2.5.0.tgz#54ef2487cda498d8bca69aaca3b55b30dee0106b" resolved "https://registry.yarnpkg.com/rollup-plugin-postcss/-/rollup-plugin-postcss-2.5.0.tgz#54ef2487cda498d8bca69aaca3b55b30dee0106b"