• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

TypeScript globby.default函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了TypeScript中globby.default函数的典型用法代码示例。如果您正苦于以下问题:TypeScript default函数的具体用法?TypeScript default怎么用?TypeScript default使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了default函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。

示例1: lintAsync

export async function lintAsync(filePatterns = defaultFilePatterns) {
  const filePaths = await globby(filePatterns);
  const contents = await Promise.all(filePaths.map(filePath => fs.readFileAsync(filePath, 'utf8')));
  const results = filePaths.map((filePath, index) => {
    const content = contents[index];
    const linter = new TsLinter(filePath, content, options);
    return linter.lint();
  });

  const failures = results.filter(result => !!result.failureCount);
  return failures;
}
开发者ID:Mercateo,项目名称:typedocs,代码行数:12,代码来源:tslint.ts


示例2: resource

export default async function resource(compiler: NexeCompiler, next: () => Promise<any>) {
  const { cwd } = compiler.options
  if (!compiler.options.resources.length) {
    return next()
  }
  const step = compiler.log.step('Bundling Resources...')
  let count = 0
  await each(globs(compiler.options.resources, { cwd }), async file => {
    if (await isDirectoryAsync(file)) {
      return
    }
    count++
    step.log(`Including file: ${file}`)
    await compiler.addResource(file)
  })
  step.log(`Included ${count} file(s). ${(compiler.resourceSize / 1e6).toFixed(3)} MB`)
  return next()
}
开发者ID:jaredallard,项目名称:nexe,代码行数:18,代码来源:resource.ts


