Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error running jsxbin in gulp #26

Open
AaronEcthelion opened this issue May 31, 2021 · 3 comments
Open

Error running jsxbin in gulp #26

AaronEcthelion opened this issue May 31, 2021 · 3 comments

Comments

@AaronEcthelion
Copy link

AaronEcthelion commented May 31, 2021

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.

@runegan
Copy link
Owner

runegan commented May 31, 2021

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.

@AaronEcthelion
Copy link
Author

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!

@runegan
Copy link
Owner

runegan commented Aug 18, 2021

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants