• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

TypeScript grunt.log类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: callback

 (err, result, code) => {
   grunt.verbose.writeln(String(result));
   if (err) {
     grunt.log.errorlns(err);
     callback(err);
   } else {
     grunt.log.ok(config.cmd + ' ' + config.args.join(' ') + ' completed.');
     callback(null, true);
   }
 });
开发者ID:horiuchi,项目名称:grunt-familiar,代码行数:10,代码来源:familiar.ts


示例2: clearCache

export function clearCache(targetName) {
    var cacheDirForTarget = path.join(cacheDir, targetName);
    try {
        if (fs.existsSync(cacheDirForTarget)) {
            rimraf.sync(cacheDirForTarget);
            grunt.log.writeln(('Cleared fast compile cache for target: ' + targetName).cyan);
        }
    }
    catch (ex) {
        grunt.log.writeln(('Failed to clear compile cache for target: ' + targetName).red);
    }
}
开发者ID:MasGaNo,项目名称:grunt-ts,代码行数:12,代码来源:cacheUtils.ts


示例3: runSocko

  /**
   * Calls socko to generate the output node
   * @return {Bluebird<SockoNodeInterface>} the output node
   */
  private runSocko (): Bluebird<SockoNodeInterface> {
    grunt.log.subhead('Running socko')

    let processorOptions = new ProcessorOptionsFactory().create()
    if (this._options.ignores && this._options.ignores.length > 0) {
      let ignoreObject = new Map<string, string>()

      for (let ignoreOption of this._options.ignores) {
        let ignoreSplit = ignoreOption.split(/=/)

        if (ignoreSplit.length === 1) {
          ignoreSplit.unshift('*')
        }

        ignoreObject.set(ignoreSplit[1], ignoreSplit[0])
      }

      processorOptions.processCartridgeNode = node => {
        if (ignoreObject.has(node.name)) {
          if (ignoreObject.get(node.name) === '*') {
            return Bluebird.resolve(new SkippedNodeBuilder().build())
          } else {
            return node.getPath(':')
              .then(
                value => {
                  if (`${ignoreObject.get(node.name)}:${node.name}` === value) {
                    return Bluebird.resolve(new SkippedNodeBuilder().build())
                  } else {
                    return Bluebird.resolve(node)
                  }
                }
              )
          }
        } else {
          return Bluebird.resolve(node)
        }
      }
    }
    if (this._options.renames && this._options.renames.length > 0) {
      let renameObject = new Map<string, string>()

      for (let renameOption of this._options.renames) {
        let splitRenameOption = renameOption.split(/:/)
        renameObject.set(splitRenameOption[0], splitRenameOption[1])
      }
      processorOptions.processResultTreeNode = node => {
        if (renameObject.has(node.name)) {
          node.name = renameObject.get(node.name)
        }
        return Bluebird.resolve(node)
      }
    }
    processorOptions.allowEmptyCartridgeSlots = this._options.ignoreMissing

    return new SockoProcessor().process(
      this._trees.sockoInput,
      this._trees.sockoNode,
      processorOptions
    )
  }
开发者ID:dploeger,项目名称:grunt-socko,代码行数:64,代码来源:SockoRunner.ts


示例4: convertToSockoTrees

  /**
   * Converts the `FileTree`s to `SockoTree`s
   * @return {Bluebird<void>}
   */
  private convertToSockoTrees (): Bluebird<void> {
    grunt.log.subhead('Converting file trees to socko trees')

    let inputConverterOptions = new ConverterOptionsFactory().create()
    let inputConverter = new FileToTreeConverter(inputConverterOptions)

    let hierarchyConverterOptions = new ConverterOptionsFactory().create()
    let hierarchyConverter = new FileToTreeConverter(hierarchyConverterOptions)

    return Bluebird.props({
      input: inputConverter.convert(this._trees.fileInput),
      hierarchy: hierarchyConverter.convert(this._trees.fileHierarchy)
    })
      .then(
        trees => {
          this._trees.sockoHierarchy = trees.hierarchy
          this._trees.sockoInput = trees.input
          return this._trees.sockoHierarchy.getNodeByPath(`:_root:${this._options.node}`, ':')
        }
      )
      .then(
        node => {
          this._trees.sockoNode = node as SockoNodeInterface
          return Bluebird.resolve()
        }
      )
  }
