本文整理汇总了TypeScript中read-pkg.default函数的典型用法代码示例。如果您正苦于以下问题:TypeScript default函数的具体用法?TypeScript default怎么用?TypeScript default使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了default函数的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: execa
skipOnWindows(plugin, async () => {
const cwd = path.join(__dirname, '../../tmp/plugin', plugin)
await fs.remove(cwd)
const pkg = await readPkg(path.join(__dirname, '../../node_modules', plugin, 'package.json'))
await execa('git', ['clone', pkg.repository.url.split('+')[1], cwd])
const opts = {cwd, stdio: [0, 1, 2]}
await execa('git', ['checkout', `v${pkg.version}`], opts)
await execa('yarn', [], opts)
await execa('yarn', ['test'], opts)
})
示例2: readPkg
const getTextlintDependencyNames = (dir: string): Promise<Array<string>> => {
return readPkg(dir)
.then((pkg: any) => {
const dependencies = pkg.dependencies || {};
const devDependencies = pkg.devDependencies || {};
const mergedDependencies = ObjectAssign({}, dependencies, devDependencies);
const pkgNames = Object.keys(mergedDependencies);
return pkgNames.filter(pkgName => {
const ruleOrFilter =
pkgName.indexOf(TextlintPackageNamePrefix.filterRule) !== -1 ||
pkgName.indexOf(TextlintPackageNamePrefix.rule) !== -1;
if (pkgName === "textlint-rule-helper") {
return false;
}
return ruleOrFilter;
});
})
.catch(() => {
return [];
});
};
示例3: readPackageJson
export function readPackageJson(dir: string) {
return readPkg(dir, { normalize: false });
}