GitToTheHub commented on code in PR #1520:
URL: https://github.com/apache/cordova-docs/pull/1520#discussion_r3943915417


##########
www/docs/en/latest/package_ref/index.md:
##########
@@ -0,0 +1,152 @@
+---
+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`](https://docs.npmjs.com/cli/configuring-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.

Review Comment:
   This sentence could be changed:
   
   > 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.
   
   To:
   
   > Cordova's tooling reads from and writes to a handful of fields in this 
file to keep track of your project's platforms and plugins.
   
   Reason:
   
   - Cordova will not write anything to config.xml after it was created.
   - There is no project's metadata which is keeping tracked in `package.json`. 
It's just the platforms and plugins.



##########
www/docs/en/latest/package_ref/index.md:
##########
@@ -0,0 +1,152 @@
+---
+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`](https://docs.npmjs.com/cli/configuring-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.

Review Comment:
   I think the introduction could made in general easier. It's just the 
platforms and plugins which Cordova manages in `package.json`.



##########
www/docs/en/latest/package_ref/index.md:
##########
@@ -0,0 +1,152 @@
+---
+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`](https://docs.npmjs.com/cli/configuring-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` at that 
time only, Cordova does not go back and update them later if `config.xml` 
changes.

Review Comment:
   > These values are copied from the corresponding attributes in `config.xml` 
at that time only
   
   I think it was wrong from me to write they are copied from there the first 
time. It's more that `config.xml` and `package.json` are created initially on 
`cordova create`. No values are read at all from `config.xml`.



##########
www/docs/en/latest/package_ref/index.md:
##########
@@ -0,0 +1,152 @@
+---
+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`](https://docs.npmjs.com/cli/configuring-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` at that 
time only, Cordova does not go back and update them later if `config.xml` 
changes.
+
+Field | Description
+----------------- | ------------
+name | Copied from `config.xml`'s `widget id` attribute (the app's reverse-DNS 
identifier), converted to lowercase.
+displayName | Copied from `config.xml`'s `<name>` element (the app's 
human-readable name).
+version | Copied from `config.xml`'s `widget version` attribute.
+
+Examples:
+
+```json
+{
+  "name": "io.cordova.hellocordova",
+  "displayName": "HelloCordova",
+  "version": "1.0.0"
+}
+```
+
+## cordova.platforms
+
+An array listing the platforms currently installed in the project. Entries are 
added automatically when you run `cordova platform add <platform>`, and removed 
when you run `cordova platform remove <platform>`. Adding a platform that's 
already listed will not create a duplicate entry.
+
+Automatic saving can be turned off with the [`--nosave` 
flag](#cli---nosave-flag).
+
+Examples:
+
+```json
+{
+  "cordova": {
+    "platforms": ["android", "ios"]
+  }
+}
+```
+
+```bash
+cordova platform add android
+cordova platform add ios --nosave
+```
+
+## cordova.plugins
+
+An object listing the plugins currently installed in the project. Each key is 
a plugin's ID, and its value holds any CLI variables that were supplied when 
the plugin was installed (or an empty object if none were needed). Entries are 
added by `cordova plugin add <plugin>` and removed by `cordova plugin remove 
<plugin>`. Automatic saving can be turned off with the [`--nosave` 
flag](#cli---nosave-flag).
+
+Examples:
+
+```json
+{
+  "cordova": {
+    "plugins": {
+      "cordova-plugin-camera": {},
+      "cordova-plugin-some-plugin": {
+        "API_KEY": "my-api-key"
+      }
+    }
+  }
+}
+```
+
+```bash
+cordova plugin add cordova-plugin-camera
+cordova plugin add cordova-plugin-some-plugin --variable API_KEY=my-api-key
+```
+
+## devDependencies
+
+A standard npm field, not unique to Cordova. See npm's docs on 
[`devDependencies`](https://docs.npmjs.com/cli/v12/configuring-npm/package-json#devdependencies)
 for the general behavior. When a platform or plugin is installed, Cordova's 
tooling also records it here as an npm dependency, alongside its installed 
version number. This is separate from [`cordova.platforms`](#cordovaplatforms) 
and [`cordova.plugins`](#cordovaplugins), `devDependencies` tracks the actual 
npm package and version that was fetched.
+
+Automatic saving can be turned off with the [`--nosave` 
flag](#cli---nosave-flag).
+
+Examples:
+
+```json
+{
+  "devDependencies": {
+    "cordova-android": "^13.0.0",
+    "cordova-plugin-camera": "^7.0.0"
+  }
+}
+```
+
+## CLI --nosave Flag
+
+By default, `cordova platform add` and `cordova plugin add` automatically save 
what you installed into `package.json` (and `config.xml`). If you'd rather 
install something without permanently adding it to your project's 
configuration, for example, to test a plugin temporarily, pass the `--nosave` 
flag:

Review Comment:
   There is nothing automatically saved to `config.xml`.
   
   The text:
   
   ```(and `config.xml`)```
   
   can be removed.



-- 
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]

Reply via email to