当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript gulp.task函数代码示例

本文整理汇总了TypeScript中gulp.task函数的典型用法代码示例。如果您正苦于以下问题:TypeScript task函数的具体用法?TypeScript task怎么用?TypeScript task使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了task函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: join

// Paths to the different tsconfig files of the Universal app.
// Building the sources in the output directory is part of the workaround for
// https://github.com/angular/angular/issues/12249
const tsconfigAppPath = join(outDir, 'tsconfig-build.json');
const tsconfigPrerenderPath = join(outDir, 'tsconfig-prerender.json');

/** Path to the compiled prerender file. Running this file just dumps the HTML output for now. */
const prerenderOutFile = join(outDir, 'prerender.js');

/** Task that builds the universal-app and runs the prerender script. */
task('prerender', ['universal:build'], execTask(
  // Runs node with the tsconfig-paths module to alias the @angular/material dependency.
  'node', ['-r', 'tsconfig-paths/register', prerenderOutFile], {
    env: {TS_NODE_PROJECT: tsconfigPrerenderPath},
    // Errors in lifecycle hooks will write to STDERR, but won't exit the process with an
    // error code, however we still want to catch those cases in the CI.
    failOnStderr: true
  }
));

task(
    'universal:build',
    sequenceTask(
        'clean',
        [
          'cdk:build-release',
          'material:build-release',
          'cdk-experimental:build-release',
          'material-experimental:build-release',
        ],
开发者ID:Nodarii,项目名称:material2,代码行数:30,代码来源:universal.ts

示例2: task

import {task} from 'gulp';
import {serverTask} from '../task_helpers';


task('serve', serverTask());
开发者ID:BernhardRode,项目名称:material2,代码行数:5,代码来源:serve.ts

示例3: task

import { spawn } from 'child_process';
import { createServer } from 'http';
import { join, resolve } from 'path';

import * as connect from 'connect';
import { task } from 'gulp';
import * as serveStatic from 'serve-static';
import { argv } from 'yargs';

import { DIST_E2E_COMPONENTS_ROOT, PROJECT_ROOT, SCRIPTS_ROOT } from '../constants';
import { mergeObjects } from '../util';


task('snapshot', ['e2e.prod'], (done: Function) => {
  snapshot(false, done);
});

task('snapshot.skipBuild', (done: Function) => {
  snapshot(false, done);
});

function snapshot(quickMode: boolean, callback: Function) {
  const snapshotConfig = require('../../snapshot/snapshot.config').config;
  const protractorConfigFile = resolve(SCRIPTS_ROOT, 'snapshot/protractor.config.js');

  const snapshotDefaults = snapshotConfig.platformDefaults || {};
  const snapshotValues: any = mergeObjects(snapshotDefaults, argv || {});

  if (!snapshotConfig.accessKey || !snapshotConfig.accessKey.length) {
    console.error('Missing IONIC_SNAPSHOT_KEY environment variable');
    return callback(new Error('Missing IONIC_SNAPSHOT_KEY environment variable'));
开发者ID:Artfloriani,项目名称:ionic,代码行数:31,代码来源:snapshot.ts

示例4: task

import {task} from 'gulp';
import {join} from 'path';
import {DIST_ROOT} from '../constants';
import {execNodeTask, sequenceTask} from '../util/task_helpers';

/**
 * Prepares the AOT compilation by copying the demo-app and building the components with their
 * associated metadata files from the Angular compiler.
 */
task('aot:deps', sequenceTask(
  'build:devapp',
  ':build:components:release')
);

/** Build the demo-app and a release to confirm that the library is AOT-compatible. */
task('aot:build', sequenceTask('aot:deps', 'aot:compiler-cli'));

/** Build the demo-app and a release to confirm that the library is AOT-compatible. */
task('aot:compiler-cli', execNodeTask(
  '@angular/compiler-cli', 'ngc', ['-p', join(DIST_ROOT, 'tsconfig-aot.json')]
));
开发者ID:Promact,项目名称:md2,代码行数:21,代码来源:aot.ts

示例5: require

const install = require("gulp-install");
const vfs = require('vinyl-fs');
const symlink = require('gulp-sym');
const bump = require('gulp-bump');
const indexDirectory = require('../builder/index-directory');
const beautify = require('gulp-beautify');
const path = require('path');

require('babel-register');
require('app-module-path').addPath(`../npm-link`);

const dirName = path.basename(process.cwd());

gulp.task('default', [
  'transpile',
  'copy-assets',
  // 'link-shattered-lib', 'link-rot-js', 'link-jcson',
  // 'install-node-modules'
]);

gulp.task('transpile',
  [
    'watch-transpile',
    'copy-assets',
    'index-components',
    'index-entity-templates',
    'index-level-generators'
  ], () =>
    gulp.src(['**/*.js', "!gulpfile.js", '!{node_modules,node_modules/**}'])
      .pipe(sourcemaps.init())
      .pipe(babel())
      .pipe(beautify({ indentSize: 2 }))
开发者ID:nathantreid,项目名称:shattered-planes,代码行数:32,代码来源:gulpfile.ts

示例6: if

        if (b.hasOwnProperty(f)) {
            if (!a[f]) {
                a[f] = b[f];
            } else if (typeof b[f] === 'object' && typeof a[f] === 'object') {
                mergeJSON(a[f], b[f]);
            } else {
                a[f] = b[f];
            }
        }
    }
};

/**
 * Nuke old build assetts.
 */
gulp.task('clean', () => ((...globs: string[]) => del(globs))('dist/', 'compiled/', '_package'));

gulp.task('default', ['build']);

gulp.task('package:lib', () => packagr());

gulp.task('pre-build:lib', (next) => runSequence('update:version-lib', next));

gulp.task('pre-build', (next) => {
    const sequence = ['check:route', 'sw:base', 'update:version', 'settings:update', next];
    if (!argv.mock && argv.demo !== true) { sequence.splice(2, 0, ['remove:mock']); }
    runSequence(...sequence);
});

gulp.task('pre-serve', (next) => runSequence(
    'check:flags',
开发者ID:acaprojects,项目名称:a2-widgets,代码行数:31,代码来源:default.ts

示例7: join

/** Path to the directory where all releases are living. */
const releasesDir = join(outputDir, 'releases');

/** Path to the demo-app source directory. */
const demoAppSource = join(packagesDir, 'demo-app');

/** Path to the demo-app output directory. */
const demoAppOut = join(outputDir, 'packages', 'demo-app');

/** Path to the tsconfig file that builds the AOT files. */
const tsconfigFile = join(demoAppOut, 'tsconfig-aot.json');

/** Builds the demo-app and material. To be able to run NGC, apply the metadata workaround. */
task('aot:deps', sequenceTask(
  ['material:build-release', 'cdk:build-release', 'material-moment-adapter:build-release'],
  [':build:devapp:assets', ':build:devapp:scss', 'aot:copy-devapp', 'aot:copy-release'],
));

// As a workaround for https://github.com/angular/angular/issues/12249, we need to
// copy the Material and CDK ESM output inside of the demo-app output.
task('aot:copy-release', () => {
  copySync(join(releasesDir, 'material'), join(demoAppOut, 'material'));
  copySync(join(releasesDir, 'cdk'), join(demoAppOut, 'cdk'));
  copySync(
      join(releasesDir, 'material-moment-adapter'), join(demoAppOut, 'material-moment-adapter'));
});

// // As a workaround for https://github.com/angular/angular/issues/12249, we need to
// copy the demo-app sources to distribution and run the NGC inside of the dist folder.
task('aot:copy-devapp', () => copySync(demoAppSource, demoAppOut));
开发者ID:StevensonNelli,项目名称:material2,代码行数:30,代码来源:aot.ts

示例8:

///<reference path="gulp-insert.d.ts" />
///<reference path="../gulp/gulp.d.ts" />

import * as gulp from 'gulp';
import * as insert from 'gulp-insert';

gulp.task('gulp-insert-tests', () => {
    return gulp.src('*.js')
        .pipe(insert.prepend('/* Inserted using gulp-insert prepend method */\n'))
        .pipe(insert.prepend('\n/* Inserted using gulp-insert append method */'))
        .pipe(insert.wrap(
            '/* Inserted using gulp-insert wrap method */\n',
            '\n/* Inserted using gulp-insert wrap method */'
        ))
        .pipe(insert.transform((contents, file) => {
            var comment = '/* Local file: ' + file.path + ' */\n';
            return comment + contents;
        }))
        .pipe(gulp.dest('gulp-insert'));
});

开发者ID:Agamnentzar,项目名称:DefinitelyTyped,代码行数:20,代码来源:gulp-insert-tests.ts

示例9: task



// NOTE: there are two build "modes" in this file, based on which tsconfig is used.
// When `tsconfig.json` is used, we are outputting ES6 modules and a UMD bundle. This is used
// for serving and for release.
//
// When `tsconfig-spec.json` is used, we are outputting CommonJS modules. This is used
// for unit tests (karma).

/** Path to the tsconfig used for ESM output. */
const tsconfigPath = path.relative(PROJECT_ROOT, path.join(COMPONENTS_DIR, 'tsconfig.json'));

/** [Watch task] Rebuilds (ESM output) whenever ts, scss, or html sources change. */
task(':watch:components', () => {
  watch(path.join(COMPONENTS_DIR, '**/*.ts'), ['build:components', triggerLivereload]);
  watch(path.join(COMPONENTS_DIR, '**/*.scss'), ['build:components', triggerLivereload]);
  watch(path.join(COMPONENTS_DIR, '**/*.html'), ['build:components', triggerLivereload]);
});


/** Builds component typescript only (ESM output). */
task(':build:components:ts', tsBuildTask(COMPONENTS_DIR, 'tsconfig-srcs.json'));

/** Builds components typescript for tests (CJS output). */
task(':build:components:spec', tsBuildTask(COMPONENTS_DIR));

/** Copies assets (html, markdown) to build output. */
task(':build:components:assets', copyTask([
  path.join(COMPONENTS_DIR, '**/*.!(ts|spec.ts)'),
  path.join(PROJECT_ROOT, 'README.md'),
  path.join(PROJECT_ROOT, 'LICENSE'),
开发者ID:justin-echternach,项目名称:material2,代码行数:29,代码来源:components.ts

示例10: minimist

import {buildConfig} from '../packaging/build-config';
import {yellow, green, red, grey} from 'chalk';
import * as minimist from 'minimist';

/** Packages that will be published to NPM by the release task. */
export const releasePackages = [
  'cdk',
  'material',
];

/** Parse command-line arguments for release task. */
const argv = minimist(process.argv.slice(3));

/** Task that builds all releases that will be published. */
task(':publish:build-releases', sequenceTask(
  'clean',
  releasePackages.map(packageName => `${packageName}:build-release`)
));

/** Make sure we're logged in. */
task(':publish:whoami', execTask('npm', ['whoami'], {
  silent: true,
  errMessage: 'You must be logged in to publish.'
}));

task(':publish:logout', execTask('npm', ['logout']));


function _execNpmPublish(label: string, packageName: string): Promise<{}> {
  const packageDir = join(buildConfig.outputDir, 'releases', packageName);

  if (!statSync(packageDir).isDirectory()) {
开发者ID:attilacsanyi,项目名称:material2,代码行数:32,代码来源:publish.ts


注:本文中的gulp.task函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。