Skip to content

Commit

Permalink
feat(nx-tools): add nx executor for running interactive commands
Browse files Browse the repository at this point in the history
  • Loading branch information
overbit committed Nov 23, 2023
1 parent 05f3dad commit 2cecb60
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 0 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,7 @@
"eslint-plugin-react": "7.32.2",
"eslint-plugin-react-hooks": "4.6.0",
"eslint-plugin-storybook": "^0.6.14",
"execa": "^5.1.1",
"generate-package-json-webpack-plugin": "^2.6.0",
"get-port": "^5.1.1",
"google-libphonenumber": "^3.2.31",
Expand Down
17 changes: 17 additions & 0 deletions tools/nx-tools/src/executors/run-interactive-command/executor.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import * as execa from "execa";

export default async function buildExecutor(options: {
command: string;
cwd?: string;
}) {
console.info(`🟡 Executing workspace:run-command...`);

await execa.command(options.command, {
cwd: options.cwd,
stdio: [process.stdin, process.stdout, "pipe"],
});

console.info(`✅ Executing workspace:run-command finished!`);

return { success: true };
}
16 changes: 16 additions & 0 deletions tools/nx-tools/src/executors/run-interactive-command/schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"$schema": "http://json-schema.org/schema",
"type": "object",
"cli": "nx",
"properties": {
"command": {
"type": "string",
"description": "The command to run"
},
"cwd": {
"type": "string",
"description": "The working directory to run the command in"
}
},
"required": ["command"]
}

0 comments on commit 2cecb60

Please sign in to comment.