从Grunt执行PowerShell脚本

use*_*401 7 powershell gruntjs

我有一个PowerShell脚本(myScript.ps1),我需要在构建过程中运行它.我正在使用Grunt来构建我的代码.我无法弄清楚如何从Grunt运行这个脚本.有谁知道如何从Grunt运行PowerShell脚本,以便在PowerShell脚本完成之前下一个任务不会运行?

谢谢!

bev*_*qua 8

你可以尝试一下grunt-shell

安装

npm install --save-dev grunt-shell
Run Code Online (Sandbox Code Playgroud)

加载

grunt.loadNpmTasks('grunt-shell');
Run Code Online (Sandbox Code Playgroud)

配置

grunt.initConfig({
    shell: {
        ps: {
            options: {
                stdout: true
            },
            command: 'powershell myScript.ps1'
        }
    }
});
Run Code Online (Sandbox Code Playgroud)

使用

grunt shell:ps
Run Code Online (Sandbox Code Playgroud)