Append to template a distribution bundle js.
544335
def _update_task_presenter_bundle_js(project):
    """"""
    if os.path.isfile ('bundle.min.js'):
        with open('bundle.min.js') as f:
            js = f.read()
        project.info['task_presenter'] += "<script>\n%s\n</script>" % js
        return

    if os.path.isfile ('bundle.js'):
        with open('bundle.js') as f:
            js = f.read()
        project.info['task_presenter'] += "<script>\n%s\n</script>" % js
442739
def install_template(username, repo):
    """"""
    print("Installing template from " + username + "/" + repo)

    dpath = os.path.join(cwd, "templates")
    getunzipped(username, repo, dpath)
1332729
function bundle(entry, output, name) {
  rollup.rollup({
    input: path.resolve(process.cwd(), entry),
    plugins: plugins
  }).then((bundle) => {
    return bundle.generate({
      format: format(),
      name: name,
      sourcemap: true
    })
  }).then(({ code, map}) => {
    return write(path.resolve(process.cwd(), output), code)
  }).then(() => {
    var source = fs.readFileSync(path.resolve(process.cwd(), output), 'utf-8', (err) => { throw err })
    var compilerFlags = {
      jsCode: [{ src: source }],
      compilationLevel: 'ADVANCED',
      languageOut: 'ECMASCRIPT5',
      createSourceMap: true
    }
    var result = compiler(compilerFlags)
    var minPath = 'bundle/' + output.split('/').pop().split('.')[0] + '.min.js'
    var sourcePath = minPath + '.map'
    // write min.js and min.js.map
    fs.writeFileSync(minPath, result.compiledCode, 'utf-8', (err) => { throw err })
    fs.writeFileSync(sourcePath, result.sourceMap, 'utf-8', (err) => { throw err })
    console.info(chalk.red(minPath) + ' ' + chalk.green(getSize(result.compiledCode)))
  }).catch((err) => {
    console.error(err)
  })
}
692466
function continuousBundle() {
    const bundle = b => b.bundle()
        .on('error', (err) => {
            notifier.notify({
                title: 'Browserify Error',
                message: err.message,
            });
            gutil.log('Browserify Error', err);
        })
        .pipe(source('crudl.js'))
        .pipe(gulp.dest(dist))
        .on('end', () => {
            notifier.notify({
                title: 'Browserify',
                message: 'OK',
            });
        })
    const opts = assign({}, watchify.args, browersifyOptions, { debug: true });
    const bundler = watchify(browserify(opts).transform(babelify.configure(babelifyOptions)));
    bundler.on('update', () => bundle(bundler)); // on any dep update, runs the bundler
    bundler.on('log', gutil.log); // output build logs to terminal

    return bundle(bundler)
}
476878
function addExampleFiles(options) {


  return new Promise(function(resolve, reject) {
    var templateFile = path.join(__dirname, '../template/cli.html');
    var tasks = [];

    tasks.push(writeHTMLFile(options));
    // add necessary JS files
    tasks.push(copyFileToDir('specificity-graph-standalone.js', options.directory))
    tasks.push(copyFileToDir('example.js', options.directory));

    // make sure all these aync tasks are done.
    Promise.all(tasks).then(resolve,reject);
  });
}
915132
function addComponent(name) {
  const source = path.join(packages, '.template');
  const destination = path.join(packages, name);

  if (fs.existsSync(destination)) {
    console.log(chalk.red('error'), 'Component package exists');
  } else {
    ncp(source, destination, error => {
      if (error) {
        console.log(chalk.red('error'), error);
      } else {
        const items = walk(destination, { nodir: true });

        items.forEach(item => {
          const string = fs.readFileSync(item.path, 'utf8');
          const template = Handlebars.compile(string);
          const data = template({ component: name });

          fs.writeFileSync(item.path, data, 'utf8');
        });

        console.log(chalk.green('success'), 'Added new component');
        execSync('yarn postinstall');
        updateDemo(name);
      }
    });
  }
}
1232817
function renderContent(source, generator, context, options, cb) {
    ejs.renderFile(generator.templatePath(source), context, options, (err, res) => {
        if (!err) {
            cb(res);
        } else {
            generator.error(`Copying template ${source} failed. [${err}]`);
        }
    });
}
578224
function previewJs() {
  return rollup({
    input: 'previewer-src/app.js',
    plugins: [
      commonjs,
      babel(babelrc)
    ]
  })
  .then(bundle => {
    return bundle.write({
      file: 'build/app.gen.js',
      format: 'umd',
      sourcemap: 'inline'
    });
  });
}
566518
function createTemplate (appname, filename, data) {
  var content, ext;
  if (data) {
    data.appname = appname
  }
  if(ignoreFileTypes.test(filename)){
    console.log('Don\'t FUTZ binary files', filename);
    content = getUnrenderedTemplateContents(filename);
  } else  {
    content = getTemplateContents(filename, data)
    // ext = path.extname(filename)
  }
    fs.writeFileSync(path.join(appname, filename), content)
  
}
1282114
function packResult(args, proto, ObjName) {
    debug && logger.trace("Package Data To Client [ %s ]", JSON.stringify(args));
    if (null == proto) {
        logger.error('No proto File Configured！');
        return "";
    } else if (typeof proto == "string") {
        if (fs.existsSync(proto)) {
            proto = ProtoBuf.loadProtoFile(proto);
        } else if (fs.existsSync(proto + ".proto")) {
            proto = ProtoBuf.loadProtoFile(proto + ".proto");
        } else {
            return "";
        }
    }

    var RetMessage = proto.build("Ret" + ObjName);
    try {
        var ret_msg = new RetMessage();
    } catch (e) {
        console.log(RetMessage, e);
    }

    for (var index in args) {
        if (args.hasOwnProperty(index)) {
            ret_msg[index] = args[index];
        }
    }

    return ret_msg.toBase64();
}
168629
async function bundleJavaScript() {
    const bundle = await rollup.rollup({
        input: `${__dirname}/src/beedle.js`,
        plugins: [
            uglify()
        ]
    });

    await bundle.write({
        format: 'umd',
        name: 'beedle',
        file: 'beedle.js',
        dir: `${__dirname}/dist/`,
    });
}
860730
function template(
  { template, types: t },
  opts,
  { imports, componentName, props, jsx, exports },
) {
  const name = componentName.name.replace('Svg', '');

  jsx
    .openingElement
    .attributes = [
      t.jsxAttribute(
        t.jsxIdentifier('aria-label'),
        t.stringLiteral(`icon_${name}`)
      ),
      ...jsx.openingElement.attributes
    ];

  const titleElement = t.jsxElement(
    t.jsxOpeningElement(t.jsxIdentifier('title'), []),
    t.jsxClosingElement(t.jsxIdentifier('title')),
    [t.jsxText(`${name}`)],
  )

  jsx.children = [titleElement, ...jsx.children];

  return template.ast`
    ${imports}
    import withIcon from './withIcon';
    const ${name} = (${props}) => ${jsx}
    export default withIcon(${name});
  `
}
846515
function bundleRelease(minify) {
  var bundler = browserify({
    entries: ['./src/' + entryFileName],
    standalone: standaloneName,
    debug: !minify
  });

  if(minify) {
    bundler = bundler.plugin(collapse);
  }

  var stream = bundler.bundle()
    .on('error', logError);

  if(!minify) {
    stream = stream.pipe(exorcist('./dist/' + bundleFileName + '.map'));
  }

  stream = stream.pipe(source(bundleFileName))
    .pipe(buffer())
    .pipe(derequire())
    .pipe(strip());

  if(minify) {
    return stream.pipe(rename({extname: '.min.js'}))
      .pipe(uglify())
      .pipe(gulp.dest('./dist/'));
  } else {
    return stream.pipe(gulp.dest('./dist/'));
  }
}
537592
function bundle () {
  const ordered = order(deps[postcssify.entry], [], {})
  const l = ordered.length
  let ast
  for (let i = 0; i < l; i++) {
    const file = ordered[i]
    const style = styles[file]
    if (style === void 0) {
      return
    } else {
      if (!ast) {
        ast = style.clone()
      } else {
        ast.append(style)
      }
    }
  }
  if (ast) {
    postcss(processors).process(ast.toResult(), { to: dest, map: true }).then((result) => {
      fs.writeFile(dest, result.css, (err) => {
        if (err) {
          throw err
        } else {
          log.info('updated: %s', dest)
        }
      })
    }).catch((err) => log.error(err))
  }
}
351776
async function build() {
  await run(clean);
  await run(copy);
  await run(bundle);
}
108280
def publish_results(self, dist_dir, use_basename_prefix, vt, bundle_dir, archivepath, id, archive_ext):
    """"""
    # TODO (from mateor) move distdir management somewhere more general purpose.
    name = vt.target.basename if use_basename_prefix else id
    bundle_copy = os.path.join(dist_dir, '{}-bundle'.format(name))
    absolute_symlink(bundle_dir, bundle_copy)
    self.context.log.info(
      'created bundle copy {}'.format(os.path.relpath(bundle_copy, get_buildroot())))

    if archivepath:
      ext = archive.archive_extensions.get(archive_ext, archive_ext)
      archive_copy = os.path.join(dist_dir,'{}.{}'.format(name, ext))
      safe_mkdir_for(archive_copy)  # Ensure parent dir exists
      atomic_copy(archivepath, archive_copy)
      self.context.log.info(
        'created archive copy {}'.format(os.path.relpath(archive_copy, get_buildroot())))
314493
function (done) {
        glob(path.join(__dirname, "*.ejs"), function (err, files) {
            if (err) {
                return done(err);
            }

            var templates = {};

            async.forEach(files, function (file, done) {
                fs.readFile(file, "utf8", function (err, data) {
                    if (err) {
                        return done(err);
                    } else {
                        templates[path.basename(file, ".ejs")] = _.template(data);
                        done();
                    }
                });
            }, function (err) {
                if (err) {
                    return done(err);
                }

                done(null, templates);
            });
        });
    }