layout: post author:
name: Audrey So
url: https://twitter.com/aud_rey_so
title: "Apache Cordova 7.0.0" categories: news
We are happy to announce that Apache Cordova 7.0.0 has been released!
Most notable changes include:
If a package.json does not exist in your project, it will be auto-created for you when cordova prepare is called.
When adding a platform or plugin, the previous default behavior of not-saving has changed to saving. Now it will automatically save that platform or plugin to your config.xml and package.json. Details about platform and plugin versions are also automatically saved in config.xml and package.json. The --save flag is no longer required to save. Use --nosave to prevent saving to config.xml or package.json.
Fetch is now the default method for fetching platforms. Fetch uses your system npm to npm install modules into your project. The --fetch flag is no longer required. Use the --nofetch flag to revert to pre-Cordova@7.0 behavior (npm install is not used to fetch modules).
After cordova prepare is run, package.json and config.xml should contain identical platforms and versions. In case of conflicts, package.json is given precedence over config.xml. For example, suppose package.json contains cordova-android@6.0.0 and config.xml contains cordova-android@4.0.0. After cordova prepare is run, config.xml and package.json will each contain only cordova-android@6.0.0.
Platforms and plugins are now required to have a package.json file.
We have added support for custom platforms. This will allow future custom platforms, and modified versions of existing platforms. Example:
cordova platform add custom-platform-name
A cordova config command has been created to set, get, delete, edit, and list global Cordova options. For example, you can use the following command cordova config set <key> <value> to set the value of autosave or fetch to true or false.
In the following case, you are turning off autosave as the default setting. autosave is true by default in cordova. Example:
cordova config set autosave false
In the following case, you are turning off fetch as the default setting. fetch is true by default in cordova. Example:
cordova config set fetch false
In addition, the cordova config command supports the browserify setting, which allows the JavaScript of plugins to be loaded at build time compared to run time. For instance, if the browserify value is not explicitly passed in by the user, the cordova config command will automatically set the browserify value saved in ~/.config/configstore/ to be saved globally. Users can get and set browserify. browserify is false by deafult in cordova. Example:
cordova config get browserify
cordova config set browserify true
Dropped support for node 0.x. Only node versions 4.0 and up are supported.
Dropped support for wp8 (windows phone 8).
cordova-windows : dropped support for any versions older than 4.0.0.
cordova-android : dropped support for any versions older than 5.0.0.
cordova-ios : dropped support for any versions older than 4.0.0.
cordova-osx : dropped support for any versions older than 4.0.0.
To upgrade:
npm install -g cordova@latest
Please report any issues you find at issues.cordova.io!
(before|after)_plugin_(uninstall|install) to always expect existence of plugin field*_plugin_install hookspackage.jsongetPlatformApiFunctionparser and handler files for deprecated versions of platformspackage.jsonengineStrict as it is no longer supportedamazon-fireos codepackage.json if it doesn't exist during cordova preparepackage.json name field is config.xml id field and package.json displayName field is config.xml name fieldrequireNoCache function and replaced instances of delete.require cachespec specified for dependencies of plugins in plugin.xmlpluginMapper code from uninstallnode 0.x--fetch and fixed failing tests for adding a relative pathpackage.json for platform/plugin add/rmspec restore to sync config.xml and package.jsoncordova-fetch is true by default. Use --nofetch flag to fetch platforms and plugins using old fetching logic.engineStrict as it is no longer supportededit and ls to cordova configcordova config command that sets, gets, and deletes global environment variables.node 0.xenginestrict since it is deprecatedresource-file from rootedit-config in config.xmlenginestrict since it is deprecatedcordova-lib dependency to 7.0.0@latest when fetching from npm when no version is specified. This will ensure an older cached version of the template is not usednode 0.x support.package.json displayname should equal config.xml name field and package.json name field should equal config.xml id field.package.json to default hello world app