Prepare the next release cycle:
- Remove the `dist` directory containing bundle tagged on given version.
- Create a new commit preparing the next release.

@return {WritableStream} The stream pipeline.
495762
function prepareNextRelease() {
  return gulp.src(config.dist)
      .pipe(git.rm({args: '-r'}))
      .pipe(git.commit('release: prepare next release'));
}
490165
function writeVendorFileThenBundle () {
    const vendorDestPath = path.join(opts.rootDir, outputOpts.dir, outputOpts.vendor)
    const outStream = fs.createWriteStream(vendorDestPath)

    var b = getBrowserifyInstance({
      inc: opts.inc,
      cacheFile: opts.cacheFile
    })

    // add vendor files to the bundle
    b.require(opts.vendor)

    const startTime = Date.now()
    const bStream = b.bundle()

    multistream(vendorFiles.map(createReadStream).concat(bStream))
      .pipe(outStream)
      .on('error', (err) => console.error(err))
      .on('close', function () {
        const endTime = Date.now()
        const delta = endTime - startTime

        console.error(
          '[vendor] written to %s (%s seconds)',
          vendorDestPath, (delta / 1000).toFixed(2)
        )

        bundle()
      })
  }
1355132
def prepare_onetime_pipeline():
    """"""
    runner = ForemastRunner()
    runner.write_configs()
    runner.create_pipeline(onetime=os.getenv('ENV'))
    runner.cleanup()
652377
function(repo, version, hash, meta, outDir) {

    var url, tempRepoDir, packageJSONData, self = this;

    if (meta.vPrefix) {
      version = 'v' + version;
    }

    // Automatically track and cleanup files at exit
    temp.track();

    url = createGitUrl(self.options.baseurl, repo, self.options.reposuffix, self.auth);

    return createTempDir().then(function(tempDir) {
      tempRepoDir = tempDir;
      return exportGitRepo(tempRepoDir, version, url, self.execOpt, self.options.shallowclone);
    }).then(function() {
      return readPackageJSON(tempRepoDir);
    }).then(function(data) {
      packageJSONData = data;
      return moveRepoToOutDir(tempRepoDir, outDir);
    }).then(function() {
      return packageJSONData;
    });
  }
900585
function buildBrowser(file, watch) {
  const props = {
    entries: [paths.src + file + '.js'],
    debug : true,
    cache: {},
    packageCache: {},
    standalone: 'swapi'
  };

  const bundler = watch ? watchify(browserify(props)) : browserify(props);

  function rebundle() {
    let stream = bundler.transform('babelify')
      .bundle();
    return stream
      .pipe($.plumber())
      .on('error', (err) => { $.notify().write(err); })
      .pipe(source(file + '.browser.js'))
      .pipe(buffer())
      .pipe($.uglify())
      .pipe(gulp.dest(paths.dist));
  }

  bundler.on('update', function() {
    rebundle();
    $.util.log('Rebundle...');
  });

  return rebundle();
}
683982
function (cb) {
    this.reset();
    var bundle = this.bundle;
    var self = this;
    async.waterfall([
      function (wfCb) {
        if (self.noclean) {
          wfCb();
        } else {
          // Remove the output directory if it exists
          existsCompat(self.outputTo, function (exists) {
            if (exists) {
              if (self.verbose) {
                console.log('compileAssets: removing output directory: ' + self.outputTo);
              }
              rimraf(self.outputTo, wfCb);
            } else {
              wfCb();
            }
          });
        }
      },
      function (wfCb) {
        if (self.verbose) {
          console.log('compileAssets: starting asset discovery phase.');
        }
        executePhase(self.phases.discovery, bundle, wfCb);
      },
      function (b, wfCb) {
        if (self.verbose) {
          console.log('compileAssets: starting compilation phase.');
        }
        try {
          // Get the correct order of asset dependencies
          var orderedAssets = bundle.getProcessingOrder().map(function (assetFilePath) {
            return bundle.getAsset(assetFilePath);
          });
          async.eachSeries(orderedAssets, function (asset, eachCb) {
            setImmediateCompat(function() {
              executePhase(self.phases.compilation, asset, eachCb);
            });
          }, wfCb);
        }
        catch (e) {
          wfCb(e);
        }
      }, function (wfCb) {
        if (self.verbose) {
          console.log('compileAssets: starting post-compilation phase.');
        }
        async.eachLimit(bundle.getAllAssets(), 50, function (asset, eachCb) {
          executePhase(self.phases.postCompilation, asset, eachCb);
        }, wfCb);
      }, function (wfCb) {
        if (self.verbose) {
          console.log('compileAssets: starting output phase.');
        }
        async.eachLimit(bundle.getAllAssets(), 50, function (asset, eachCb) {
          executePhase(self.phases.output, asset, eachCb);
        }, wfCb);
      }
    ], cb);
  }
