當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript CLIOptions.hasFlag方法代碼示例

本文整理匯總了TypeScript中aurelia-cli.CLIOptions.hasFlag方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript CLIOptions.hasFlag方法的具體用法?TypeScript CLIOptions.hasFlag怎麽用?TypeScript CLIOptions.hasFlag使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在aurelia-cli.CLIOptions的用法示例。


在下文中一共展示了CLIOptions.hasFlag方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: runWebpack

function runWebpack(done) {
  // https://webpack.github.io/docs/webpack-dev-server.html
  let opts = {
    host: 'localhost',
    publicPath: config.output.publicPath,
    filename: config.output.filename,
    hot: project.platform.hmr || CLIOptions.hasFlag('hmr'),
    port: project.platform.port,
    contentBase: config.output.path,
    historyApiFallback: true,
    open: project.platform.open,
    stats: {
      colors: require('supports-color')
    },
    https: config.devServer.https
  } as any;

  if (project.platform.hmr || CLIOptions.hasFlag('hmr')) {
    config.plugins.push(new webpack.HotModuleReplacementPlugin());
    config.entry.app.unshift(`webpack-dev-server/client?http://${opts.host}:${opts.port}/`, 'webpack/hot/dev-server');
  }

  const compiler = webpack(config);
  let server = new Server(compiler, opts);

  // tslint:disable-next-line:only-arrow-functions
  server.listen(opts.port, opts.host, function(err) {
    if (err) { throw err; }

    reportWebpackReadiness(opts);
    done();
  });
}
開發者ID:jbockle,項目名稱:aurelia-json-schema-form,代碼行數:33,代碼來源:run.ts

示例2: Karma

let karma = done => {
  new Karma({
    configFile: path.join(__dirname, '/../../test/karma.conf.js'),
    singleRun: !CLIOptions.hasFlag('watch'),
    autoWatch: CLIOptions.hasFlag('watch')
  }, function(exitCode) {
    console.log('Karma has exited with ' + exitCode)
    process.exit(exitCode)
  }).start();
};
開發者ID:AshleyGrant,項目名稱:cli,代碼行數:10,代碼來源:karma.ts

示例3: runWebpack

function runWebpack(done) {
  // https://webpack.github.io/docs/webpack-dev-server.html
  let opts = {
    host: '0.0.0.0',
    publicPath: config.output.publicPath,
    filename: config.output.filename,
    hot: project.platform.hmr || CLIOptions.hasFlag('hmr'),
    port: project.platform.port,
    contentBase: config.output.path,
    historyApiFallback: true,
    open: project.platform.open,
    stats: {
      colors: require('supports-color')
    }
  } as any;

  if (!CLIOptions.hasFlag('watch')) {
    opts.lazy = true;
  }

  if (project.platform.hmr || CLIOptions.hasFlag('hmr')) {
    config.plugins.push(new webpack.HotModuleReplacementPlugin());
    config.entry.app.unshift(`webpack-dev-server/client?http://${opts.host}:${opts.port}/`, 'webpack/hot/dev-server');
  }

  const compiler = webpack(config);
  let server = new Server(compiler, opts);

  server.listen(opts.port, opts.host, function(err) {
    if (err) throw err;

    if (opts.lazy) {
      buildWebpack(() => {
        reportWebpackReadiness(opts);
        done();
      });
    } else {
      reportWebpackReadiness(opts);
      done();
    }
  });
}
開發者ID:adamfur,項目名稱:helix,代碼行數:42,代碼來源:run.ts

示例4: runProtractor

export function runProtractor(done) {
  return gulp.src(`${e2ePath}/**.js`)
    .pipe(protractor({
      configFile: __dirname + '/../../protractor.conf.js',
      args: [
        '--baseUrl',
        CLIOptions.hasFlag('baseUrl') ? CLIOptions.getFlagValue('baseUrl') : 'http://127.0.0.1:9000'
      ]
    }))
    .on('end', function() { done(); })
    .on('error', function(e) { throw e; });
};
開發者ID:j-party,項目名稱:game,代碼行數:12,代碼來源:e2e.ts

示例5: default

export default (cb) => {
  let options = packageJson.jest;
  
  if (CLIOptions.hasFlag('watch')) {
    Object.assign(options, { watch: true});
  }

  jest.runCLI(options, [path.resolve(__dirname, '../../')], (result) => {
    if(result.numFailedTests || result.numFailedTestSuites) {
      cb(new gutil.PluginError('gulp-jest', { message: 'Tests Failed' }));
    } else {
      cb();
    }
  });
};
開發者ID:reyno-uk,項目名稱:cli,代碼行數:15,代碼來源:jest.ts

示例6: browserSync

 done => {
   browserSync({
     online: false,
     open: CLIOptions.hasFlag('open'),
     port: 9000,
     logLevel: 'silent',
     server: {
       baseDir: [project.platform.baseDir],
       middleware: [historyApiFallback(), function(req, res, next) {
         res.setHeader('Access-Control-Allow-Origin', '*');
         next();
       }]
     }
   }, function (err, bs) {
     if (err) return done(err);
     let urls = bs.options.get('urls').toJS();
     log(`Application Available At: ${urls.local}`);
     log(`BrowserSync Available At: ${urls.ui}`);
     done();
   });
 }
開發者ID:AshleyGrant,項目名稱:cli,代碼行數:21,代碼來源:run.ts

示例7: done

      let urls = bs.options.get('urls').toJS();
      console.log(`Application Available At: ${urls.local}`);
      console.log(`BrowserSync Available At: ${urls.ui}`);
      done();
    });
  }
);

let refresh = gulp.series(
  build,
  reload
);

let watch = function() {
  gulp.watch(project.transpiler.source, refresh).on('change', onChange);
  gulp.watch(project.markupProcessor.source, refresh).on('change', onChange);
}

let run;

if (CLIOptions.hasFlag('watch')) {
  run = gulp.series(
    serve,
    watch
  );
} else {
  run = serve;
}

export default run;
開發者ID:openiddict,項目名稱:openiddict-samples,代碼行數:30,代碼來源:run.ts

示例8: Karma

let karma = done => {
  new Karma({
    configFile: __dirname + '/../../karma.conf.js',
    singleRun: !CLIOptions.hasFlag('watch')
  }, done).start();
};
開發者ID:Resounding,項目名稱:Jobs-Web,代碼行數:6,代碼來源:test.ts

示例9: readProjectConfiguration

let build = gulp.series(
  readProjectConfiguration,
  gulp.parallel(
    transpile,
    processMarkup,
    processCSS,
    copyFiles
  ),
  lint,
  writeBundles
);

let main;

if (CLIOptions.taskName() === 'build' && CLIOptions.hasFlag('watch')) {
  main = gulp.series(
    build,
    (done) => { watch(); done(); }
  );
} else {
  main = build;
}

function readProjectConfiguration() {
  return buildCLI.src(project);
}

function writeBundles() {
  return buildCLI.dest();
}
開發者ID:TylerLeite,項目名稱:supa-kyapucha-gemu,代碼行數:30,代碼來源:build.ts

示例10: unit

export function unit(done) {
  new Karma({
    configFile: __dirname + '/../../karma.conf.js',
    singleRun: !CLIOptions.hasFlag('watch')
  }, done).start();
}
開發者ID:Andromia,項目名稱:web,代碼行數:6,代碼來源:test.ts


注:本文中的aurelia-cli.CLIOptions.hasFlag方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。