Skip to content

Commit

Permalink
marge changes with master
Browse files Browse the repository at this point in the history
  • Loading branch information
mnsn committed Feb 18, 2017
1 parent 19e7b01 commit 0edf22e
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
5 changes: 0 additions & 5 deletions bin/package.json

This file was deleted.

17 changes: 16 additions & 1 deletion src/cli/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,12 @@ for (let i = 0; i < args.length; i++) {
}
}

// NOTE: Pending resolution of https://github.com/tj/commander.js/issues/346
// Remove this (and subsequent use in the logic below) after bug is resolved and issue is closed
const ARGS_THAT_SHARE_NAMES_WITH_OPTIONS = [
'version',
];

// set global options
commander.version(pkg.version);
commander.usage('[command] [flags]');
Expand All @@ -58,6 +64,7 @@ commander.option('--prod, --production [prod]', '');
commander.option('--no-lockfile', "don't read or generate a lockfile");
commander.option('--pure-lockfile', "don't generate a lockfile");
commander.option('--frozen-lockfile', "don't generate a lockfile and fail if an update is needed");
commander.option('--link-duplicates', 'create hardlinks to the repeated modules in node_modules');
commander.option('--global-folder <path>', '');
commander.option(
'--modules-folder <path>',
Expand Down Expand Up @@ -88,7 +95,7 @@ let commandName: ?string = args.shift() || '';
let command;

//
const getDocsLink = (name) => `https://yarnpkg.com/en/docs/cli/${name || ''}`;
const getDocsLink = (name) => `${constants.YARN_DOCS}${name || ''}`;
const getDocsInfo = (name) => 'Visit ' + chalk.bold(getDocsLink(name)) + ' for documentation about this command.';

//
Expand Down Expand Up @@ -144,6 +151,7 @@ const reporter = new Reporter({
noProgress: !commander.progress,
});
reporter.initPeakMemoryCounter();

//if we have unknown flag we should exit
commander.on(commandName, (args, unknown) => {
commander.args.unshift(commandName);//the emitter remove the command
Expand Down Expand Up @@ -192,6 +200,11 @@ if (commandName === 'help' || args.indexOf('--help') >= 0 || args.indexOf('-h')

// parse flags
args.unshift(commandName);

if (ARGS_THAT_SHARE_NAMES_WITH_OPTIONS.indexOf(commandName) >= 0 && args[0] === commandName) {
args.shift();
}

commander.parse(startArgs.concat(args));
commander.args = commander.args.concat(endArgs);

Expand Down Expand Up @@ -400,6 +413,8 @@ config.init({
const exit = () => {
process.exit(0);
};
// verbose logs outputs process.uptime() with this line we can sync uptime to absolute time on the computer
reporter.verbose(`current time: ${new Date().toISOString()}`);

const mutex: mixed = commander.mutex;
if (mutex && typeof mutex === 'string') {
Expand Down

0 comments on commit 0edf22e

Please sign in to comment.