You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by er...@apache.org on 2020/03/15 13:38:26 UTC

[cordova-common] branch master updated: chore: various cleanup tasks (#139)

This is an automated email from the ASF dual-hosted git repository.

erisu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cordova-common.git


The following commit(s) were added to refs/heads/master by this push:
     new 672566d  chore: various cleanup tasks (#139)
672566d is described below

commit 672566d5f317c2fbbdefd1c4cf56b18efd40aa9d
Author: エリス <er...@users.noreply.github.com>
AuthorDate: Sun Mar 15 22:38:19 2020 +0900

    chore: various cleanup tasks (#139)
    
    * test(coverage): exclude coverage directory
    * style(README): fix markdown violations
    * doc(README): modernize code examples
    * doc(README): minor text improvements
    * style(RELEASENOTES): minor text visual improvement
    * doc(README): apply suggestions & more
    * doc(README): update CI badge to reference master
---
 README.md       | 117 +++++++++++++++++++++++++++++++++-----------------------
 RELEASENOTES.md |   2 +-
 package.json    |   1 +
 3 files changed, 72 insertions(+), 48 deletions(-)

diff --git a/README.md b/README.md
index 86f9dd7..f1ce210 100644
--- a/README.md
+++ b/README.md
@@ -19,33 +19,42 @@
 #
 -->
 
-[![Actions Status](https://github.com/apache/cordova-common/workflows/Node%20CI/badge.svg)](https://github.com/apache/cordova-common/actions)
+[![Node CI](https://github.com/apache/cordova-common/workflows/Node%20CI/badge.svg?branch=master)](https://github.com/apache/cordova-common/actions?query=branch%3Amaster)
 [![NPM](https://nodei.co/npm/cordova-common.png)](https://nodei.co/npm/cordova-common/)
 
 # cordova-common
+
 Exposes shared functionality used by [cordova-lib](https://github.com/apache/cordova-lib/) and Cordova platforms.
+
 ## Exposed APIs
 
 ### `events`
 
-Represents special instance of NodeJS EventEmitter which is intended to be used to post events to cordova-lib and cordova-cli
+Represents special instance of NodeJS `EventEmitter` which is intended to be used to post events to `cordova-lib` and `cordova-cli`
 
 Usage:
+
 ```js
-var events = require('cordova-common').events;
+const { events } = require('cordova-common');
 events.emit('warn', 'Some warning message')
 ```
 
-There are the following events supported by cordova-cli: `verbose`, `log`, `info`, `warn`, `error`.
+Here are the following supported events by `cordova-cli`:
+
+* `verbose`
+* `log`
+* `info`
+* `warn`
+* `error`
 
 ### `CordovaError`
 
-An error class used by Cordova to throw cordova-specific errors. The CordovaError class is inherited from Error, so CordovaError instances is also valid Error instances (`instanceof` check succeeds).
+An error class used by Cordova to throw cordova-specific errors. The `CordovaError` class is inherited from `Error`, so it is a valid instance of `Error`. (`instanceof` check succeeds).
 
 Usage:
 
 ```js
-var CordovaError = require('cordova-common').CordovaError;
+const { CordovaError } = require('cordova-common');
 throw new CordovaError('Some error message', SOME_ERR_CODE);
 ```
 
@@ -53,13 +62,14 @@ See [CordovaError](src/CordovaError/CordovaError.js) for supported error codes.
 
 ### `ConfigParser`
 
-Exposes functionality to deal with cordova project `config.xml` files. For ConfigParser API reference check [ConfigParser Readme](src/ConfigParser/README.md).
+Exposes functionality to deal with cordova project `config.xml` files. For `ConfigParser` API reference check [ConfigParser Readme](src/ConfigParser/README.md).
 
 Usage:
+
 ```js
-var ConfigParser = require('cordova-common').ConfigParser;
-var appConfig = new ConfigParser('path/to/cordova-app/config.xml');
-console.log(appconfig.name() + ':' + appConfig.version());
+const { ConfigParser } = require('cordova-common');
+const appConfig = new ConfigParser('path/to/cordova-app/config.xml');
+console.log(`${appconfig.name()}:${appConfig.version()}`);
 ```
 
 ### `PluginInfoProvider` and `PluginInfo`
@@ -67,39 +77,40 @@ console.log(appconfig.name() + ':' + appConfig.version());
 `PluginInfo` is a wrapper for cordova plugins' `plugin.xml` files. This class may be instantiated directly or via `PluginInfoProvider`. The difference is that `PluginInfoProvider` caches `PluginInfo` instances based on plugin source directory.
 
 Usage:
+
 ```js
-var PluginInfo: require('cordova-common').PluginInfo;
-var PluginInfoProvider: require('cordova-common').PluginInfoProvider;
+const { PluginInfo, PluginInfoProvider }  = require('cordova-common');
 
 // The following instances are equal
-var plugin1 = new PluginInfo('path/to/plugin_directory');
-var plugin2 = new PluginInfoProvider().get('path/to/plugin_directory');
+const plugin1 = new PluginInfo('path/to/plugin_directory');
+const plugin2 = new PluginInfoProvider().get('path/to/plugin_directory');
 
-console.log('The plugin ' + plugin1.id + ' has version ' + plugin1.version)
+console.log(`The plugin ${plugin1.id} has version ${plugin1.version}`)
 ```
 
 ### `ActionStack`
 
-Utility module for dealing with sequential tasks. Provides a set of tasks that are needed to be done and reverts all tasks that are already completed if one of those tasks fail to complete. Used internally by cordova-lib and platform's plugin installation routines.
+Utility module for dealing with sequential tasks. Provides a set of tasks that are needed to be done and reverts all tasks that are already completed if one of those tasks fail to complete. Used internally by `cordova-lib` and platform's plugin installation routines.
 
 Usage:
+
 ```js
-var ActionStack = require('cordova-common').ActionStack;
-var stack = new ActionStack()
+const { ActionStack } = require('cordova-common');
 
-var action1 = stack.createAction(task1, [<task parameters>], task1_reverter, [<reverter_parameters>]);
-var action2 = stack.createAction(task2, [<task parameters>], task2_reverter, [<reverter_parameters>]);
+const stack = new ActionStack();
+const action1 = stack.createAction(task1, [<task parameters>], task1_reverter, [<reverter_parameters>]);
+const action2 = stack.createAction(task2, [<task parameters>], task2_reverter, [<reverter_parameters>]);
 
 stack.push(action1);
 stack.push(action2);
 
 stack.process()
-.then(function() {
-    // all actions succeded
-})
-.catch(function(error){
-    // One of actions failed with error
-})
+    .then(() => {
+        // all actions succeded
+    })
+    .catch(error => {
+        // One of actions failed with error
+    });
 ```
 
 ### `superspawn`
@@ -107,16 +118,17 @@ stack.process()
 Module for spawning child processes with some advanced logic.
 
 Usage:
+
 ```js
-var superspawn = require('cordova-common').superspawn;
+const { superspawn } = require('cordova-common');
+
 superspawn.spawn('adb', ['devices'])
-.progress(function(data){
-    if (data.stderr)
-        console.error('"adb devices" raised an error: ' + data.stderr);
-})
-.then(function(devices){
-    // Do something...
-})
+    .progress(data => {
+        if (data.stderr) console.error(`"adb devices" raised an error: ${data.stderr}`);
+    })
+    .then(devices => {
+        // Do something...
+    });
 ```
 
 ### `xmlHelpers`
@@ -124,30 +136,41 @@ superspawn.spawn('adb', ['devices'])
 A set of utility methods for dealing with XML files.
 
 Usage:
+
 ```js
-var xml = require('cordova-common').xmlHelpers;
+const { xmlHelpers } = require('cordova-common');
 
-var xmlDoc1 = xml.parseElementtreeSync('some/xml/file');
-var xmlDoc2 = xml.parseElementtreeSync('another/xml/file');
+const doc1 = xmlHelpers.parseElementtreeSync('some/xml/file');
+const doc2 = xmlHelpers.parseElementtreeSync('another/xml/file');
 
-xml.mergeXml(doc1, doc2); // doc2 now contains all the nodes from doc1
+xmlHelpers.mergeXml(doc1, doc2); // doc2 now contains all the nodes from doc1
 ```
 
 ### Other APIs
 
 The APIs listed below are also exposed but are intended to be only used internally by cordova plugin installation routines.
 
-```
-PlatformJson
-ConfigChanges
-ConfigKeeper
-ConfigFile
-```
+* `PlatformJson`
+* `ConfigChanges`
+* `ConfigKeeper`
+* `ConfigFile`
 
 ## Setup
+
 * Clone this repository onto your local machine
-    `git clone https://github.com/apache/cordova-common.git`
+
+    ```bash
+    git clone https://github.com/apache/cordova-common.git
+    ```
+
 * Navigate to cordova-common directory, install dependencies and npm-link
-    `cd cordova-common && npm install && npm link`
+
+    ```bash
+    cd cordova-common && npm install && npm link
+    ```
+
 * Navigate to cordova-lib directory and link cordova-common
-    `cd <cordova-lib directory> && npm link cordova-common && npm install`
+
+    ```bash
+    cd <cordova-lib directory> && npm link cordova-common && npm install
+    ```
diff --git a/RELEASENOTES.md b/RELEASENOTES.md
index 139eec2..9a66c5c 100644
--- a/RELEASENOTES.md
+++ b/RELEASENOTES.md
@@ -18,7 +18,7 @@
 # under the License.
 #
 -->
-# Cordova-common Release Notes
+# cordova-common Release Notes
 
 ### 3.2.1 (Oct 28, 2019)
 
diff --git a/package.json b/package.json
index 3f88e29..222afb0 100644
--- a/package.json
+++ b/package.json
@@ -50,6 +50,7 @@
   "nyc": {
     "all": true,
     "exclude": [
+      "coverage/",
       "spec/"
     ],
     "reporter": [


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org