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

Running generate locally #34

Open
kokujin opened this issue Aug 28, 2016 · 8 comments
Open

Running generate locally #34

kokujin opened this issue Aug 28, 2016 · 8 comments

Comments

@kokujin
Copy link

kokujin commented Aug 28, 2016

Is it possible to locally run generate? I would like to avoid installing it gobally.

@tunnckoCore
Copy link

yes, it will work. you should access it wit node_modules/.bin/gen as usual, i believe. but it not make sense, its not so usable that way. by this i mean its uncomfortable

@jonschlinkert
Copy link
Member

If you experience an issue with this, consider it a bug. I'd like for this to be supported. thanks for the issue

@jonschlinkert
Copy link
Member

jonschlinkert commented Sep 1, 2016

its not so usable that way. by this i mean its uncomfortable

I have an idea for this... we already support macros, like this:

$ gen --macro=foo bar baz qux

Which will allow you to run the bar baz qux generators with the $ gen foo command; So when $ gen foo is given, the command is replaced with $ gen bar baz qux.

But we might be able to prepend or append macros to the current command. Which would allow you to do something like this:

$ gen --macro.prepend=local node_modules/.bin/gen

Then, you could just do this:

$ gen local bar baz qux

Which would expand to:

$ gen node_modules/.bin/gen bar baz qux

Thoughts?

edit: I just updated the syntax of the prepend example

cc @doowb

@tunnckoCore
Copy link

Dont think so it's unnecessary, imho. maybe i can be some sort of detection like if task name contains / understand it as path ... hm. in anyway, if we have prepend macro and expand to that you shown, what next? i mean.. $ gen node_modules ... not looks good to me, in anyway it would have some sort of detection as i said.

unnecessary complexity, when i believe it works currently or at least it will be simple fix in the cli.

@jonschlinkert
Copy link
Member

$ gen node_modules ...

why would you do that?

@tunnckoCore
Copy link

tunnckoCore commented Sep 1, 2016

You said it that way.

Which would expand to:
$ gen node_modules/.bin/gen bar baz qux

in which i dont see sense, or not sense, but how this would make it better. And i cant see how it would work.

edit: And $ gen to work, you should have installed it globally, so it not make sense to have path to local modules. I dont know. But if user dont want it globally, i believe that users have one more choice using npm link generate?

@jonschlinkert
Copy link
Member

Which would expand to:

sorry, I see what you mean. I thought of that macro idea and didn't really think it through enough before I wrote it out. Of course, you would still need a global generate to resolve the macro and use it.

Actually though, you could easily run a locally-installed generate like any other node library. You would just do:

// -- generator.js-- (or whatever you want)
var generate = require('generate');
var app = generate();

app.task('default', function(cb) {
  cb();
});

app.build('default', function(err) {
  if (err) return console.log(err);
});

And run:

$ node generator

@tunnckoCore
Copy link

tunnckoCore commented Sep 1, 2016

Yea exactly. Or as I mention in first comment $ node_modules/.bin/gen task task2 task3.
There are a few ways to do what @kokujin need, and we don't need to add some more complexity.

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

3 participants