nwjs/grunt-nw-builder

Last update seems to have broken it

Closed this issue · 3 comments

I've had a look and the last minor update seems to have completely broken the code.

options.srcDir = this.data.src; should be options.srcDir = this.data; as before (because you're not making the target an object with a src property, it's just a flat property)

Also, I noticed this could all be simplified to omit the separate options and src target by just doing:

module.exports = function (grunt) {
  grunt.registerMultiTask(
    "nwjs",
    "Package Node.js app as NW.js app",
    async function () {
      const done = this.async();

      let nwbuild = undefined;

      try {
        nwbuild = await import("nw-builder");
        nwbuild = nwbuild.default;
      } catch (e) {
        console.log(e);
      }

      await nwbuild(this.data);
      await done();
    },
  );
};

and then in the Gruntfile (for example):

nwjs: {
   build: {
      platform: ['win'],
      arch: ['ia32'],
      srcDir: "srcdir"
   }
}

Depends on if you want to do away with the options now though.

That'll be me that broke that with #180. I think this area of the code is rather brittle and changing too much version to version. I think this broken behaviour varies depending on if you're using multiple definitions or not. Can you share a reproducing Grunt config?

@CareyJWilliams I have reverted your patch and have released it as v4.6.0 (to match nw-builder's v4.6.4). @butasok Looks like the tests are passing and it should work now.

@CareyJWilliams @butasok I have verified that it works in v4.6.1