本文整理汇总了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);
});
};
示例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);
});
}
示例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);
示例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);