Skip to content

Commit 25e605b

Browse files
mikeharderharryli0108
authored andcommitted
[TypeSpecValidation/ Format document (Azure#24642)
1 parent 1e201de commit 25e605b

1 file changed

Lines changed: 15 additions & 15 deletions

File tree

eng/tools/TypeSpecValidation/src/TypeSpecValidation.ts

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
1-
import {exec} from "child_process";
2-
import {access} from "fs/promises"
3-
import {parseArgs, ParseArgsConfig} from 'node:util';
1+
import { exec } from "child_process";
2+
import { access } from "fs/promises"
3+
import { parseArgs, ParseArgsConfig } from 'node:util';
44
import path from "path";
5-
import {simpleGit} from 'simple-git';
5+
import { simpleGit } from 'simple-git';
66

7-
async function runCmd(cmd:string, cwd:string) {
7+
async function runCmd(cmd: string, cwd: string) {
88
console.log(`run command:${cmd}`)
99
const { err, stdout, stderr } = await new Promise((res) =>
1010
exec(
11-
cmd,
12-
{ encoding: "utf8", maxBuffer: 1024 * 1024 * 64, cwd: cwd},
13-
(err: unknown, stdout: unknown, stderr: unknown) =>
14-
res({ err: err, stdout: stdout, stderr: stderr })
11+
cmd,
12+
{ encoding: "utf8", maxBuffer: 1024 * 1024 * 64, cwd: cwd },
13+
(err: unknown, stdout: unknown, stderr: unknown) =>
14+
res({ err: err, stdout: stdout, stderr: stderr })
1515
)
1616
) as any;
1717
let resultString = stderr + stdout;
@@ -27,21 +27,21 @@ async function runCmd(cmd:string, cwd:string) {
2727
return resultString as string;
2828
}
2929

30-
async function checkFileExists(file:string) {
30+
async function checkFileExists(file: string) {
3131
return access(file)
3232
.then(() => true)
3333
.catch(() => false)
3434
}
35-
35+
3636
export async function main() {
3737
const args = process.argv.slice(2);
3838
const options = {
3939
folder: {
40-
type: 'string',
41-
short: 'f',
40+
type: 'string',
41+
short: 'f',
4242
},
4343
};
44-
const parsedArgs = parseArgs({ args, options, allowPositionals: true} as ParseArgsConfig);
44+
const parsedArgs = parseArgs({ args, options, allowPositionals: true } as ParseArgsConfig);
4545
const folder = parsedArgs.positionals[0];
4646
console.log("Running TypeSpecValidation on folder:", folder);
4747

@@ -50,7 +50,7 @@ export async function main() {
5050
const actual_npm_prefix = (await runCmd(`npm prefix`, folder)).trim()
5151
if (expected_npm_prefix !== actual_npm_prefix) {
5252
console.log("ERROR: TypeSpec folders MUST NOT contain a package.json, and instead MUST rely on the package.json at repo root.")
53-
throw new Error ("Expected npm prefix: " + expected_npm_prefix +"\nActual npm prefix: " + actual_npm_prefix)
53+
throw new Error("Expected npm prefix: " + expected_npm_prefix + "\nActual npm prefix: " + actual_npm_prefix)
5454
}
5555

5656
// Spec compilation check

0 commit comments

Comments
 (0)