Giter Site home page Giter Site logo

cordova-discuss's Introduction

cordova-discuss

This is the place where you can initiate proposals for new features/ideas in Cordova.

Adding a Proposal

For adding new proposals and ideas, please review instructions here.

Active Proposals - Help needed

Proposal Status/Notes
Support for Android N Proposed - Ongoing
Support for third party package managers - Nuget & coccoapods Proposed

In Progress Proposals

Proposal Status/Notes
Templates in Cordova CLI Part 2 Proposed

Completed Proposals

Proposal Status/Notes
Nightly Builds for Cordova and platforms Completed
Templates in Cordova CLI Completed
Cordova-lib Refactoring proposal Completed
Cordova Face2Face Oct 2015 meeting Meeting held Oct 15 - completed
Automatic Generation of plugin API docs Completed only for cordova-plugin-camera
Removal of whitelist from iOS platform Completed
Proposal to pin plugins with cLI Completed in 6.0 & replaced with plugin fetching in Cordova 6.1.
Platform project Some ideas adopted into the Cordova Platform API work.
Plugin version fetching - improve plugin versioning story Completed & part of Cordova 6.1
New information architecture for Cordova Completed and live on docs.cordova.io.
Add Telemetry to Cordova CLI Completed
Ideas for improving documentation [1] [2] Most of the recommendations completed
CI for PRs submitted for cordova plugins Completed
Unified cordova-fetch proposal Completed

cordova-discuss's People

Contributors

audreyso avatar axemclion avatar breautek avatar csantanapr avatar dblotsky avatar dpogue avatar infil00p avatar janpio avatar juliascript avatar kamrik avatar kant2002 avatar knight9999 avatar martijnwalraven avatar nikhilkh avatar omefire avatar purplecabbage avatar riknoll avatar ryanjsalva avatar sarangan12 avatar shazron avatar stevengill avatar theblang avatar tony-- avatar vladimir-kotikov avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cordova-discuss's Issues

Confusing UnhandledPromiseRejectionWarning if plugin.xml has lingering diff markers [minor]

If I would test a plugin with lingering "<<<<<<" markers from git merge I get the following confusing output on the latest version of Cordova CLI (8.0.0):

(node:23173) UnhandledPromiseRejectionWarning: CordovaError: Invalid attribute name
Line: 3
Column: 1
Char: <
    at /Users/brodybits/.nvs/node/9.3.0/x64/lib/node_modules/cordova/node_modules/cordova-lib/src/plugman/fetch.js:112:45
    at _rejected (/Users/brodybits/.nvs/node/9.3.0/x64/lib/node_modules/cordova/node_modules/q/q.js:864:24)
    at /Users/brodybits/.nvs/node/9.3.0/x64/lib/node_modules/cordova/node_modules/q/q.js:890:30
    at Promise.when (/Users/brodybits/.nvs/node/9.3.0/x64/lib/node_modules/cordova/node_modules/q/q.js:1142:31)
    at Promise.promise.promiseDispatch (/Users/brodybits/.nvs/node/9.3.0/x64/lib/node_modules/cordova/node_modules/q/q.js:808:41)
    at /Users/brodybits/.nvs/node/9.3.0/x64/lib/node_modules/cordova/node_modules/q/q.js:624:44
    at runSingle (/Users/brodybits/.nvs/node/9.3.0/x64/lib/node_modules/cordova/node_modules/q/q.js:137:13)
    at flush (/Users/brodybits/.nvs/node/9.3.0/x64/lib/node_modules/cordova/node_modules/q/q.js:125:13)
    at process._tickCallback (internal/process/next_tick.js:150:11)
(node:23173) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:23173) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

A more informative error message such as "syntax error in plugin.xml" would be much better.

I would consider this to be a minor bug. I think a more informative error message would be extremely helpful for the newer plugin developers.

Deprecate cordova-plugin-device-motion

I think it is time that we deprecate cordova-plugin-device-motion. The plugin follows an old API and is no longer the standard way to get accelerometer information from devices. Instead we should be following the DeviceOrientation Event Specification which is already well supported in iOS 9.3+ and Android 4.4+.

The last actual code commit was November of 2016.

Let's deprecate it and close the 7 open issues.

Reduce JIRA issue count

I think we should close all JIRA issues that

  • refer to a deprecated component
  • haven't been updated in over X
    (I think one year might work for now)

I'm open to other closing criteria.

Proposal for comment on issues closed for inactivity

Thanks for reporting this bug. It's been some time since there were any updates to this issue, so I'm not sure this is still a problem. I'm going to close this issue now and request you reopen the issue if you're still experiencing this problem. I'm sorry for any inconvenience.

Quick Stats

  • Unresolved issues: 2020
  • haven't been updated in over a year: 1224

Proposal: Add New Image Element to config.xml

Discussion started here: http://markmail.org/message/yx3pvydgyxpssgas

At present, there are only an icon element and splashscreen element that handles copying images from a source to destination in the config.xml. These elements also only handle copying 1 image for a specific icon/splash size.

I would like to propose a new tag that would simply handle copying images that wouldn't be used as the app icon or splash image.

The reason to make this new tag is because my users are already using the icon and splash tag in the config.xml, so why not let them specify other images as well in the same place?

I'm open to other ideas, but my architect wanted the user to be able to specify other images in the config.xml, so maybe we can come to a better solution if it can't be done in the config.xml.

Rename "osx" platform in a major release?

