How to use the aurelia-cli.Configuration function in aurelia-cli

To help you get started, we’ve selected a few aurelia-cli examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github aurelia / cli / skeleton / cli-bundler / aurelia_project / tasks__if_babel / transpile.js View on Github external
import gulp from 'gulp';
import plumber from 'gulp-plumber';
import babel from 'gulp-babel';
import notify from 'gulp-notify';
import rename from 'gulp-rename';
import cache from 'gulp-cache';
import project from '../aurelia.json';
import fs from 'fs';
import through from 'through2';
import {CLIOptions, build, Configuration} from 'aurelia-cli';

let env = CLIOptions.getEnvironment();
const buildOptions = new Configuration(project.build.options);
const useCache = buildOptions.isApplicable('cache');

function configureEnvironment() {
  return gulp.src(`aurelia_project/environments/${env}.js`, {since: gulp.lastRun(configureEnvironment)})
    .pipe(rename('environment.js'))
    .pipe(through.obj(function (file, _, cb) {
      // https://github.com/aurelia/cli/issues/1031
      fs.unlink(`${project.paths.root}/${file.relative}`, function () { cb(null, file); });
    }))
    .pipe(gulp.dest(project.paths.root));
}

function buildJavaScript() {
  let transpile = babel(project.transpiler.options);
  if (useCache) {
    // the cache directory is "gulp-cache/projName-env" inside folder require('os').tmpdir()
github aurelia-contrib / aurelia-combo / aurelia_project / tasks / transpile.js View on Github external
import gulp from 'gulp';
import plumber from 'gulp-plumber';
import babel from 'gulp-babel';
import notify from 'gulp-notify';
import rename from 'gulp-rename';
import cache from 'gulp-cache';
import project from '../aurelia.json';
import {CLIOptions, build, Configuration} from 'aurelia-cli';

let env = CLIOptions.getEnvironment();
const buildOptions = new Configuration(project.build.options);
const useCache = buildOptions.isApplicable('cache');

function configureEnvironment() {
  return gulp.src(`aurelia_project/environments/${env}.js`, {since: gulp.lastRun(configureEnvironment)})
    .pipe(rename('environment.js'))
    .pipe(gulp.dest(project.paths.root));
}

function buildJavaScript() {
  let transpile = babel(project.transpiler.options);
  if (useCache) {
    // the cache directory is "gulp-cache/projName-env" inside folder require('os').tmpdir()
    // use command 'au clear-cache' to purge all caches
    transpile = cache(transpile, {name: project.name + '-' + env});
  }
github aurelia / cli / lib / resources / tasks / transpile.js View on Github external
import gulp from 'gulp';
import changedInPlace from 'gulp-changed-in-place';
import plumber from 'gulp-plumber';
import babel from 'gulp-babel';
import sourcemaps from 'gulp-sourcemaps';
import notify from 'gulp-notify';
import rename from 'gulp-rename';
import cache from 'gulp-cache';
import project from '../aurelia.json';
import {CLIOptions, build, Configuration} from 'aurelia-cli';

let env = CLIOptions.getEnvironment();
const buildOptions = new Configuration(project.build.options);
const useCache = buildOptions.isApplicable('cache');

function configureEnvironment() {
  return gulp.src(`aurelia_project/environments/${env}.js`)
    .pipe(changedInPlace({firstPass: true}))
    .pipe(rename('environment.js'))
    .pipe(gulp.dest(project.paths.root));
}

function buildJavaScript() {
  let transpile = babel(project.transpiler.options);
  if (useCache) {
    // the cache directory is "gulp-cache/projName-env" inside folder require('os').tmpdir()
    // use command 'au clear-cache' to purge all caches
    transpile = cache(transpile, {name: project.name + '-' + env});
  }
github buttonwoodcx / bcx-aurelia-reorderable-repeat / aurelia_project / tasks / transpile.js View on Github external
import gulp from 'gulp';
import plumber from 'gulp-plumber';
import babel from 'gulp-babel';
import notify from 'gulp-notify';
import rename from 'gulp-rename';
import cache from 'gulp-cache';
import project from '../aurelia.json';
import {CLIOptions, build, Configuration} from 'aurelia-cli';

let env = CLIOptions.getEnvironment();
const buildOptions = new Configuration(project.build.options);
const useCache = buildOptions.isApplicable('cache');

function configureEnvironment() {
  return gulp.src(`aurelia_project/environments/${env}.js`, {since: gulp.lastRun(configureEnvironment)})
    .pipe(rename('environment.js'))
    .pipe(gulp.dest(project.paths.root));
}

function buildJavaScript() {
  let transpile = babel(project.transpiler.options);
  if (useCache) {
    // the cache directory is "gulp-cache/projName-env" inside folder require('os').tmpdir()
    // use command 'au clear-cache' to purge all caches
    transpile = cache(transpile, {name: project.name + '-' + env});
  }
github stamp-web / stamp-web-aurelia / aurelia_project / tasks / transpile.js View on Github external
import gulp from 'gulp';
import plumber from 'gulp-plumber';
import babel from 'gulp-babel';
import notify from 'gulp-notify';
import rename from 'gulp-rename';
import cache from 'gulp-cache';
import project from '../aurelia.json';
import fs from 'fs';
import through from 'through2';
import { CLIOptions, build, Configuration } from 'aurelia-cli';

let env = CLIOptions.getEnvironment();
const buildOptions = new Configuration(project.build.options);
const useCache = buildOptions.isApplicable('cache');

function configureEnvironment() {
    return gulp.src(`aurelia_project/environments/${env}.js`, {
        since: gulp.lastRun(configureEnvironment)
    })
        .pipe(rename('environment.js'))
        .pipe(through.obj(function (file, _, cb) {
            // https://github.com/aurelia/cli/issues/1031
            fs.unlink(`${project.paths.root}/${file.relative}`, function () {
                cb(null, file);
            });
        }))
        .pipe(gulp.dest(project.paths.root));
}
github zeit / now / test / dev / fixtures / 03-aurelia / aurelia_project / tasks / build.js View on Github external
import webpackConfig from '../../webpack.config';
import webpack from 'webpack';
import project from '../aurelia.json';
import gulp from 'gulp';
import del from 'del';
import {CLIOptions, Configuration} from 'aurelia-cli';
import configureEnvironment from './environment';

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

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

function buildWebpack(done) {
  if (CLIOptions.hasFlag('watch')) {
    compiler.watch({}, onBuild);
  } else {
    compiler.run(onBuild);
    compiler.hooks.done.tap('done', () => done());
github aurelia / cli / lib / resources / tasks / build-webpack.js View on Github external
import webpackConfig from '../../webpack.config';
import webpack from 'webpack';
import project from '../aurelia.json';
import {CLIOptions, Configuration} from 'aurelia-cli';
import gulp from 'gulp';
import configureEnvironment from './environment';
import del from 'del';

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

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

function buildWebpack(done) {
  if (CLIOptions.hasFlag('watch')) {
    compiler.watch({}, onBuild);
  } else {
    compiler.run(onBuild);
    compiler.hooks.done.tap('done', () => done());
github aurelia / cli / lib / resources / tasks / build-webpack.ts View on Github external
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) {