Question:
I have a PowerShell script (myScript.ps1) that I need to run as part of my build process. I’m using Grunt to build my code. I cannot figure out how to run this script from Grunt. Does anyone know how to run a PowerShell script from Grunt such that the next task won’t run until the PowerShell script has completed?
Thank you!
Answer:
You could give a try to grunt-shell
Install
1 2 |
npm install --save-dev grunt-shell |
Load
1 2 |
grunt.loadNpmTasks('grunt-shell'); |
Configure
1 2 3 4 5 6 7 8 9 10 11 |
grunt.initConfig({ shell: { ps: { options: { stdout: true }, command: 'powershell myScript.ps1' } } }); |
Use
1 2 |
grunt shell:ps |