Idea from discussion in apache/cordova-common#32, thought of it myself over the past 1-2 years.

I would personally favor something like "mac" (slightly favored by myself: short and sweet, unquestionably one word) or perhaps"macos" (may be better consistency as described by Shazron).

Proposal: Cordova Plugin Search

Cordova Plugin Search

Move to NPM poses new challenges around branding and plugin discoverability. Below I'll go into details of this problem and how it's tackled by other open source communities. You can also find a proposal for Cordova at the end.

NPM

Currently NPM doesn't support customized search queries. It's designed to be "one size fits all". This is not ideal as we want cordova users to be able to quickly identify plugins and download them as friction-less as possible. In this case, a naive cordova developer might search for the query "cordova" instead of "ecosystem:cordova".

npm cli

NPM cli search is not a good solution either. Search in this case will download a local copy of all npm meta data from npm couchdb and will perform search afterwards. As can be seen from this GH issue, it's really hard.

(1) command took 20 minutes; (2) about 1000 lines of output; (3) peak swap usage 1.81GB; (4) network bandwidth reasonably small; (5) high CPU usage for the full 20 minutes; (6) high disk I/O averaged 3 to 10 MB/sec continuously probably thrashing; (7) the swapfile expanded to permit "npm search" to complete now takes up 1/7 of the whole drive.

gulp

Gulp relies on some 3rd party service to deliver it's search results. (http://npmsearch.com/ in this case). Npmsearch relies on elasticsearch to provide super fast search results. Filtering is achieved by using keywords (gulpplugin). There's also a blacklist. Technically gulp plugin search is a static search page. It works like the following:

  • user visits plugin page
  • page makes a cross-domain query on npmsearch
  • user downloads a list of all available plugins (up to 804ms - 557kb - 1533 entries)
  • filters blacklisted plugins
  • search page is presented (under 1.25s total)

Once the page is presented, search bar is used to further filter plugins.

gruntjs

Grunt stores the plugin data on their own servers. They're currently collecting plugin information by some server side script. But similar to gulp, client downloads are presented as one big json data and all the searches are done on client side after it's downloaded. Search data seems more optimized compared to gulp (221kb - 719ms - 4403 entries)

bowerjs

Bower also stores the plugin data on their own servers. (1.9mb -2.30s - 28k entries) The rest is identical to bower and grunt.

cordova

After my research, I've concluded that serving pluginsearch results as json is the way to go. I've bare-bones of a search page implementation available on GH (see screenshot above). It follows the same design principles with gulp/grunt/bower. I would like to get feedback from Cordova devs on the following topics:

  1. Should we host/implement a service to collect Cordova related plugin information or rely on a 3rd party service such as "npmsearch" ?
  2. Do we want to maintain a list of blacklisted plugins like bower? If so, what are the rules for adding a plugin to blacklist? Where and how are we going to maintain this file?
  3. What are the most important things to display on search page? Currently I'm thinking version, plugin name, plugin description and stars/rating. What else is important?

I'm hoping to get our new search page prototype on it's feet as soon as possible to get feedback from extended community! Please feel free to share your ideas and provide feedback.

Cookie work!

I'm little confused, because in my cordova app (iOS, Android) COOKIES is work!
I'm use last cordova.
And i have a question: it's a bug or really cordova enable cookies?

How much longer should plugins support the wp8 platform?

Considering the following factors:

  • wp8 is "deprecated"
  • wp8 requires C# while most Windows 8.1/Windows Phone 8.1/Windows 10 plugins can simply use Javascript
  • it is almost impossible to interface wp8 with C/C++ libraries due to the use of Silverlight

Is there any reason for plugins to keep supporting wp8?

Use of patch-package?

I discovered https://www.npmjs.com/patch-package which looks like a really nice way to deal with minor patches needed. I have no idea if there is any way people can use this to patch minor issues with upstream plugins, hope to look at this someday. Any ideas or suggestions from the user community?

cordova-serve release needed from master

From @ruslan-bikkinin (with links fixed):

Hello again Cordova team.

I am looking forward to hearing from you.

--
Best regards,
Ruslan

From: "Ruslan Bikkinin (Akvelon)" *****@microsoft.com
Date: Tuesday, May 29, 2018 at 2:22 PM
To: "[email protected]" [email protected]
Cc: "Artem Egorov (Akvelon)" *****@microsoft.com, "Sergey Akhalkov (Akvelon)" *****@microsoft.com, Dhanvi Kapila *****@microsoft.com

Subject: Request for releasing new cordova-serve version

