本文整理汇总了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;
}
示例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));
}
示例3: resolve
export function resolve (...paths: string[]): string {
return path.resolve(process.cwd(), ...paths)
}
示例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);
}