Created
July 23, 2021 15:35
-
-
Save craigbilner/f2f8722720247d0c4783a2b39bd0216d to your computer and use it in GitHub Desktop.
nx executor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const { exec } = require('child_process'); | |
| const { promisify } = require('util'); | |
| const path = require('path'); | |
| module.exports.default = async function tsc(options, context) { | |
| process.chdir( | |
| path.join(context.cwd, context.workspace.projects[context.projectName].root) | |
| ); | |
| try { | |
| const { stdout, stderr } = await promisify(exec)(`tsc -b`); | |
| console.log(stdout); | |
| console.error(stderr); | |
| return { success: stderr === '' }; | |
| } catch (e) { | |
| console.error(e.stdout); | |
| } | |
| return { success: false }; | |
| }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Nice!
context.cwdcould be replaced withcontrext.root.cwdis for your current directory, whilerootis for project root.I got stuck with it once and now promoting all around 😄