jsxbin icon indicating copy to clipboard operation
jsxbin copied to clipboard

Error running jsxbin in gulp

Open AaronEcthelion opened this issue 3 years ago • 3 comments

I want to automate my workflow, but this is always giving me error in gulp 4.

My gulp code: `const jsxbin = require('jsxbin');

function toJsxbin() { return jsxbin('myScript.jsx'); }

exports.toJsxbin = toJsxbin;`

Then I type gulp toJsxbin in vscode terminal.

Everytime I got this error: [22:58:46] Starting 'toJsxbin'... [22:58:48] 'toJsxbin' errored after 2.26 s [22:58:48] Error: Error with ESTK: 'unknown' at getESDError (D:\Adobe_Scripting\ZXP_Packaging\node_modules\jsxbin\src\convertScripts.js:32:8)
at convertFileContents (D:\Adobe_Scripting\ZXP_Packaging\node_modules\jsxbin\src\convertScripts.js:56:3) at convertScripts (D:\Adobe_Scripting\ZXP_Packaging\node_modules\jsxbin\src\convertScripts.js:79:27)
at D:\Adobe_Scripting\ZXP_Packaging\node_modules\jsxbin\index.js:61:16

What I am missing? Thx in advance.

AaronEcthelion avatar May 31 '21 15:05 AaronEcthelion

Hi! Difficult to say exactly what is going on, but here are some troubleshooting suggestions:

Have you tried running the same code outside of gulp? Do you get the same error?

How are you referencing the file to convert? Is it an absolute or absolute or relative path?

Are you using variables? Maybe they are giving some wrong values.

What is the contents of the file you are converting? Try with something simpler, maybe there is some issue with the parsing of the code.

Try some of those and get back to me, and I'll take a closer look.

I have found that when jsxbin breaks it is usually either in the file I am trying to convert, the contents has syntax errors, or the path to it, I am not referencing the file correctly.

runegan avatar May 31 '21 15:05 runegan

Sorry for the late reply. And thx for your suggestions. After trying those many times, I finally found what was causing the error. It was the jsx file that I tried to convert that had some syntax errors which broke jsxbin plugin. I uglified the jsx first, which caused error in extendScript. Yes, those uglified conditional statements will easily break extendScript. The jsxbin plugin works fine when I have correct jsx file contents.

This is a great plugin, but I have 2 questions:

  1. Is is possible that there can be a gulp version of this that can return a stream? For now, it is returning a promise object. And I have to write 3 separate tasks and combine them in series() method to finish my workflow. (1) convert jsx to jsxbin. (2) rename the jsxbin back to jsx. (3) delete the remaining jsxbin. But if it can return a stream, I can write all those in one single task using .pipe() method. And this can be piped after something like gulp-include or gulp-uglify, which would be great.

  2. I see that this plugin is implementing jsxbin v2.0. So is it possible that it can implement jsxbin v2.1, which adobe now is using? Or even v3.0? Not sure if adobe app would support v3.0.

Thanks for this great plguin!

AaronEcthelion avatar Jun 08 '21 11:06 AaronEcthelion

hi! Sorry for late reply!

  1. Gulp stream. I don't have any experience writing gulp plugins, so I don't know what that would work for this. Maybe it's better to create another package that is just a gulp wrapper for this? If you or anyone has any idea how to do that, feel free to create it.

  2. Version. I'm not aware of any newer versions of jsxbin. Do you have any more info on that?

runegan avatar Aug 18 '21 11:08 runegan