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

ZXPs should support installing generator plugins #286

Open
alekbarszczewski opened this issue Jan 20, 2015 · 9 comments
Open

ZXPs should support installing generator plugins #286

alekbarszczewski opened this issue Jan 20, 2015 · 9 comments

Comments

@alekbarszczewski
Copy link

I am not sure where to post this issue.
I am developing extension (extension panel) using CEP5 (runs on PS CC 2014).
It allows to run node.js code from HTML5 environment.
What I am trying to do is to run generator-core from the extension. This works on mac OS however there is a bug on windows (7 64bit). https://github.com/adobe-photoshop/generator-core/blob/master/lib/generator.js#L32 line is a problem because it is trying to reference process.stdout and for some reason it always throws following error on windows (only when node code is executed from HTML5 extension):

Error: Implement me. Unknown stream file type!
    at createWritableStdioStream (node.js:262:15)
    at process.stdout (node.js:278:16)
    at ...\node_modules\generator-core\lib\generator.js:32:28
    at Object.<anonymous> (...\node_modules\generator-core\lib\generator.js:1701:2)  
...

Despite that console.log works both from HTML and node.js code (results are printed in chrome debugger).

I know it's not an issue of generator but could you tell me where I should post this issue? I guess it should go to PS dev team...

@marekhrabe
Copy link
Contributor

Running your own generator is (i think) not recommended. Even Adobe doesn't do that in CEP panels they ship with Photoshop.

The approach that they are using and we are using for almost all plugins at Source is that we separated generator-specific code (basically node.js app) to a module that will be automatically run by default generator after photoshop starts, so we don't need to launch our own and we save system resources. In that node.js app, we create a web server (that listens on localhost) and also a socket server exposing API that we need to make our CEP panel work. Think of it like classic web app, but instead of calling some remote server, you will be XHRing or socketing to 127.0.0.1:port.

(btw: I thing this is a good place for this as CEP repositories are kind of inactive and they even don't respond to e-mails)

@alekbarszczewski
Copy link
Author

Thanks for info. I was using same approach before but since CEP5 it works better (is more stable, at least on mac :) when in "single process". Also before I had to listen for some events in HTML5 extension and send them through socket to generator plugin (listening on localhost) because it was impossible to hook to those events from node.js code. Generally now (on mac) it is much faster and stable when I run both generator + plugin in extension panel. What's more I don't care about changes inside generator-core shipped with PS because I run my own version.

Also I am not sure how you are installing/shipping your extensions but when I run all ( generator + generator plugin + HTML5 panel) in CEP "container" I can ship whole plugin in a single zxp package.

@iwehrman
Copy link
Contributor

Hi @alekbarszczewski. What @marekhrabe said is (as usual) right on: running Generator from within CEP isn't a supported configuration, and his suggested architecture is roughly how Adobe builds its own CEP-Generator plugins. It looks like the exception you're hitting is due to some difference between the CEP JavaScript interpreter and a vanilla Node interpreter, which is the platform on which Generator is intended to be run. I've also asked someone from the CEP team to chime in here about 1) the particular limitation you're seeing; and 2) what the right place is to file a CEP bug. Hope that helps!

@alekbarszczewski
Copy link
Author

Thanks! I have just one question - if I would like to run my generator plugin on top of photoshops default generator then, as far as I know, I would have to use custom plugin installer right? Because if I want to ship plugin in a single zxp package then I cant run any scripts during plugin installation so I am unable to copy generator plugin code to generator plugins folder - am I right?

I think there should be option to automatically ship generator plugin inside zxp package - it could be pointed from manifest file and would be loaded automatically by photoshop default generator.

@iwehrman
Copy link
Contributor

I agree that this ought to be possible... but I'm not sure how to do this or if it actually is possible. @joelrbrandt: do you have any words of wisdom?

@alekbarszczewski
Copy link
Author

Maybe generator core, after it is started, could just iterate over all installed/active extensions (their directories) and look for generator plugins there (some special file or special entry in manifest file?) and load them automatically? It would be quite easy I think but I am not sure if it is possible for generator to list photoshop extensions (it is easy to do that using CEP api). Also not sure which part is initialized first - generator core or extensions?

Another way I can think of (better way I think) is to make it possible to dynamically load generator plugin from extension by sending additional plugins directory to generator core. So when my extension is started I could just tell generator to load plugin from /CEP/extensions/myextension/generator-plugin for example.

@arthurwei1975
Copy link

@iwehrman 's answer is correct. This is not a supported configuration.

Please report CEP issues to https://github.com/Adobe-CEP/CEP-Resources/issues

Thanks

@joelrbrandt
Copy link
Contributor

@alekbarszczewski Unfortunately I don't have any words of wisdom -- there's currently no way for ZXPs to handle generator plugins. What folks are doing now is simply creating their own installers that copy plugins to the third party "Plug-ins/Generator" folder next to the application.

An alternative approach would be to have your CEP panel code do this on first launch. (Folks that are building apps that communicate with Generator do this same thing: copy to the plug-in folder on first launch.)

I'm going to rename this bug to be about supporting generator plugin installation in ZXPs. I can't guarantee we'll prioritize this soon, but at least we can collect some 👍s in this thread to make a case for prioritizing the work.

@joelrbrandt joelrbrandt changed the title generator and CEP5 compatibility on windows ZXPs should support installing generator plugins Feb 8, 2015
@arthurwei1975
Copy link

In order for ZXP to install generator plugins, you can discuss with Nicholas Goodall (goodall@adobe.com), who is responsible for Extension Manager and Adobe Exchange. This sounds like a new feature for Adobe Exchange.

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

No branches or pull requests

6 participants