+10, you cracked one of the big problems Omar. watch project www, but serve/livereload platform www
#Multiple External IP addresses for livereload on device I see you use a browsersync method bs.options.getIn(['urls', 'external']); But those this handle the use case when there are multiple ip adresses. This is something we hit here at work with our CLI, and we handle in the same form as Ionic CLI. To reproduce usually I hit when I'm at home and connected to work using VPN. then my system has two external ips, but only one of them my iphone can reach. 9.x.x.x (work vpn) 10.x.x.x (home wifi) and my iphone can only connect to 10.x.x.x This is not a check you have to do all them time, you can save last value selected, and next time if that ip is still valid is a good chance that's the one you want to use again avoiding asking the user every time. https://github.com/driftyco/ionic-app-lib/blob/e9d17cd81fb5fea29229b7bfa19dce765361f243/lib/serve.js#L843 #NPM dependencies after_plugin_add dependenciesInstall I don't know how I feel about a plugin automatically running npm install on an users to satisfy plugin hook nodejs scripts one way is to allow user to install npm modules in the root of the cordova project, node will walk up the directory tree and find the dependency there. Some of those dependencies you can get a reference from cordova-lib with context.requireCordovaModule() So no need to have them in package.json The reason I bring this things up is because we at work we are shipping some cordova plugins, and phase the dilema of npm dependencies for the plugin hooks that we use. 1. QA, we want to use the version of the dependency we tested with (if we use requireCordovaModule we might not get the same version) 2. Legal, we need to clear with legal team and notices any 3rd party dependency so user is aware of any 3rd party software we are using 3. Node/NPM not installed, believe it or not we shipped node and in our product we provide a cli that takes care of nodejs, and cordova-cli for the user. user only need to download our cli and set it in their path. So for now what we do is to bundle the dependencies with the plugin, same solution we have today for platforms the cordova platforms bundle the npm dependencies with the git repo. I would like to discuss livereload and npm dependences topic in F2F with folks that are interested on this. On Thu, Oct 8, 2015 at 12:38 PM Carlos Santana <[email protected]> wrote: > Hi Omar > improvements are good direction. > > How do I specify which files to watch or ignore? > > Maybe by default it watches every file in www/**/*.* > But allow --livereload to take a value of glob/match ="www/js/*.*" > > Another use case is the one that the browsersync plugin offers is to > specify ignore > by default watch everything but except --ignore=lib/**/*.* > https://github.com/nparashuram/cordova-plugin-browsersync#ignoring-files > > > > On Thu, Oct 8, 2015 at 1:26 AM Mefire O. <[email protected]> wrote: > >> Thanks for the feedback, it was received. >> >> As follow up actions, I've done the following changes: >> >> - Changed things into a plugin >> - Added support for multiplatform support: `cordova run android ios >> --device -- --livereload` >> - Added the capability to mirror gestures: clicks, scrolls, form inputs >> - Made it so the user doesn't have to manually remove CSP anymore, it's >> done automatically >> - Cleaned up the code >> - Added ability to use '-- --livereload' flag, so no change is required >> in cordova-cli >> >> It would be great if you could provide further feedback: >> https://github.com/omefire/cordova-plugin-livereload >> >> >> Thanks, >> Mefire >> >> -----Original Message----- >> From: [email protected] [mailto:[email protected]] On Behalf >> Of Brian LeRoux >> Sent: Wednesday, August 26, 2015 11:59 AM >> To: [email protected] >> Subject: Re: [DISCUSS] CORDOVA AND LIVERELOAD >> >> also a -1 to core / most of the downstreams have livereload or hotreload >> baked into their respective frameworks >> >> On Wed, Aug 26, 2015 at 10:59 AM, Carlos Santana <[email protected]> >> wrote: >> >> > -1 to add to cordova-lib >> > >> > maybe to be a default plugin, but I'm with Jesse with this one lets >> > not add yet and lets be agile and iterate based on community feedback, >> > >> > there might be other better way to add the plugin than the default >> > template (i.e. cordova tool add livereload, etc..) lets see how it >> > goes for now >> > >> > Currently no a big fan of having the whitelist added by default, I >> > understand all the background from it but as high level view a plugin >> > is something you add is not something that comes included. >> > >> > >> > >> > >> > On Wed, Aug 26, 2015 at 1:44 PM Jesse <[email protected]> wrote: >> > >> > > Personally, I would rather we didn't force it thru. >> > > We don't include cordova-plugin-console which is a huge ease-of-use >> > > improvement, and it is tiny, and more arguably should be built in. >> > > If we get through a few versions, and it proves popular, and is >> > > working well, I may change my mind, but I would rather soft launch >> > > it instead of suddenly springing new developer debt on the project. >> > > >> > > >> > > >> > > >> > > >> > > >> > > My team is hiring! >> > > @purplecabbage >> > > https://na01.safelinks.protection.outlook.com/?url=risingj.com&data= >> > > 01%7c01%7commenjik%40microsoft.com%7ce21867b2bd9542b192c508d2ae486cb >> > > 0%7c72f988bf86f141af91ab2d7cd011db47%7c1&sdata=zCcu7T0VKRwLqlr6BCXWN >> > > rPMZqbzuX4%2bcWaqD%2f9ej8c%3d >> > > >> > > On Wed, Aug 26, 2015 at 10:23 AM, Mefire O. <[email protected]> >> > > wrote: >> > > >> > > > >> > > > Also, to improve DISCOVERABILITY and EASE OF USE, I was thinking >> > > > about making the LiveReload tooling part of the default Cordova >> > > > experience by including the plugin in the default project template >> > > > or by it being in cordova-lib ( depending on what architectural >> choice we make). >> > > > >> > > > It would only be turned on by including the --livereload from the >> CLI. >> > > > >> > > > Any thoughts ? >> > > > >> > > > >> > > > - >> > > > https://na01.safelinks.protection.outlook.com/?url=https%3a%2f%2fg >> > > > ithub.com%2fMSOpenTech%2fcordova-cli%2fcommits%2fLiveReload&data=0 >> > > > 1%7c01%7commenjik%40microsoft.com%7ce21867b2bd9542b192c508d2ae486c >> > > > b0%7c72f988bf86f141af91ab2d7cd011db47%7c1&sdata=gWu1DeX0p6PI%2b8zM >> > > > Cu76cMQgIsPfKrOlGUos3rhmFPo%3d >> > > > - >> > > > https://na01.safelinks.protection.outlook.com/?url=https%3a%2f%2fg >> > > > ithub.com%2fomefire%2fcordova-plugin-livereload&data=01%7c01%7comm >> > > > enjik%40microsoft.com%7ce21867b2bd9542b192c508d2ae486cb0%7c72f988b >> > > > f86f141af91ab2d7cd011db47%7c1&sdata=vzLznF3YibCj0SXDV%2bGZeANhNjQF >> > > > jnMoLCbyfo76p0w%3d >> > > > >> > > > >> > > > Thanks, >> > > > Mefire >> > > > >> > > > -----Original Message----- >> > > > From: Mefire O. [mailto:[email protected]] >> > > > Sent: Monday, August 24, 2015 11:01 AM >> > > > To: [email protected] >> > > > Subject: RE: [DISCUSS] CORDOVA AND LIVERELOAD >> > > > >> > > > Thanks for the feedback, guys. >> > > > >> > > > As a result of your comments, I've done the following changes : >> > > > >> > > > - Pivoted towards a plugin-based architecture : >> > > > >> > > >> > https://na01.safelinks.protection.outlook.com/?url=https%3a%2f%2fgithu >> > b.com%2fomefire%2fcordova-plugin-livereload&data=01%7c01%7commenjik%40 >> > microsoft.com%7ca5385b13d97b4d71e84f08d2acae110d%7c72f988bf86f141af91a >> > b2d7cd011db47%7c1&sdata=6YrzZ4dCG8FttPF150r%2f00G2gfB8%2fqGwLax41boeVo >> > 4%3d >> > > > - The plugin is going to be activated only when the '--livereload' >> > option >> > > > is passed to the CLI. >> > > > - I forgot to include the changes to cordova-cli to accommodate >> > > > the --livereload flag : >> > > > >> > > >> > https://na01.safelinks.protection.outlook.com/?url=https%3a%2f%2fgithu >> > b.com%2fMSOpenTech%2fcordova-cli%2fcommits%2fLiveReload&data=01%7c01%7 >> > commenjik%40microsoft.com%7ca5385b13d97b4d71e84f08d2acae110d%7c72f988b >> > f86f141af91ab2d7cd011db47%7c1&sdata=wLWcK7014onZyfFCfbI4PKGTcjBLHq2TWX >> > 8uGPzfZRs%3d >> > > > >> > > > >> > > > Thanks, >> > > > Mefire >> > > > >> > > > -----Original Message----- >> > > > From: Carlos Santana [mailto:[email protected]] >> > > > Sent: Friday, August 21, 2015 5:28 PM >> > > > To: [email protected] >> > > > Subject: Re: [DISCUSS] CORDOVA AND LIVERELOAD >> > > > >> > > > This is so awesome, as working on a downstream I have being >> > > > debating if this is something I should add to my downstream. >> > > > I think this is standard stuff that cordova should enable but not >> > include >> > > > in core, it should be a plugin. >> > > > >> > > > maybe we should have a tag for plugins that are only for tooling, >> > > meaning >> > > > that are easy to take out or ignore when building/running a >> > > > production >> > > app. >> > > > or be dormant until the "--livereload" is pass in the command line >> > > > for emulate or run. >> > > > >> > > > I really think BrowserSync is rad, and having a plugin implemented >> > > > by cordova is good as reference implementation if others want to >> > implement a >> > > > different one. but I think we can provide that satisfy the need of >> > > > most developers. >> > > > >> > > > But I think the cordova-cli should document and have some >> > > > convention support the developer to emulate/run with --livereload. >> > > > then a plugin >> > > can >> > > > declare that it provides the livereload feature, and detect that >> > > > --livereload was pass do it's magic >> > > > >> > > > >> > > > >> > > > On Fri, Aug 21, 2015 at 5:14 PM Jesse <[email protected]> >> wrote: >> > > > >> > > > > This is really cool work, and will absolutely help developers. >> > > > > Personally, I prefer the plugin approach. >> > > > > Which library is chosen is entirely up to the plugin author, but >> > > > > I really like BrowserSync! >> > > > > >> > > > > In all cases, I believe it is important to try NOT to add >> > > > > features to cordova. The ultimate goal is have cordova be >> > > > > intrinsic to all device platforms, and the more things we build >> > > > > into cordova, the more difficult this becomes. Others may have >> > > > > different views, and I am anxious to hear them, but that is the >> way I have always looked at it. >> > > > > >> > > > > >> > > > > >> > > > > >> > > > > >> > > > > My team is hiring! >> > > > > @purplecabbage >> > > > > >> > https://na01.safelinks.protection.outlook.com/?url=risingj.com&data=01 >> > > > > %7c01%7commenjik%40microsoft.com >> > %7c0cc1f1dff2144c1556fa08d2aa88a610%7c >> > > > > >> > 72f988bf86f141af91ab2d7cd011db47%7c1&sdata=ZDxBbaiDrRKHqVa7fRKQut47GEt >> > > > > cdR6r1kDZvZPTl6o%3d >> > > > > >> > > > > On Fri, Aug 21, 2015 at 11:50 AM, Mefire O. >> > > > > <[email protected]> >> > > > > wrote: >> > > > > >> > > > > > Hi all, >> > > > > > >> > > > > > Problem >> > > > > > Most Web developement workflows today have a quick >> > > > > > edit-refresh-preview loop, enabling rapid application >> development. >> > > > > > While Cordova is based on >> > > > > Web >> > > > > > technologies, the cordova run step after every little HTML or >> > > > > > CSS change >> > > > > is >> > > > > > still slow and takes a considerable amount of time to deploy >> > > > > > to the emulator or device. >> > > > > > Some livereload-related offerings : >> > > > > > >> > https://na01.safelinks.protection.outlook.com/?url=https%3a%2f%2fsco >> > > > > > https://na01.safelinks.protection.outlook.com/?url=tch.io&data >> > > > > > =01%7c01%7commenjik%40microsoft.com%7ce21867b2bd9542b192c508d2 >> > > > > > ae486cb0%7c72f988bf86f141af91ab2d7cd011db47%7c1&sdata=f5Ijck6y >> > > > > > gB4UUNWdbzql%2bY%2brYb3YF6HbNaBrWscu4qY%3d >> > %2ftutorials%2fa-quick-guide-to-using-livereload-with-gulp&dat >> > > > > > a=01%7c01%7commenjik%40microsoft.com >> > %7c0cc1f1dff2144c1556fa08d2aa88a >> > > > > > >> > 610%7c72f988bf86f141af91ab2d7cd011db47%7c1&sdata=kFyIR7Q1nZljOSdc1HI >> > > > > > dhl6mgExcgIG0CVrGLHU%2fXew%3d >> > > > > . >> > > > > > Adding the "live reload" capability in Cordova would increase >> > > > > > developer efficiency. Note that varieties of LiveReload >> > > > > > already in many downstream Cordova distributions. >> > > > > > >> > > > > > Prototypes >> > > > > > Browsersync< >> > https://na01.safelinks.protection.outlook.com/?url=http% >> > > > > > 3a%2f%2fbrowsersync.io%2f&data=01%7c01%7commenjik%40microsoft. >> > > > > > com >> > %7c >> > > > > > >> > 0cc1f1dff2144c1556fa08d2aa88a610%7c72f988bf86f141af91ab2d7cd011db47% >> > > > > > 7c1&sdata=TKcLau%2bk%2fRfQ2wGutlt4gspmxDMbTTa4ZRqLSBxKkCM%3d> >> > > > > > is a popular livereload library that enables refreshing the >> > > > > > browser/webview when HTML/CSS/JS or images change, mirrors >> > > > > > clicks and scrolls across multiple devices and even does >> > > > > > incremental CSS >> > or >> > > > > > DOM updates. Here is a prototype implementation< >> > > > > > >> > https://na01.safelinks.protection.outlook.com/?url=https%3a%2f%2fgit >> > > > > > https://na01.safelinks.protection.outlook.com/?url=hub.com&dat >> > > > > > a=01%7c01%7commenjik%40microsoft.com%7ce21867b2bd9542b192c508d >> > > > > > 2ae486cb0%7c72f988bf86f141af91ab2d7cd011db47%7c1&sdata=LUwQuEW >> > > > > > qPMOlTJtFbN1jBhsM5r%2fZqd9uLx%2b8t3ZIeD8%3d >> > %2fMSOpenTech%2fcordova-lib%2fcommits%2fLiveReload&data=01%7c >> > > > > > 01%7commenjik%40microsoft.com >> > %7c0cc1f1dff2144c1556fa08d2aa88a610%7c7 >> > > > > > >> > 2f988bf86f141af91ab2d7cd011db47%7c1&sdata=qFVTL9IljD%2bCrsg%2bpkF8PD >> > > > > > %2fse%2bJUVcFAzZ5BWnCpVpk%3d> that I put together into >> > > > > > cordova-lib using BrowserSync and can be started easily >> > > > > using >> > > > > > --livereload with the cordova run command : `cordova run >> > > > > > android -livereload` An alternative approach here implements a >> > > > > > similar functionality using a Cordova plugin< >> > > > >> > > >> > https://na01.safelinks.protection.outlook.com/?url=https%3a%2f%2fgithu >> > b.com%2faxemclion%2fcordova-plugin-browsersync&data=01%7c01%7commenjik >> > %40microsoft.com%7c0cc1f1dff2144c1556fa08d2aa88a610%7c72f988bf86f141af >> > 91ab2d7cd011db47%7c1&sdata=zX7tQKxHoiw6AWowjzJIOeTo9xVj4qFF87sU2Nuirrg >> > %3d >> > > > >. >> > > > > > Here is another plugin< >> > > > > > >> > https://na01.safelinks.protection.outlook.com/?url=https%3a%2f%2fgit >> > > > > > https://na01.safelinks.protection.outlook.com/?url=hub.com&dat >> > > > > > a=01%7c01%7commenjik%40microsoft.com%7ce21867b2bd9542b192c508d >> > > > > > 2ae486cb0%7c72f988bf86f141af91ab2d7cd011db47%7c1&sdata=LUwQuEW >> > > > > > qPMOlTJtFbN1jBhsM5r%2fZqd9uLx%2b8t3ZIeD8%3d >> > %2ffingerproof%2fcordova-plugin-gapreload&data=01%7c01%7comme >> > > > > > njik%40microsoft.com >> > %7c0cc1f1dff2144c1556fa08d2aa88a610%7c72f988bf86 >> > > > > > >> > f141af91ab2d7cd011db47%7c1&sdata=qMT7cUIEh3XbP5RWaVpVuw20F2RtPnDXYT8 >> > > > > > XT%2bS%2frzI%3d> that implements livereload using LiveReload< >> > https://na01.safelinks.protection.outlook.com/?url=http%3 >> > > > > > a%2f%2flivereload.com%2f&data=01%7c01%7commenjik%40microsoft.c >> > > > > > om >> > %7c0 >> > > > > > >> > cc1f1dff2144c1556fa08d2aa88a610%7c72f988bf86f141af91ab2d7cd011db47%7 >> > > > > > c1&sdata=d2sbj1khMnFHemoIM4aRZ3OzagVexcNNK9qr9qKFn6w%3d> >> > > > > > instead of >> > > > > browserSyc. >> > > > > > >> > > > > > Design Questions >> > > > > > What would be the best approach to add this functionality into >> > > Cordova >> > > > ? >> > > > > > 1. In cordova-lib as prototyped above ? >> > > > > > 2. As a Plugins with hooks that start browserSync? >> > > > > > 3. As a plugin with hooks that uses LiveReload ? >> > > > > > 4. A plugin that is a part of the default template 5. Any >> > > > > > other suggestions >> > > > > > >> > > > > > Trying to list the goals from our implementation >> > > > > > >> > > > > > 1. Live reload should be discoverable, quick to get started >> > > > > > and easy >> > > > > to >> > > > > > use. It should be available to all developers in a standard way. >> > > > > > 2. It should integrate well with existing workflows and not >> > > > > > come in >> > > > > the >> > > > > > way of existing solutions that already have live reload. >> > > > > > 3. It should work for most major platforms. Note that the >> > > > > > above examples change the <content src=> to a http:// server. >> > > > > > This has a different behavior from the default Cordova app. >> > > > > > 4. Though the above examples depend on browsersync, there >> > > > > > are other equally good solutions like LiveReload, Amok, etc. >> > > > > > Should we depend on BrowserSync? Or will using a plugin >> > > > > > approach give us the flexibility of using alternate solutions >> > > > > > >> > > > > > Here's a link to the corresponding cordova-discuss proposal : >> > > > > > >> > https://na01.safelinks.protection.outlook.com/?url=https%3a%2f%2fgit >> > > > > > https://na01.safelinks.protection.outlook.com/?url=hub.com&dat >> > > > > > a=01%7c01%7commenjik%40microsoft.com%7ce21867b2bd9542b192c508d >> > > > > > 2ae486cb0%7c72f988bf86f141af91ab2d7cd011db47%7c1&sdata=LUwQuEW >> > > > > > qPMOlTJtFbN1jBhsM5r%2fZqd9uLx%2b8t3ZIeD8%3d >> > %2fomefire%2fcordova-discuss%2fcommits%2fLiveReload&data=01%7 >> > > > > > c01%7commenjik%40microsoft.com >> > %7c0cc1f1dff2144c1556fa08d2aa88a610%7c >> > > > > > >> > 72f988bf86f141af91ab2d7cd011db47%7c1&sdata=PKJALeV0NmgPckU9s0CYv0BsY >> > > > > > 5XZBNLKCvBFjyIWqa0%3d >> > > > > > Thanks, >> > > > > > Mefire >> > > > > > >> > > > > >> > > > B >> > KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKCB >> > > > [ X ܚX K K[XZ[ >> > > > ] ][ X ܚX P ܙ ݘK \ X K ܙ B ܈ Y ] [ۘ[ [X[ K[XZ[ >> > > > ] Z [ ܙ ݘK \ X K ܙ B >> > > > >> > > >> > >> >
