Skip to content

Commit

Permalink
BREAKING CHANGE: removed clipboard option
Browse files Browse the repository at this point in the history
- clipboardy depends on native compiled binaries
- webpack built code does not include these
- not frequently used
- common source of bugs
  • Loading branch information
tabrindle committed Nov 27, 2018
1 parent c0e448d commit aa5fa68
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 14 deletions.
2 changes: 1 addition & 1 deletion dist/cli.js
100644 → 100755

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/envinfo.js

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions src/cli.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const envinfo = require('./envinfo.js');
const argv = require('minimist')(process.argv.slice(2));
const version = __VERSION__ || ''; // eslint-disable-line
// const version = __VERSION__ || ''; // eslint-disable-line

argv.console = true;

Expand Down Expand Up @@ -41,9 +41,10 @@ if (argv.help || argv._.indexOf('help') > -1) {
--markdown Print output in markdown format
--json Print output in JSON format
--console Print to console (defaults to on for CLI usage, off for programmatic usage)
--clipboard Copy output to your system clipboard
--showNotFound Don't filter out values marked 'Not Found'
--title Give your report a top level title ie 'Environment Report'
--clipboard *Removed - use clipboardy or clipboard-cli directly*
`);
process.exit(0);
} else if (argv.version || argv.v || argv._.indexOf('version') > -1) {
Expand Down
12 changes: 6 additions & 6 deletions src/envinfo.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
'use strict';

const copypasta = require('clipboardy');
const helpers = require('./helpers');
const formatters = require('./formatters');
const presets = require('./presets');
Expand All @@ -23,15 +22,16 @@ function format(data, options) {

if (options.console) console.log(formatter(data, Object.assign({}, options, { console: true }))); // eslint-disable-line no-console

// call the formatter with console option off first to return, or pipe to clipboard
// call the formatter with console option off first to return
const formatted = formatter(data, Object.assign({}, options, { console: false }));
if (options.clipboard) copypasta.writeSync(formatted);

return formatted;
}

function main(props, options) {
options = options || {};
if (options.clipboard)
console.log('\n*** Clipboard option removed - use clipboardy or clipboard-cli directly ***\n');
// set props to passed in props or default to presets.defaults
const defaults = Object.keys(props).length > 0 ? props : presets.defaults;
// collect a list of promises of helper functions
Expand Down Expand Up @@ -100,7 +100,7 @@ function cli(options) {
helpers[`get${options.helper}`] ||
helpers[`get${options.helper}Info`] ||
helpers[options.helper];
return helper ? helper().then(console.log) : console.error('Not Found');
return helper ? helper().then(console.log) : console.error('Not Found'); // eslint-disable-line no-console
}
// generic function to make sure passed option exists in presets.defaults list
// TODO: This will eventually be replaced with a better fuzzy finder.
Expand All @@ -118,13 +118,13 @@ function cli(options) {
}, {});
// if there is a preset, merge that with the parsed props and options
if (options.preset) {
if (!presets[options.preset]) console.error(`\nNo "${options.preset}" preset found.`);
if (!presets[options.preset]) console.error(`\nNo "${options.preset}" preset found.`); // eslint-disable-line no-console
return main(
Object.assign({}, utils.omit(presets[options.preset], ['options']), props),
Object.assign(
{},
presets[options.preset].options,
utils.pick(options, ['duplicates', 'fullTree', 'json', 'markdown', 'console', 'clipboard'])
utils.pick(options, ['duplicates', 'fullTree', 'json', 'markdown', 'console'])
)
);
}
Expand Down
5 changes: 2 additions & 3 deletions src/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,8 @@ module.exports = Object.assign({}, utils, packages, {
.run('xcodebuild -showsdks')
.then(sdks => sdks.match(/[\w]+\s[\d|.]+/g))
.then(utils.uniq)
.then(
platforms =>
platforms.length ? ['iOS SDK', { Platforms: platforms }] : ['iOS SDK', NotFound]
.then(platforms =>
platforms.length ? ['iOS SDK', { Platforms: platforms }] : ['iOS SDK', NotFound]
);
}
return Promise.resolve(['iOS SDK', NA]);
Expand Down
1 change: 0 additions & 1 deletion src/presets.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ module.exports = {
npmPackages: ['react', 'react-dom', 'react-scripts'],
npmGlobalPackages: ['create-react-app'],
options: {
clipboard: true,
duplicates: true,
showNotFound: true,
},
Expand Down

0 comments on commit aa5fa68

Please sign in to comment.