本文整理匯總了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));
}
示例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));
}
示例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);
}));
}
示例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');
}
}
示例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', '*');