Skip to content
This repository has been archived by the owner on Jul 8, 2020. It is now read-only.

Use npm scripts as alias #466

Closed
MathiasTim opened this issue Jan 19, 2017 · 7 comments
Closed

Use npm scripts as alias #466

MathiasTim opened this issue Jan 19, 2017 · 7 comments
Milestone

Comments

@MathiasTim
Copy link
Contributor

MathiasTim commented Jan 19, 2017

We could use npm scripts for "complicated commands"

e.g.

gulp --cordova 'run ios --buildConfig=build.json --device' --env=dev --res=dev

could be

npm run run-ios-device

Don't know if its just something we could write in a guide or preconfigure for some commands in the generated project.

What do you think @lordgreg @gruppjo ?

@gruppjo
Copy link
Contributor

gruppjo commented Jan 25, 2017

@MathiasTim, I really like the idea of supplying a default set of commands via npm scripts.

Thank might actually clarify some the main workflows of the generator for beginners and clear up any initial confusion of how certain things are done.

Really good idea 👍

Additionally, we could still provide a guide on what they do and how to configure them.

@gruppjo gruppjo added this to the 1.11.0 milestone Jan 27, 2017
@gruppjo
Copy link
Contributor

gruppjo commented Feb 17, 2017

@MathiasTim, one of the many great things about this is: you can make your common flags part of the command.

For instance --no-open for gulp watch.
image

npm start

And you're done.

This might make our gulp defaults task and setup obsolete.

I like this idea so much. I'm actually a little jealous that I didn't think of this! :)

@gruppjo gruppjo mentioned this issue Feb 17, 2017
@gruppjo
Copy link
Contributor

gruppjo commented Feb 17, 2017

This will also make it a lot easier to distribute best practices and avoid common pitfalls when running cordova commands for instance.

Additionally a guide would make sense, I think. To configure the default script using for instance --target and other flags: https://github.com/mwaylabs/generator-m-ionic/blob/master/docs/guides/development_intro.md#build-on-a-deviceemulator

However, we need to be aware that it will be perceived as our responsibility by the users that these commands will work. We're adding another layer of complexity and some might not even care that we're using gulp, cordova and all that underneath...
We'll get more issues like: why doesn't this just work?!

@gruppjo
Copy link
Contributor

gruppjo commented Feb 17, 2017

This would be my initial suggestion:

"scripts": {
    "test": "npm run build && gulp karma",
    "start": "gulp watch",
    "watch": "npm start",
    "prepare": "gulp --cordova 'prepare'",
    "livereload:ios": "gulp --livereload 'run ios'",
    "livereload:android": "gulp --livereload 'run android'",
    "run:ios": "gulp --cordova 'run ios",
    "run:android": "gulp --cordova 'run android'",
    "watch:build": "gulp watch-build",
    "build": "gulp build --minify"
  }

@MathiasTim, @lordgreg. Comments?

@MathiasTim
Copy link
Contributor Author

From my perspective this is a good start.

@lordgreg
Copy link
Contributor

I'd wait through weekend. Maybe we could think of more of the commands.

🥇

@gruppjo
Copy link
Contributor

gruppjo commented Feb 24, 2017

docs, how to use options:

npm run watch -- --env=prod

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants