本文整理汇总了TypeScript中pkg-dir.default函数的典型用法代码示例。如果您正苦于以下问题:TypeScript default函数的具体用法?TypeScript default怎么用?TypeScript default使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了default函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: Promise
it('bundleable by webpack with no errors', async function() {
this.timeout(50000);
const memoryFS = new MemoryFS();
const rootPath = await pkgDir(__dirname);
const compiler = webpack({
mode: 'development',
entry: {
main: path.join(rootPath!, 'dist', 'src', 'lib', 'service.js')
},
node: {
path: 'empty', // users should provide alias to path-webpack
net: 'empty',
fs: 'empty',
module: 'empty'
}
});
compiler.outputFileSystem = memoryFS;
await new Promise((res, rej) =>
compiler.run((err, stats) => {
if (err || stats.hasErrors()) {
rej(err || new Error(stats.toString()));
} else {
res();
}
})
);
});
示例2: install
public static async install (
puppetModule : string,
puppetVersion = 'latest',
): Promise<void> {
log.info('PuppetManager', 'install(%s@%s) please wait ...', puppetModule, puppetVersion)
await npm.install(
`${puppetModule}@${puppetVersion}`,
{
cwd : await pkgDir(__dirname),
output : true,
save : false,
},
)
log.info('PuppetManager', 'install(%s@%s) done', puppetModule, puppetVersion)
}
示例3: run
async function run() {
const rootPath = await pkgDir()
const isInPackage = rootPath !== null
if (isInPackage) {
const scriptsPath = join(rootPath, 'node_modules', '.bin', 'tux-scripts')
const insideTuxProject = await fs.pathExists(scriptsPath)
if (insideTuxProject) {
// tslint:disable-next-line:no-console
console.log(`Inside ${chalk.cyan('tux')} project.`)
require(scriptsPath)
return
}
}
// tslint:disable-next-line:no-console
console.log(`Not inside ${chalk.cyan('tux')} project.`)
require('./new')
}
示例4: installAll
public static async installAll (): Promise<void> {
log.info('PuppetManager', 'installAll() please wait ...')
const moduleList: string[] = []
for (const puppetModuleName of Object.keys(PUPPET_DEPENDENCIES)) {
const version = PUPPET_DEPENDENCIES[puppetModuleName as any as PuppetModuleName]
if (version !== '0.0.0') {
moduleList.push(`${puppetModuleName}@${version}`)
}
}
await npm.install(
moduleList,
{
cwd : await pkgDir(__dirname),
output : true,
save : false,
},
)
}
示例5: suiteSetup
suiteSetup(async () => {
rootDir = await pkgDir(__dirname);
});