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

TypeScript fs-extra-promise.readJsonSync函数代码示例

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

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



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

示例1: toMarkdown

export function toMarkdown(typeDocJsonFile: string): string {
  const source = readJsonSync(typeDocJsonFile);

  const markdown = new Markdown(source);

  return markdown.getText();
}
开发者ID:Mercateo,项目名称:typedocs,代码行数:7,代码来源:index.ts


示例2: getTypes

function getTypes() {
  // it looks like types need to be converted to an absolute path for ForkTsCheckerWebpackPlugin
  // we need to do this for "../dist-i18n" mostly
  if (project.ws.tsconfigPath) {
    const config = readJsonSync(project.ws.tsconfigPath);
    if (config.compilerOptions && config.compilerOptions.types) {
      return config.compilerOptions.types.map((type: string) =>
        type.startsWith('.')
          ? join(dirname(project.ws.tsconfigPath!), type)
          : type
      );
    } else {
      return [];
    }
  } else {
    return [];
  }
}
开发者ID:Mercateo,项目名称:ws,代码行数:18,代码来源:options.ts


示例3: readJsonSync

  async: false,
  checkSyntacticErrors: true,
  // `watch` is optional, but docs say it improves performance (less stat calls)
  watch: [project.ws.srcDir, project.ws.testsDir]
});

export const devtool = 'inline-source-map';

export const devtoolProduction = 'source-map';

export const externalsSpa = project.ws.externals ? [project.ws.externals] : [];

// dirty fix until https://github.com/liady/webpack-node-externals/issues/39 is solved
let isWorkspace = false;
try {
  const pkg = readJsonSync(join(process.cwd(), '..', '..', 'package.json'));
  isWorkspace = !!pkg.workspaces;
} catch (err) {
  // no workspace
}

export const externalsNode = [
  // require json files with nodes built-in require logic
  function(_context: any, request: any, callback: any) {
    if (/\.json$/.test(request)) {
      callback(null, 'commonjs ' + request);
    } else {
      callback();
    }
  },
  // in order to ignore all modules in node_modules folder
开发者ID:otbe,项目名称:ws,代码行数:31,代码来源:options.ts


示例4: readJsonSync

import { join, basename } from 'path';
import chalk from 'chalk';
import { existsSync, readJsonSync } from 'fs-extra-promise';
import {
  parseJsonConfigFileContent,
  readConfigFile,
  sys,
  CompilerOptions
} from 'typescript';

const { yellow } = chalk;

const unvalidatedProject = readJsonSync(join(process.cwd(), 'package.json'));

export const TYPE = {
  SPA: 'spa' as 'spa',
  NODE: 'node' as 'node',
  BROWSER: 'browser' as 'browser'
};

const TYPES = [TYPE.SPA, TYPE.NODE, TYPE.BROWSER];

/**
 * Our i18n settings. Only needed for translated projects.
 */
export interface I18nConfig {
  /**
   * The locales your project supports. A locale consists of a language code (expressed
   * by two lower case characters), a `_` and a country code (expressed by two upper case
   * characters). E.g. valid locales are `'en_GB'`, `'de_AT'`, `'it_IT'` and so on.
   *
开发者ID:Mercateo,项目名称:ws,代码行数:31,代码来源:project.ts


示例5: join

import { readJsonSync, writeFileAsync, readFileAsync } from 'fs-extra-promise';
import { join, relative } from 'path';
import chalk from 'chalk';
import { CLIEngine } from 'eslint';
import codeFrame from 'babel-code-frame';
import { sourceFilePatterns } from '../project';

const { dim, red } = chalk;

// relative from dist/index.js
const configPath = join(__dirname, '..', '.eslintrc.json');
const config = readJsonSync(configPath);
// learn about the caveats of `config.fix = true` here: https://github.com/eslint/eslint/issues/9147
config.fix = true;
const engine = new CLIEngine(config);

interface Message {
  ruleId: string;
  severity: 0 | 1 | 2;
  message: string;
  line: number;
  column: number;
  nodeType: string;
  source: string;
  endLine: number;
  endColumn: number;
}

interface Result {
  filePath: string;
  messages: Array<Message>;
开发者ID:otbe,项目名称:ws,代码行数:31,代码来源:eslint.ts



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
TypeScript fs-extra-promise.removeAsync函数代码示例发布时间:2022-05-25
下一篇:
TypeScript fs-extra-promise.readFileSync函数代码示例发布时间: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