Skip to content

Commit 1884bdb

Browse files
Extract exec function to a dedicated processes.ts module and update references for better modularity.
1 parent 11873c3 commit 1884bdb

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
lines changed

src/utils/filesystem.ts

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
import * as fs from "node:fs";
2-
import { exec as nodeExec } from "node:child_process";
3-
import { promisify } from "node:util";
42
import { type Config } from "../types/config";
53

64
export const cwd = (): string => {
@@ -34,11 +32,3 @@ export const writeFile = (
3432
): void => {
3533
fs.writeFileSync(filePath(config, filename), content);
3634
};
37-
38-
export const exec = async (command: string): Promise<string> => {
39-
const execAsync = promisify(nodeExec);
40-
41-
const { stdout } = await execAsync(command);
42-
43-
return stdout.toString().trim();
44-
};

src/utils/processes.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import { promisify } from 'node:util'
2+
import { exec as nodeExec } from 'node:child_process'
3+
4+
export const exec = async (command: string): Promise<string> => {
5+
const execAsync = promisify(nodeExec);
6+
7+
const { stdout } = await execAsync(command);
8+
9+
return stdout.toString().trim();
10+
};

src/utils/repository.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import type { Config } from "../types/config";
2-
import { exec } from "./filesystem";
32
import { randomizer } from "./randomizer";
43
import type { GitHub } from "@actions/github/lib/utils";
54
import type { RestEndpointMethodTypes } from "@octokit/plugin-rest-endpoint-methods/dist-types/generated/parameters-and-response-types";
5+
import { exec } from './processes'
66

77
export class Repository {
88
private _config: Config;

0 commit comments

Comments
 (0)