-
Notifications
You must be signed in to change notification settings - Fork 63
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
Use command line arguments for scripts. #26
Comments
Hello, this sounds nice, but I think you need at least 2 commands then, to distinct between dev and prod environment, because of this
Nevertheless, I like your syntax more, than mine, so feel free to implement it, and sent me a pull request. |
@cairinmichie have you given it a try ? |
I haven't had a chance yet, was planning on doing it this weekend. |
ok, no problem, I'll keep this issue open for 3 weeks, if nothing happens. |
@cairinmichie do you have any progress? |
No, sorry I have been too busy with other work. |
@cairinmichie did you made any progress or should I close the ticket ? |
It would be useful also to be able to specify command line arguments or a build.json file served to the I could just run that command after running |
The build.json approach is cleaner:
In this approach, the plugin does not need to parse command line arguments. Rather it could automatically check if build.json exists in src-cordova, and if so, then add it to the |
@jacobg you came to the same problem then here I think: My question there was, how would you distinct between cordova and vue arguments ? If all the arguments are passed to cordova, you no longer can use the arguments, like these: An idea I had, was having a prompt asking for the commands, if you run cordova with i.e. new --interactive flag... |
never tried build.json, so in fact, you can define all the arguments you need, for every cordova command and keep then command arguments away ? If so, this would help a lot keeping all the special cordova features away from the plugin... IMO it's important that the plugin is simple to understand and use, and if you are a more advanced user, you still can do more things with the plugin... As the plugin is running 2 commands (vue serve, cordova run), it needs to be very clear, to which command, the arguments are passed... That's why I had the idea of an interactive prompt, so you can normally pass the initial arguments to the vue command, and afterwards enter more arguments to the cordova command... |
I agree about keeping it simple and being clear about separating of vue and cordova. Sounds like build.json accomplishes that. The npm commands remain exactly the same, and build.json is not required to maintain existing functionality. |
I agree that the build.json seems to be the simplest way to give users more control. |
ok, I'll give build.json a try, and we can mention and explain this in the README for the "advanced" users |
Thanks @m0dch3n. What are your thoughts with respect to specifying a mode in the npm command? For example, it's highly useful in order to specify which backend service environment the vue app should use (e.g., production, local development server, staging, etc). Then the specific project can define the .env.[mode] files to specify the environment variables that apply to that mode. |
@jacobg modes are already working, if you do
the app takes the vars from .env.staging... |
so i.e. you could this
this would end up in :
|
BTW, if we go with only one command for the plugin flexibility, we cannot solve this issue in the same time, because during the plugin runtime, it's already to late ... |
Ahh, that's great. I didn't realize that the vue cli will automatically use the mode even on custom commands. Thanks! |
Any progress with adding build.json support :) |
+1 for this. |
@alexcroox Are you running cordova-ios 4? Because that does require |
Updated to 5 and it's working now thanks. How do I specify signing params and packageType for |
For that you need build.json. For now, you would need to manually run |
Thanks, for now I'm running it after this plugin runs, but it still builds twice for the emulator Sorry for the complexity of the build script, I'm building 2 different apps from the same codebase so I have to remove and re-install the ios platform every time I change the name.
I've also tried |
What?
I think it would be easier to specify npm run scripts with command line arguments rather, as it would allow greater diversity in scripts that are runnable.
Example:
As an example I will use a simple add method that take command line arguments in its script:
The script becomes:
To run the script:
Giving an output of:
Relevance to vue-cli-plugin-cordova?
Using this method:
can be replace with:
This would be ideal in my situation, as I can't build my ios projects on the command line. So my typical build command would be
cordova prepare ios
and then I would run the app through xcode. But because your cli commands don't allow forcordova prepare ios
I can't do this.This way would also make adding commands like
cordova prepare ios
easier.The text was updated successfully, but these errors were encountered: