Skip to content

Commit

Permalink
[dev-tool] create ./review directory if it doesn't exist (#32638)
Browse files Browse the repository at this point in the history
when extracting api.

This allows us to remove the `dev-tool vendored mkdirp ./review` NPM script
before extracting api report.
  • Loading branch information
jeremymeng authored Jan 21, 2025
1 parent abd5a1a commit 1a9ecfa
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
8 changes: 7 additions & 1 deletion common/tools/dev-tool/src/commands/run/extract-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { leafCommand, makeCommandInfo } from "../../framework/command";

import { createPrinter } from "../../util/printer";
import path from "path";
import { readFile, writeFile, unlink } from "node:fs/promises";
import { readFile, writeFile, unlink, mkdir } from "node:fs/promises";
import { existsSync } from "node:fs";
import { resolveProject } from "../../util/resolveProject";

Expand Down Expand Up @@ -121,6 +121,12 @@ export default leafCommand(commandInfo, async () => {
const packageJsonPath = path.join(projectInfo.path, "package.json");
const packageJson = JSON.parse(await readFile(packageJsonPath, { encoding: "utf-8" }));

const reviewDirPath = path.join(projectInfo.path, "review");
if (!existsSync(reviewDirPath)) {
log.info(`creating directory ${reviewDirPath}`);
await mkdir(reviewDirPath);
}

const apiExtractorJsonPath: string = path.join(projectInfo.path, "api-extractor.json");
const extractorConfigObject = ExtractorConfig.loadFile(apiExtractorJsonPath);
// sub path exports extraction
Expand Down
2 changes: 1 addition & 1 deletion sdk/defendereasm/arm-defendereasm/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
"CHANGELOG.md"
],
"scripts": {
"build": "npm run clean && dev-tool run build-package && dev-tool run vendored mkdirp ./review && dev-tool run extract-api",
"build": "npm run clean && dev-tool run build-package && dev-tool run extract-api",
"build:browser": "echo skipped",
"build:node": "echo skipped",
"build:samples": "echo skipped.",
Expand Down

0 comments on commit 1a9ecfa

Please sign in to comment.