microsoft/typespec

Public

mirrored from https://github.com/microsoft/typespecAvailable

CodeCommitsIssuesPull requestsActionsInsightsSecurity
a9bc288cda0d8226ce647df708ecca5fb0c4a893

Branches

Tags

  • No tags available.
0Branches0Tags
Go to file
Add file
Code

Clone

HTTPS

Download ZIP

packages/migrate/src/utils.ts

23lines · modecode

1import { globby } from "globby";
2import { join } from "path";
3
4export async function findTypeSpecFiles(root: string, ignore: string[] = []) {
5 return findFiles(
6 [
7 normalizePath(join(root, "**/*.tsp")),
8 normalizePath(join(root, "**/*.cadl")),
9 normalizePath(join(root, "**/cadl-project.yaml")),
10 normalizePath(join(root, "**/tspconfig.yaml")),
11 ],
12 ignore
13 );
14}
15
16export async function findFiles(include: string[], ignore: string[] = []): Promise<string[]> {
17 const patterns = [...include, "!**/node_modules", ...ignore.map((x) => `!${x}`)];
18 return globby(patterns);
19}
20
21export function normalizePath(path: string): string {
22 return path.replace(/\\/g, "/");
23}
24