740597
public static PipelineConfiguration
    appendStep(PipelineConfiguration history,
               List<String> inputFiles,
               ActionConfiguration configuration,
               AppVersionInfo versionInfo) {

        LightFileDescriptor[] inputDescriptors = inputFiles
                .stream()
                .map(f -> LightFileDescriptor.calculate(Paths.get(f)))
                .toArray(LightFileDescriptor[]::new);

        return new PipelineConfiguration(
                Stream.concat(
                        Stream.of(history.pipelineSteps),
                        Stream.of(new PipelineStep(versionInfo, inputDescriptors, configuration))
                ).toArray(PipelineStep[]::new));
    }
446911
def release():
    

    from secrets import pypi_auth

    # Check that all changes are committed before creating a new version
    git_check()

    # Test package
    test()

    # Increment version
    inc_version()

    # Commit new version, create tag for version and push everything to origin
    git_push()

    # Build and publish package
    build()
    pathname = 'dist/pynb-{}.tar.gz'.format(version.__version__)
    docker_exec('twine upload -u {user} -p {pass} {pathname}'.format(pathname=pathname, **pypi_auth))

    # Remove temporary files
    clean()
1151324
function() {
        var distDir = this.readConfig('distDir');
        var packedDirName = this.readConfig('packedDirName');
        var archivePath = this.readConfig('archivePath');

        if (packedDirName) {
          packedDirName = path.join(archivePath, packedDirName);
          this.log('moving ' + distDir + ' to ' + packedDirName);

          this.distDir = packedDirName;
          return move(distDir, packedDirName);
        }

        return RSVP.resolve();
      }
