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


TypeScript posix.resolve方法代码示例

本文整理汇总了TypeScript中path.posix.resolve方法的典型用法代码示例。如果您正苦于以下问题:TypeScript posix.resolve方法的具体用法?TypeScript posix.resolve怎么用?TypeScript posix.resolve使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在path.posix的用法示例。


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

示例1: mainNgcc

export function mainNgcc(args: string[]): number {
  const formats = args[0] ? args[0].split(',') : ['fesm2015', 'esm2015', 'fesm5', 'esm5'];
  const packagePaths = args[1] ? [path.resolve(args[1])] : findPackagesToCompile();
  const targetPath = args[2] ? args[2] : 'node_modules';

  const transformer = new PackageTransformer();
  packagePaths.forEach(packagePath => {
    formats.forEach(format => {
      // TODO: remove before flight
      console.warn(`Compiling ${packagePath} : ${format}`);
      transformer.transform(packagePath, format, targetPath);
    });
  });

  return 0;
}
开发者ID:DeepanParikh,项目名称:angular,代码行数:16,代码来源:main.ts

示例2: findPackagesToCompile

/**
 * Look for packages that need to be compiled.
 * The function will recurse into folders that start with `@...`, e.g. `@angular/...`.
 * Without an argument it starts at `node_modules`.
 */
function findPackagesToCompile(folder: string = 'node_modules'): string[] {
  const fullPath = path.resolve(folder);
  const packagesToCompile: string[] = [];
  readdirSync(fullPath)
      .filter(p => !p.startsWith('.'))
      .filter(p => lstatSync(path.join(fullPath, p)).isDirectory())
      .forEach(p => {
        const packagePath = path.join(fullPath, p);
        if (p.startsWith('@')) {
          packagesToCompile.push(...findPackagesToCompile(packagePath));
        } else {
          packagesToCompile.push(packagePath);
        }
      });

  return packagesToCompile.filter(path => recursiveDirTest(path, hasMetadataFile));
}
开发者ID:DeepanParikh,项目名称:angular,代码行数:22,代码来源:main.ts

示例3: resolve

export function resolve (...paths: string[]): string {
  return path.resolve(process.cwd(), ...paths)
}
开发者ID:checle,项目名称:r.js,代码行数:3,代码来源:path.ts

示例4: walk

///<reference path="typings/tsd.d.ts"/>
import {res as res_define} from '../client/src/hall/HallRes';
import * as fs from 'fs'
var path=require('path').posix;

let files={};
function walk(base, p) {
	var realpath=path.join(base, p);
	var dirList = fs.readdirSync(realpath);
	dirList.forEach(function(item){	
		//var filepath = p+"/"+item;
		var fn=path.join(realpath, item);
		if (fs.statSync(fn).isDirectory()) return walk(base, path.join(p, item));
		files[path.join(p, item)]=1;
	});
}
console.log(__dirname, path.resolve('../../../client/dist/'));
walk(path.resolve('../../../client/dist/'), 'images');

for (let i=0; i<res_define.length; i++) {
	if (files[res_define[i].src]) files[res_define[i].src]='used';
	else {
		console.log('missed', res_define[i].src);
	}
}

for (let n in files) {
	if (files[n]!='used') console.log('unused', n);
}
开发者ID:hUangDDD,项目名称:bally,代码行数:29,代码来源:swipe.ts


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