當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript pkg-dir.default函數代碼示例

本文整理匯總了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();
                }
            })
        );
    });
開發者ID:wix,項目名稱:stylable-intelligence,代碼行數:30,代碼來源:browser-compatible.spec.ts

示例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)
 }
開發者ID:zixia,項目名稱:wechaty,代碼行數:15,代碼來源:puppet-manager.ts

示例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')
}
開發者ID:aranja,項目名稱:tux,代碼行數:20,代碼來源:cli.ts

示例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,
      },
    )

  }
開發者ID:zixia,項目名稱:wechaty,代碼行數:22,代碼來源:puppet-manager.ts

示例5: suiteSetup

 suiteSetup(async () => {
     rootDir = await pkgDir(__dirname);
 });
開發者ID:wix,項目名稱:stylable-intelligence,代碼行數:3,代碼來源:completion.test.ts


注:本文中的pkg-dir.default函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。