當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。