1271538
function bundleJavascript() {
  const bundleEntryPath = path.resolve(__dirname, '..', 'dist', 'static', 'hierplane.js');
  const bundlePath = path.resolve(__dirname, '..', 'dist', 'static', 'hierplane.bundle.js');

  // Put together our "bundler", which uses browserify
  const browserifyOpts = {
    entries: [ bundleEntryPath ],
    standalone: 'hierplane'
  };

  // If we're watching or changes, enable watchify
  if (isWatchTarget) {
    // These are required for watchify
    browserifyOpts.packageCache = {};
    browserifyOpts.cache = {};

    // Enable the plugin
    browserifyOpts.plugin = [ watchify ];
  };

  // Construct the bundler
  const bundler = browserify(browserifyOpts);

  // Make an inline function which writes out the bundle, so that we can invoke it whenever
  // an update is detected if the watch target is being executed.
  const writeBundle = () => {
    console.log(chalk.cyan(`bundling ${chalk.magenta(path.relative(execArgs.cwd, bundleEntryPath))}`));
    bundler.bundle().pipe(fs.createWriteStream(bundlePath))
    console.log(chalk.green(`wrote ${chalk.magenta(path.relative(execArgs.cwd, bundlePath))}`));
  };

  // Write out the bundle once
  writeBundle();

  // If we're supposed to watch for changes, write out the bundle whenever they occur
  if (isWatchTarget) {
    bundler.on('update', writeBundle);
  }
}
283395
function bundleUp(bundler) {
  return bundler
    .bundle()
    .on('error', logAndEndStream)
    .pipe(source('ng-redux-dev-tools.js'))
    .pipe(buffer())
    .pipe(sourcemaps.init({
      loadMaps: true
    }))
    .pipe(sourcemaps.write())
    .pipe(gulp.dest('dist'));
}
182020
async function buildUnreleasedPackages() {
	const cwdBefore = process.cwd();
	const unreleasedPackagesSourceFolder = path.resolve(__dirname, '../../packages/');
	const unreleasedPackagesDistFolder = path.resolve(__dirname, '../packages');
	await rimrafAsync(unreleasedPackagesDistFolder);
	await mkdirAsync(unreleasedPackagesDistFolder);
	process.chdir(unreleasedPackagesDistFolder);
	console.log('🎁  Packing current packages');
	await Promise.all(
		fs
			.readdirSync(unreleasedPackagesSourceFolder)
			.filter((packageName) => fs.statSync(path.join(unreleasedPackagesSourceFolder, packageName)).isDirectory())
			.map((packageName) => execAsync(`npm pack "${path.resolve(__dirname, '../../packages/' + packageName)}"`))
	);
	// Remove version number from file name
	await Promise.all(
		fs
			.readdirSync(unreleasedPackagesDistFolder)
			.filter((tarPackageName) => /\.tgz/.test(tarPackageName))
			.map((tarPackageName) =>
				renameAsync(
					path.join(unreleasedPackagesDistFolder, tarPackageName),
					path.join(unreleasedPackagesDistFolder, tarPackageName.replace(/\-\d[^-]+$/, '.tgz'))
				)
			)
	);

	process.chdir(cwdBefore);
}
1265223
function publishToS3() {
  return new Promise((resolve, reject) => {
    const client = S3.createClient({
      s3Options: {
        accessKeyId: process.env.S3_ACCESS_KEY,
        secretAccessKey: process.env.S3_SECRET_KEY
      }
    });

    // Sync the local /dist directory to /{version} in the S3 bucket
    let uploader = client.uploadDir({
      localDir: Path.join(__dirname, 'dist'),
      deleteRemoved: true,
      s3Params: {
        ACL: process.env.S3_ACL,
        Prefix: __version,
        Bucket: process.env.S3_BUCKET
      }
    });

    uploader.on('error', (err) => {
      reject(err);
    });

    uploader.on('end', () => {
      console.log(Chalk.green('%s has been published to S3! ☁️'), __version);
      resolve();
    });
  });
}
1301557
function createStream (options) {
        options = options || {}

        var stream = through2.obj(function transform (chunk, encoding, cb) {
            stream.push(options.objectMode ? chunk : JSON.stringify(chunk)+'\n')
            cb()
        })
        stream.close = function close () {
            setImmediate(function () {
                stream.push(null)
                changes.unpipe(stream)
            })
            numStreams--
        }
        changes.pipe(stream)
        numStreams++
        return stream
    }
492708
async function archiveGitTree(repPath, tree, archive) {
  // recursively collect all entries (blobs and trees)
  const allEntries = await collectTreeEntries(repPath, tree, [], '');

  const process = async ({ type, oid, path }) => {
    if (type === 'tree' || type === 'commit') {
      // directory or submodule
      archive.append(null, { name: `${path}/` });
    } else {
      // blob
      const stream = await createBlobReadStream(repPath, oid);
      archive.append(stream, { name: path });
    }
  };

  return new Promise((resolve, reject) => {
    async.eachSeries(
      allEntries,
      async.asyncify(process),
      (err) => {
        if (err) {
          reject(err);
        } else {
          resolve(archive);
        }
      },
    );
  });
}
876028
function bundle() {
    return bundler.bundle()
        // log errors if they happen
        .on('error', gutil.log.bind(gutil, 'Browserify Error'))
        .pipe(source('nutella_lib.js'))
        .pipe(gulp.dest('./dist'));
}
1095999
function build (stream) {
  return stream
    .pipe(plumber())
    .pipe(tap((file) => {
      log.start('build')
        .action('Building JS file')
        .data(paths.fromJs(file.path))
        .send();
    }))
    .pipe(babel(config))
    .pipe(gulp.dest(paths.get.js.dest))
    .pipe(tap((file) => {
      log.success('build')
        .action('Compiled JS File')
        .data(paths.from(paths.get.js.dest, file.path))
        .send();
    }));
}