From afad9a13290825fae02b18d23a035766b05fa3d0 Mon Sep 17 00:00:00 2001 From: Albert Date: Tue, 25 Jul 2023 12:32:06 -0700 Subject: [PATCH] tsv path requirement check --- .../TypeSpecValidation/src/TypeSpecValidation.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/eng/tools/TypeSpecValidation/src/TypeSpecValidation.ts b/eng/tools/TypeSpecValidation/src/TypeSpecValidation.ts index 447f73d6ecae..f8adabca363c 100755 --- a/eng/tools/TypeSpecValidation/src/TypeSpecValidation.ts +++ b/eng/tools/TypeSpecValidation/src/TypeSpecValidation.ts @@ -48,6 +48,17 @@ export async function main() { const folder = parsedArgs.positionals[0]; console.log("Running TypeSpecValidation on folder:", folder); + // Verify specs' path requirements + let leafDir = folder.substring(folder.lastIndexOf(path.sep) + 1); + if (leafDir.includes(".") && !/\w\.[A-Z]/.test(leafDir)) { + throw new Error( + "Please rename the folder " + + leafDir + + " to " + + leafDir.replace(/\.\w/g, (l) => l.toUpperCase()) + ); + } + // Verify all specs are using root level pacakge.json let expected_npm_prefix = process.cwd(); const actual_npm_prefix = (await runCmd(`npm prefix`, folder)).trim();