erisu opened a new pull request #510:
URL: https://github.com/apache/cordova-cli/pull/510
### Motivation, Context & Description
- Migrate `cordova info` lib logic to CLI.
- This PR:
- closes https://github.com/apache/cordova-lib/issues/659
- closes https://github.com/apache/cordova-lib/issues/660
- closes https://github.com/apache/cordova-lib/issues/661
- closes https://github.com/apache/cordova-cli/issues/301
Migrating the `cordova info` logic to cli makes it easier to grab the CLI
version. Even though we document to install cordova globally and that we can
use a spawn to grab the version, this allows us to properly display the
information level of the CLI and its dependencies if the CLI was installed
locally to the project.
- Add `systeminformation` dependency to easily grab more detailed OS
information
- Expanded on the printout for plugins
- Shorten the `package.json` output to snippet only the cordova data which
is the only important data needed for debugging
#### Example Printout
```
cordova info
Warning: using prerelease version 10.0.0-nightly.2020.6.30.7b8e8678
([email protected])
Cordova Packages:
cli : 10.0.0-nightly.2020.6.30.7b8e8678
common : 4.0.2-nightly.2020.6.30.87167bd4
create : 3.0.0-nightly.2020.6.30.17dd4aff
lib : 10.0.0-nightly.2020.6.30.38e3e74b
common : 4.0.2-nightly.2020.6.30.87167bd4
create : 3.0.0-nightly.2020.6.30.17dd4aff
fetch : 3.0.1-nightly.2020.6.30.e6882379
serve : 3.0.0
Project Installed Platforms:
android : 8.1.0
Project Installed Plugins:
cordova-plugin-whitelist : 1.3.4
Environment:
OS : macOS Catalina 10.15.5 (19F101) (darwin 19.5.0) x64
Node : v14.4.0
npm : 6.14.5
android Environment:
ERROR: Command failed with ENOENT: android list target
spawn android ENOENT
Project Setting Files:
config.xml :
<?xml version='1.0' encoding='utf-8'?>
<widget id="io.cordova.hellocordova" version="1.0.0"
xmlns="http://www.w3.org/ns/widgets"
xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>HelloCordova</name>
<description>
A sample Apache Cordova application that responds to the deviceready
event.
</description>
<author email="[email protected]" href="http://cordova.io">
Apache Cordova Team
</author>
<content src="index.html" />
<access origin="*" />
<allow-intent href="http://*/*" />
<allow-intent href="https://*/*" />
<allow-intent href="tel:*" />
<allow-intent href="sms:*" />
<allow-intent href="mailto:*" />
<allow-intent href="geo:*" />
<platform name="android">
<allow-intent href="market:*" />
</platform>
<platform name="ios">
<allow-intent href="itms:*" />
<allow-intent href="itms-apps:*" />
</platform>
</widget>
package.json :
--- Start of Cordova JSON Snippet ---
{
"plugins": {
"cordova-plugin-whitelist": {}
},
"platforms": [
"android"
]
}
--- End of Cordova JSON Snippet ---
```
The above example is an Android project.
The above example's `android Environment:` printout is the original printout
logic that is used for Android. iOS also has original logic.
Ignore that the printout displays an error as my environment is not
configured with that binary. That printout is the original printout.
The platform environment data should be fetched from the platform directly.
This PR has also introduced the call to the platform API to fetch this data but
no platform today supports this API. This is a future task that is to be done
in a separate PR in their own repos. Requests or feedback on what should be
displayed in this section is out of this PR's scope.
Any improvement requests in regards to platform's environment printout is
out of this PR scope and is not to be commented in this PR.
### Testing
- `npm t`
*Note: CLI does not need a special lib version for this test as it will not
call lib in this case.*
### Checklist
- [x] I've run the tests to see all new and existing tests pass
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]