I am maintainer of Microsoft / cordova-simulate and Microsoft / vscode-cordova repos and we have a couple of issues (microsoft/cordova-simulate#257, microsoft/vscode-cordova#371) that took place because apache / cordova-serve repo didn’t support Cordova 7+ for android. However, this PR apache/cordova-serve#7 provides a fix that already have been merged into master a week and a half ago but no new version has been released. Could you please release new version of cordova-serve so we could use it to fix issues that affects our repos?

--
Best regards,
Ruslan

Where to report plug-in issues?

Sorry for the spam, but I can't see where to report plug-in issues, in my case for the camera, the latest version (4.0.3) of which is giving me the slightly alarming message

CameraProxy.js:105 [Deprecation] URL.createObjectURL with media streams is deprecated and will be removed in M68, around July 2018. Please use HTMLMediaElement.srcObject instead. See https://www.chromestatus.com/features/5618491470118912 for more details.

[Proposal] package.json repos should link to github

Now that we are fully in this npm registry thing, I think we should update where repos point to in each package.json.

Currently if a user visits npmjs.org and views one of our packages [1] , the link takes them to the apache repos site [2]. At this point I think most users would slowly back away as no one really interacts with our repos there directly except for committers.

If however, we pointed to the github mirror [3], users might go, okay, here it is, okay I know how this works, forking ...
and send us pull requests!

The github mirror is in fact the place I would expect most people will interact with our repos, I myself have created all my forks from our github mirrors, after which I added remotes to git-wip-us.
I think this will help users discovering our packages as well as drive metrics like fork count, stars and other things that we don't typically care about that are used by others to determine the overall health of a project. To me this is all upside.

[1] https://www.npmjs.com/package/cordova
[2] https://git-wip-us.apache.org/repos/asf?p=cordova-cli.git
[3] https://github.com/apache/cordova-cli

Archive deprecated repos

I propose to archive any deprecated repos.

To still be able to easily point people to maintained forks we could add a link to a central Wiki page (for example in apache/cordova) that lists up-to-date information on deprecated projects. Something along the lines of:

This project is DEPRECATED. For up-to-date information and possible alternatives see LINK.

Do not assert Apache license on generated projects

If I do cordova create to generate a project the generated www code includes Apache copyright/license statement. I would rather see the template code under CC0 or public domain license, or a statement that Apache Cordova does NOT assert copyright and license on the generated code. (If I generate a project with Xcode, it seems to mark the code with copyright to my own name.)

CB14148: cordova platform ls shows "www ^3.12.0"

$ cordova --version
8.0.0
$ cordova platform ls
Installed platforms:
  
Available platforms: 
  android ~7.0.0
  browser ~5.0.1
  ios ~4.5.4
  osx ~4.0.1
  windows ~5.0.0
  www ^3.12.0

If I would do cordova platform add www:

$ cordova platform add www
(node:10383) UnhandledPromiseRejectionWarning: CordovaError: Error: npm: Command failed with exit code 1 Error output:
npm ERR! code ENOLOCAL
npm ERR! Could not install from "www" as it does not contain a package.json file.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/brodybits/.npm/_logs/2018-01-04T04_21_59_700Z-debug.log
    at /Users/brodybits/.nvs/node/9.3.0/x64/lib/node_modules/cordova/node_modules/cordova-fetch/index.js:104:29
    at _rejected (/Users/brodybits/.nvs/node/9.3.0/x64/lib/node_modules/cordova/node_modules/q/q.js:864:24)
    at /Users/brodybits/.nvs/node/9.3.0/x64/lib/node_modules/cordova/node_modules/q/q.js:890:30
    at Promise.when (/Users/brodybits/.nvs/node/9.3.0/x64/lib/node_modules/cordova/node_modules/q/q.js:1142:31)
    at Promise.promise.promiseDispatch (/Users/brodybits/.nvs/node/9.3.0/x64/lib/node_modules/cordova/node_modules/q/q.js:808:41)
    at /Users/brodybits/.nvs/node/9.3.0/x64/lib/node_modules/cordova/node_modules/q/q.js:624:44
    at runSingle (/Users/brodybits/.nvs/node/9.3.0/x64/lib/node_modules/cordova/node_modules/q/q.js:137:13)
    at flush (/Users/brodybits/.nvs/node/9.3.0/x64/lib/node_modules/cordova/node_modules/q/q.js:125:13)
    at process._tickCallback (internal/process/next_tick.js:150:11)
(node:10383) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:10383) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Extended LTS release support?

Constant and rapid evolution is excellent in general but can cause problems for certain users that have to work for years without major upgrades. It would be great to see LTS releases that are supported for at least 3-5 years.

I would be happy to help as much as I can. I hope some others would be willing to help.

Safeguard against conflicting plugins

This has been an issue with sqlite but I could see this becoming an issue with other plugins that get forked over time. It would be great if Cordova could avoid this problem by reporting an error if someone adds multiple plugins with the same clobbers target value.

[CB-12397] .gitignore instead of unwanted .npmignore after cordova create (7.0.1)

C:\Users\Chris\Documents\chris-work
λ cordova --version
7.0.1

C:\Users\Chris\Documents\chris-work
λ cordova create ctapp1
Creating a new cordova project.

C:\Users\Chris\Documents\chris-work

C:\Users\Chris\Documents\chris-work
λ ls -a ctapp1\
./  ../  .npmignore  config.xml  hooks/  package.json  platforms/  plugins/  res/  www/

C:\Users\Chris\Documents\chris-work
λ cat ctapp1\.npmignore
# OS X
.DS_Store

C:\Users\Chris\Documents\chris-work
λ

I would rather have .gitignore instead ref: Apache CB-12397: fix .gitignore for plugins & platforms in app template

Support generic platforms

Currently, unless your new platform has a known name, you cannot use it with the cordova-cli.

cordova-lib has numerous checks for whether or not the platform is in the list of know platforms. This is why you can cordova platform add cordova-android and then run cordova run android, the alias mapping prevents new platforms from working.

This was recently discussed on the mailing list, some important excerpts here:
[@shazron]

re: https://issues.apache.org/jira/browse/CB-11346?focusedCommentId=15875577&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-15875577

Looks like there is more to it than the patch. The error occurs here: https://github.com/apache/cordova-lib/blob/a9605411ab007d700849c971043f0c211c06100c/cordova-lib/src/cordova/platform.js#L389

