m0dch3n / vue-cli-plugin-cordova

Vue Cli 3 Cordova Plugin
MIT License
417 stars 63 forks source link

Cloning the project #39

Closed evinkuraga closed 5 years ago

evinkuraga commented 5 years ago

Firstly, thank you for this fantastic package! This repo is worth it's share of gold. :)

This worked perfectly on a new installation, but what about if a project is cloned? It's missing all the node files, Cordova etc.

I figured the steps to get this up and running again would be to run: 1: checkout the project 2: add any global global packages like vuecli & Cordova and any required emulation software and such 3: run npm install in root and inside src-cordova 4: vue add cordova ? 5: run which ever npm script to get the app running

However, I'm getting a no platforms installed issue and when I try to run Cordova based commands such as "Cordova prepare", I get "Current working directory is not a Cordova-based project."

It might be a good to put install steps for existing projects on the read.me?

evinkuraga commented 5 years ago

To all people who fall on this issue in the future, here's how I managed to resolve this: Make sure you have a www directory in your src-cordova folder.

If you ran the vue add Cordova command, make sure it didn't break the files you had before or revert them to their original form.

syonip commented 5 years ago

I'm getting this when cloning the project on every new machine. I don't think that running vue add cordova again on every machine is a good solution. For me, creating a new directory src-cordova/www and then cordova platform add works better, because it doesn't override things. Do you think we can find a better solution to this issue? I'm happy to contribute.

m0dch3n commented 5 years ago

I somehow missed this issue, because the owner closed it by himself already...

When I'm pulling from repo, I'm doing

npm install
cd src-cordova
cordova add plaform android
cordova add platform ios
cd.. 

Maybe we can introduce a new command also for this, to avoid to the steps manually

m0dch3n commented 5 years ago

PS

vue add cordova

Is the wrong way, because it's like vue create command, which you also don't do, if you clone from repository... The reason is, vue add, will execute cordova create command, and then cordova add platform...

So you can say:

npm install is "equal" to cordova add platform

syonip commented 5 years ago

I agree that cordova platform add is ok to run, but the things is it doesn't work either. You get an error:

cd src-cordova
cordova platform add android
Current working directory is not a Cordova-based project.

This happens because the www folder is not in source control (it's added to gitignore by the plugin). So you first need to create an empty folder www and then you can run the cordova commands.

You can clone this sample repo to see it: https://github.com/syonip/vue-csv-sample

m0dch3n commented 5 years ago

ok, to be honest, I only did this clone thing once, and maybe at that point www was not ignored...

Nevertheless, so best option is to change

www to www/* in this case

syonip commented 5 years ago

I've tested this in my repo, and it seems to not make the empty folder tracked by git. This SO answer suggests adding an inner .gitignore file to the www folder, and this seems to work.

m0dch3n commented 5 years ago

well on a new project, this should work if the folder is not empty (I did not test)

if it's empty, we also need www/.gitkeep

this is a git feature to keep empty folders

syonip commented 5 years ago

cool shall I try to add this to the plugin and PR?

m0dch3n commented 5 years ago

yes please, any help is appreciated! Thanks

m0dch3n commented 5 years ago

Please also create an issue for it then, and use

fix #issueid

as commit message, so that it will be referenced automatically in changelog on new release

m0dch3n commented 5 years ago

or use this one with

fix #39

syonip commented 5 years ago

@m0dch3n did you get a change to review my PR?

m0dch3n commented 5 years ago

yes, but did not have time to test and verify, sorry

syonip commented 5 years ago

no worries :)