本文整理汇总了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', '*');