How to use the bannerjs.onebanner function in bannerjs

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 / 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 / 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 JSLite / JSLite / build / build.js View on Github external
return rollup(rollup_option).then(bundle=>{
    var code = bundle.generate({
      dest: 'dist/JSLite.js', 
      format: 'umd',
      moduleName: 'JSLite'
    }).code
    var minified = banner.onebanner() + '\n' + uglify.minify(code, {
      fromString: true,
      output: {
        ascii_only: true
      }
    }).code
    return write('dist/JSLite.min.js', minified)
  }).then(zip)
github jaywcjlove / cookie.js / script / build.js View on Github external
(async () => {
  const bundle = await rollup.rollup(inputOptions);
  const umd = await bundle.write({
    file: 'dist/cookie.js',
    format: 'umd',
    name: 'cookie',
    banner: banner.multibanner(),
  });
  report(umd, 'dist/cookie.js');

  const iife = await bundle.write({
    file: 'dist/cookie.min.js',
    name: 'cookie',
    banner: banner.onebanner(),
    format: 'iife',
    plugins: [terser()]
  });
  report(iife, 'dist/cookie.min.js');

  const esm = await bundle.write({
    file: 'dist/cookie.esm.js',
    format: 'esm',
    name: 'cookie',
    banner: banner.multibanner(),
  });
  report(esm, 'dist/cookie.esm.js');

  const cjs = await bundle.write({
    file: 'dist/cookie.cjs.js',
    format: 'cjs',
github jaywcjlove / store.js / scripts / build.js View on Github external
(async () => {
  const bundle = await rollup.rollup(inputOptions);
  const umd = await bundle.write({
    file: 'dist/store.js',
    format: 'umd',
    name: 'store',
    banner: banner.multibanner(),
  });
  report(umd, 'dist/store.js');

  const iife = await bundle.write({
    file: 'dist/store.min.js',
    name: 'store',
    banner: banner.onebanner(),
    format: 'iife',
    plugins: [terser()]
  });
  report(iife, 'dist/store.min.js');

  const esm = await bundle.write({
    file: 'dist/store.esm.js',
    format: 'esm',
    name: 'store',
    banner: banner.multibanner(),
  });
  report(esm, 'dist/store.esm.js');

  const cjs = await bundle.write({
    file: 'dist/store.cjs.js',
    format: 'cjs',

bannerjs

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

MIT
Latest version published 1 year ago

Package Health Score

46 / 100
Full package analysis

Popular bannerjs functions