Example #1
0
  async build () {
    if (process.env.SKIP_BUILD) {
      log.info('SKIP_BUILD environment variable is true, skipping "build" task')
      return
    }
    if (process.env.DRY_RUN) {
      log.debug('build')
      return
    }

    const start = process.hrtime()

    const asciidoctorCoreDependency = {
      user: this.asciidoctorCoreUser,
      repo: this.asciidoctorCoreRepo,
      version: this.asciidoctorCoreVersion,
      target: this.asciidoctorCoreTarget
    }

    bfs.mkdirsSync('build/css')
    await rebuild(asciidoctorCoreDependency, this.environments)
    generateFlavors(this.asciidoctorCoreTarget, this.environments)
    await uglifyModule.uglify()
    log.success(`Done in ${process.hrtime(start)[0]} s`)
  }
Example #2
0
;(async () => {
  await builder.build()
  bfs.mkdirsSync(builder.benchmarkBuildDir)
  const runners = ['node', 'chrome']
  runners.forEach(runner => bfs.copyToDirSync(`benchmark/${runner}.js`, builder.benchmarkBuildDir))
  bfs.copyToDirSync(`benchmark/stats.js`, builder.benchmarkBuildDir)
  log.task('download sample data from AsciiDoc repository')
  await Promise.all([
    getContentFromAsciiDocRepo('asciidoc.txt', 'build/benchmark/userguide.adoc'),
    getContentFromAsciiDocRepo('customers.csv', 'build/benchmark/customers.csv')
  ])
  log.task('run benchmark')
  if (runner === 'chrome') {
    execModule.execSync('node ' + path.join(builder.benchmarkBuildDir, 'chrome.js'))
  } else if (runner === 'node') {
    execModule.execSync('node ' + path.join(builder.benchmarkBuildDir, 'node.js'))
  } else {
    log.error(`${runner} runner is unsupported!`)
  }
})()
Example #3
0
 environments.forEach(environment => bfs.mkdirsSync(`dist/${environment}`))
Example #4
0
const removeDistDirSync = (environments) => {
  log.debug('remove dist directory')
  bfs.removeSync('dist')
  bfs.mkdirsSync('dist/css')
  environments.forEach(environment => bfs.mkdirsSync(`dist/${environment}`))
}
Builder.prototype.removeDistDirSync = function () {
  log.debug('remove dist directory');
  bfs.removeSync('dist');
  bfs.mkdirsSync('dist/templates');
};
Builder.prototype.removeBuildDirSync = function () {
  log.debug('remove build directory');
  bfs.removeSync('build');
  bfs.mkdirsSync('build');
};