Skip to content

Commit

Permalink
Use execFileSync instead of execSync in gen-flow-types.ts (#537)
Browse files Browse the repository at this point in the history
## Summary:
This addressed https://github.com/Khan/wonder-stuff/security/code-scanning/7

## Test Plan:
- let CI do its thing

Author: kevinbarabash

Reviewers: jeresig

Required Reviewers:

Approved By: jeresig

Checks: ✅ codecov/project, ✅ Test (macos-latest, 16.x), ✅ CodeQL, ✅ Lint, typecheck, and coverage check (ubuntu-latest, 16.x), ✅ gerald, ✅ Prime node_modules cache for primary configuration (ubuntu-latest, 16.x), ⏭  dependabot, ✅ Analyze (javascript)

Pull Request URL: #537
  • Loading branch information
kevinbarabash authored Feb 21, 2023
1 parent c38fc71 commit 3fd414b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 2 additions & 0 deletions .changeset/smooth-wombats-protect.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
---
6 changes: 3 additions & 3 deletions build-scripts/gen-flow-types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {execSync} from "child_process";
import {execFileSync} from "child_process";
import * as path from "path";
import * as fglob from "fast-glob";

Expand All @@ -9,10 +9,10 @@ const files = fglob.sync("packages/wonder-stuff-*/dist/**/*.d.ts", {

for (const inFile of files) {
const outFile = inFile.replace(".d.ts", ".js.flow");
const command = `yarn flowgen ${inFile} -o ${outFile} --add-flow-header`;
const args = ["flowgen", inFile, "-o", outFile, "--add-flow-header"];

try {
execSync(command, {cwd: rootDir});
execFileSync("yarn", args, {cwd: rootDir});
console.log(`✅ wrote: ${outFile}`);
} catch (e) {
console.log(`❌ error processing: ${inFile}: ${e}`);
Expand Down

0 comments on commit 3fd414b

Please sign in to comment.