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


TypeScript tsconfig.loadSync函数代码示例

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


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

示例1: generate

export default function generate(argv: GenerateCommand) {
    let manifest = resolveManifestSync();
    let tsconfigPath = tsconfig.resolveSync(argv.sourceDir);

    if (!tsconfigPath) {
        throw new Error('Cannot resolve tsconfig.json in sourceDir');
    }

    let { files, compilerOptions } = tsconfig.loadSync(tsconfigPath);

    let tsCompilerOptions = helpers.rawToTsCompilerOptions(compilerOptions, process.cwd(), ts);
    let ctx = helpers.generateFiles(files, manifest.package, tsCompilerOptions);

    ctx.generateForeignModules(argv.deepForeign);

    let writer = new DocWriter(ctx);
    writer.ensureDir(argv.docDir);
    writer.writeModules(path.join(argv.docDir, 'generated'), !argv.withoutSearch)
        .then(() => {
            helpers.copyUI(argv.docDir, argv.ui);
            process.exit(0);
        })
        .catch((e) => {
            console.error(e);
            process.exit(1);
        });
};
开发者ID:lowkay,项目名称:docscript,代码行数:27,代码来源:generate.ts

示例2: _collectFiles

 private _collectFiles(): string[] {
   console.error("Collecting files");
   try {
     var tsConfig = tsconfig.loadSync(TESTS_DIR);
   } catch (e) {
     return [];
   }
     return (tsConfig.files || []).map(function(file: string) {
         return utils.normalizePath(file);
     });
 }
开发者ID:alexsaveliev,项目名称:srclib-typescript,代码行数:11,代码来源:scan.ts

示例3: createMatchPath

import { createMatchPath } from "../../src";
import * as Tsconfig from "tsconfig";
import * as path from "path";

// Load tsconfig
const loadResult = Tsconfig.loadSync(process.cwd(), undefined);

// Create function that will match paths
const matchPath = createMatchPath(
  path.join(
    path.dirname(loadResult.path),
    loadResult.config.compilerOptions.baseUrl
  ),
  loadResult.config.compilerOptions.paths
);

// Match a path and log result
const result = matchPath("foo/mylib");
console.log(result);
开发者ID:christoffer,项目名称:tsconfig-paths,代码行数:19,代码来源:main.ts

示例4: argParser

    sourceDir: string;
    mainPackage: string;
    outDir: string;
    ui?: string;
    deepForeign?: boolean;
    withoutSearch?: boolean;
}

if (!module.parent) {
    let argParser = ((minimist as any).default || minimist);
    let argv: Argv = argParser(process.argv.slice(2)) as any;

    console.log(argv);

    let tsconfigPath = tsconfig.resolveSync(argv.sourceDir);
    let { files, compilerOptions } = tsconfig.loadSync(tsconfigPath);

    let tsCompilerOptions = helpers.rawToTsCompilerOptions(compilerOptions, process.cwd(), ts);
    let ctx = helpers.generateFiles(files, argv.mainPackage, tsCompilerOptions);

    ctx.generateForeignModules(argv.deepForeign);

    let writer = new DocWriter(ctx);
    writer.ensureDir(argv.outDir);
    writer.writeModules(path.join(argv.outDir, 'generated'), !argv.withoutSearch)
        .then(() => {
            helpers.copyUI(argv.outDir, argv.ui);
            process.exit(0);
        })
        .catch((e) => {
            console.error(e);
开发者ID:blink1073,项目名称:docscript,代码行数:31,代码来源:index.ts


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