adobe-photoshop / generator-core

Core Node.js library for Adobe Photoshop CC's Generator extensibility layer
MIT License
692 stars 97 forks source link

Add a warn about symlink plugins not being supported anymore #421

Closed maxcnunes closed 1 year ago

maxcnunes commented 4 years ago

Hey there πŸ‘‹

A recent change broke the plugins local development setup for me https://github.com/adobe-photoshop/generator-core/pull/419. I used to use symlink to keep the plugin I am working on in development in a different folder:

/Users/myuser/Development/mycompany/generator
β”œβ”€β”€ generator-core
└── plugins
    └── myplugin -> /Users/myuser/Development/mycompany/myplugin

With that recent change, any dependency of my plugin returns this error message:

Unable to load plugin at '/Users/myuser/Development/mycompany/generator/plugins/myplugin': Could not load plugin at path '/Users/myuser/Development/mycompany/generator/plugins/myplugin': Cannot find module 'some-dependency-of-myplugin'

That happens because that recent change hacks the modules loading system and only allows modules to be loaded from the generator directory. But because I am using symlink it gets the resolved path to the original source which is in a different directory and it blocks any module from being loaded.

It took me a few hours to understand this was the problem. So, it would be nice to at least show a warn message in case other people go through the same issue. Or if we could have that recent change disabled in development it would allow us using symlink back in development.

mcilroyc commented 4 years ago

Sorry @maxcnunes. For the short term, I just posted a message here https://groups.google.com/g/adobe-generator-dev/c/QEBYEgdSFT4 and added a warning in the documentation https://github.com/adobe-photoshop/generator-core/wiki/Generator-Development-Environment-Setup#run-generator.

maxcnunes commented 4 years ago

I pushed a change that adds back to the relative plugins path support. But no worries if you rather keep things as is. Thanks.

maxcnunes commented 4 years ago

hey @mcilroyc I noticed that even if I copy the plugin folder instead of using symlink, that module restriction change still breaks the generator if I have any module in my plugin using npm-link. How about we add an argument option to disable that strict rule in development?

node app.js -v -f ~/plugins --dev

or

node app.js -v -f ~/plugins --no-module-loading-restriction

or

node app.js -v -f ~/plugins --insecure