All three conditions have to be satisfied:

version (from package.json)
platform name (from package.json name, has to be in the form of cordova-XXXX where XXX is the actual platform name)
platform name exists in platformConfig.json file
We would have to remove checks 2 and 3, but not sure of the impact since platformConfig.json contains information that is probably needed elsewhere (ideally it would exist in the platform itself!)

[@shazron]

The src/platforms/platforms.js file touches almost all commands, particularly the use of the getPlatformAPI call, so removing this is tricky -- but at least there is only one API call to abstract away.

Ideally platform name/alias should be part of the platformAPI or just part of it's package.json
cli commands that touch platforms could potentially just take the specified platform string and look inside platforms/ for a folder with that name. The location of the platformAPI is standard within that forlder.

Cordova vs PhoneGap CLI is too confusing

From #PgDay USA (NYC) 2017: Sometimes we have to use Cordova CLI, sometimes we have to use PhoneGap CLI, depending on who wrote the directions for a tutorial or workshop. This is getting too confusing, please separate when to use Cordova vs PhoneGap tools. For example: Cordova CLI for basic tasks such as prepare/build/run project in a work area, PhoneGap CLI for more specialized items such as running in PhoneGap developer app.

In specific terms: please deprecate PhoneGap CLI.

It is my understanding from @macdonst that PhoneGap CLI uses the exact same library code as Cordova CLI per version which is already good progress. Hope to see the final end of this mess.

Breaking changes in cordova-create

Recently I've done quite a lot of cleanup work in cordova-create (see apache/cordova-create/pull/13). This PR includes only non-breaking changes. However, IMHO there is still a lot of technical debt that can only be addressed by making some breaking changes.

For most of these changes I already have some code in my local repo, so all of this could probably be implemented in short to no time. I'd just have to get it done before work hits again.

In what follows, let cordovaCreate be the anonymous function that is the main export of the cordova-create package.

