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

TypeScript grunt.file类代码示例

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

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



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

示例1: testFile

function testFile(test, path: string) {
    var actualFileName = 'test/' + path,
        expectedFileName = 'test/expected/' + path;
    var actual = grunt.file.read(actualFileName);
    var expected = grunt.file.read(expectedFileName);
    test.equal(expected, actual, 'Actual did not match expected:' + grunt.util.linefeed +
        actualFileName + grunt.util.linefeed +
        expectedFileName);
}
开发者ID:MasGaNo,项目名称:grunt-ts,代码行数:9,代码来源:test.ts


示例2: testExpectedFile

function testExpectedFile(test, path: string) {
    var actualFileName = path.replace('\\expected', '').replace('/expected', ''),
        expectedFileName = path;

    var actual = grunt.file.read(actualFileName);
    var expected = grunt.file.read(expectedFileName);
    test.equal(expected, actual, 'Actual did not match expected:' + grunt.util.linefeed +
        actualFileName + grunt.util.linefeed +
        expectedFileName);
}
开发者ID:MasGaNo,项目名称:grunt-ts,代码行数:10,代码来源:test.ts


示例3: testFile

function testFile(test, path: string, whitespaceDifferencesOK = false) {
    var actualFileName = 'test/' + path,
        expectedFileName = 'test/expected/' + path;

    var actual = grunt.file.read(actualFileName);
    var expected = grunt.file.read(expectedFileName);

    if (whitespaceDifferencesOK) {
      actual = actual.replace(/\s/g,'');
      expected = expected.replace(/\s/g,'');
    }

    test.equal(expected, actual, `Actual did not match expected.  Run this to compare:` +
      `${grunt.util.linefeed}kdiff3 "${actualFileName}" "${expectedFileName}"`);
}
开发者ID:davidparsson,项目名称:grunt-ts,代码行数:15,代码来源:test.ts


示例4: testExpectedFile

export function testExpectedFile(test, path: string, whitespaceDifferencesOK = false) {
    let actualFileName = path.replace('\\expected', '').replace('/expected', '')
      .replace('.expected.', '.');
    let expectedFileName = path;

    var actual = grunt.file.read(actualFileName);
    var expected = grunt.file.read(expectedFileName);

    if (whitespaceDifferencesOK) {
      actual = actual.replace(/\s/g,'');
      expected = expected.replace(/\s/g,'');
    }

    test.equal(expected, actual, `Actual did not match expected.  Run this to compare:` +
      `${grunt.util.linefeed}kdiff3 "${actualFileName}" "${expectedFileName}"`);
}
开发者ID:TypeStrong,项目名称:grunt-ts,代码行数:16,代码来源:testHelpers.ts


示例5: executeOtherTool

function executeOtherTool(config: IConfigData, callback: Function): void {
  if (!grunt.file.exists(config.checkFile)) {
    grunt.verbose.writeln(config.checkFile + ' is not found.');
    return callback(null, false);
  }
  grunt.verbose.writeln(config.checkFile + ' is found.');

  grunt.util.spawn(config,
    (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,代码行数:19,代码来源:familiar.ts


示例6: assertFileDoesNotExist

function assertFileDoesNotExist(test, path: string) {
    var exists = grunt.file.exists(path);
    test.equal(false, exists, 'Expected this file to not exist: ' + path);
}
开发者ID:MasGaNo,项目名称:grunt-ts,代码行数:4,代码来源:test.ts


示例7: 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


示例8: compileSuccessfull

export function compileSuccessfull(paths: string[], targetName) {
    // update timestamp
    grunt.file.write(getStampPath(targetName), '');
    // update filehash
    updateHashes(paths, targetName);
}
开发者ID:donaldpipowitch,项目名称:grunt-ts,代码行数:6,代码来源:cacheUtils.ts


示例9: getHashPath

 _.forEach(filePaths, (filePath) => {
     var hashPath = getHashPath(filePath, targetName);
     var hash = generateFileHash(filePath);
     grunt.file.write(hashPath, hash);
 });
开发者ID:donaldpipowitch,项目名称:grunt-ts,代码行数:5,代码来源:cacheUtils.ts


示例10: testFile

function testFile(test, path) {
    var actual = grunt.file.read('test/' + path);
    var expected = grunt.file.read('test/expected/' + path);
    test.equal(expected, actual, 'tested path: ' + path);
}
开发者ID:ThaNarie,项目名称:grunt-ts,代码行数:5,代码来源:test.ts



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
TypeScript grunt.log类代码示例发布时间:2022-05-25
下一篇:
TypeScript grunt.initConfig函数代码示例发布时间: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