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/07/17 07:31:15 UTC

[cordova-lib] branch master updated: breaking: remove cordova info logic from lib (#846)

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-lib.git


The following commit(s) were added to refs/heads/master by this push:
     new dd273bf  breaking: remove cordova info logic from lib (#846)
dd273bf is described below

commit dd273bff476a501f63b3476821db1514bdee5126
Author: エリス <er...@users.noreply.github.com>
AuthorDate: Fri Jul 17 16:31:08 2020 +0900

    breaking: remove cordova info logic from lib (#846)
    
    * breaking: remove cordova info logic from lib
    * chore: remove unused indent-string dependency
---
 package-lock.json      |   3 +-
 package.json           |   1 -
 src/cordova/cordova.js |   1 -
 src/cordova/info.js    | 119 -------------------------------------------------
 4 files changed, 2 insertions(+), 122 deletions(-)

diff --git a/package-lock.json b/package-lock.json
index 18c8805..e9904e1 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -2133,7 +2133,8 @@
     "indent-string": {
       "version": "4.0.0",
       "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-4.0.0.tgz",
-      "integrity": "sha512-EdDDZu4A2OyIK7Lr/2zG+w5jmbuk1DVBnEwREQvBzspBJkCEbRa8GxU1lghYcaGJCnRWibjDXlq779X1/y5xwg=="
+      "integrity": "sha512-EdDDZu4A2OyIK7Lr/2zG+w5jmbuk1DVBnEwREQvBzspBJkCEbRa8GxU1lghYcaGJCnRWibjDXlq779X1/y5xwg==",
+      "dev": true
     },
     "inflight": {
       "version": "1.0.6",
diff --git a/package.json b/package.json
index ff73cda..e4be7c2 100644
--- a/package.json
+++ b/package.json
@@ -21,7 +21,6 @@
     "execa": "^4.0.3",
     "fs-extra": "^9.0.1",
     "globby": "^11.0.1",
-    "indent-string": "^4.0.0",
     "init-package-json": "^1.10.3",
     "md5-file": "^5.0.0",
     "pify": "^5.0.0",
diff --git a/src/cordova/cordova.js b/src/cordova/cordova.js
index 2cec60d..c298113 100644
--- a/src/cordova/cordova.js
+++ b/src/cordova/cordova.js
@@ -54,7 +54,6 @@ exports = module.exports = {
     platforms: require('./platform'),
     compile: require('./compile'),
     run: require('./run'),
-    info: require('./info'),
     targets: require('./targets'),
     requirements: require('./requirements'),
     projectMetadata: require('./project_metadata'),
diff --git a/src/cordova/info.js b/src/cordova/info.js
deleted file mode 100644
index 1859ef7..0000000
--- a/src/cordova/info.js
+++ /dev/null
@@ -1,119 +0,0 @@
-/**
-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.
-*/
-
-const execa = require('execa');
-var cordova_util = require('./util');
-var pkg = require('../../package');
-var path = require('path');
-var fs = require('fs-extra');
-
-const indent = s => require('indent-string')(s, 2);
-
-/**
- * Outputs information about your system, your Cordova installation and
- * the Cordova project this is called in, if applicable.
- *
- * Useful when submitting bug reports and asking for help.
- *
- * @return {Promise} resolved when info has been dumped
- */
-module.exports = function info () {
-    const basicInfo = [
-        // Get versions for cordova and all direct cordova dependencies
-        cordovaVersionInfo(),
-        // Get information on the current environment
-        environmentInformation()
-    ];
-
-    const projectRoot = cordova_util.isCordova();
-    const projectInfo = !projectRoot ? [] : [
-        // Get list of plugins
-        listPlugins(projectRoot),
-        // Get Platforms information
-        getPlatforms(projectRoot),
-        // Display project config.xml file
-        displayFileContents(cordova_util.projectConfig(projectRoot)),
-        // Display project package.json file
-        displayFileContents(path.join(projectRoot, 'package.json'))
-    ];
-
-    const infoPromises = [].concat(basicInfo, projectInfo);
-    const failSafePromises = infoPromises.map(p => Promise.resolve(p).catch(err => err));
-    return Promise.all(failSafePromises)
-        .then(results => console.info(results.join('\n\n')));
-};
-
-function cordovaVersionInfo () {
-    const versionFor = name => require(`${name}/package`).version;
-    const deps = Object.keys(pkg.dependencies)
-        .filter(name => name.startsWith('cordova-'))
-        .map(name => `${name}@${versionFor(name)}`)
-        .join('\n');
-    return `cordova-lib@${pkg.version} with:\n${indent(deps)}`;
-}
-
-function environmentInformation () {
-    return Promise.all([
-        'OS: ' + process.platform,
-        'Node: ' + process.version,
-        failSafeSpawn('npm', ['-v']).then(out => 'npm: ' + out)
-    ])
-        .then(env => env.join('\n'))
-        .then(env => 'Environment: \n' + indent(env));
-}
-
-function listPlugins (projectRoot) {
-    var pluginPath = path.join(projectRoot, 'plugins');
-    var plugins = cordova_util.findPlugins(pluginPath).join('\n');
-    return 'Plugins:' + (plugins.length ? '\n' + indent(plugins) : ' []');
-}
-
-function getPlatforms (projectRoot) {
-    var platforms = cordova_util.listPlatforms(projectRoot);
-    if (!platforms.length) {
-        return 'No Platforms Currently Installed';
-    }
-    return Promise.all(platforms.map(getPlatformInfo))
-        .then(outs => outs.join('\n\n'));
-}
-
-function getPlatformInfo (platform) {
-    switch (platform) {
-    case 'ios':
-        return failSafeSpawn('xcodebuild', ['-version'])
-            .then(out => 'iOS platform:\n' + indent(out));
-    case 'android':
-        return failSafeSpawn('android', ['list', 'target'])
-            .then(out => 'Android platform:\n' + indent(out));
-    }
-}
-
-function failSafeSpawn (command, args) {
-    return execa(command, args)
-        .then(({ stdout }) => stdout, err => `ERROR: ${err.message}`);
-}
-
-function displayFileContents (filePath) {
-    const fileName = path.basename(filePath);
-    if (!fs.existsSync(filePath)) {
-        return fileName + ' file not found';
-    }
-    const contents = fs.readFileSync(filePath, 'utf-8');
-    return `${fileName} <<EOF\n${contents}\nEOF`;
-}


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