TOC

  • §1 Simplify arguments accepted by cordovaCreate (#99)
  • §2 [RESOLVED] Drop support for reading configuration from <dir>/.cordova/config.json
  • §3 New logic for setting attributes in package.json & config.xml (#100)
  • §4 Do not subscribe CordovaLogger to Cordova events (#101)
  • §5 Do not copy "missing" files from default template (#102)
  • §6 [RESOLVED] Fetch templates to system temp dir
  • §7 Reduce supported template layouts (#103)
  • §8 Drop support for linking (#104)

§1 Simplify arguments accepted by cordovaCreate

Current situation

Arguments

/**
 * Usage:
 * @dir - directory where the project will be created. Required.
 * @optionalId - app id. Required (but be "undefined")
 * @optionalName - app name. Required (but can be "undefined").
 * @cfg - extra config to be saved in .cordova/config.json Required (but can be "{}").
 * @extEvents - An EventEmitter instance that will be used for logging purposes. Required (but can be "undefined").
 **/
// Returns a promise.
function (dir, optionalId, optionalName, cfg, extEvents) {...}

Properties of cfg used in cordovaCreate¹

{
    lib: {
        www: {
            // The path/url/npm-name to the template that should be used
            url: String,

            // Symlink instead of copy files from template to dir
            link: Boolean,

            // Template is only fetched when true.
            // Template files are only copied when true.
            // If false, only some "mandatory" files are copied over from
            // `cordova-app-hello-world`
            template: Boolean,

            // Deprecated alias for url (w/out deprecation warning)
            uri: String
        }
    }
}

¹: neither the cfg object nor parts larger than single leaf properties are
passed outside the scope of this module, so a local view on this is all we need.

Pain Points

  • Required but optional™ arguments
  • Deeply nested structure of configuration
  • Confusing naming and unclear semantics of configuration

Proposal

Arguments

/**
 * Creates a new cordova project in dest.
 *
 * @param {string} dest - directory where the project will be created.
 * @param {Object} [opts={}] - options to be used for creating a new cordova project.
 * @returns {Promise} Promise that resolves when project creation has finished
 */
function (dest, opts) {...}

Structure of opts

{
    // Attributes to be set in package.json & config.xml
    id: String,
    name: String,
    version: String,

    // The path/url/npm-name to the template that should be used
    template: String,

    // Symlink instead of copy files from template to dest
    link: Boolean,

    // An EventEmitter instance that will be used for logging purposes
    // If not dropped as proposed in §4
    extEvents: EventEmitter
}

§2 Drop support for reading configuration from <dir>/.cordova/config.json

Resolved in apache/cordova-create#18

Current situation

Before doing anything interesting, cordovaCreate looks for the file
<dir>/.cordova/config.json. If it exists, its contents are parsed as JSON and
merged with cfg.

Pain Points

  • Undocumented feature (AFAIK; related phonegap issue)
  • Completely untested feature (at least in cordova-create)
  • Unclear use cases (As config can be passed to CLI as JSON too)
  • Makes it harder to reason about code

Proposal

Drop it like it's hot!

§3 New logic for setting attributes in package.json & config.xml

I'm talking about the logic behind setting the appropriate fields for App ID,
App Name and App Version in the files package.json and config.xml.

Current situation

The most common strategy is to set the attribute in both files iff a value for
it was given to cordovaCreate. Exceptions are

  • App ID in package.json: set attribute if value given else set to helloworld
  • App Version in both files: always set to 1.0.0

Pain Points

  • Strategies employed for setting the attributes differ
  • Falling back to hard coded defaults is not very flexible (e.g. I usually start my version numbering at 0.1.0)

Proposal

For every file f and every attribute attr, do the following

if (attr in opts) {
    // Save attribute value passed to cordovaCreate to f
    f[attr] = opts[attr]
} else if (attr in f) {
    // Attribute already present in f and no override specified
    // => Leave the existing value untouched
} else if (isRequired(attr, f)) {
    handleMissingRequiredAttribute(attr, f)
}

where isRequired would have to be defined adequately
and handleMissingRequiredAttribute could either:

  1. Throw an error (my preference)
  2. Save some hard coded fallback value to f (possibly warn that f is invalid)

Related issues

CB-12274 - widget version number not copied from template config.xml file

§4 Do not subscribe CordovaLogger to Cordova events

Current situation

Right at the start, cordovaCreate calls the following function with the
extEvents argument passed to it.

/**
 * Sets up to forward events to another instance, or log console.
 * This will make the create internal events visible outside
 * @param  {EventEmitter} externalEventEmitter An EventEmitter instance that will be used for
 *   logging purposes. If no EventEmitter provided, all events will be logged to console
 * @return {EventEmitter}
 */
function setupEvents (externalEventEmitter) {
    if (externalEventEmitter) {
        // This will make the platform internal events visible outside
        events.forwardEventsTo(externalEventEmitter);
    // There is no logger if external emitter is not present,
    // so attach a console logger
    } else {
        CordovaLogger.subscribe(events);
    }
    return events;
}

Pain Points

  • Every call to cordovaCreate w/out extEvents subscribes CordovaLogger to
    events again w/ no possibility to unsubscribe it.
  • cordovaCreate is tightly coupled to the Cordova event bus singleton.

Proposal

I don't know much about the established patterns to use the Cordova event bus,
but the following would make sense to me as replacements for setupEvents in cordovaCreate:

1. Send events to cordova-common's events

if (extEvents) {
    events.forwardEventsTo(extEvents);
}

Forwarding events makes no sense in this case. If we emit events to a global event bus, we don't need to provide the service to setup event forwarding for callers. The callers could just call events.forwardEventsTo(extEvents) themselves. The forwarding we setup isn't scoped to cordovaCreate either.

2. Only emit events if an EventEmitter was passed to cordovaCreate

const emit = extEvents
    ? (...args) => extEvents.emit(...args)
    : () => {};

This would break the coupling to the global event bus and enable callers to subscribe to cordovaCreate events only.

§5 Update required template files/dirs

Some files and dirs are copied to dest from cordova-app-hello-world if they
are not present in the used template.

Current situation

These files and dirs are:

  • www
  • hooks
  • config.xml

Pain Points

  • hooks dir has been deprecated for a long time and is created w/ every new cordova app
  • package.json could initially be missing from an app

Proposal

A: Remove this behavior (Preferred)

  • Make cordovaCreate more agnostic to the template layout
  • Principle of least surprise for template authors

B: Update this behavior

Update required files and dirs to:

  • www (not even sure if this is necessary)
  • config.xml
  • package.json

Related

#78

§6 Fetch templates to system temp dir

Current situation

cordovaCreate uses cordova-fetch to save any remote templates to
$HOME/.cordova before copying the assets to the created app.

Pain Points

  • Litters the user's home directory (How I hate this...)
  • Fetched template is not deleted after usage

Proposal

Fetch templates to system temp dir w/ cleanup on process exit (provided by tmp package).
This functionality might even be provided by cordova-fetch itself.

I don't even think this one would be a breaking change, but I'm not sure so it is included here.

§7 Reduce supported template layouts

Current situation

cordovaCreate supports handling of at least three different layouts for the
templates that are referenced by url. Let TEMPLATE be the directory on disk that
contains the resolved template. Then there are these three cases:

  1. TEMPLATE contains a proper template as documented in the template docs
    cordovaCreate will copy all contents of TEMPLATE/template_src to dir (simplified)
  2. A "bare" folder w/out a main module
    cordovaCreate will copy all contents of TEMPLATE except for some blacklisted² files to dir
  3. basename(TEMPLATE) === 'www'
    cordovaCreate will copy TEMPLATE to dir/www

Additionally cordovaCreate still handles (and corrects) the case that
config.xml is located in TEMPLATE/www instead of TEMPLATE.

²: package.json, RELEASENOTES.md, .git, NOTICE, LICENSE, COPYRIGHT, .npmignore

Pain Points

  • AFAICT, only case 1 is documented
  • Increased code & documentation complexity

Proposal

  • Drop support for 3.
  • Document or drop 2.
  • Drop Support for templates with www/config.xml.

§8 Drop support for linking

I'm not so sure about this one, but after all this is called cordova-discuss, right?

Current situation

Ignoring all special cases of §7, cordovaCreate w/ enabled link option will

  • symlink folders www, merges and hooks
  • symlink the file config.xml

Pain Points

  • I don't get what use cases there could be for this.
    Even if there are some, this does not seem like something that is used often.
    Is there any telemetry data on this?
  • hooks is deprecated
  • Needs special privileges on Windows since it also links files.

Proposal

Drop it.

Conclusion

Let me break all the things! 😉

cordova prepare needed for sqlite plugin on iOS with Xcode 8

For some reason I need to do cordova prepare before running an app with Cordova-sqlite-storage on iOS with Xcode 8. If I do cordova prepare then Cordova-sqlite-storage works for me on my iOS 8.1.2 device (iPhone 4S) and iOS 10.0.2 device (iPhone 5S), with or without the WKWebView plugin. I did the testing with the built-in test suite and https://github.com/brodybits/Cordova-sqlite-bootstrap-test. I think this explains the problems reported in storesafe/cordova-sqlite-storage#567 and storesafe/cordova-sqlcipher-adapter#22.

Unfortunately I did not have a chance to test if this is a problem with any other plugins or not. I would be happy to do some further testing to help narrow the problem when I get a chance in the next couple weeks or so. For now I will simply document the use of cordova prepare as a requirement for iOS and as a recommendation for the other platforms.

Question: Format for discussion new ideas

As I understand from the README, this is a repo to discuss new ideas for Cordova. I think it would help if we lay down guidelines on how to create new files for new ideas. Is the idea here that we use github instead of google docs ?

Would help if that is elaborated in the README, and we have suggestions on how to create a new idea.

cordova-android 6.0.0 (installed by cordova-cli 6.4.0) drops result with u2028/u2029

Similar to Apache Cordova CB-9435 (cordova-ios) (will not be fixed, also an issue on macOS ["osx"]): after upgrading to Cordova CLI 6.4.0 (which seems to use [email protected]) my sqlite plugin cannot return results with u2028 (line separator) or u2029 (paragraph separator) characters.

I don't expect this to be an issue on Windows since Cordova does not seem to use JSON on that platform. (I will test and confirm when I get a chance.) UPDATE: Confirming this is NOT an issue on the Windows platform. I am not sure about the deprecated wp8 platform.

I will understand if this is not fixed for Android or iOS but would like to see this limitation documented. I will raise this on Apache Cordova JIRA and contribute this when I get a chance.

[Windows] Universal Windows 8.1 version?

I noticed when I installed a new version of Visual Studio 2015 (Community Edition) for testing that it is possible to generate a "Universal Windows 8.1" Javascript project that can run on both Windows 8.1 and Windows Phone 8.1. While this will eventually be superseded with Windows 10, do we want to consider supporting this one for now?

Unknown: I don't know if it is possible to get a native C++ library working for "Universal Windows 8.1".

Proposal: cordova-serve

I started a thread about this on the dev list, but figured it would be good to have it here.

A while back we duplicated a bunch of cordova serve code in cordova-browser so that cordova run browser would launch from a server rather than the local file system. At the time, the desire was expressed that ultimately we should avoid the duplicated code and have a separate cordova-serve module. Since this module would also be useful for the plugin simulation stuff I've been working on, I've been taking a look at it recently.

I have an initial prototype implementation (which also includes some functionality I need for the plugin simulation work) here, changes to cordova-browser to use it here, and corresponding changes to cordova-lib here.

Primary question is where this module would live. Likely possibilities are:

  1. As a new Cordova repository.
  2. Within the cordova-lib repository (it would be its own npm module - its source would live in a cordova-serve folder next to the cordova-lib folder).

The advantage of the second approach is that it avoids proliferation of Cordova repositories, particularly for a small helper module that is required by cordova-lib, and it starts implementing the whole reason cordova-lib is in a folder within the cordova-lib repo (so we can have multiple packages in the repo). However, it has some disadvantages:

  • It will have to share appveyor and travis configuration files with cordova-lib.
  • It will not be installable via npm from git (since npm requires package.json at the root of the repo).

I'm interested in opinions on what would be the best approach.

Cordova and Multi-Window

Has there been any progress in finding a solution for this multi-window support? As it has described here, the Cordova activty is destroyed and restarted whenever being resized, and along with it goes the webview. My users have reported this, and since my javascript does locally store some values relating to the session and inputs, this causes some annoyance.

Not sure if this is the place for this or if this project is still active, but wondering if anyone has found a workaround. Thanks.

Proposal: Plugin docs generation

Cordova docs-gen proposal

Initial points for investigation were the following:

  • Code to Docs tool selection -> proposing JSDoc for following reasons:
    • JSDoc parses code-tree, which means smart code analysis, internal linking and less comments verbosity in code,
    • JSDoc is extensible via JS plugins,
    • JSDoc presentation is customizable via templates,
    • Existing code uses JSDoc format mostly;
  • Generated docs renderer selecting -> Use either JSDoc (HTML output) or jsdoc-to-markdown (md output),
  • Create JSDoc plugin for handling Cordova-specific tags like supported-platforms, quirks (or windows-quirks, android-quirks, ...), etc.,
    • Investigate possibility: Link to quirks/examples (similar to tutorial tag) instead of inlining to reduce noise in the code (this will also help as existing docs will be moved as is),
      • @partial plugin can be used for this purpose. Using it along with markdown plugin allows just to move big docs chunks from plugin docs to function/class-related files (there is also a @tutorial plugin, but it just inserts a link to separate file),
      • JSDoc @typedef tag can be used for linking to separate file - this has a drawback that separate file has to be in JSDoc comments format (while we have md);
  • Use custom JSDoc template to integrate with cordova-docs site,
    • The documentation will need to be rebuilt on each code change. Investigate a proper way to do this? (CI tools, precommit hook, prepackage hook for npm).

Prototypes:

Thoughts?
Perhaps there are some better tools or methods I have missed?

cordova and languages in projects

Yesterday I saw this issue
https://issues.apache.org/jira/browse/CB-9789 (camera plugin doesn't use the native iOS language)

And I was going to close as some other older duplicated
https://issues.apache.org/jira/browse/CB-1857
https://issues.apache.org/jira/browse/CB-3213

Let me explain the problem, iOS native components show the UI in the project languages and not in the device laguage, and cordova ios projects are created in english (all native projects are created in english by default), the language can be changed on the info.plist changing this line

<key>CFBundleDevelopmentRegion</key>
<string>English</string>

But that issue made me think, is there a way of creating cordova projects in other languages or make them multilingual?
Cordova apps are created with html, css and javascript, so you can display the UI in any language you want or make it multilingual with different techniques, but that only makes your app multilingual not the project, so on the eyes of the stores (at least on the apple store, your app will be just in english, not sure about others) and you will have problems like the mentioned on the previous issues.

I've found this issue proposing "language flags for app stores" https://issues.apache.org/jira/browse/CB-7103

So, should we do something about it? manage project languages on config.xml? a core plugin? or a 3rd party plugin?

Proposal: Create Cordova projects from templates

When creating a new cordova project, we can today do a cordova create --copy-from to create the project based on another project. However, --copy-from only copies from folders, not from HTTP/Git URLs. The proposal is to allow --copy-from to use git and http URLs.

The advantage would be that folks from the community could create starter Cordova projects (using frameworks like Ionic, Angular, OnseenUI) or specify default plugins that come pre-installed, etc. This would be a quick way to start a new Cordova project, based on templates created by the community and hosted on git or on the web.

Fix CLI guide: use --save flag when adding plugins

https://cordova.apache.org/docs/en/latest/guide/cli/#add-platforms specifies that the --save flag should be used with each cordova platform add command.

I think this should also be done for each cordova plugin add command in the CLI guide at: https://cordova.apache.org/docs/en/latest/guide/cli/#add-plugins

Major benefits would include:

I find this to be especially important with some of the more complex plugins such as cordova-sqlite-storage which is updated frequently and deals with external dependencies.

I will raise an Apache JIRA issue and propose a fix when I get a chance.

This is driven by the question at: https://groups.google.com/forum/#!topic/phonegap/VqSQ9HV-O6Q - cordova-sqlite-storage npm failure to install

Non-destructive platform update

Although we designed/intended for platforms to be build artifacts, there will always be cases where the app developer has made changes that they would like to keep.
Currently if an app developer runs cordova platform update ios any changes they have made to the xcode project, or any files present in the new template will be overwritten.

While being aware of and migrating any changes is absolutely out of scope, it would great if we could keep the older version around so that developers could at least have the chance to do their own migration.

Proposal:

(using ios for example only, this applies to all platforms)

Assuming the app developer has already done a cordova platform add [email protected]
Their file structure then looks like this:

./platforms/ios/

If they choose to update, running cordova platform update ios
We will:

  • rename the current ios to [email protected] based on it's own version number
  • fetch the latest ios as we do already, and place it in ./platforms/ios

So the developer's file structure then looks like this:

./platforms/ios/
./platforms/[email protected]

This has been discussed in the past, and I believe there is consensus that this is a good idea. I just wanted to formalize it here before we move forward with it.

Some out of scope nice-to-have's that will be a part of another proposal:

  • allow running of each platform@version, so the dev could still run
  • support downgrading (which could be destructive?)
    • cordova platform downgrade|revert ios
  • support adding older platform versions

Plugin dependencies (using npm)?

I maintain several versions of the sqlite plugin and have been keeping them in sync by git merging. It is extremely time consuming to go through the merge-test stages over and over. It is especially time-consuming to keep the README.md documentation in reasonable sync.

It is possible to define sub-projects in git but I suspect the Cordova tooling would not follow such git sub-projects. I am also not convinced that this would be the best solution.

It would be possible to define a plugin to depend on other plugin(s), but I find this clumsy and error-prone and don't expect it to work with cordova-paramedic CI testing.

The solution I know of is to define a before_plugin_install hook script like they do in: https://github.com/AllJoyn-Cordova/cordova-plugin-alljoyn

In comparison, Node.js/npm defines a way for modules to depend on each other which works great for Javascript but does not support nested dependencies for C/C++ addon code modules.

EXTRA NOTE ADDED: It would be possible to include certain external dependencies by adding dependenc(y)(ies) on other plugin project(s) but this would not be supported by the automatic cordova-paramedic CI testing that I am using.

Improve startup in JavaScript

The requirement to wait for the deviceready event has caused some major confusion and other trouble for people using Ionic 2 and other Angular derivatives with the sqlite plugin. Here are a couple examples:

I think storesafe/cordova-sqlite-storage#594 (comment) by @rodineijf really helps to highlight this problem:

Hi @brodybits, by default the attribution of rootPage on ionic 2 is on declaration of var rootPage. I can solve my problem moving the rootPage attribution to the platformReady on app.component

initializeApp() {
this.platform.ready().then(() => {

  this.rootPage = MyPage;
  StatusBar.styleDefault();
  Splashscreen.hide();
});
}

In contrast I heard that in the React Native there is no requirement to wait for the deviceready event.

I think the solution is to fix cordova.js to prepare the all of the JavaScript from the plugins upon loading and to have cordova.exec put the native calls into a queue until the initialization is confirmed to be completed.

I will take a look at fixing this when I get a chance.

Document why "AnyCPU" platform is dropped for Windows 10 UWP

Over the past 1-2 years I noticed that if I would use the Cordova CLI to add the Windows platform build and then open the Visual Studio Solution file with the Visual Studio (2015) GUI it would select the "Any CPU" platform by default. This was good for Windows 8.1 and Windows Phone 8.1 for WinJS apps without SQLite since almost other plugins have been JavaScript only. I found a nice article for reference that seems to be duplicated somehow:

Then I found out that Microsoft did not really want to support the "Any CPU" target platform for Windows 10 UWP. I discovered that if I would build a test app with no plugins I could run an "Any CPU" build in Debug mode but not release mode.

From an unrelated discussion (storesafe/cordova-sqlite-storage#610) I searched for information about an <EnableDotNetNativeCompatibleProfile> setting and found this question: http://stackoverflow.com/questions/29979047/windows-universal-app-no-any-cpu-configuration-for-windows-10

With some more searching I discovered why: .NET Native ref: https://blogs.windows.com/buildingapps/2015/08/20/net-native-what-it-means-for-universal-windows-platform-uwp-developers/

I wish this were documented more clearly for Cordova users, on a blog for example.

Migrate issues to GitHub PLEASE

GitHub issue NEEDED to track all of the little bugs and unanswered questions to avoid repeated investigation work and other forms of wasted time. (GitHub migration proposal in #75 seems to have stalled with no more response.) I already started https://github.com/brodybits/cordova-notes to keep track of these items and would be very happy to transfer it to your organization if desired.

Simpler native storage solution

I recently discovered https://github.com/TheCocoaProject/cordova-plugin-nativestorage which looks like a simpler solution for "native storage of variables" on Android/iOS/Windows. Please add it to http://cordova.apache.org/docs/en/latest/cordova/storage/storage.html.

I found it in a comment on https://www.sitepoint.com/storing-local-data-in-a-cordova-app/, maybe also good to add a pointer to this guide to storage.html.

Major advantages of the Cordova sqlite plugin that I maintain include the incredible flexibility of SQL, support for batch transactions, and consistent support across all major mobile platforms Android/iOS/Windows.

JavaScript improvements for a major release

  • Same cordova-js build for all platforms. Use of concepts such as IOC (inversion of control), DI, factory functions, etc. to keep same common JavaScript for all platforms, with limited number of platform-specific functions. I would be happy to explain further if this is not clear enough.
  • Cordova JavaScript should initialize the functions, structures, queues, etc. so that application JavaScript does not have to wait for deviceready event (already raised in #60). I think this could be an especially major win with frameworks like Angular.

I would be happy to make a demo for discussion, cannot promise when I can make the time.

Proposal: Unified logging

Cordova unified logging

Note: The issue is associated with Cordova-lib refactoring proposal .

Existing architecture issues and proposed solutions

1. cordova-lib and cordova platforms have logging set up inconsistently

Current implementation details:

  • cordova-lib uses EventEmitter, which is further listened in cordova-cli and redirected to console calls,
  • Cordova platforms use console methods directly.

This leads to the following issue: log level of cordova-cli doesn't affect platforms at all.

Proposed solutions:
Variant A: Platforms can use EventEmitter passed as a dependency module via PlatformApi' interface (f.e. as a ctor parameter).
In case of CLI-mode cordova-lib EventEmitter will be used (and logs handling will be unified therefore).
In case of platform-standalone mode EventEmitter will be defaulted in the platform.
Variant B: Pass logger class from cordova-lib down to platforms and call its methods further.

Variant A is recommended as it separates aspects of events emitting from logging and is more flexible in terms of substituting logger module.


2. The log messages aren't standardized

Proposed solution:

  • logger module verbosity-based prefixing can be used (WARN :, ERROR:, etc.),
  • Emit objects rather than just messages in case of errors (f.e. use CordovaError extended with an error code).

3. Platforms logging mechanism does not allow plugging in a custom handling code/module (integration & custom transport levels)

Proposed solution:

  • Top-level cordova.on event can be used to subscribe for error events since cordova-lib' EventEmitter will be used,
  • Additionally logger module used in CLI or platform-standalone mode can be substituted to a pluggable one, for example winston,
  • Some multi-transport logger module can be used to use transports other than console (file, couchdb, etc.).

4. Errors from third-party components (ant, gradle, etc.) can't be easily distinguished

Proposed solution:
Attach to process.spawn stdout and stderr, supply caught errors with their source in meta object (f.e. extended CordovaError - see 2.).

Proposal: Adding custom label for contacts manager

I'm developing an app that needs to add custom labels on contacts using the contacts plugin. I saw that the custom label is not implemented. How possible is to implement this?

I make some ajusts in the plugin in my project, but only in the Android app.

Update available message after update on Windows [minor]

C:\Users\Chris
λ
C:\Users\Chris
λ npm update -g cordova
npm WARN deprecated [email protected]: Use uuid module instead
C:\Users\Chris\nvs\default\cordova -> C:\Users\Chris\nvs\default\node_modules\cordova\bin\cordova
C:\Users\Chris\nvs\default
`-- [email protected]


C:\Users\Chris
λ cordova --version
7.0.1


┌──────────────────────────────────────────┐
│ Update available: 7.0.1 (current: 7.0.0) │
│ Run npm install -g cordova to update.    │
└──────────────────────────────────────────┘


C:\Users\Chris
λ cordova --version
7.0.1

C:\Users\Chris
λ

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.