UNPKG

turbo-gulp

Version:

Gulp tasks to boost high-quality projects.

31 lines (30 loc) 1.22 kB
import { Minimatch } from "minimatch"; import { posix as posixPath } from "path"; import * as matcher from "../utils/matcher"; export function resolveTsLocations(options) { const tsconfigJson = options.tsconfigJson !== null ? options.tsconfigJson : posixPath.join(options.srcDir, "tsconfig.json"); const tsconfigJsonDir = posixPath.dirname(tsconfigJson); const rootDir = options.srcDir; let typeRoots = undefined; if (options.customTypingsDir !== null) { const atTypesDir = posixPath.join(posixPath.dirname(options.packageJson), "node_modules", "@types"); typeRoots = [atTypesDir, options.customTypingsDir]; } const outDir = options.buildDir; const relInclude = []; const relExclude = []; const absScripts = []; for (const script of options.scripts) { const pattern = matcher.relative(tsconfigJsonDir, new Minimatch(script)); if (pattern.negate) { relExclude.push(pattern.pattern); } else { relInclude.push(pattern.pattern); } absScripts.push(script); } return { tsconfigJson, tsconfigJsonDir, rootDir, typeRoots, outDir, relInclude, relExclude, absScripts }; }