當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。