示例3: reset

  public async reset() {
    this.logWithMetadata(['info', 'optimize:watch_cache'], 'The optimizer watch cache will reset');

    // start by deleting the state file to lower the
    // amount of time that another process might be able to
    // successfully read it once we decide to delete it
    await del(this.statePath);

    // delete everything in optimize/.cache directory
    // except ts-node
    await del(
      await globby(
        [
          normalizePosixPath(this.cachePath),
          `${normalizePosixPath(`!${this.cachePath}/ts-node/**`)}`,
        ],
        { dot: true }
      )
    );

    // delete some empty folder that could be left
    // from the previous cache path reset action
    await deleteEmpty(this.cachePath);

    // delete dlls
    await del(this.dllsPath);

    // re-write new cache state file
    await this.write();

    this.logWithMetadata(['info', 'optimize:watch_cache'], 'The optimizer watch cache has reset');
  }
开发者ID:lucabelluccini,项目名称:kibana,代码行数:32,代码来源:watch_cache.ts


示例4: writeFileAsync

export async function formatAsync(filePatterns = sourceFilePatterns) {
  const filePaths = await globby(filePatterns, { absolute: true });
  const contents = await Promise.all(
    filePaths.map(filePath => readFileAsync(filePath, 'utf8'))
  );

  const fixedFiles: string[] = [];
  await Promise.all(
    filePaths.map(async (filePath, index) => {
      const content = contents[index];
      let formattedContent;

      try {
        formattedContent = format(content, options);
      } catch (err) {
        error(`Couldn't format ${red(filePath)}.`);
        throw err;
      }

      if (content !== formattedContent) {
        fixedFiles.push(filePath);
        await writeFileAsync(filePath, formattedContent);
      }
    })
  );

  return fixedFiles;
}
开发者ID:otbe,项目名称:ws,代码行数:28,代码来源:prettier.ts


示例5: buildProductionProjects

    async () => {
      await buildProductionProjects({ kibanaRoot: tmpDir, buildRoot, onlyOSS: true });

      const files = await globby(['**/*', '!**/node_modules/**'], {
        cwd: buildRoot,
      });

      expect(files.sort()).toMatchSnapshot();
    },
开发者ID:elastic,项目名称:kibana,代码行数:9,代码来源:build_production_projects.test.ts


示例6: getIntlLocales

export async function getIntlLocales(): Promise<LocaleMap> {
  if (!cachedLocales) {
    const intlPath = await resolve('intl');
    const cwd = join(dirname(intlPath), 'locale-data/jsonp');
    const localeFiles = await globby('*.js', { cwd });
    const locales = localeFiles.map((file) => basename(file, '.js'));
    cachedLocales = {};
    locales.forEach((key) => (cachedLocales[key] = true));
  }
  return cachedLocales;
}
开发者ID:Mercateo,项目名称:ws,代码行数:11,代码来源:intl.ts


示例7: generateTypings

export async function generateTypings(
  declarationDir: string,
  filePatterns = sourceFilePatterns
) {
  if (project.typings) {
    debug('Generate typings.');
    const filePaths = await globby(filePatterns);
    const options = {
      declaration: true,
      declarationDir
    };

    const result = createProgram(filePaths, options).emit(
      undefined, // targetSourceFile
      undefined, // writeFile
      undefined, // cancellationToken
      true // emitOnlyDtsFiles
    );

    if (result.diagnostics.length) {
      const message = result.diagnostics
        .map(({ messageText, file, start }) => {
          if (file && start) {
            const pos = file.getLineAndCharacterOfPosition(start);
            const frame = codeFrame(
              file.getFullText(),
              pos.line + 1,
              pos.character + 1,
              {
                highlightCode: true
              }
            );
            return `${messageText}\n${frame}`;
          } else {
            return messageText;
          }
        })
        .join('\n');
      throw `\n${message}\n`;
    }

    // check if they exist at the same place where it is configured in your package.json
    const exist = await existsAsync(join(process.cwd(), project.typings));
    if (!exist) {
      throw `${red('typings')} do not exist in ${project.typings}`;
    }
  }
}
开发者ID:Mercateo,项目名称:ws,代码行数:48,代码来源:typescript.ts


示例8: discoverModules

/**
 * Function to list plugins from a specific directory. The returned array consists of module names
 * relative to the passed-in directory.
 */
async function discoverModules(directory: string): Promise<string[]> {
  // Given the tree structure below, this function returns the array ['Foo', 'Bar', 'Baz']:
  // * plugins/
  //   * Foo/
  //   * Bar.js
  //   * Baz/
  //
  // Here's how:
  // 1. globby('*', cwd: plugins) => [Foo, Bar.js, Baz] (directories don't have suffixes)
  // 2. path.basename(module, .js) => [Foo, Bar, Baz] (extension in basename() is optional)
  //
  // We use path.basename() to prettify the module names. It's compatible with how require() sees
  // the world, as it will attempt to add the .js extension back before falling back to finding
  // an index.js file in the named directory. So long as the modules are given good names, they
  // can be presented to the user directly in a menu or printed out for debugging.
  const modules = await globby('*', { cwd: directory, onlyFiles: false });

  return modules.map(moduleName => path.basename(moduleName, '.js'));
}
开发者ID:forumone,项目名称:generator-web-starter,代码行数:23,代码来源:discoverModules.ts


示例9: through

    files.forEach(filepath => {
        console.log(filepath);
        var bundledStream = through();
        var fileParts = filepath.split('/');
        var directory = fileParts.slice(0, fileParts.length - 1).join('/');
        var filename = fileParts[fileParts.length - 1].replace('.ts', '.out.js');

        if (filename == 'app.js')
            return;

        if (filename.indexOf('.out.out.') !== -1) {
            return;
        }

         console.log(`dir: ${directory} filename: ${filename}`);

        bundledStream
            .pipe(source(filename))
            .pipe(buffer())
            // .pipe(sm.init({loadMaps: true}))
            // .pipe(uglify())
            // .pipe(sm.write('./'))
            .pipe(gulp.dest(directory));

        globby(taskPath, function(err, entries) {
            if (err) {
                bundledStream.emit('error', err);
                return;
            }

            var b = browserify({
                entries: [filepath],
                debug: true,
                paths: ['scripts'],
                noParse:['lodash.js'],
                standalone: 'GLib'

            }).plugin('tsify',{target:'es5'});
            b.bundle().pipe(bundledStream);
        });
    });
开发者ID:cmc19,项目名称:GutiarLibTS,代码行数:41,代码来源:gulpfile.ts



注:本文中的globby.default函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
TypeScript globby.sync函数代码示例发布时间:2022-05-25
下一篇:
TypeScript globalize.format函数代码示例发布时间:2022-05-25
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap