Skip to content

Add Gulp to README dependencies #37

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

Closed
wants to merge 1 commit into from

Conversation

pselle
Copy link

@pselle pselle commented Nov 11, 2015

Gulp is needed globally to run the build/dev server processes, also a minor sentence change for running the generator.

Gulp is needed globally to run the build/dev server processes, also added a note about `gulp serve` and a minor sentence change for running the generator.
@chrisdwheatley
Copy link
Owner

Thanks for the pull request Pam. There's actually some logic in the codebase to check whether a user has gulp installed globally or not (https://github.com/swirlycheetah/generator-angular2/blob/master/app/index.js#L64) but perhaps that's not working as it should be.

If you could try re-running the generator, letting me know if you've got gulp installed globally or not and then seeing what command Yeoman says to run once the generator has finished that'd be useful.

I'd prefer not to have to ask people to install global packages if possible so it'd be good to figure out an alternative solution, perhaps something like wrapping the gulp tasks in npm run scripts. Any thoughts/suggestions welcome.

@pselle
Copy link
Author

pselle commented Nov 11, 2015

@swirlycheetah I got it to run once I installed gulp globally ... my testing ground is biased though, because I had to unbork some Node setup on this machine, so the yo process halted and I had to step into it. Generator works great once all that (and gulp) is set up :)

I also dislike global packages, so I'm with you there, and I noticed there weren't any scripts set up for gulp

[UPDATE] The code snippet for post-boot is only for launching on that first run ... for future runs, sounds like an npm run option is appealing?

@chrisdwheatley
Copy link
Owner

Sorry, I missed your update. Just for clarification do you mean an npm run task to wrap the gulp tasks? If that's the case I'll sort that, it should mean I can actually tear out quite a bit of that nasty global dependency checking I'm doing.

@pselle
Copy link
Author

pselle commented Nov 18, 2015

@swirlycheetah Yes, my suggestion is an npm run task by putting it in the scripts object in package.json :)

@chrisdwheatley
Copy link
Owner

Have added the npm run scripts and pushed a new tag, 0.6.2. Any further issues let me know.

@pselle
Copy link
Author

pselle commented Nov 23, 2015

Apologies if this is added somewhere else ... but I don't see your changes here, FYI https://github.com/swirlycheetah/generator-angular2/blob/master/package.json#L19-L21

@chrisdwheatley
Copy link
Owner

Ah, the package.json that gets created when you run yo angular2 is here https://github.com/swirlycheetah/generator-angular2/blob/master/app/templates/_package.json. I hope we weren't at crossed wire this entire time and you actually meant this project's package.json rather than the one created by the generator!

I have noticed one issue with 0.6.2, if you're using npm >= version 3 there's an issue with the traceur runtime location (#39), I'll get this fixed tonight.

@pselle
Copy link
Author

pselle commented Nov 23, 2015

the scripts would need to be more like ./node_modules/gulp/... pointing to the executable for that to work without depending on global gulp.

$ npm start

> [email protected] start /Users/----/---/foo
> gulp dev

sh: gulp: command not found

npm ERR! Darwin 14.5.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "start"
npm ERR! node v5.0.0
npm ERR! npm  v3.3.6
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! [email protected] start: `gulp dev`
npm ERR! spawn ENOENT
npm ERR! 
npm ERR! Failed at the [email protected] start script 'gulp dev'.
npm ERR! This is most likely a problem with the foo package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     gulp dev
npm ERR! You can get their info via:
npm ERR!     npm owner ls foo
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /Users/----/---/foo/npm-debug.log

you'll want

  "scripts": {
    "build": "./node_modules/gulp/bin/gulp.js",
    "start": "./node_modules/gulp/bin/gulp.js dev"
  },

I like how you used build + start! I've brute forced in the past (gulp as a key and using the wordy npm run gulp). Dig your method.

@pselle
Copy link
Author

pselle commented Nov 23, 2015

I'm closing this PR since I don't want it merged and you're doing fixes elsewhere :) feel free to make an issue, but I think this is almost done anyhow. Thanks for maintaining the generator!

@pselle pselle closed this Nov 23, 2015
@chrisdwheatley
Copy link
Owner

Thanks for the feedback Pam. You don't actually need to reference the longhand path for local dependencies when using npm run scripts, see https://docs.npmjs.com/cli/run-script;

In addition to the shell's pre-existing PATH, npm run adds node_modules/.bin to the PATH provided to scripts. Any binaries provided by locally-installed dependencies can be used without the node_modules/.bin prefix.

@pselle
Copy link
Author

pselle commented Nov 23, 2015

  1. I am a terrible QA person and got the error message in a situation where the node_modules were not yet installed
  2. I have learned much from this PR. Thanks!

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

Successfully merging this pull request may close these issues.

2 participants