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

Local Slush generators? #5

Closed
kokujin opened this issue May 12, 2014 · 8 comments
Closed

Local Slush generators? #5

kokujin opened this issue May 12, 2014 · 8 comments
Milestone

Comments

@kokujin
Copy link

kokujin commented May 12, 2014

When would it be possible to use locally installed Slush generators?

@joakimbeng
Copy link
Member

@kokujin thanks for the request! I'll add it in the next version then (v.1.1.0).

blai pushed a commit to blai/slush that referenced this issue May 20, 2014
blai pushed a commit to blai/slush that referenced this issue May 20, 2014
@Eruant
Copy link

Eruant commented Oct 13, 2014

You can alway create a local version and use npm link. You should then be able to call slush my-pkg without it being uploaded to npm.

@julianpinedayyz
Copy link

I have one running like Eruant suggests. I t works great. Still on the works but does the trick.

@joakimbeng
Copy link
Member

I'm thinking of extracting the "find global or local modules by pattern"-functionality to a separate module, and then use it in Slush. Haven't come that far yet though :)

@joakimbeng joakimbeng added this to the 2.0 milestone Feb 23, 2015
@ghost
Copy link

ghost commented May 4, 2015

I expect the same behavior as gulp...both the generators and slush should be installed locally. The global slush should only look for the local slush. The solution that @Eruant suggests doesn't work the moment two projects need to use different versions of a generator. I was hoping local installation was what slush offered over yeoman. It is disappointing to see the same requirement of globals.

@andreasgrimm
Copy link

any news on this one?

@joakimbeng
Copy link
Member

Until slush is looking for both local and global generators by default a good workaround is to install both slush and the generators locally, e.g: npm install --save-dev slush slush-angular.
By adding node_modules/.bin to your PATH calling slush will call the local module and also list the local generators.

@ghost
Copy link

ghost commented Jan 10, 2016

@joakimbeng Thank you for pointing out that a local install does work from npm run scripts (which adds node_modules/.bin to PATH).

Global install npm i slush slush-angular -g:

$ slush -v
[slush] 1.1.1

$ slush
[slush] Installed generators
[slush] └── angular (0.4.5)

$ slush angular
[slush] Using slushfile /Users/tmpUser/.nvm/versions/node/v0.12.9/lib/node_modules/slush-angular/slushfile.js
[18:16:11] Starting 'angular:default'...
[?] What do you want to name your AngularJS app? (tmp) 

Local install npm i [email protected] [email protected] --save-dev with "slush":"slush" in the scripts section of package.json:

$ npm run slush -- -v

> [email protected] slush /Users/tmpUser/tmp/tmp
> slush "-v"

[slush] 1.0.0

$ npm run slush

> [email protected] slush /Users/tmpUser/tmp/tmp
> slush

[slush] Installed generators
[slush] └── angular (0.4.0)

$ npm run slush angular

> [email protected] slush /Users/tmpUser/tmp/tmp
> slush "angular"

[slush] Using slushfile /Users/tmpUser/tmp/tmp/node_modules/slush-angular/slushfile.js
[18:06:24] Starting 'angular:default'...
[?] What do you want to name your AngularJS app? (tmp) 

I actually really like this behavior. I wonder if adding this strategy for local generators to the documentation would be enough.

NOTE: The version of npm shipped with node v0.10 doesn't support this behavior of passing arguments/options to run-scripts.

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

5 participants