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


TypeScript CLIOptions.getEnvironment方法代碼示例

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


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

示例1: configureEnvironment

function configureEnvironment() {
  let env = CLIOptions.getEnvironment();

  return gulp.src(`aurelia_project/environments/${env}.js`)
    .pipe(rename('environment.js'))
    .pipe(gulp.dest(project.paths.root));
}
開發者ID:itainteasy,項目名稱:cli,代碼行數:7,代碼來源:build-javascript.ts

示例2: configureEnvironment

function configureEnvironment() {
  let env = CLIOptions.getEnvironment();

  return gulp.src(`aurelia_project/environments/${env}.ts`)
    .pipe(changedInPlace({firstPass:true}))
    .pipe(rename('environment.js'))
    .pipe(gulp.dest(project.paths.root));
}
開發者ID:agileraymond,項目名稱:cli,代碼行數:8,代碼來源:transpile.ts

示例3: configureEnvironment

function configureEnvironment() {
  let env = CLIOptions.getEnvironment();

  return gulp.src(`aurelia_project/environments/${env}${project.transpiler.fileExtension}`)
    .pipe(rename(`environment${project.transpiler.fileExtension}`))
    .pipe(gulp.dest(project.paths.root))
    .pipe(through.obj(function (file, enc,  cb) {
      // https://github.com/webpack/watchpack/issues/25#issuecomment-287789288
      var now = Date.now() / 1000;
      var then = now - 10;
      fs.utimes(file.path, then, then, function (err) { if (err) throw err });
      cb(null, file);
    }));
}
開發者ID:AshleyGrant,項目名稱:cli,代碼行數:14,代碼來源:environment.ts

示例4: Configuration

import * as webpackConfig from '../../webpack.config';
import * as webpack from 'webpack';
import * as project from '../aurelia.json';
import {CLIOptions, Configuration} from 'aurelia-cli';

const buildOptions = new Configuration(project.build.options);
const isProd = CLIOptions.getEnvironment() === 'prod';
const server = buildOptions.isApplicable('server');
const extractCss = buildOptions.isApplicable('extractCss');
const coverage = buildOptions.isApplicable('coverage');

const config = webpackConfig({
  isProd, server, extractCss, coverage
});
const compiler = webpack(config);

function build(done) {
  compiler.run(onBuild);
  compiler.plugin('done', () => done());
}

function onBuild(err, stats) {
  if (err) {
    console.error(err.stack || err);
    if (err.details) console.error(err.details);
    process.exit(1);
  } else {
    process.stdout.write(stats.toString({ colors: require('supports-color') }) + '\n');
  }
}
開發者ID:reyno-uk,項目名稱:cli,代碼行數:30,代碼來源:build-webpack.ts

示例5: onChange

import * as gulp from 'gulp';
import * as browserSync from 'browser-sync';
import * as historyApiFallback from 'connect-history-api-fallback/lib';
import * as project from '../aurelia.json';
import build from './build';
import {CLIOptions} from 'aurelia-cli';

const env = CLIOptions.getEnvironment(),
  baseDir = env === 'prod' ? project.paths.export : '.';

function onChange(path) {
  console.log(`File Changed: ${path}`);
}

function reload(done) {
  browserSync.reload();
  done();
}

let serve = gulp.series(
  build,
  done => {
    browserSync({
      online: false,
      open: false,
      port: 9000,
      logLevel: 'silent',
      server: {
        baseDir: [baseDir],
        middleware: [historyApiFallback(), function(req, res, next) {
          res.setHeader('Access-Control-Allow-Origin', '*');
開發者ID:Resounding,項目名稱:Jobs-Web,代碼行數:31,代碼來源:run.ts


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