当前位置: 首页>>代码示例>>TypeScript>>正文


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

本文整理汇总了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;未经允许,请勿转载。