开发者ID:dploeger,项目名称:grunt-socko,代码行数:31,代码来源:SockoRunner.ts


示例5: convertToFileTrees

  /**
   * Converts the directories to `FileTree`
   * @return {Bluebird<void>}
   */
  private convertToFileTrees (): Bluebird<void> {
    grunt.log.subhead('Converting fileInput and fileHierarchy directories to tree.')
    grunt.log.verbose.writeln('Ignoring fileHierarchy path in fileInput path and vice versa while doing so.')

    let inputScanOptions = new ScanOptions(this._paths.input)
    if (this._paths.hierarchy.startsWith(this._paths.input)) {
      inputScanOptions.filter = (filterPath, entry) => {
        return Bluebird.resolve(!path.join(filterPath, entry).endsWith(this._paths.hierarchy))
      }
    }

    let hierarchyScanOptions = new ScanOptions(this._paths.hierarchy)

    if (this._paths.input.startsWith(this._paths.hierarchy)) {
      hierarchyScanOptions.filter = (filterPath, entry) => {
        return Bluebird.resolve(!path.join(filterPath, entry).endsWith(this._paths.input))
      }
    }

    return Bluebird.props({
      input: new FileNode().scan(inputScanOptions),
      hierarchy: new FileNode().scan(hierarchyScanOptions)
    })
      .then(
        trees => {
          this._trees.fileHierarchy = trees.hierarchy
          this._trees.fileInput = trees.input
          return Bluebird.resolve()
        }
      )
  }
开发者ID:dploeger,项目名称:grunt-socko,代码行数:35,代码来源:SockoRunner.ts


示例6: taskFunction

export function taskFunction (this: grunt.task.ITask): void {

  let done = this.async()

  let options = this.options<SockoOptionsInterface>({
    input: null,
    output: null,
    node: null,
    ignores: [],
    renames: [],
    skipIdenticalSockets: false,
    clean: false,
    hierarchy: null,
    ignoreMissing: false
  })

  if (!options.input) {
    grunt.log.error('Please specify an fileInput directory')
    done(false)
  }

  if (!options.output) {
    grunt.log.error('Please specify an output directory')
    done(false)
  }

  if (!options.node) {
    grunt.log.error('Please specify a node')
    done(false)
  }

  let runner = new SockoRunner(options)

  runner.run()
    .catch(
      (error) => {
        grunt.log.error(error.message)
        done(false)
      }
    )
    .then(
      () => {
        done()
      }
    )

}
开发者ID:dploeger,项目名称:grunt-socko,代码行数:47,代码来源:sockoTaskFunction.ts


示例7: convertFromOutputNode

  /**
   * Converts the output node to a directory with files
   * @param {SockoNodeInterface} outputNode the output node to generate
   * @return {Bluebird<void>}
   */
  private convertFromOutputNode (outputNode: SockoNodeInterface): Bluebird<void> {
    grunt.log.subhead('Converting output tree to directory')

    let converterOptions = new ConverterOptionsFactory().create()
    converterOptions.checkBeforeOverwrite = this._options.skipIdenticalSockets
    converterOptions.outputPath = this._paths.output

    return new TreeToFileConverter(converterOptions).convert(outputNode)
  }
开发者ID:dploeger,项目名称:grunt-socko,代码行数:14,代码来源:SockoRunner.ts


