GitToTheHub commented on code in PR #1520: URL: https://github.com/apache/cordova-docs/pull/1520#discussion_r3931196170
########## www/docs/en/latest/package_ref/index.md: ########## @@ -0,0 +1,149 @@ +--- +license: > + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. + +title: package.json API +description: List of Cordova-specific fields in the package.json file, and when the CLI updates them. +--- + +{% cdv_platform inject %} + +# package.json API + +Alongside `config.xml`, every Cordova project created with the CLI also has a standard npm `package.json` file. Cordova's tooling reads from and writes to a handful of fields in this file automatically, in addition to `config.xml`, to keep track of your project's platforms, plugins, and metadata. + +This page lists the Cordova-specific fields you may find in your `package.json`, and explains when and how the CLI updates each one, so that you know what's safe to edit by hand and what's managed for you. + +**Sample `package.json`:** + +```json +{ + "name": "io.cordova.hellocordova", + "displayName": "HelloCordova", + "version": "1.0.0", + "description": "Sample Apache Cordova App", + "main": "index.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "cordova": { + "platforms": [ + "android", + "ios" + ], + "plugins": { + "cordova-plugin-device": {} + } + }, + "devDependencies": { + "cordova-android": "^13.0.0", + "cordova-ios": "^7.0.0", + "cordova-plugin-device": "^2.1.0" + } +} +``` + +## name, displayName, version + +Set automatically when a project is first created with `cordova create`. These values are copied from the corresponding attributes in `config.xml`, and kept in sync with them. Review Comment: Yes, I noticed that, too. You have to keep them sync manually. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
