How to use bannerjs - 10 common examples

To help you get started, we’ve selected a few bannerjs examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github jaywcjlove / hotkeys / scripts / watch.js View on Github external
{
      file: 'dist/hotkeys.common.js',
      name: 'hotkeys',
      banner: banner.multibanner(),
      format: 'cjs',
    },
    {
      file: 'dist/hotkeys.js',
      name: 'hotkeys',
      banner: banner.multibanner(),
      format: 'umd',
    },
    {
      file: 'dist/hotkeys.esm.js',
      name: 'hotkeys',
      banner: banner.multibanner(),
      format: 'es',
    },
  ],
};
const watcher = rollup.watch(watchOptions);

watcher.on('event', (event) => {
  if (event.code === 'FATAL') {
    console.log('FATAL:', event.error.codeFrame);
  }
  // event.code can be one of:
  //   START        — the watcher is (re)starting
  //   BUNDLE_START — building an individual bundle
  //   BUNDLE_END   — finished building a bundle
  //   END          — finished building all bundles
  //   ERROR        — encountered an error while bundling
github JSLite / JSLite / build / build.js View on Github external
rollup(rollup_option).then( bundle => {
  // console.log("test",bundle);
    return write('dist/JSLite.js', bundle.generate({
      // output format - 'amd', 'cjs', 'es6', 'iife', 'umd'
      // amd – 使用像requirejs一样的银木块定义
      // cjs – CommonJS,适用于node和browserify / Webpack
      // es6 (default) – 保持ES6的格式
      // iife – 使用于
github jaywcjlove / hotkeys / scripts / build.js View on Github external
// console.log(bundle.imports); // an array of external dependencies
  // console.log(bundle.exports); // an array of names exported by the entry point
  // console.log(bundle.modules); // an array of module objects

  const umd = await bundle.generate({
    format: 'umd',
    name: 'hotkeys',
    banner: banner.multibanner(),
  });

  const umdMinified = `${banner.onebanner()}\n${uglify.minify(umd.output[0].code, uglifyOption).code}`;

  const common = await bundle.generate({
    format: 'cjs',
    name: 'hotkeys',
    banner: banner.multibanner(),
  });
  const commonMinified = `${banner.onebanner()}\n${uglify.minify(common.output[0].code, uglifyOption).code}`;

  const es = await bundle.generate({
    format: 'es',
    name: 'hotkeys',
    banner: banner.multibanner(),
  });

  write('dist/hotkeys.js', umd.output[0].code)
    .then(() => write('dist/hotkeys.min.js', umdMinified, true))
    .then(() => write('dist/hotkeys.common.js', common.output[0].code))
    .then(() => write('dist/hotkeys.common.min.js', commonMinified, true))
    .then(() => write('dist/hotkeys.esm.js', es.output[0].code));
}
github jaywcjlove / hotkeys / scripts / build.js View on Github external
// console.log(bundle.modules); // an array of module objects

  const umd = await bundle.generate({
    format: 'umd',
    name: 'hotkeys',
    banner: banner.multibanner(),
  });

  const umdMinified = `${banner.onebanner()}\n${uglify.minify(umd.output[0].code, uglifyOption).code}`;

  const common = await bundle.generate({
    format: 'cjs',
    name: 'hotkeys',
    banner: banner.multibanner(),
  });
  const commonMinified = `${banner.onebanner()}\n${uglify.minify(common.output[0].code, uglifyOption).code}`;

  const es = await bundle.generate({
    format: 'es',
    name: 'hotkeys',
    banner: banner.multibanner(),
  });

  write('dist/hotkeys.js', umd.output[0].code)
    .then(() => write('dist/hotkeys.min.js', umdMinified, true))
    .then(() => write('dist/hotkeys.common.js', common.output[0].code))
    .then(() => write('dist/hotkeys.common.min.js', commonMinified, true))
    .then(() => write('dist/hotkeys.esm.js', es.output[0].code));
}
github jaywcjlove / store.js / scripts / watch.js View on Github external
const path = require('path');
const rollup = require('rollup');
const babel = require('rollup-plugin-babel');
const nodeResolve = require('@rollup/plugin-node-resolve');
const commonjs = require('@rollup/plugin-commonjs');
const { terser } = require('rollup-plugin-terser');
const banner = require('bannerjs');
require('colors-cli/toxic');

const watchOptions = {
  input: 'lib/main.js',
  output: [
    { file: 'dist/store.common.js', name: 'store', format: 'cjs', banner: banner.multibanner() },
    { file: 'dist/store.js', name: 'store', format: 'umd', banner: banner.multibanner() },
    { file: 'dist/store.esm.js', name: 'store', format: 'es', banner: banner.multibanner() },
    {
      file: 'dist/store.min.js',
      name: 'store',
      banner: banner.onebanner(),
      format: 'iife',
      plugins: [terser()]
    },
  ],
  plugins: [
    nodeResolve(), // so Rollup can find `ms`
    commonjs(), // so Rollup can convert `ms` to an ES module
    babel({
      exclude: 'node_modules/**', // 只编译我们的源代码
    }),
  ],
};
github uiwjs / copy-to-clipboard / rollup.config.js View on Github external
import resolve from 'rollup-plugin-node-resolve';
import commonjs from 'rollup-plugin-commonjs';
import banner from 'bannerjs';
import pkg from './package.json';

export default [
  // browser-friendly UMD build
  {
    input: 'src/main.js',
    output: {
      name: 'copyTextToClipboard',
      file: pkg.browser,
      format: 'umd',
      banner: banner.multibanner(),
    },
    plugins: [
      resolve(), // so Rollup can find `ms`
      commonjs() // so Rollup can convert `ms` to an ES module
    ]
  },

  // CommonJS (for Node) and ES module (for bundlers) build.
  // (We could have three entries in the configuration array
  // instead of two, but it's quicker to generate multiple
  // builds from a single configuration where possible, using
  // an array for the `output` option, where we can specify 
  // `file` and `format` for each target)
  {
    input: 'src/main.js',
    external: ['ms'],
github jaywcjlove / cookie.js / script / watch.js View on Github external
const nodeResolve = require('@rollup/plugin-node-resolve');
const commonjs = require('@rollup/plugin-commonjs');
const { terser } = require('rollup-plugin-terser');
const banner = require('bannerjs');
require('colors-cli/toxic');

const watchOptions = {
  input: 'src/main.js',
  output: [
    { file: 'dist/cookie.cjs.js', name: 'cookie', format: 'cjs' },
    { file: 'dist/cookie.js', name: 'cookie', format: 'umd', banner: banner.multibanner() },
    { file: 'dist/cookie.esm.js', name: 'cookie', format: 'es', banner: banner.multibanner() },
    {
      file: 'dist/cookie.min.js',
      name: 'cookie',
      banner: banner.onebanner(),
      format: 'iife',
      plugins: [terser()]
    },
  ],
  plugins: [
    nodeResolve(), // so Rollup can find `ms`
    commonjs(), // so Rollup can convert `ms` to an ES module
    babel({
      exclude: 'node_modules/**', // 只编译我们的源代码
    }),
  ],
};
const watcher = rollup.watch(watchOptions);

watcher.on('event', (event) => {
  // event.code can be one of:
github jaywcjlove / store.js / scripts / watch.js View on Github external
const nodeResolve = require('@rollup/plugin-node-resolve');
const commonjs = require('@rollup/plugin-commonjs');
const { terser } = require('rollup-plugin-terser');
const banner = require('bannerjs');
require('colors-cli/toxic');

const watchOptions = {
  input: 'lib/main.js',
  output: [
    { file: 'dist/store.common.js', name: 'store', format: 'cjs', banner: banner.multibanner() },
    { file: 'dist/store.js', name: 'store', format: 'umd', banner: banner.multibanner() },
    { file: 'dist/store.esm.js', name: 'store', format: 'es', banner: banner.multibanner() },
    {
      file: 'dist/store.min.js',
      name: 'store',
      banner: banner.onebanner(),
      format: 'iife',
      plugins: [terser()]
    },
  ],
  plugins: [
    nodeResolve(), // so Rollup can find `ms`
    commonjs(), // so Rollup can convert `ms` to an ES module
    babel({
      exclude: 'node_modules/**', // 只编译我们的源代码
    }),
  ],
};
const watcher = rollup.watch(watchOptions);

watcher.on('event', (event) => {
  // event.code can be one of:
github jaywcjlove / hotkeys / gulpfile.js View on Github external
gulp.task('min', function (cb) {
    
    gulp.src('dist/hotkeys.js')
        .pipe(uglify({
            mangle: true,
            output:{
                // comments:true
            }
        }))
        .pipe(rename({
            suffix:".min"
        }))
        .pipe(banner(bannerjs.onebanner()))
        .pipe(gulp.dest('./dist/'));

})
github jaywcjlove / hotkeys / gulpfile.js View on Github external
gulp.task('build', function (cb) {

    gulp.src('src/hotkeys.js')
        .pipe(umd({
            exports: function(file) {
                return 'hotkeys';
            },
            namespace: function(file) {
                return 'hotkeys';
            }
        }))
        .pipe(banner(bannerjs.multibanner()))
        .pipe(gulp.dest('./dist/'));

})

bannerjs

Get one-line/multi-line comment banner based on package.json.

MIT
Latest version published 11 months ago

Package Health Score

53 / 100
Full package analysis

Popular bannerjs functions