如何以编程方式运行grunt任务nodejs



我需要使用grunt-phonegap-build,我已经通过编程使用了这个方法:

grunt.loadNpmTasks('grunt-phonegap-build');  
  grunt.initConfig({
                "phonegap-build": {
                        debug: {
                              options: {
                                    archive:"myapp.zip",
                                   "appId":"567576",
                                   "user": {
                                        "email":******,
                                        "password":******
                                        },
                                    download:'dist/android.apk'         
                               }
                         }
                  }
                });
  grunt.tasks('phonegap-build', {}, function(args) {
     grunt.log.ok('Done running tasks.');
  });

问题是执行重复相同的过程和"完成运行任务"之后。有时它只执行一次。当我按下按钮时,通过ajax调用此函数。我不知道,你能解释一下吗?如何解决这个问题?

终端流程:

  Running "phonegap-build:debug" (phonegap-build) task
>> Starting upload
>> Upload successful (HTTP 200)
>> Checking build status successful (HTTP 200)
>> Getting download location for ios successful (HTTP 302)
>> Downloading ios app
>> Checking build status successful (HTTP 200)
>> Checking build status successful (HTTP 200)
>> Downloaded ios app
Running "phonegap-build:debug" (phonegap-build) task
>> Starting upload
>> Checking build status successful (HTTP 200)
>> Checking build status successful (HTTP 200)
>> Upload successful (HTTP 200)
>> Checking build status successful (HTTP 200)
>> Getting download location for ios successful (HTTP 302)
>> Downloading android app
>> Checking build status successful (HTTP 200)
>> Checking build status successful (HTTP 200)
>> Downloaded android app
Done, without errors.

如果我在CLI中发出grunt phonegap build命令,请手动执行。它工作得很好。你能帮我吗?

程序化执行咕哝声不能正常工作

请先创建默认任务,然后调用您的自定义phonegap任务。

如果你也在做同样的事情,而我没有得到你完整的gruntfile,所以我可以在这里运行它,

相关内容

  • 没有找到相关文章

最新更新