ignite-cli does not play well with symlinks

Created on 7 Aug 2017  Â·  16Comments  Â·  Source: infinitered/ignite


Linked npm packages are not available as boilerplate

You can try this by using a npm linked package or even by replacing the ignite-{yourBoilerplateName} folder by a symlink.

Create a boilerplate plugin, link it then try to ignite a new app with that boilerplate

#Linking result
/home/libre/.nvm/versions/node/v8.2.1/lib/node_modules/ignite-AutoRnApp -> 
/home/libre/dev/AutoRnApp/ignite/plugins/ignite-AutoRnApp

# Then ignite the app
libre@libre:~/dev$ ignite new BoilerTest -b ignite-AutoRnApp #Also tried without "ignite-" prefix

🔥 igniting app BoilerTest
✖ ignite-AutoRnApp is not available on npm.

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  We also searched in these directories:

libre@libre:~/dev$ ignite doctor
System
  platform           linux                                                                 
  arch               x64                                                                   
  cpu                4 cores           Intel(R) Core(TM) i5-4690K CPU @ 3.50GHz  
  directory          /home/libre/dev                                                       

JavaScript
  node               8.2.1        /home/libre/.nvm/versions/node/v8.2.1/bin/node  
  npm                5.3.0        /home/libre/.nvm/versions/node/v8.2.1/bin/npm   
  yarn               0.27.5       /home/libre/.nvm/versions/node/v8.2.1/bin/yarn  

React Native
  react-native-cli   2.0.1       

Ignite
  ignite             2.0.0        /home/libre/.nvm/versions/node/v8.2.1/bin/ignite  

Android
  java               1.8.0_131    /usr/bin/java            
  android home       -            /home/libre/Android/Sdk  

enhancement

All 16 comments

If I install the new app with relative path it works but then if I delete manualy or with npm uninstall the boilerplate plugin and then link my local plugin, it does not work. The generate command does nothing.

Could you elaborate on how boilerplates packages are managed by ignite cli ?

Well, I understand that ignite cli does not detect symlinks

It’s not that it doesn’t work with symlinks, it’s that it doesn’t check with your global npm packages for boilerplates.

Which is perfectly reasonable to expect.

For now, add the boilerplate with -b /path/to/boilerplate.

Well, that was my first question.
But even if I do that, if I try to replace the folder in node_modules with a symlink, everything is broken. That's why I say it does play nice with symlinks.

What I do now for testing is adding the boilerplate to the current project with ignite add.

Why the cli does not recognize node_module when they are symlinks ?

I needed a way to live test the command file itself.
The way it is tested now is by using ignite-cli with execa which means the command must be available to ignite-cli.
If you just install with -b /path/to/boilerplate, you must change the file in node_module to see updates which is not enjoyable as node_modules containes thousand of dirs.

The best solution for now is to add (ignite add /path/to/boilerplate) the plugin directly into the project so generator is available to project ignite-cli and then live reloads works.

It might be obvious for you as you work with it all day long but it was not for me as the steps described in this tutorial are not suitable for live reload tests.

@skellock I understand if ignite doesn't check global npm packages, but if you run npm link in your boilerplate, then npm link ignite-jhipster in your local app, it creates a symlink in your project's local node_modules pointing to your local boilerplate folder. Ignite stops working after that though.

It's a pain to create anything that uses ignite generate because you have to ignite add every time you make a change. On my system, adding a local ignite plugin takes 15-20 seconds each time.

As a workaround for testing commands, I've been running cp from my local boilerplate folder into my app. This only takes 2 seconds compared to 15-20 seconds, but you still have to run it after any changes
cp -r /full/path/to/your/ignite-jhipster ./node_modules/

@l1br3 Thanks for opening this, it's been on my To-Do list for a while

Why the cli does not recognize node_module when they are symlinks ?

@l1br3 Just looked at this. It's because we're using fs-jetpack's find function which doesn't support searching for symlinks. We can change that.

As far as symlinks and React Native are concerned. That is an exercise in frustration.

Ignite, however, should most certainly support it.

@ruddell our environment is node & npm, symlinks should be supported. Sorry for the grief!

Alright, hopefully https://github.com/szwacz/fs-jetpack/pull/55 will be accepted. Then we can add this.

I tested this workflow locally and it seems to be what we need. :tada:

@skellock Thanks for such a quick fix 😄

ok, PR is in to fs-jetpack. He's cutting a new version. Next step is for me to bump that dependency version on https://github.com/infinitered/gluegun .

Then we'll be set to bask in glorious symlinks my friends.

(unlikely to get to this until the weekend tho)

image

:tada:

Well done for the quick answer and PR ! Hope this will be released soon in my favorite CLI ! <3

Just tested this with master and it's working great, a huge improvement for plugin authors. Thanks again.

Thank YOU ! ;)

Sweet. We'll get a new release of ignite-cli out shortly. I've run out of time again this week. 😿

Was this page helpful?
0 / 5 - 0 ratings

Related issues

whalemare picture whalemare  Â·  3Comments

rammmukul picture rammmukul  Â·  3Comments

GantMan picture GantMan  Â·  3Comments

tayfunyasar picture tayfunyasar  Â·  3Comments

NikitaVr picture NikitaVr  Â·  3Comments