Build the js files into one file using browserify, deploys the file to ipfs and binds the new hash to ipns
964055
async function deploy() {
  try {
    await browserifyDBCP();
    await uglify();
    const ipfsHash = await deployToIPFS(`${ deploymentFolder}/${ browserifyName}`);
    await pinToIPFS(ipfsHash);
    const ipnsHash = await deployToIpns(ipfsHash);
    deleteDeploymentFolder();

    console.log(`\nFinished deployment`);
    console.log(`IPFS: ${ ipfsHash }`);
    console.log(`IPNS: ${ ipnsHash }`);
  } catch (ex) {
    console.error(ex);
  }
}
262642
function bundleJsFiles () {
  return concat(jsFiles)
    .then((output) => {
      const uglified = UglifyJS.minify(output)
      if (uglified.error) {
        throw new Error(uglified.error)
      }
      return uglified.code
    })
}
1072474
function bundler(loader, options, modules) {
  var stack    = modules.slice(0);
  var mods     = [];
  var finished = {};

  function processModule(mod) {
    if (finished.hasOwnProperty(mod.id)) {
      return;
    }

    mod = loader.getModule(mod.id);

    // browser pack chunk
    var browserpack = {
      id     : mod.id,
      source : mod.source,
      deps   : {}
    };

    // Gather up all dependencies
    var i, length, dep;
    for (i = 0, length = mod.deps.length; i < length; i++) {
      dep = mod.deps[i];
      stack.push(dep);
      browserpack.deps[dep.id] = dep.id;
    }

    finished[mod.id] = browserpack;
    mods.unshift(browserpack);
  }

  // Process all modules
  while (stack.length) {
    processModule(stack.pop());
  }

  var stream = browserPack(options).setEncoding("utf8");
  var promise = pstream(stream);

  stream.end(JSON.stringify(mods));
  return promise;
}
851625
async function buildIifeAmd() {
  // create a bundle
  const bundle = await rollup.rollup({
    input: 'src/index.js',
    external: ['riot'],
    plugins: [
      nodeResolve({
        jsnext: true,
        main: true,
        browser: true
      }),
      commonjs({
        include: 'node_modules/**',
        namedExports: namedExports
      }),
      buble()
    ]
  });
  await bundle.write({
    format: 'iife',
    name: 'riotx',
    globals: {
      riot: 'riot'
    },
    banner: banner,
    intro: intro,
    file: 'dist/riotx.js',
    sourcemap: true
  });
  await bundle.write({
    format: 'amd',
    banner: banner,
    intro: intro,
    file: 'dist/amd.riotx.js',
    sourcemap: true
  });
}
705160
function buildJs() {
  const jsFiles = config.jsCoreFiles;
  config.componentPaths.forEach(component => {
    jsFiles.push(path.join(component, '*.js'));
    jsFiles.push(path.join(component, '**/*.js'));
  });

  gutil.log("building js files...");

  const jsBuildStream = gulp.src(jsFiles)
  .pipe(filterNonCodeFiles())
  .pipe(utils.buildNgMaterialDefinition())
  .pipe(plumber())
  .pipe(ngAnnotate())
  .pipe(utils.addJsWrapper(true));

  const jsProcess = series(jsBuildStream, themeBuildStream())
  .pipe(concat('angular-material.js'))
  .pipe(BUILD_MODE.transform())
  .pipe(insert.prepend(config.banner))
  .pipe(insert.append(';window.ngMaterial={version:{full: "' + VERSION + '"}};'))
  .pipe(gulp.dest(config.outputDir))
  .pipe(gulpif(!IS_DEV, uglify({output: {comments: 'some'}})))
  .pipe(rename({extname: '.min.js'}))
  .pipe(gulp.dest(config.outputDir));

  return series(jsProcess, deployMaterialMocks());

  // Deploy the `angular-material-mocks.js` file to the `dist` directory
  function deployMaterialMocks() {
    return gulp.src(config.mockFiles)
    .pipe(gulp.dest(config.outputDir));
  }
}
1097876
function scripts (src, dest, watch) {
  var bundleOpts = _.extend({}, watchify.args)
  if (watch) bundleOpts.debug = true

  var bundle = browserify(src, bundleOpts)

  if (watch) {
    bundle = watchify(bundle)

    bundle.on('update', function () { compileBundle(bundle, dest) }) // when a dependency changes, recompile
    bundle.on('log', gutil.log) // output build logs to terminal
  } else {
    bundle.transform({ global: true }, 'uglifyify')
  }

  return compileBundle(bundle, dest)
}
259095
function createForBuild(build) {
  var exports = {};
  
  function bundles(name, sourceType) {
    /*jshint validthis: true */
    var ml = build.bundles(name, sourceType);
    return this.markSafe(ml);
  }
  exports.bundles = bundles;
  
  function link(srcPath, relative) {
    /*jshint validthis: true */
    var ml = build.link(srcPath, relative);
    return this.markSafe(ml);
  }
  exports.link = link;
  
  function script(srcPath, relative) {
    /*jshint validthis: true */
    var ml = build.script(srcPath, relative);
    return this.markSafe(ml);
  }
  exports.script = script;
  
  function scriptCode(js) {
    /*jshint validthis: true */
    var ml = '<script type="text/javascript">' + js + '</script>';
    return this.markSafe(ml);
  }
  exports.scriptCode = scriptCode;

  exports.t = build.translate.bind(build);
  exports.tn = build.translateNumeric.bind(build);

  return exports;
}
385968
function watchifyFile(src, out) {
    var opts = assign({}, watchify.args, {
        entries: src,
        standalone: "NavMesh",
        debug: true
    });
    var b = watchify(browserify(opts));
    function bundle() {
        return b.bundle()
            .on('error', gutil.log.bind(gutil, "Browserify Error"))
            .pipe(source(src.replace(/^src\//, '')))
            .pipe(derequire())
            .pipe(gulp.dest(out));
    }
    b.on('update', bundle);
    b.on('log', gutil.log);
    return bundle();
}
1182106
function build(previousFileSizes) {

  console.log('\n\nThe process.env.NODE_ENV is: ', chalk.cyan.bold(process.env.NODE_ENV))
  customEnvVarKey && console.log('The custom environment variable is: ', chalk.cyan.bold(customEnvVarKey))
  const spinner = ora('Creating an optimized production build...')
  spinner.color = 'blue'
  spinner.start()
  // console.log('Creating an optimized production build...');

  let compiler = webpack(config);
  return new Promise((resolve, reject) => {
    compiler.run((err, stats) => {
      if (err) {
        return reject(err);
      }
      const messages = formatWebpackMessages(stats.toJson({}, true));
      if (messages.errors.length) {
        // Only keep the first error. Others are often indicative
        // of the same problem, but confuse the reader with noise.
        if (messages.errors.length > 1) {
          messages.errors.length = 1;
        }
        return reject(new Error(messages.errors.join('\n\n')));
      }
      if (
        process.env.CI &&
        (typeof process.env.CI !== 'string' ||
          process.env.CI.toLowerCase() !== 'false') &&
        messages.warnings.length
      ) {
        console.log(
          chalk.yellow(
            '\nTreating warnings as errors because process.env.CI = true.\n' +
            'Most CI servers set it automatically.\n'
          )
        );
        return reject(new Error(messages.warnings.join('\n\n')));
      }
      spinner.succeed()
      return resolve({
        stats,
        previousFileSizes,
        warnings: messages.warnings,
      });
    });
  });
}
1189006
def build_files(payload, dirname=None, indent=4, tabs=False, header=False):
    
    if dirname is None:
        dirname = os.getcwd()

    for config in payload['config']:
        path = config['file']
        if not os.path.isabs(path):
            path = os.path.join(dirname, path)

        # make directories that need to be made for the config to be built
        dirpath = os.path.dirname(path)
        if not os.path.exists(dirpath):
            os.makedirs(dirpath)

        # build then create the nginx config file using the json payload
        parsed = config['parsed']
        output = build(parsed, indent=indent, tabs=tabs, header=header)
        output = output.rstrip() + '\n'
        with codecs.open(path, 'w', encoding='utf-8') as fp:
            fp.write(output)
747666
function Buildit(opts) {
	opts = opts || {};

	this.cwd = opts.baseUrl || process.cwd();
	this.name = opts.name;
	this.locals = {};
	this.externals = [];

	if (opts.define) {
		this.define = opts.define;
	}

	if (opts.exports) {
		this.exports = opts.exports;
	}

	if (opts.extensions) {
		this.extensions = opts.extensions;
	}
}
1153276
function bundleDevelopment() {
    const opts = assign({}, browersifyOptions, { debug: true });
    const bundler = browserify(opts).transform(babelify.configure(babelifyOptions));
    bundler.on('log', gutil.log); // output build logs to terminal

    return bundler.bundle()
    .on('error', (err) => { // log errors if they happen
        gutil.log('Browserify Error', err);
    })
    .pipe(source('crudl.js'))
    .pipe(gulp.dest(dist))
    .on('end', () => {
        gutil.log(`Successfully build ${gutil.colors.magenta(`${dist}/crudl.js`)}`)
    })
}
1225310
async function build() {
  console.time('Packager');

  let requires = [];
  let esmExportString = '';
  let cjsExportString = '';

  try {
    if (!fs.existsSync(DIST_PATH)) fs.mkdirSync(DIST_PATH);
    fs.writeFileSync(ROLLUP_INPUT_FILE, '');
    fs.writeFileSync(TEST_MODULE_FILE, '');

    // All the snippets that are Node.js-based and will break in a browser
    // environment
    const nodeSnippets = fs
      .readFileSync('tag_database', 'utf8')
      .split('\n')
      .filter(v => v.search(/:.*node/g) !== -1)
      .map(v => v.slice(0, v.indexOf(':')));

    const snippets = fs.readdirSync(SNIPPETS_PATH);
    const archivedSnippets = fs
      .readdirSync(SNIPPETS_ARCHIVE_PATH)
      .filter(v => v !== 'README.md');

    snippets.forEach(snippet => {
      const rawSnippetString = getRawSnippetString(SNIPPETS_PATH, snippet);
      const snippetName = snippet.replace('.md', '');
      let code = getCode(rawSnippetString);
      if (nodeSnippets.includes(snippetName)) {
        requires.push(code.match(/const.*=.*require\(([^\)]*)\);/g));
        code = code.replace(/const.*=.*require\(([^\)]*)\);/g, '');
      }
      esmExportString += `export ${code}`;
      cjsExportString += code;
    });
    archivedSnippets.forEach(snippet => {
      const rawSnippetString = getRawSnippetString(
        SNIPPETS_ARCHIVE_PATH,
        snippet
      );
      cjsExportString += getCode(rawSnippetString);
    });

    requires = [
      ...new Set(
        requires
          .filter(Boolean)
          .map(v =>
            v[0].replace(
              'require(',
              'typeof require !== "undefined" && require('
            )
          )
      )
    ].join('\n');

    fs.writeFileSync(ROLLUP_INPUT_FILE, `${requires}\n\n${esmExportString}`);

    const testExports = `module.exports = {${[...snippets, ...archivedSnippets]
      .map(v => v.replace('.md', ''))
      .join(',')}}`;

    fs.writeFileSync(
      TEST_MODULE_FILE,
      `${requires}\n\n${cjsExportString}\n\n${testExports}`
    );

    // Check Travis builds - Will skip builds on Travis if not CRON/API
    if (util.isTravisCI() && util.isNotTravisCronOrAPI()) {
      fs.unlink(ROLLUP_INPUT_FILE);
      console.log(
        `${chalk.green(
          'NOBUILD'
        )} Module build terminated, not a cron job or a custom build!`
      );
      console.timeEnd('Packager');
      process.exit(0);
    }

    await doRollup();

    // Clean up the temporary input file Rollup used for building the module
    fs.unlink(ROLLUP_INPUT_FILE);

    console.log(`${chalk.green('SUCCESS!')} Snippet module built!`);
    console.timeEnd('Packager');
  } catch (err) {
    console.log(`${chalk.red('ERROR!')} During module creation: ${err}`);
    process.exit(1);
  }
}
617210
function buildNode(file, watch) {
  if (watch) {
    return gulp.watch(paths.src + file + '.js')
      .on('change', function(file) {
        $.util.log('Copying to lib...');
        gulp.src(file.path)
          .pipe($.plumber())
          .pipe($.babel())
          .pipe(gulp.dest(paths.dist));
      });
  } else {
    return gulp.src(paths.src + file + '.js')
      .pipe($.plumber())
      .pipe($.babel())
      .pipe(gulp.dest(paths.dist));
  }
}
334215
function (hash) {
  console.log('Pinning to IPFS...');

  return new Promise((resolve, reject) => {
    const options = {
      hostname: ipfsHost,
      port: ipfsProtocol === 'https' ? '443' : '8080',
      path: `/pins/${hash}`,
      method: 'POST'
    }

    const req = https.request(options, (res) => {
      res.setEncoding('utf8')
      res.on('data', (chunk) => { })
      res.on('end', () => resolve())
    })

    req.on('error', async (ex) => reject(new Error(`failed to pin hash "${hash}"; ${e.message || e}`)))
    req.on('timeout', async () => reject(new Error(`timeout during pinning of hash "${hash}"`)))

    req.write('')
    req.end()
  })
  .then(() => requestFileFromEVANIpfs(hash));
}
69821
function buildScripts() {
  return Promise.resolve()
    // Create the dist folder if it doesn't exist
    .then(() => {
      if(!FS.existsSync(Path.join(__dirname, 'dist'))) {
        return FS.mkdirAsync(Path.join(__dirname, 'dist'));
      }
    })

    // Generate minified scripts
    .then(() => new Promise((resolve, reject) => {
      let scripts = {
        'dropdowns.js': FS.readFileSync(Path.join(__dirname, 'source/js/dropdowns.js'), 'utf8'),
        'tabs.js': FS.readFileSync(Path.join(__dirname, 'source/js/tabs.js'), 'utf8')
      };

      let result = UglifyJS.minify(scripts, {
        output: {
          comments: /^!/
        }
      });
      if(result.error) {
        reject(result.error);
        return;
      }

      resolve(result.code);
    }))

    // Write minified scripts to dist
    .then((scripts) => {
      let file = Path.join(__dirname, 'dist/shoelace.js');

      // Update {{version}} in JS since it's not processed with Handlebars
      scripts = scripts.replace(/\{\{version\}\}/g, __version);

      // Output a message
      console.log(Chalk.green('JS processed: %s! 🐭'), Path.relative(__dirname, file));

      // Write output file
      return FS.writeFileAsync(file, scripts, 'utf8');
    });
}
228172
function() {
  // Path to apis.js file
  var apis_js = path.join(__dirname, '../src', 'apis.js');
  // Create content
  // Use json-stable-stringify rather than JSON.stringify to guarantee
  // consistent ordering (see http://bugzil.la/1200519)
  var content = "/* eslint-disable */\nmodule.exports = " + stringify(apis, {
    space: '  '
  }) + ";";
  fs.writeFileSync(apis_js, content, {encoding: 'utf-8'});
}