示例8: executeNode

    return executeNode([tsc, '@' + tempfilename]).then((result: ICompileResult) => {

        if (task.fast !== 'never' && result.code === 0) {
            resetChangedFiles(newFiles, targetName);
        }

        result.fileCount = files.length;

        fs.unlinkSync(tempfilename);

        grunt.log.writeln(result.output);

        return Promise.cast(result);
    }, (err) => {
开发者ID:ThaNarie,项目名称:grunt-ts,代码行数:14,代码来源:compile.ts


示例9: compileAllFiles

export function compileAllFiles(targetFiles: string[], target: ITargetOptions, task: ITaskOptions, targetName: string): Promise<ICompileResult> {

    // Make a local copy so we can modify files without having external side effects
    var files = _.map(targetFiles, (file) => file);

    var newFiles: string[] = files;
    if (task.fast === 'watch') { // if we only do fast compile if target is watched

        // if this is the first time its running after this file was loaded
        if (cacheClearedOnce[grunt.task.current.target] === undefined) {

            // Then clear the cache for this target 
            clearCache(targetName);
        }
    }
    if (task.fast !== 'never') {
        if (target.out) {
            grunt.log.writeln('Fast compile will not work when --out is specified. Ignoring fast compilation'.cyan);
        }
        else {
            newFiles = getChangedFiles(files, targetName);

            if (newFiles.length !== 0) {
                files = newFiles;

                // If outDir is specified but no baseDir is specified we need to determine one
                if (target.outDir && !target.baseDir) {
                    target.baseDir = utils.findCommonPath(files, '/');
                }
            }
            else {
                grunt.log.writeln('No file changes were detected. Skipping Compile'.green);
                return new Promise((resolve) => {
                    var ret: ICompileResult = {
                        code: 0,
                        fileCount: 0,
                        output: 'No files compiled as no change detected'
                    };
                    resolve(ret);
                });
            }
        }
    }

    // Transform files as needed. Currently all of this logic in is one module
    transformers.transformFiles(newFiles, targetFiles, target, task);

    // If baseDir is specified create a temp tsc file to make sure that `--outDir` works fine
    // see https://github.com/grunt-ts/grunt-ts/issues/77
    var baseDirFile: string = '.baseDir.ts';
    var baseDirFilePath: string;
    if (target.outDir && target.baseDir && files.length > 0) {
        baseDirFilePath = path.join(target.baseDir, baseDirFile);
        if (!fs.existsSync(baseDirFilePath)) {
            grunt.file.write(baseDirFilePath, '// Ignore this file. See https://github.com/grunt-ts/grunt-ts/issues/77');
        }
        files.push(baseDirFilePath);
    }

    // If reference and out are both specified.
    // Then only compile the updated reference file as that contains the correct order
    if (target.reference && target.out) {
        var referenceFile = path.resolve(target.reference);
        files = [referenceFile];
    }

    // Quote the files to compile. Needed for command line parsing by tsc
    files = _.map(files, (item) => '"' + path.resolve(item) + '"');

    var args: string[] = files.slice(0);

    // boolean options
    if (task.sourceMap) {
        args.push('--sourcemap');
    }
    if (task.declaration) {
        args.push('--declaration');
    }
    if (task.removeComments) {
        args.push('--removeComments');
    }
    if (task.noImplicitAny) {
        args.push('--noImplicitAny');
    }
    if (task.noResolve) {
        args.push('--noResolve');
    }

    // string options
    args.push('--target', task.target.toUpperCase());
    args.push('--module', task.module.toLowerCase());

    // Target options:
    if (target.out) {
        args.push('--out', target.out);
    }
    if (target.outDir) {
        if (target.out) {
            console.warn('WARNING: Option "out" and "outDir" should not be used together'.magenta);
        }
//.........这里部分代码省略.........
开发者ID:ThaNarie,项目名称:grunt-ts,代码行数:101,代码来源:compile.ts


示例10: getTsc

function getTsc(binPath: string): string {
    var pkg = JSON.parse(fs.readFileSync(path.resolve(binPath, '..', 'package.json')).toString());
    grunt.log.writeln('Using tsc v' + pkg.version);

    return path.join(binPath, 'tsc');
}
开发者ID:ThaNarie,项目名称:grunt-ts,代码行数:6,代码来源:compile.ts



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
TypeScript grunt.util类代码示例发布时间:2022-05-25
下一篇:
TypeScript grunt.file类代码示例发布时间:2022-05-25
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap